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 boards or another serial communicating device. RX receives 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 boards. One for the sender and other for the receiver.

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. Learn more information about Serial.write.



Code for Receiver Arduino

This is code for the 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, the received the data from sender Arduino using Serial.readBytes. Learn more information about Serial.read.



Step 4: Upload the code to Arduino

Upload the code to the sender Arduino code to one board and receiver Arduino Board code to another 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 the program on it.

29 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.

  4. I was following your instruction above. Then i try to sending little bit longer word. The receiver was receiving the word, but when sender sending the word again some character has missing. Can you help with this issue?

  5. How would you implement it when using a flex sensor in one arduino and a servo in the other. Im trying to make it work using the serial command but to no avail

  6. I need to Send a Data from one arduino to another, after the second arduino read this Data, it will resolve a math equation and I need to send the result of this equation back to the first arduino.
    is it possible by TX/RX communication?

  7. How to use the received data as a integer. And send a data as a integer. Or can we use char as a integer. Please reply

  8. Hi, thanks for the tutorial. I’ve tried and it works.
    How about if i want to send an integer array over serial from one arduino to other arduino? is that possible?

    Thanks !

  9. Can I merge two arduino uno board by serial communication to increase I/O pins to control 4 dc motors and 4 servo motors simultaneously?

Leave a Reply