The UART is an asynchronous serial protocol between two devices. It is the simplest and most classic way to make two chips “talk” to each other using separate transmission and reception lines.
It’s useless to have a powerful processor if it can’t tell other chips what it’s “thinking” (sensors, displays, or other micros). And here, UART remains the king of simplicity: serial port debugging, GPS, classic Bluetooth modules, or bootloaders.
In the Arduino world, we simply call it “Serial”. It’s what you use every time you open the Serial Monitor to see a Serial.print("Hello World").
What is UART?
Unlike other protocols we’ll see later (like I2C or SPI), UART is Asynchronous. This means there is NO clock line marking the rhythm.
Analogy: Imagine two musicians playing together.
- In a Synchronous system (with a clock), there’s a drummer keeping time (tick-tock-tick). Both know when to play.
- In UART (Asynchronous), there is no drummer. Both musicians must have previously agreed to play at an exact speed (e.g., 120 BPM). If one plays slower than the other, the song is a disaster.
The Wires: TX and RX
Physically, UART requires at least two data wires (plus a ground reference, GND).
- TX (Transmit): Data goes out from here (talks).
- RX (Receive): Data comes in here (listens).
How to Cross TX and RX
This is where 90% of beginners get it wrong. UART is a crossed communication. What I speak (TX), you listen to (RX).
- The TX of Device A → goes to the RX of Device B.
- The RX of Device A → goes to the TX of Device B.
- In a non-isolated UART connection, GND must be joined with GND to share the electrical reference.
Do not connect two TX outputs together. If both try to impose opposite levels, excessive current can flow and damage them. Sharing a line requires an interface designed for that purpose.
The Baud Rate (The Speed)
Since we don’t have a clock wire to synchronize, both devices must be configured to the same speed. This is expressed in bauds (symbols per second). In a binary UART, each symbol carries one line bit, though framing reduces the useful data rate.
Standard speeds are:
- 9600: The classic and slow one. Very robust.
- 115200: The modern standard (used by ESP32 and most bootloaders).
- Others: 19200, 38400, 57600…
If your Arduino sends at 9600 bauds and your computer listens at 115200 bauds, you’ll see strange symbols and garbage on the screen. It’s like listening to a vinyl record at the wrong speed.
The Data Frame: How Does Information Travel?
On the wire, the idle state (silence) is HIGH (1). When you want to send a Byte (a letter, for example ‘A’), the following happens:
- Start Bit: The line goes LOW to 0 for one cycle. This tells the receiver: “Wake up, I’m going to talk!”.
- Data Bits: The 8 bits of the byte are sent, one after another (usually starting with the least significant bit).
- Parity Bit (Optional): Sometimes an extra bit is added to check for errors (rarely used today; we configure “No Parity”).
- Stop Bit: The line goes back HIGH to 1 to mark the end.
All this happens super fast, and the UART hardware does it automatically. You just tell it “Send an A” and the chip generates those pulses.
Voltage Levels: TTL vs RS-232
This is where a dangerous historical trap lies.
- UART TTL (Transistor-Transistor Logic): This is the one used by microcontrollers (Arduino, ESP32, GPS modules).
- Logic 0 = 0V.
- Logic 1 = 5V (or 3.3V).
- RS-232: This is the electrical interface associated with many serial ports using a DB9 connector. It uses positive and negative voltages and inverts the logic relative to a microcontroller UART; the exact values depend on the transceiver and the load.
Safety Warning: If you connect a sensor or industrial device with an RS-232 port directly to the RX/TX pins of your Arduino, you will burn it out instantly. The voltage is inverted and very high (-12V). You need a converter chip (like the famous MAX232) to translate the levels.
Advantages and Disadvantages
| Feature | Rating |
|---|---|
| Simplicity | ⭐⭐⭐⭐⭐ (Very easy to program) |
| Wires | 2 wires (+GND) |
| Speed | Low/Medium (up to a few Mbps) |
| Distance | Short (meters) in TTL, Long in RS-232/485 |
| Topology | Point-to-Point (Only two devices talking) |
The big drawback of UART is that it is Point-to-Point. You cannot connect 5 sensors to the same TX/RX wire.
To connect many devices using few wires, we need something more advanced… like I2C.