This tutorial assumes you have already installed the QMI8658 library and know how to flash the board. See the library installation guide and getting started guide if needed.
What is I2C?
I2C (Inter-Integrated Circuit, pronounced “I-squared-C”) is a two-wire serial communication protocol. Every device on the bus shares two lines:- SDA — Serial Data
- SCL — Serial Clock
0x68). The controller (your ESP32) initiates every transaction and addresses a specific peripheral. Multiple devices can coexist on the same two wires as long as their addresses are unique.
Why does this matter for E-Spin? Your board already has one I2C device built in — the IMU. The exposed GPIO headers let you chain additional sensors (temperature, pressure, distance, OLED displays…) onto the same bus without using extra pins.
What this project does
The scanner iterates through all 128 possible I2C addresses and attempts to contact each one. When a device acknowledges the ping, its address is printed to the serial monitor. Expected output on a bare E-Spin:Wiring
No additional wiring needed. The IMU is already connected to the ESP32’s I2C bus on the PCB. If you want to scan external devices, connect them to the GPIO header:| E-Spin Pin | Function |
|---|---|
GPIO5 | I2C Data |
GPIO4 | I2C Clock |
3.3V | Power |
GND | Ground |
Most 3.3V I2C breakout boards work directly. For 5V modules, use a logic-level shifter — the ESP32-C3 is not 5V tolerant.
Code
What’s next?
Now that you’ve confirmed the IMU is alive on the bus, the next tutorial reads actual sensor data from it.Read IMU Raw Data
Read accelerometer and gyroscope values directly over I2C.