Sensors, embedded & practical systems · tree view
Getting bits between chips: what makes a wire set a "bus" (a standard, not just copper), serial vs parallel, UARTs and baud, and the reach numbers for RS-232 vs RS-485.
This collection of wires that I keep referring to between the tank and the monitoring location can be called a bus or a network. The distinction between these two terms is more semantic than technical, and the two may be used interchangeably for all practical purposes.
Names like "Fieldbus" or "Profibus" encompass not only the physical wiring of the bus or network, but also the specified voltage levels for communication, their timing sequences (especially for serial data transmission), connector pinout specifications, and all other distinguishing technical features of the network.
Fortunately, there are digital IC chips called UARTs (Universal Asynchronous Receiver-Transmitters) that handle all these details on their own and make the designer's life much simpler.
The standard measure of network bandwidth is bits per second, or bps. An obsolete unit of bandwidth known as the baud is sometimes falsely equated with bits per second, but is actually the measure of signal level changes per second. Many serial network standards use multiple voltage or current level changes to represent a single bit, and so for these applications bps and baud are not equivalent.
Because all the bits arrived at their destination simultaneously, we would call BogusBus a parallel network technology.
RS-232C is a prime example of a ground-referenced serial network, while RS-422A is a prime example of a differential voltage serial network. RS-232C finds popular application in office environments where there is little electrical interference and wiring distances are short. RS-422A is more widely used in industrial applications where longer wiring distances and greater potential for electrical interference from AC power wiring exists.
RS-422A/RS-485 Two serial networks designed to overcome some of the distance and versatility limitations of RS-232C. Used widely in industry to link serial devices together in electrically "noisy" plant environments. Much greater distance and speed limitations than RS-232C, typically over half a mile and at speeds approaching 10 Mbps.
RS-232C The most common serial network used in computer systems, often used to link peripheral devices such as printers and mice to a personal computer. Limited in speed and distance (typically 45 feet and 20 kbps, although higher speeds can be run with shorter distances).
Perhaps the most important consideration of an ADC is its resolution. Resolution is the number of binary bits output by the converter. Because ADC circuits take in an analog signal, which is continuously variable, and resolve it into one of many discrete steps, it is important to know how many of these steps there are in total.
Serial data network frequencies start to enter the radio range, and simple wires begin to act as antennas, pairs of wires as transmission lines, with all their associated quirks due to inductive and capacitive reactances.
A robust alternative to the common ground signal method is the differential voltage method, where each bit is represented by the difference of voltage between a ground-isolated pair of wires, instead of a voltage between one wire and a common ground.
Other networks, such as RS-232C, are almost exclusively point-to-point; and token ring (as you might have guessed) is implemented solely in a ring topology.
Paraphrase (book-adjacent): the universal asynchronous framing that UART chips run — a line idling high, one low start bit, 5–9 data bits LSB first, then a high stop bit — is what the book's "timing sequences" bullet means in practice. The frame layout itself comes from the UART standards, not from the library texts.
A UART sends one byte as: 1 start bit (low) + 8 data bits (LSB first) + 1 stop bit (high), line idles high. That is 10 bit-times per byte. All timing python-verified.
To predict the outcome:
| element | level | bit_times | time_at_9600 |
|---|---|---|---|
| idle | high | any | between frames |
| start bit | low | 1 | 0.1042 ms |
| 8 data bits (LSB first) | byte value, e.g. 0x55 → 1,0,1,0,1,0,1,0 | 8 | 0.8333 ms |
| stop bit | high | 1 | 0.1042 ms |
| whole byte (framing overhead 2 of 10 bits = 20%) | — | 10 | 1.042 ms per byte → 960 bytes/s |
The book's own spec lines: RS-232C "typically 45 feet and 20 kbps"; RS-422A/485 "over half a mile and at speeds approaching 10 Mbps". Predict what each does to a 1 kB transfer.
To predict the outcome:
| bus | reach_typical | speed_typical | time_for_1_kb | signalling |
|---|---|---|---|---|
| RS-232C | ≈45 ft (book) | 20 kbps (book) | ≈0.5 s | ground-referenced, single-ended |
| RS-422A/RS-485 | > half a mile (book) | ≈10 Mbps (book) | ≈0.8 ms — ~600× faster, ~60× farther | differential pair, noise rejected as common-mode |
| RS-232 pushed past rating | book: 100 kbps worked on a 6 ft cable | distance and speed trade against each other | ≈0.1 s | short cable keeps the stray capacitance small |
The book's BogusBus carries 5 data bits on 7 wires (5 data + 24 V supplies), all bits arriving simultaneously — parallel. Re-send the same 8-bit value serially on one pair and the wire frequency jumps. The book's own example: parallel 0.5 Hz → serial ≈4 Hz, an eightfold increase. Python-verified factor.
To predict the outcome:
| metric | parallel | serial | verdict |
|---|---|---|---|
| wires for 5 bits of data | 5 data (+2 power) = 7 (BogusBus) | 2 (pair) or 3 with ground | serial trades copper for encoding |
| wires for 8-bit resolution | 8 data lines | same 2 wires, faster clock | serial scales resolution for free in copper, at a cost in speed |
| wire frequency (book example) | 0.5 Hz max | ≈4 Hz (8× more) | python-verified: 8 bits / (1 s update) → 8 transitions/s per alternating bit pattern |
| at 32–64 bits, thousands of updates/s | impractical copper count | frequencies reach the radio range — wires behave as transmission lines (book) | why real buses care about twisted pairs and differential signalling |
GAP, loudly: the library has no I2C/SPI text (Kuphaldt Vol IV stops at RS-485-era networks). These rows are standard/datasheet facts, offered book-adjacent for prediction practice — flagged for future sourcing.
To predict the outcome:
| bus | wires_for_4_slaves | addressing | typical_speed | idle_level |
|---|---|---|---|---|
| I2C | 2 shared (SDA, SCL) + pull-ups | 7-bit address inside the packet | 100–400 kHz (fast-mode 1 MHz, high-speed 3.4 MHz) | both lines high — open-drain, pull-ups required; no pull-up = bus stuck low |
| SPI | 4 + one CS per extra slave (MOSI, MISO, SCLK, CS) | hardware chip-select line per slave | multi-MHz to tens of MHz | push-pull — defined without pull-ups |
| shared wire, two masters, I2C | same 2 wires | arbitration keeps the bus coherent — address clashes are the failure mode | same as single master | contention detected as a master losing a bit it released |
| UART vs these | 2, but strictly point-to-point (book: RS-232 almost exclusively point-to-point) | none — one peer each way | whatever both ends agree (book: 20 kbps classic RS-232) | high (marking); start bit breaks idle |