Sub topic 1
Why Serial? Sending Bits One at a Time
Serial communication sends data one bit after another over a communication channel. A bit is a binary value, either 0 or 1. A serial link may use one wire for data in one direction, or separate wires for sending and receiving.
UART is a common serial system used by Arduino boards, sensors, GPS receivers, and computers. UART stands for Universal Asynchronous Receiver/Transmitter. It converts bytes in a program into timed electrical signals and converts received signals back into bytes.
Prerequisites
This chapter assumes that you know the basic Arduino setup() and loop() functions, understand that a byte contains eight bits, and can distinguish digital HIGH and LOW voltage levels. You should also be comfortable with basic C or C++ syntax.
Serial and Parallel Communication
There are two broad ways to move digital data.
- Serial communication sends bits one after another.
- Parallel communication sends several bits at the same time on separate data lines.
For example, the byte 10110010 can travel through one serial data line as eight successive bit values. A parallel connection might use eight data lines and transmit all eight bits during one transfer.
| Method | Data lines | Main advantage | Main cost |
|---|---|---|---|
| Serial | 1 or a few | Fewer wires and simpler connectors | Bits take turns |
| Parallel | Several | Multiple bits move at once | More wires and timing problems |
Parallel communication sounds faster because it sends more bits together. In practice, separate wires do not always change at exactly the same time. At higher speeds, this difference creates skew, where some bits arrive slightly before others. Parallel cables also become larger, more expensive, and more sensitive to electrical interference between wires.
Serial communication avoids much of this complexity. One data path carries a sequence of bits, so the receiver only needs to determine when to sample that path.
What “One Bit at a Time” Means
Suppose a transmitter wants to send the byte 01000001. In a simple serial model, it places the bits on the line in order:
0 → 1 → 0 → 0 → 0 → 0 → 0 → 1The receiver measures the line at agreed times. Each measurement becomes one bit, and the receiver rebuilds the byte.
The transmitter and receiver must agree about timing. If the transmitter changes the line every 104 microseconds but the receiver expects a change every 52 microseconds, the receiver samples at the wrong points. The result is corrupted data even though the wires are connected correctly.
UART does not use a separate clock wire. Instead, both devices are configured with the same speed and frame rules. The receiver detects the beginning of a character and uses its configured timing to sample the following bits. This is why UART is called asynchronous communication: the devices share timing settings, but they do not share a continuously transmitted clock.
Why Serial Fits Arduino Projects
An Arduino often communicates with devices that are physically separate from the board. A GPS module, motor controller, or wireless modem may need only a transmit line, a receive line, and a shared ground. Fewer wires make the circuit easier to assemble and leave more microcontroller pins available for other functions.
Serial communication also supports long streams of data. A device can send a sensor reading, a command, or a text line one byte at a time. The receiver can process the stream as bytes arrive instead of requiring a large group of parallel wires.
A serial link still has limits. Sending one bit at a time takes time. The two devices must also use compatible electrical levels and communication settings. Later chapters will examine timing, voltage levels, framing, and buffering.
A Useful Mental Model
Think of a serial connection as a single-lane road for bits. Vehicles cannot pass side by side, but the road needs fewer lanes and is easier to build. The transmitter controls the order and timing of the vehicles. The receiver must know when to inspect the road and how to interpret what it sees.
For a UART connection, the next questions are:
- How does the receiver find the beginning of a byte?
- How long does each bit last?
- Which voltage represents a logical 0 or 1?
- What happens when electrical noise changes a bit?
These questions lead to UART frames, baud rate, line levels, and error handling.
Exercise
Why might an Arduino project use serial communication instead of eight separate data wires for one byte?
Show answer
Serial communication needs fewer wires and avoids the timing and skew problems that occur when several parallel wires must change together.