Serial Communication Between Two Arduino Boards

Learn the Serial communication between two Arduino. How Serial read and write works. Serial Communication between two Arduino UNO Board is given in this article. You can perform this on any two Arduino Board or other serial communicating device. RX recieves serial data and TX sends the serial data to other board or device.

Step 1: Required Components

Arduino UNO Board x 2
Jumper Wires

Step 2: Circuit Time

Serial communication between two Arduino Boards

Make a circuit as per the given diagram. Connect both the RX and TX pins of Arduino vice versa (first Arduino’s TX pin to another’s RX pin and first Arduino’s RX pin to another’s TX pin). Also common the ground pin of both Arduino.


Step 3: Code Time

There are two codes for two Arduino board. One for sender and other for reciever.

Code for Sender Arduino

This is code for Sender Arduino Board. First, initialize a string with data “Hello”. In setup, the Serial Monitor is begun at 9600 Baud. In the loop, sent the data to receiver Arduino using Serial.write. For more information about Serial.write, click here.

Code for Receiver Arduino

This is code for Receiver Arduino Board. First, initialize a blank string to store serial received data. In setup, the Serial Monitor is begun at 9600 Baud. In the loop, received the data from sender Arduino using Serial.readBytes. For more information about serial.read, click here.

Step 4: Upload the code to Arduino

Upload the code to the sender Arduino code to one board and receiver Arduino Board code to other device. Make a circuit as per the given diagram after uploading code. It will transmit “Hello” from one Arduino to another Arduino board or other device. You can transmit your data or variable like this.

Learn about uploading code to Arduino Board.

Note: If it shows error while uploading code to Arduino. Then, disconnect the connection between Arduino and try to upload program on it.

13 thoughts on “Serial Communication Between Two Arduino Boards”

  1. Arduino: 1.6.5 (Windows 8.1), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

    C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega C:\Users\Owner\AppData\Local\Temp\build8801446510065506591.tmp\Sender.cpp -o C:\Users\Owner\AppData\Local\Temp\build8801446510065506591.tmp\Sender.cpp.o

    Sender.ino:1:17: error: initializer-string for array of chars is too long [-fpermissive]
    initializer-string for array of chars is too long [-fpermissive]

  2. I have followed your tutorial but I when I check serial monitor of the “receiver” I have no output. Any ideas on what I could be doing wrong? The “sender” is outputting hello. But reciever Uno is blank.

  3. can you please tell me that how can I upload my code with this communication code.i mean im using ultrasonic sensors and voice modules using two arduinos so that if sensor detects any obstacle then it will say turn left or right… so its not possible using one arduino how can i communicate it with two arduinosss.. plzz help me its very urgent.

Leave a Reply