Skip to main content

How to program ESP 8266 from Arduino

ESP 8266 is a tinny WiFi module, normally it requires the USB to serial converter to upload the programs. In this post we are going to see, how to program the ESP 8266 with out USB to serial converter. Here we are going to use the Arduino IDE and Arduino Uno board to program the tinny WiFi module.

Hardwares required

  • ESP 8266 - 01
  • Arduino Uno
  • ESP demo board (Optional)
  • Jumper wires
  • LED with Resistor (220 / 330 ohm)

Softwares required

  • Arduino IDE

What is ESP demo board and why it is required ?

As you aware the ESP 8266's operation voltage is 3.3V but the Arduino is working in 5V. So the direct connection of RX and TX PINS between the Arduino and ESP is not recommended.
In some cases, It breaks the ESP, So we need to step down the 5V RX, TX PINS to 3.3V as well as for 5V power supply.


The ready made ESP demo board offers this functionality to us. Otherwise we have to add the resistors  between the RX and TX to step down the voltage.

How to connect the PINS between the ESP 8266

ESP8266Arduino
RXTX
TXRX
CH_PD3.3V
GPIO 0GND
VCC3.3V
GNDGND
if you use the ESP demo board, just ignore the CH_PD pin, it is directly looped in the circuit itself and it has 2 Rx PINS, one is for 3.3V and another one is for 5V. We have to use the 5V Rx PIN Since we are connecting from the Arduino

Ardunio IDE setup

  • Download and install the Arduino IDE
  • Add the ESP board using following steps
  • Go to FIle -> Preferences and add the URL http://arduino.esp8266.com/stable/package_esp8266com_index.json in the field 'Additional Boards Manager URLs'
  • Select Tools -> Board -> Board Manager and select ESP 8266 board and choose the version 2.5.0 and click install  (At the time writing this post 2.5.1 and 2.5.2 versions are not working properly) 
  • Once successfully installed the board restart the IDE and choose the 'Generic ESP 8266' board via Tools -> Boards -> Generic ESP 8266

Writing the program to blink the LED

  • Upload the below program 
#define LED 2
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
delay(1000);
}
  • Connect the LED with ESP board in the GPIO2 and GND (use the 220 / 330 ohm resistor )
  •  Remove the Rx, TX and GPIO0 PINS 
 Now the LED should blink

Comments

Popular posts from this blog

Implementing Turn-by-Turn Navigation with the GraphHopper Routing Engine

 Introduction to Turn-by-Turn Navigation Turn-by-turn navigation is a feature that guides users through a journey step-by-step using voice or visual prompts. It is typically found in GPS navigation apps and can be used for driving, walking, and biking. When it comes to the actual implementation, turn-by-turn navigation utilizes several technologies such as GPS, maps, and routing algorithms to guide users along the best route to their destination. In this article, we will explore the implementation of turn-by-turn navigation using the GraphHopper library and OpenStreetMap data. Understanding the GraphHopper Routing Engine GraphHopper Routing Engine is an open-source routing library that allows developers to calculate efficient routes for various transportation modes, such as cars, bikes, and walking. It utilizes OpenStreetMap data to generate a routing graph, which is then used to calculate the fastest or shortest routes between two points. GraphHopper is written in Java and can be ...

K - Means (Simplest clustering algorithm)

K- Means Algorithm Introduction K- Means algorithm is an unsupervised machine learning algorithm. It is the simplest algorithm to grouping the data based on theirs attribute values. What is clustering? Clustering is the process of grouping similar elements together. As a example, we will take the salaries of the persons and grouping them as middle class, lower middle class and upper middle class. Let's assume the example data set (Persons and their salaries) Input Data set Person 1 20000 Person 2 6000 Person 3 7000 Person 4 11000 Person 5 15000 Person 6 19000 Person 7 30000 Person 8 25000 Person 9 4000 Perso   10 8000 The similar amount of salaried persons can be grouped as like below Lower Middle Class Middle Class Upper Middle Class Person 2 Person 1 Person 7 Person 3 Person 4 Person 8 Person 9 Person 5 ...

Test Driven Development

What is Test Driven Development (TDD)? TDD is a process of writing the test code before writing the functional code. In the TDD the tests are developed even before implementing the feature. At the first level the test will fail because we are not yet implemented the functional code. To make the test pass, we need to implement the functional code. TDD workflow The TDD follows the flow of "Red, Green, Refactor"     Identify the smallest behavior of the application and add the test     The test may fail     Write the functional code to make the test pass     Run the test case and make sure the tests pass     Refactor the code, if required     Repeat the process for the complete application behaviors Flow diagram for Test Driven Development (TDD)   Advantage of TDD     Early bug identification     Good understanding of code     Be...