← Back to Basic Projects

πŸ“‘ Two-Arduino Serial Communication

Send real sensor data wirelessly between two Arduinos via UART serial β€” your first hands-on hardware communication protocol.

πŸ“‹ Overview

UART (Universal Asynchronous Receiver-Transmitter) is the simplest and most universal serial communication protocol. Understanding it unlocks GPS, Bluetooth, GSM, and virtually every wireless module you'll ever use in electronics.

Technical Insight: UART transmits data bit-by-bit at a fixed baud rate (bits per second). At 9600 baud, each bit takes ~104Β΅s. A start bit, 8 data bits, and a stop bit form one byte frame. Both devices must agree on the same baud rate β€” no clock line needed. Arduino's SoftwareSerial library lets you emulate UART on any two digital pins, freeing the hardware UART for debugging.

In simple terms: One Arduino (the Transmitter) reads a sensor and packs the reading into a short text message, then sends it as a stream of HIGH/LOW voltage pulses. The second Arduino (the Receiver) reconstructs those pulses back into the original text and displays it.

What you'll learn: UART protocol basics (start/stop bits, baud rate), SoftwareSerial.h usage, cross-device communication, data framing with newline delimiters, and debugging multi-device systems.

Estimated time: 45-60 minutes. Difficulty: ⭐⭐⭐ Intermediate β€” introduces multi-device hardware systems.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R35V2One Transmitter, one Receiver
LDR / PotentiometerAnalog sensor1For Transmitter to read
10kΞ© ResistorPull-down for LDR1
LED + 220Ξ© Resistor1Controlled by Receiver
16x2 LCD with I2COptional1Shows received data on Receiver
Jumper WiresM-M6TX/RX cross-connection

πŸ—ΊοΈ Component Pin Mapping

Two-Arduino Serial Communication Component Pin Mapping Infographic

πŸ“– Step-by-Step Tutorial

1

Cross-Connect TX and RX

Transmitter Arduino pin 10 (TX) β†’ Receiver Arduino pin 11 (RX). Transmitter pin 11 (RX) β†’ Receiver pin 10 (TX). Connect both Arduino GNDs together (CRITICAL).
2

Wire the Sensor on Transmitter

LDR voltage divider on A0. Or just connect a potentiometer center pin to A0.
3

Upload Transmitter Sketch

Upload the TX code to the first Arduino. It sends sensor readings every 500ms as formatted text.
4

Upload Receiver Sketch

Upload the RX code to the second Arduino. It reads the incoming text, parses the value, and controls an LED.
5

Observe Live Data

Open Serial Monitor on the Receiver. Incoming messages from the Transmitter appear in real time. Change the sensor value and watch the LED respond.
πŸ’‘
UART is SINGLE-WIRE-PER-DIRECTION: TX of one device goes to RX of the other. Never connect TX to TX or RX to RX β€” this is the most common wiring mistake. And always share GND between both devices β€” without a common ground reference, no signal can be interpreted correctly.

πŸ’» Arduino Code

two_arduino_serial.ino
INO
// ====== TRANSMITTER ARDUINO CODE β€” Volt X ======
// Upload this to Arduino #1 (has the sensor)
#include <SoftwareSerial.h>

SoftwareSerial mySerial(11, 10); // RX=11, TX=10
const int SENSOR_PIN = A0;

void setup() {
  mySerial.begin(9600);
  Serial.begin(9600);
  Serial.println("TRANSMITTER Ready");
}

void loop() {
  int sensorVal = analogRead(SENSOR_PIN);
  int mapped    = map(sensorVal, 0, 1023, 0, 100); // 0-100%

  mySerial.print("DATA:");
  mySerial.println(mapped);

  Serial.print("Sent: "); Serial.println(mapped);
  delay(500);
}

// ====== RECEIVER ARDUINO CODE β€” Volt X ======

⭐Reviews & Ratings

β€”0 reviews
5β˜…
0
4β˜…
0
3β˜…
0
2β˜…
0
1β˜…
0
...

Loading reviews...

volt-X / Two-Arduino Serial Communication β€” Arduino Tutorial