INTRODUCTION TO ESP8266 module (original) (raw)

Today, in this article we are going to introduce you to a new Wi-Fi module named ESP8266. It is widely used in the Internet of things (IoT) and working voltage of this module is 3 V. We can use this module with our Arduino development boards that are used in simple as well as complex projects in order to provide Wi-Fi to Arduino development boards, as no Arduino development board comes up with built-in Wi-Fi feature so far. So in short, we can say that every ESP8266 module comes up preprogrammed with AT command set firmware and can be plugged with any other development board to act as a Wi-Fi shield. But to use it with some development boards we must be cautious that how should our ESP8266 should get operating voltage because it cannot bear more than 3.6 V and how to make serial connections with other development boards and how to ping other devices.

Introduction to ESP8266 wifi module

ESP8266 comes up with powerful processing speed on board. Storage space of this module is also high allowing it to integrate with other devices like sensors. To make this module compatible with other development boards, we have to do level shifting of voltages externally because this board doesn’t come up with on-board voltage regulator. This module is cost effective and thus used widely in many applications like the Internet of things and much more.So in this article, we are going to discuss key features of ESP8266, pins specifications, how to use this board for programming purposes and a sample program.

KEY FEATURES ESP8266 WIFI Module

PIN CONFIGURATION of ESP8266

PROGRAMMING OF ESP8266

Like other Arduino development boards, we can use Arduino IDE for programming of this board too. But we have to install specific libraries and drivers to make this board recognizable by Arduino IDE. So, first of all, we will guide you through the installation process of ESP8266 in Arduino IDE.

STEPS TO CONFIGURE ESP8266 IN ARDUINO IDE:

BOOTLOADER MODES OF ESP8266

Depending on the general purpose input output pins, i.e., 15, 2 and 0 our boot loader can have a number of modes as these modes are dependent on states of above mentioned general purpose input output pins. In our case, we are only interested in flash startup mode and UART download mode. By considering the above mentioned pin, we have drawn a table in which you can see that to use a specific download mode what should be your pin configuration.

MODE GPIO 0 GPIO 2 GPIO 15
UART download mode (for programming purposes) 0 1 0
Flash Startup Mode 1 1 0
SD card boot 0 0 1

CIRCUIT DIAGRAM FOR ESP8266 WITH USB TO serial converter

The circuit diagram to connect our ESP8266 board for programming purposes is given below. For uploading purposes, we just have to press the flash button. In some boards flash as well as reset button is used for this purpose but that’s not the case in this board. So for this purpose, by consulting the table above we can see that we have to connect GPIO 0 pin as low, GPIO 2 pin as high and GPIO 15 pin as low. In order to put our board in serial programming mode, we have to press and hold the reset button and while reset button in pressed we have to press and hold flash button. After it, we have to release our reset button while keeping your flash button in the pressed state and after releasing your reset button we can release our flash button too.7 introduction to esp8266

LED BLINKING with ESP8266 WIFI Module

So we are going to discuss the led blinking program in detail here. There is a built-in led in our ESP8266 board which we will program and will compare the results according to our code which we are going to write.

CODE:

/* ESP8266 Blink Blink the blue LED on the ESP8266 module */

#define LED 2 //Define blinking LED pin

void setup() { pinMode(LED, OUTPUT); // Initialize the LED pin as an output } // the loop function runs over and over again forever void loop() { digitalWrite(LED, LOW); // Turn the LED on (Note that LOW is the voltage level) delay(1000); // Wait for a second digitalWrite(LED, HIGH); // Turn the LED off by making the voltage HIGH delay(1000); // Wait for two seconds }

CODE DETAILS:

In the above program, we first defined our led that we are going to blink. If we look at the program flow, then we can say that our setup function in the program will run only once and it will run once our program is uploaded on the board. After the setup function, we will have a loop function. Why are we not doing all this in a single function? The answer to this question is that we have to show led blinking. If we use only the setup function, then our led will turn on and off only once. So we have to use another function that will run in a loop.

If we look at the structure of the Arduino IDE program, then we can see that setup and loop functions are a mandatory part of a program. We can many functions, but these two functions are compulsory. We have already discussed the use of setup function and now if we look at the loop function we can see that we first have turned on our led by assigning it low voltage level and then we waited for one sec, and after that we assigned it a high voltage level which will turn off our led and then again we will wait for a sec and then our led will turn off again and so on. As loop function will run continuously as long as your program is running. If we have to stop this program then either you can power off your board by disconnecting it or stop the program from running in Arduino IDE. So in this way, we can blink our led by using ESP8266 microcontroller.

So in this article, we looked at the key features, pin layout, how to make our board compatible with Arduino IDE and a sample program of blinking led. In case of any ambiguity, we can ask your questions related to this article in the comment section below.