Concept explainer · Beginner · 4 min read
UART and Serial Communication
TX, RX, Baud Rate and Wiring
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
A UART sends data one bit at a time over one wire with no shared clock, so both ends must agree on the speed, called the baud rate (9600 and 115200 are common). Connect each device's TX to the other's RX and join the grounds. GPS, Bluetooth, GSM and MP3 modules all use UART. Logic levels must match: 3.3 V boards need a divider or level shifter from 5 V devices.
Key specs at a glance
- Wires
- TX, RX, GND (cross TX to RX)
- Frame
- Usually 8N1: start bit, 8 data bits, no parity, 1 stop bit
- Common baud rates
- 9600, 38400, 57600, 115200
- Throughput
- About baud / 10 bytes per second (9600 baud = 960 bytes/s)
- Logic levels
- TTL 5 V or 3.3 V; RS-232 uses about ±12 V (never connect directly)
- Distance
- A few metres at TTL levels; RS-485 for long runs
How UART works
The line idles HIGH. To send a byte, the transmitter pulls it LOW for one bit time (the start bit), sends 8 data bits (least significant first), then returns HIGH for the stop bit. The receiver detects the falling edge of the start bit and samples the line in the middle of each bit time, which is why both sides must use the same baud rate: a mismatch produces garbage characters. Each frame of 10 bits carries one byte, so 9600 baud moves about 960 bytes per second.
Serial ports on common boards
| Board | Hardware UARTs | Pins | Notes |
|---|---|---|---|
| Arduino Uno / Nano | 1 | D0 RX, D1 TX | Shared with USB; disconnect modules while uploading |
| Arduino Mega 2560 | 4 | 0/1, 19/18, 17/16, 15/14 (RX/TX) | Serial1 to Serial3 are free for modules |
| ESP32 | 3 | UART0 = USB; Serial2 default GPIO 16 RX / 17 TX | Pins can be remapped: Serial2.begin(9600, SERIAL_8N1, RX, TX) |
| ESP8266 | 1.5 | GPIO 3 RX / 1 TX; GPIO 2 TX-only | Serial.swap() moves UART0 to GPIO 13/15 |
| Raspberry Pi Pico | 2 | Serial1 GP0 TX / GP1 RX by default | USB serial is separate (Serial) |
| Raspberry Pi | 1 main (more on Pi 4/5) | GPIO 14 TX, 15 RX | Enable in raspi-config; disable the login console to use it |
- Arduino Uno / Nano
- Hardware UARTs:
- 1
- Pins:
- D0 RX, D1 TX
- Notes:
- Shared with USB; disconnect modules while uploading
- Arduino Mega 2560
- Hardware UARTs:
- 4
- Pins:
- 0/1, 19/18, 17/16, 15/14 (RX/TX)
- Notes:
- Serial1 to Serial3 are free for modules
- ESP32
- Hardware UARTs:
- 3
- Pins:
- UART0 = USB; Serial2 default GPIO 16 RX / 17 TX
- Notes:
- Pins can be remapped: Serial2.begin(9600, SERIAL_8N1, RX, TX)
- ESP8266
- Hardware UARTs:
- 1.5
- Pins:
- GPIO 3 RX / 1 TX; GPIO 2 TX-only
- Notes:
- Serial.swap() moves UART0 to GPIO 13/15
- Raspberry Pi Pico
- Hardware UARTs:
- 2
- Pins:
- Serial1 GP0 TX / GP1 RX by default
- Notes:
- USB serial is separate (Serial)
- Raspberry Pi
- Hardware UARTs:
- 1 main (more on Pi 4/5)
- Pins:
- GPIO 14 TX, 15 RX
- Notes:
- Enable in raspi-config; disable the login console to use it
SoftwareSerial and when to avoid it
On an Uno, the only hardware UART is shared with USB, so modules often use SoftwareSerial on two other pins. It works at 9600 to 38400 baud, but it can only listen on one port at a time, blocks interrupts while sending, and becomes unreliable at 115200. If you need several serial devices or high speeds, use a Mega, an ESP32 or a Pico, which have spare hardware UARTs.
#include <SoftwareSerial.h>
SoftwareSerial module(10, 11); // RX, TX
void setup() {
Serial.begin(115200); // to the computer
module.begin(9600); // to the module (GPS, HC-05, SIM800L...)
}
void loop() {
if (module.available()) Serial.write(module.read());
if (Serial.available()) module.write(Serial.read());
}Voltage levels: TTL, RS-232 and RS-485
Microcontroller UARTs use TTL levels: 0 V for LOW and 3.3 V or 5 V for HIGH. A 5 V TX into a 3.3 V RX pin needs a voltage divider (for example 1 kΩ and 2 kΩ) or a level shifter; a 3.3 V TX into a 5 V Arduino RX usually works directly. RS-232 (old PC serial ports, some industrial gear) uses about ±12 V with inverted logic and will destroy a microcontroller pin; use a MAX3232 converter. RS-485 sends the signal differentially over a twisted pair for distances up to about a kilometre and multiple devices; use a MAX485-type module and Modbus for industrial sensors.
Debugging serial links
- Nothing at all: TX and RX not crossed, no common ground, or the module is not powered.
- Garbage characters: baud rate mismatch, or a wrong line ending setting for AT commands.
- Works on USB power only: the module draws more current than the supply can give (common with GSM modules).
- Upload fails on Uno: a module is connected to D0/D1; disconnect it while uploading.
- A USB to TTL adapter and a terminal program let you talk to a module directly from a computer.
Try it: Voltage divider calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Connecting TX to TX.
- Forgetting the common ground.
- Feeding 5 V TX into a 3.3 V RX without a divider.
- Connecting RS-232 levels straight to a microcontroller.
- Running SoftwareSerial at 115200 baud and blaming the module.
Frequently asked questions
What does UART stand for?
Universal Asynchronous Receiver-Transmitter: hardware that sends and receives serial data without a shared clock line.
How do I connect two devices by UART?
TX of one to RX of the other, RX to TX, and ground to ground. Both must use the same baud rate and compatible voltage levels.
What baud rate should I use?
Whatever the device expects: 9600 is the default for many modules (GPS, HC-05, SIM800L); 115200 is common for debugging.
What is the difference between UART and USB serial?
UART is the simple TX/RX signal; USB serial is a converter chip or built-in USB that makes a UART appear as a COM port on a computer.
Can I use more than one serial device on an Arduino Uno?
Yes, with SoftwareSerial, but only one software port can listen at a time. For several devices, use a Mega, ESP32 or Pico.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 8 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
- Arduino Serial and SoftwareSerial references
- Espressif ESP32 UART documentation
- Texas Instruments application notes on RS-232 and RS-485
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.




