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