Sensors & Measurement · Study deck
Sensor Interfacing Protocols
Picture a room sensor connected to a small controller.
Gateway Gus is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Differentiate between I2C, SPI, and UART communication protocols based on wiring, speed, and topology
- Configure an I2C bus with correct pull-up resistors and address assignments for multi-sensor applications
- Implement SPI communication with proper mode selection for high-speed sensor data transfer
- Evaluate and justify the appropriate protocol for specific sensor requirements and constraints
Major section
Start With the Measurement Story
The sensor may use one pin, two shared wires, a clocked link, or a simple serial line.
- The best choice is the one that keeps the reading and its failure state clear.
- A protocol means shared rules for an exchange.
- GPIO means general purpose input and output pins.
- Silence must not become a valid zero.
Major section
Start With the Measurement Story (continued)
Inter-integrated circuit (I2C) means a short shared wired link between chips.
- Serial Peripheral Interface (SPI) means a clocked wired link with separate data paths.
- Universal asynchronous receiver-transmitter (UART) means a serial link that agrees on timing without a shared clock.
- This runway does not prove cable length, noise margin, or power use.
Major section
In 60 Seconds
The capacitance and current limits leave no valid passive pull-up at the stated bus load.
- At 400 pF, 4.7 kΩ rises in about 1.59 µs, slower than the 1 µs Standard-mode limit.
- Fast mode needs R ≤885 Ω for rise time and ≥967 Ω for sink current.
- No passive value meets both bounds at that capacitance; reduce capacitance or redesign.
Major section
I2C Communication Protocol
The controller addresses the sensor for writing, selects a register, issues a repeated START, addresses it for reading, accepts the returned byte, and ends the transfer with NACK and STOP.
- The repeated START preserves one logical transaction while reversing direction; this sequence is the protocol meaning behind the API calls used later.
Major section
SPI Communication Protocol
SPI (Serial Peripheral Interface) is a synchronous, full-duplex communication protocol using four lines: MISO (Master In Slave Out), MOSI (Master Out Slave In), SCK (Serial Clock), and CS (Chip Select).
- Unlike I2C, SPI supports simultaneous bidirectional data transfer.
- The transaction is easiest to understand when chip selection and clocking are separated from the two data paths.
Major section
UART Serial Communication
A direct TX/RX link commonly connects two devices, but a multidrop physical layer and an addressing protocol can connect more.
- Both sides of each link must use compatible baud and frame settings.
- Asynchronous: No shared clock; endpoints need compatible baud rates.
- Many sensors provide UART as a simpler alternative to I2C/SPI, though at lower data rates.
Deck summary
Key takeaways
The sensor may use one pin, two shared wires, a clocked link, or a simple serial line.
- Inter-integrated circuit (I2C) means a short shared wired link between chips.
- Sensor communication protocols (I2C, SPI, UART) are the "languages" sensors and microcontrollers use to exchange data.
- The controller addresses the sensor for writing, selects a register, issues a repeated START, addresses it for reading, accepts the returned byte, and ends the transfer with NACK and STOP.
- SPI (Serial Peripheral Interface) is a synchronous, full-duplex communication protocol using four lines: MISO (Master In Slave Out), MOSI (Master Out Slave In), SCK (Serial Clock), and CS (Chip Select).
Retrieval practice
Recall check 1 of 4

Gateway Gus says: answer from memory, then check your reasoning.
Q1Per Phoebe's Field Notes, why can't a 4.7 kOhm pull-up reliably run an I2C bus at the full 400 pF capacitance ceiling, even at just 100 kHz (Standard mode)?
Show answer
Answer: A see answers page
Retrieval practice
Recall check 2 of 4

Gateway Gus says: answer from memory, then check your reasoning.
Q2In the I2C protocol, what does Wire.endTransmission(false) do differently from Wire.endTransmission(true)?
Show answer
Answer: C Passing false to endTransmission() sends a Repeated START instead of a STOP.
Retrieval practice
Recall check 3 of 4

Gateway Gus says: answer from memory, then check your reasoning.
Q3Per this chapter's 'When to Choose Each Protocol' guidance, which requirement is listed as a reason to choose SPI over I2C?
Show answer
Answer: A The chapter lists real-time transfer under 1 ms as a reason to investigate SPI; verify the installed end-to-end timing.
Retrieval practice
Recall check 4 of 4

Gateway Gus says: answer from memory, then check your reasoning.
Q4Why does a basic direct TX/RX UART link usually connect two devices, while a multidrop UART network needs extra design?
Show answer
Answer: A Basic UART frames carry data and framing bits but no inherent device address.
Print reference
Answers
Answer key.
- A · The chapter's own worked case: R=4.7kOhm, C=400pF gives tau=RC=1.88us and tr=0.847xRC=1.59us -- slower than the 1000ns Standard-mode rise-time limit, so a bus that actually reaches the 400pF ceiling cannot run reliably at 4.7kOhm even at 100kHz. This is why fast, heavily-loaded buses use smaller pull-ups (1-2.2kOhm) instead.
- C · Passing false to endTransmission() sends a Repeated START instead of a STOP.
- A · The chapter lists real-time transfer under 1 ms as a reason to investigate SPI; verify the installed end-to-end timing.
- A · Basic UART frames carry data and framing bits but no inherent device address.