SPI vs I2C Bus Explorer
Run the SPI vs I2C Bus Explorer MicroSim Fullscreen
Edit in the p5.js Editor
About This MicroSim
Two displays can look identical on the outside and still be wired in completely different ways. SPI and I2C are the two buses you will meet in this book, and they make opposite trades. This explorer draws both wiring patterns in the same space so you can flip between them and count the difference yourself. Your goal is to differentiate the two buses by wire count, by how devices are told apart, and by speed, and then to look at any wiring diagram and name the bus it uses.
How to Use
- Start in the SPI view. Count the labeled signal wires and check your count against the "Wires used" readout in the corner.
- Click each wire for its one-sentence definition. Note that CS is the wire that forces every extra SPI device to add another connection.
- Click Show I2C. Watch the wire count drop while the number of devices goes up.
- Click the two I2C device boxes to see their addresses, 0x3C and 0x68, and read how an address replaces a dedicated wire.
- Hover any wire to trace its full path and see its short name in a tooltip.
Iframe Embed Code
You can add this MicroSim to any web page by adding this to your HTML:
1 2 3 4 | |
Lesson Plan
Grade Level
9-12 (High School)
Duration
10-15 minutes
Prerequisites
- Can name the GPIO pins on a Raspberry Pi Pico, such as GP2 through GP6.
- Knows the five signal wires an SPI display needs: SCK, SDA, RES, DC, and CS.
- Understands that power and ground are separate from the wires carrying data.
- Can read a hexadecimal number such as 0x3C as a device label.
Activities
- Exploration (5 min): Click all seven wires in the SPI view, then all four in the I2C view. Build a two-column table of wire names for each bus.
- Guided Practice (5 min): Answer in writing: how many wires would three SPI displays need, and how many would three I2C devices need? Use the CS definition in your reasoning.
- Assessment (5 min): Sketch a wiring diagram of your own on paper, hand it to a partner, and have them name the bus and defend the answer with one piece of evidence from the diagram.
Assessment
- States the signal wire count for each bus correctly: five for SPI, two for I2C.
- Explains that SPI selects a device with a dedicated CS wire while I2C selects one by sending an address.
- Identifies the bus used by an unlabeled diagram and names the clue that gave it away.
- Names one situation where the extra SPI wires are worth it, such as fast full-screen animation on a color display.
References
- Serial Peripheral Interface (Wikipedia) - Clock, data, and chip-select signals of the SPI bus.
- I2C (Wikipedia) - The two-wire bus and its 7-bit device addressing scheme.
- MicroPython machine.SPI Documentation - Creating an SPI bus object in MicroPython.
- MicroPython machine.I2C Documentation - Creating an I2C bus object and scanning for device addresses.