Skip to content

I2C Simulations

These five MicroSims go with Appendix A: The I2C Bus. Do them in order. Each one builds on the one before it.

What Each MicroSim Shows

  1. I2C Start Bit and Address Framing. Step through a real transaction byte by byte: a controller writes a 16-bit memory address to an EEPROM, then reads a byte back, while an LCD shares the same bus. See exactly when a device checks the bus for its own address, and why it can't be confused by another device's data bytes.
  2. I2C Bus Scanner. The Pico asks every address, "is anyone there?" Chips answer with an ACK. Unplug a chip and scan again.
  3. I2C Collision-Avoidance Robot. One distance sensor on the I2C bus steers a robot. Within 15 cm of a wall, the robot backs up 20 cm and flips a coin to turn left or right. Slow the reads down and watch it bump.
  4. I2C Two Sensors in a Maze. A robot drives a maze. The Pico reads an accelerometer, then a gyroscope or a compass, taking turns on one bus.
  5. I2C Five-Device Sensor Fusion. Five devices share one bus. See a display picture block the sensors. Then fuse the accelerometer and the gyroscope into one clean angle.