Monitor I2C data - into the Arduino Serial Monitor?

Hello,
I would like to investigate the ability to monitor an I2C data-bus as a troubleshooting tool.
I would like to be able to connect the Arduino up to a current I2C bus and simply watch the data on that bus - on the IDE serial monitor.

I suspect someone has already done that?
Can anyone point me in the direction of where I might find an example sketch/program?

Sincere thanks
dw

The data usually go by far too fast to be observed by printing on the serial monitor.

Most people use a multichannel logic analyzer to do bus analysis and troubleshooting. They need not be expensive (this absolutely minimal example (PC also needed), might work for your project).

Have a look here for a few I2C sniffers. They don't work in real time as it were. They capture I2C activity for a short period of time - usually until their memory buffers fill up, and then print out what they've captured on the serial monitor. They are also usually limited to an I2C bus running at 100kHz. I don't think any of them will handle a 400kHz bus.

As suggested, a cheap LA can be had for around 10 GBP on eBay. There's some great PC software that will decode the captured I2C data for you (SigRok?) . I think even the cheap LAs also capture SPI data and standard UART data as well as discrete logic signals.

They are a really useful tool to have - even a really cheap one.

The unit linked by jremington coupled with the Pusleview software is a great troubleshooting tool. The Pulseview software even has an I2C decoder that will show what is sent and received.

This is a RTC sending date and time to an Uno.

Why does everyone wants to take the fun away?

I would consider this a very interesting learning project and a useful tool if it works.

a very interesting learning project and a useful tool if it works.

Done long ago. You can read about one example here: Arduino I2C Sniffer | Hackaday and tell us whether this is "useful".

Thank you all!!
I'll check out both options.
Thanks :-]

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.