In this tutorial, we will learn how to use Arduino as an IoT device with the help of ESP8266. In this tutorial, we will go with step by step process of basic information, connections and code of this project.
If you want to build an IoT project as a beginner, then ESP8266 is a fresh start to enter the IoT field. ESP8266 module can be programmed in two ways: By LUA scripting and the second is by Arduino programming. As Arduino is gaining much popularity in Embedded system, we will program this module through an Arduino IDE. This tutorial is all about interfacing and programming the ESP8266 module with Arduino.
What Is ESP8266?
ESP8266 is a Low-cost wifi module that can provide internet connectivity to your small-scale embedded system/projects. This module comes with a single-chip CPU, GPIO pins, analog pins, I2C and SPI pins. The processor used in this module is the L106 32 bit RISC microprocessor, which runs on 80 MHz at Tensilica xtensa Dimond’s standards. Let’s look at some of its cool features first.
Features of ESP8266:
- On-chip Wi-Fi modules
- It has 2 GPIO pins
- Has inbuild 10 bit ADC (Analog to digital converter)
- 32 KB instruction RAM
- 16 KB system data RAM
- 32-bit microcontroller
- UART On dedicated Pins can be transferred UART to GPIO 0
- L106 32-bit RISC microprocessor core of Tensilica Xtensa Diamond standards 106 Micro run at a frequency of 80 MHz
Pinout of ESP8266
PinDescriptionVCCThis is the power pin for 3.3vGNDGround pin for giving 0 voltRxReceiver pin used to
receive serial data from another deviceTxTransmitter pin used to
transfer serial data to other devicesCH_EnChip enable pin, usually connected to 3.3 volt due to active-high propertyGPIO 0General-purpose GPIO pin basically has two used
1) used as a normal GPIO pin
2) used to enable the programming mode of ESP8266GPIO 2Used as a GPIO pin
Components Required:
For interfacing an ESP8266 with Arduino, we will need the following components :
ESP8266-01 connection with Arduino
While connecting an ESP8266 with Arduino, you have to make the connection as follows:
ESP8266 | Arduino |
---|---|
VCC | 3.3v |
GND | GND |
CH_EN | 3.3 v |
RST | Normally open, GND to reset |
GPIO 0 | GND |
Tx | Tx |
Rx | Rx |
Software, Boards Installation:
You have to follow few simple steps to install ESP8266 in the Arduino IDE:
- First, you need to download the Arduino IDE.
- After that, we need to install the ESP8266 Board in Arduino IDE.
- Copy the following link to add ESP8266 or ESP8266 integrated board in Arduino IDE.
- Go to Arduino IDE, then follow the path File/preferences and open the preference tab.
- And paste the above link in the additional board manager URL box as shown in the image.
After this, go to Tool/ Board Tools/board/board manager and type ESP8266. You will find a board ofESP8266 clickon the install option.
- This is how your ESP8266 board get installed.
Code
After installing the ESP8266 board in Arduino, you need to follow few simple steps:
- Open Arduino IDE.
- Go to Tools /Board/ ESP8266 (2.7.4) and then select Generic ES8266 Module, just like shown in the image.
Now go to file and open blink sketch and replace keyword “Inbuild_LED” with “2“, as the ESP8266 board’s inbuild LED is connected to pin 2.
Select the appropriate port, while uploading code to Arduino, make sure that GPIO 0 pin connected to the ground.
Note: If your program is failed to upload code, then reset the board once. Board can be reset by providing ground to reset(RST) pin.
Final Words
From the above experiment, we learned how to program the ESP8266 module through Arduino. The above steps found that coding into this wifi board is straightforward to build simple IoT projects with Arduino IDE. In advance, we may also program this module to upload the data on the internet or download data from the Internet. We can also control the big appliances wirelessly with the help of this tiny module.
I hope you will find this article helpful. Let us know if you have any doubt in the comment section.
Leave a Reply
You must be logged in to post a comment.