Introduction: Serial Communication Between Arduino and ESP-01

In This Tutorial we will see the Serial Communication Between the Arduino and ESP-01. The main task Is How to upload code in ESP-01 Using Arduino IDE. As we know that ESP-01 contain only two data line GPIO0 and GPIO2. So to extend Data line we connect the arduino Serialy With Esp-01.

In IOT application We can use this two instead of Nodemcu. because nodemcu contain only 8 digital IO line where In Arduino UNO we can use total 14 Digital IO line and using ESP-01 we can connect to the Internet .

Step 1: Connection of Nodemcu and ESP 01

ESP 01 contain total 8 pins.Now to upload the code in in ESP 01 we use here Nodemcu we can also use arduino.

First connect your ESP 01 with Nodemcu as per the given diagram.

Step 2: Uploading Code to ESP 01

First of all Open Arduino IDE Go to Tool>Board Manger select Generic ESP8266 as board. select the port on which you have connected your nodemcu.

Now try to upload your code. If code is deployed into ESP 01 than It's GOOD.

But if you are having Problem in Uploading the Code than follow this step:

  1. Take out CH_PD pin of ESP 01 from VCC and Connect it to Ground for one Second and Again connect it to VCC.
  2. Take out Reset pin of ESP 01 from VCC and Connecct it to Ground for 1 sec and Again connect it ot VCC.
  3. Now again upload the Code into ESP 01.

Stil you are having a same problem then again follow this task after try 2 to 3 time and then upload this code again.

This .ino file contains NOT(Netwrok of Things) code.After Uploading Code into ESP 01 Copy the IP and paste it into browser. you will find buttons.

Step 3: Connection of Arduino and ESP 01

Connect Your Arduino with ESP 01

Arduino ESP01

3.3V VCC

GND GND

CH_PD VCC

RESET VCC

GPIO0 VCC

TX RX

RX TX

Now upload the Second code which is for arduino.

In this code we receive data Serial which is coming on Serial Monitor.

Step 4: Code of Arduino for Receiving Data From ESP 01

NOTE:

  1. When you are uploading the code into arduino at that time remove tx and rx pin from Arduino.
  2. Connect GPIO0 with VCC but before connecting to Vcc ground it for 1 sec.

The Code is Given Below:

/*
Created by : Viraj Hapaliya

*/

char data;

void setup() {

// put your setup code here, to run once:

Serial.begin(9600);

pinMode(13,OUTPUT);

}

void loop()

{

// put your main code here, to run repeatedly:

while(Serial.available()) {

data=Serial.read();

Serial.println(data);

digitalWrite(13,HIGH);

delay(500);

digitalWrite(13,LOW);

}

}