Context and goal
Each pair was given a topic to wrap up the programming course; ours was the I²C bus. The goal: understand in depth how it works — the protocol, addressing and the components you can connect to it.
A test bench, then a PCB designed in KiCad, to understand the I²C bus and the devices you can connect to it.


The device on a breadboard (test bench)

The finished shield, with program 1 (temperature) on screen
Each pair was given a topic to wrap up the programming course; ours was the I²C bus. The goal: understand in depth how it works — the protocol, addressing and the components you can connect to it.
Arduino · C++ · KiCad · oscilloscope · display, temperature sensor, EEPROM, I/O expanders
The shield plugs onto an Arduino MEGA 1280. It brings together, on a single I²C bus, an MCP23017 I/O expander, a temperature sensor, a real-time clock and an extension connector. A display, four buttons and a small speaker make up the interface.
| Required | Delivered |
|---|---|
| Menu: temperature, time, MCP23017 I/O, memory | Six-program menu |
| Control every MCP23017 output (8 inputs, 8 outputs) | Done |
| Test every I²C address and list the slaves | Scanner for addresses 1 to 126 |
| Alarm if a slave does not respond (880 Hz, 3 s) | Alarm alternating between 800 Hz and 100 Hz while the bus is incomplete |
| TC74 sensor | MCP9808 in the final version |
| External 24LC01 memory, reset to FFh at start-up | Arduino's internal EEPROM, reset to 0 |
The external memory was not part of the final validation, as the program header states.
You scroll through the six programs with UP and DOWN, enter with ENTER and leave with EXIT: temperature, time and date, MCP23017 control, memory, I²C scanner and free text saved to memory.
In parallel, every 500 ms, the program rescans all 126 addresses. If it finds fewer than three slaves, the speaker sounds; when a device is plugged in or removed, it gives a rising or falling beep. At start-up, holding UP and DOWN for more than 2 s erases the whole memory.
In our study, we measured the SDA (data) and SCL (clock) lines on the oscilloscope, using test points designed into the board. You can see the start condition (SDA goes low while SCL is high), the slave address, the data and the stop condition.
We can also estimate, in theory, how long a scan takes. At 100 kHz, the Arduino's default frequency, one bit lasts 1 / 100,000 = 10 µs. Testing an address takes about 11 bits (start, 7 address bits, read/write, acknowledge, stop), i.e. 11 × 10 µs = 110 µs. A full scan therefore takes 126 × 110 µs ≈ 13.9 ms and, repeated every 500 ms, it occupies the bus about 13.9 / 500 ≈ 2.8 % of the time.

A finished device on a PCB, with a display, onto which more devices can be added along the I²C chain.
Going from code to the real signal seen on the oscilloscope, then from a breadboard prototype to a manufactured PCB. It gave me a complete view of an electronic system, from design to fabrication.