Lesson 07 · 60 minutes
Roll Call on Two Wires
How the parts talk: I2C buses and addresses
Today's goal
Draw every part on the robot's I2C bus with its address, and explain what goes wrong when two parts share one.
Ideas in this lesson
- I2C: many parts share just two wires, SDA (data) and SCL (clock)
- Each part answers only to its own number, its address
- Two parts with the same address talk over each other
- The robot finds its parts by calling out every address at power-on
Sense → Think → Do
Before the robot can SENSE anything with the IMU, the laser or the ADS1115 inputs, it has to find them. At power-on it calls each address and listens for an answer, like taking attendance.
How the session runs
- Play roll call: everyone holds a card with a number (0x28, 0x29, 0x48, 0x49, 0x4A, 0x68). The teacher calls a number; only that person stands up.
- Now give two kids 0x29. Call it. Both stand and talk at once. That is exactly what happens if a BNO055 and the laser are both at 0x29.
- Look at the robot's breadboard: SDA rail to A4, SCL rail to A5, 5V and GND rails. Trace each board to the rails.
- Restart the robot and read the console: 'imu: on MPU-6050 0x68', 'tof: VL53L0X found', 'adc: ADS1115 found: 0x48 0x49 0x4A'.
- Unplug one ADS1115 and send kp; (probe again). Which address disappeared?
- Draw the bus map: each board, its address, and how its address was chosen (the ADS1115 ADDR pin to GND, VDD, SDA or SCL; the BNO055 ADD pin to GND for 0x28).
Try this
- The ADS1115 can only be 0x48 to 0x4B. How many can one bus have?
- Why does a cheap BNO055 board need its ADD pin pulled to GND on our robot?
- Why do 3.3 V boards like the BNO055 need a level shifter on a 5 V bus?
When it goes wrong
| What you see | What it means |
|---|---|
| Nothing found on I2C | SDA and SCL swapped, or no 5V/GND to the boards. |
| A board shows up at the wrong address | Its address pin is floating or pulled the other way. Check the ADDR / ADD wiring. |
| IMU and laser both missing, or garbage | Two boards at 0x29. Pull the BNO055's ADD to GND so it moves to 0x28. |
Notes for the grown-up
The roll-call game makes addresses stick. The 0x29 collision is a real story from building this robot: tell it.
Ages: K-5: roll call game only, with animal names instead of hex. 6-12: read the hex addresses, the 7-bit address plus read/write bit, and the level-shifter question.
Materials: Robot with several I2C boards, index cards with addresses, breadboard close-up photo or the real robot, app console.