9-DOF IMU Chip Layout
Run the 9-DOF IMU Chip Layout MicroSim Fullscreen
Iframe Embed Code
You can add this MicroSim to any web page by adding this to your HTML:
1 2 3 4 | |
About This MicroSim
The IMU board on the swarm robot is called a 9-DOF IMU. "9-DOF" means nine degrees of freedom: three axes from a gyroscope, three from an accelerometer, and three from a magnetometer. It looks like one small board, but it is really two separate chips that share one I2C bus:
- The L3GD20 gyroscope answers at I2C address
0x6B. It gives 3 axes of rotation rate in degrees per second. - The LSM303D answers at I2C address
0x1D. It holds two sensors in one chip: a 3-axis accelerometer (in g) and a 3-axis magnetometer (in gauss).
Both chips connect to the same two wires: GPIO16 (SDA) and GPIO17 (SCL), which make I2C bus 0 on the Pico W. I2C lets many devices share one pair of wires, as long as each device has a different address (a number that picks which chip should answer).
The What i2c.scan() prints card shows the output of the chapter's scan code. With a working module it lists two addresses, not one. The scenario buttons show what the scan prints when one chip's wiring has failed, which is the first row of the chapter's troubleshooting table.
Clone boards can use different addresses
Each chip has an address-select pin. On some boards the gyroscope shows up at 0x6A
and the LSM303D at 0x1E. Always run i2c.scan() and use the addresses your own
board reports.
This MicroSim goes with Chapter 13: Swarm Robotics and Advanced Engineering Patterns, in the section "Meet the 9-DOF IMU: L3GD20 + LSM303D."
How to Use
- Hover over (or tap) each box, from left to right. Read the explanation in the Details card.
- Hover over the
addr 0x6Bandaddr 0x1Dlabels. How does the Pico W pick which chip answers? - Count the gray boxes on the right. How many axes does each one have? Add them up. Do you get 9?
- Press Gyro not answering, then Accel/Mag not answering. Look at the scan output each time. Which address is missing?
- Explain to a partner why reading this module needs two small drivers, not one.
Lesson Plan
Learning Objective
Students will explain (Bloom's Taxonomy: Understand) that a "9-DOF IMU module" is two
separate I2C sensor chips sharing one bus, each with its own address, rather than one
combined chip, and will interpret an i2c.scan() result in those terms.
Grade Level
Grades 8–12
Duration
10–15 minutes
Prerequisites
- I2C buses, SDA/SCL, and device addresses from Chapter 6: Electronics, DC Motors, and Communication Protocols
- Reading an I2C sensor with
readfrom_mem()from Chapter 8: Sensors and Data Input
Activities
- Prediction (3 min): Before showing the diagram, ask: "The board says 9-DOF. How
many addresses will
i2c.scan()print?" Most students predict one; record the split. - Guided walk-through (5 min): Project the diagram and hover each node from left to right. Pause at the LSM303D and ask why one chip can produce six of the nine values.
- Fault reasoning (4 min): Use the two failure scenarios. Students state which address disappears and which readings the robot would lose (rotation rate versus acceleration and heading).
- Hardware check (3 min): If modules are available, students run the chapter's scan
and
WHO_AM_Icode and compare the printed addresses with the diagram, noting any clone-board address differences.
Discussion Questions
- Why can the time-of-flight sensor, the OLED display, and both IMU chips all share GPIO16 and GPIO17?
- What would happen if two chips on the bus had the same address?
- Why does the chapter warn that motors near the LSM303D distort one of its readings but not the other?
Assessment
- Formative: Students label a blank copy of the diagram with the two addresses and the units of each data type.
- Exit ticket: "
i2c.scan()prints['0x6b']. Which chip is missing, and which robot features stop working?" (Expected: the LSM303D; tilt sensing and the compass heading.) - Rubric (4-point): Exemplary — explains the two-chip design, both addresses, and how the bus selects a chip; Proficient — names both chips and addresses; Developing — knows there are two chips but confuses which sensor is on which; Beginning — treats the module as a single device.
References
- Inertial measurement unit (Wikipedia) — what an IMU measures and why several sensor types are combined.
- I²C (Wikipedia) — how devices share SDA and SCL and how 7-bit addresses select one device.
- MicroPython machine.I2C documentation —
scan()andreadfrom_mem()used in the chapter code. - Pololu MinIMU-9 v3 (L3GD20H and LSM303D carrier) — a well-documented board with the same two-chip arrangement and address-select pins.
- Magnetometer (Wikipedia) — how a magnetometer works as an electronic compass.
- Swarm Robot Build Plan — full L3GD20 and LSM303D drivers for this course's module.