Serial communication between ESP8266 and Arduino

Learn the Serial communication between ESP8266 and Arduino. Transmit data between two ESP8266 and Arduino using RX/TX lines. How Software Serial read and write works. You can perform it on any ESP8266 and Arduino Board.

First, learn about the SoftwareSerial Library of Arduino IDE. SoftwareSerial allows serial communication on other digital pins using software to replicate the functionality. Here we are using SoftwareSerial to start Serial at 9600 Baud. In general case, the serial will start at 115200 Baud Rate because of ESP8266 works on that rate.

Step 1: Required Components

ESP8266 Module x 1
Arduino UNO Board x 1
3.3V Linear Voltage Regulator (LD1117) x 1
Breadboard x 1
Jumper Wires

Step 2: Circuit Time

Make a circuit as per the given diagram after uploading the program. Connect RX pin of ESP8266 to TX pin of Arduino and TX pin of ESP8266 to RX pin of Arduino. Also, common both Grounds of ESP8266 and Arduino as per diagram.

Circuit Diagram of Serial communication between ESP8266 and Arduino

Step 3: Code Time

These are two codes for ESP8266 and Arduino board.

Code for Sender ESP8266

This is code for Sender ESP8266. First included the SoftwareSerial Library and started SoftwareSerial at RX and TX pin. (pin no 3 and 1) In Setup, SoftwareSerial is started at 9600 Baud. In the loop, written ‘123’ to the Serial.

Code for Receiver Arduino

This is code for Receiver Arduino. First declared a variable to store received data. In Setup, Serial Begin at 9600 Baud. In the loop, read the serial data and store it in a variable.

Step 4: Upload the code

Upload the code to ESP8266 and Arduino Board. Make a circuit as per the given diagram after uploading code. ‘123’ will be transmitted from Sender ESP8266 to Receiver Arduino. You can transmit your data or variable like this.

For more information about Serial communication in Arduino, click here.

For information about uploading code to ESP8266 (Click Here) and Arduino Board (Click Here).

12 thoughts on “Serial communication between ESP8266 and Arduino”

  1. The ESP8266 is very sensitive to over-voltage. It can tolerate signals up to 3.6 V max. The data from the Arduino should go through a level shifter or voltage divider to avoid damage. The ESP8266 usually will deteriorate quickly.
    For improved reliability, it is important to have a 10 – 100 uFd capacitor right at the module power pins

Leave a Reply