Introduction: Getting Started With ESP8266 (IOT Project)

Hello everyone. In this instructable we are going to see the basic project to get started with IOT (Internet of things). If you are already familiar with arduino projects then this articles helps you to step into IOT projects. Giving short introduction to IOT. Internet of things means connecting electronic devices to internet or network through WiFi or Ethernet. So we can control them or getting data from the devices over internet obviously any where from the world. But today here we are going to see WiFi network level controlling of devices. To do that we are going to use ESP8266 wifi module. ESP8266 is a WiFi module which consists programmable I/O pins like arduino and also it can be programmable using Arduino IDE. Lets get started with the practical. We are going to see two things in this practical.

  • Configure Arduino IDE to program ESP8266 wifi module.

  • Program mini server using ESP8266 wifi module in our network to control LED.

Step 1: Configure Arduino IDE to Program ESP8266 WiFi Module:

The first step in configuration, install ESP8266 board manager in Arduino IDE. For that copy the below link:

http://arduino.esp8266.com/stable/package_esp8266c...

Open ArduinoIDE and goto file --> Preferences and paste the copied link in the "Additional Board Manager URLs:" then click ok.

Then goto Tools -- > Board -- > Boards Manager then a new window will open. Search ESP8266 Then install the search result as shown in video. Then restart the arduino IDE. goto Tools -- > Board -- > Boards Manager and scroll down then select the option NodeMCU 1.0.

ESP8266 board manager detail : https://github.com/esp8266/Arduino

Now connect the ESP8266 to computer through USB Data cable.

Now we need the install the driver for ESP8266 (It may vary based on the board. For most case you can see the driver name in the back side of the ESP8266 board).

For my board i need to install driver CH340G. it is available in below link:

https://wiki.wemos.cc/downloads

Some other board require CP210X drivers. To get that visit link below:

https://www.silabs.com/products/development-tools/...

After install the driver. Let us upload the sample blink code given below into ESP8266 module using Arduino IDE

Blink Code :

int LED = D2;

void setup() {

pinMode(LED, OUTPUT);

}

void loop() {

digitalWrite(LED, HIGH);

delay(1000);

digitalWrite(LED, LOW);

delay(1000);

}

Step 2: Program Mini Server Using ESP8266 WiFi Module in Our Network to Control LED.

In this part we are going to make ESP8266 to act as a mini server in our WiFi network. The ESP8266 has simple html page host in it. If it connected to our WiFi or mobile hotspot then it host that html page in particular IP address which can accessible with in our network. That html page consist buttons to control LED connected in ESP8266 module D2 pin as shown in video. Code for this functionality given below. Upload the code to ESP8266 and open any mobile or computer (which connected in the same WiFi network or Mobile hotspot that ESP8266 connected.)browser go to the IP address which will shown in serial monitor of arduino IDE after uploading the code.

To Get the code of MINI server to control led download the attached code.txt file.

Play with the project. Thank you for reading.


Attachments