Paano mag-usap ang mga chip Serial protocols — UART, I²C, SPI, I²S, RS-485, Modbus, CAN

Malalim na aralinDeep dive 12 · high school

Tagalog: draft — for Kate / Janet to check.  Shown in slow motion: a real bus sends thousands to millions of bits every second.

1. Serial vs parallel One wire at a time

8 wire = isang hakbang lang, pero 8 wire. 1 wire = 8 hakbang, pero 1 wire lang. Parallel sends a whole byte at once but needs 8 wires. Serial sends one bit at a time down one wire. Wires cost pins, space and money — so almost everything is serial. Serial trades TIME for WIRES.

2. UART — walang clock No clock, so agree a speed

Dalawang wire: TX at RX, nagkakasalubong. Walang clock, kaya pareho kayong dapat sumang-ayon sa baud rate. Two wires, crossed: TX→RX. There is no clock line, so both ends must agree a baud rate in advance — that is what "asynchronous" means. Wrong baud = pure garbage. This is what the Serial Monitor is. Point-to-point only: two devices.

3. I²C — dalawang wire, maraming device Two shared wires, addresses

SDA (data) at SCL (clock), hinahati ng lahat. May address ang bawat device. Kailangan ang pull-up resistors — kung wala, walang mangyayari. Two wires shared by many devices, each with its own address. Cheap wiring, slower. ⚠️ I²C needs pull-up resistors and silently does NOTHING without them — the single most common beginner failure. Some boards have them built in, some do not.

4. SPI — mabilis Fast, but a wire per device

MOSI, MISO, SCLK + isang CS sa bawat device. Mabilis. Four wires, and one extra chip-select line for every device you add. Much faster than I²C. Used where speed matters: displays, SD cards. Pull one CS low and only that device listens.

5. I²S — para sa tunog lang Audio only

Hindi pangkalahatang data — audio lang. BCLK + WS (left/right) + DATA. Not a general data bus: digital audio. Bit clock, word select (which picks left or right channel) and data. A digital mic sends clean audio with no analog stage to pick up noise — which is exactly why our desk pet spec rejects analog mics.

6. RS-485 at Modbus — ang wire at ang wika The wire and the language

HINDI magkaribal ang dalawa. RS-485 = ang wire. Modbus = ang wika na dinadala nito. THE BIG FIX: RS-485 and Modbus are not alternatives, and every tutorial that lists them side by side hides this. RS-485 is a physical layer — two wires, differential, noise-proof, good for hundreds of metres and many devices. Modbus RTU is the message format carried on top. Like "English" and "telephone". CAN is also differential, used in vehicles.

Differential: ang ingay ay tumatama sa dalawang wire nang pareho, kaya ang pagkakaiba ay nananatiling malinis. Why differential survives noise: interference hits both wires equally, so the DIFFERENCE between them is unchanged. The receiver reads the difference and ignores the noise.

7. Alin ang gagamitin Which one — and where ours are

ProtocolWiresUse it forIn our projects
UART2 (TX/RX)Two devices, simple linkThe Serial Monitor, every lesson. ESPClaw debug output.
I²C2 sharedMany small sensors, displaysOLED screens and most sensors on the bots.
SPI4 + 1 per deviceSpeed: displays, SD cardsThe round GC9A01 displays (desk pet, DooiRobot).
I²S3Digital audio onlyINMP441 mic + MAX98357A amp in the desk pet.
RS-4852 differentialLong runs, noisy placesThe wire to the solar inverter and charge controller.
Modbus RTU(rides on RS-485)Industrial gear: ask a register, get a valueReading battery state of charge and solar production.
CAN2 differentialVehicles, many tough nodesKnow it exists. Vehicle diagnostics.

⚠️ Mukhang serial pero hindi Looks like serial, but isn't

Ang 3-wire na servo / ESC lead ay HINDI serial bus. Signal, positive, negative — isang pulse lang ang dinadala, hindi data. A servo or ESC lead has three wires and a connector that looks exactly like a data bus. It is not one: signal, +, −, carrying a single PWM pulse whose WIDTH is the command. No addresses, no clock, no bytes. Also not serial: MCP over WiFi (ESPClaw) — that runs over the network, a completely different layer.