existing i2c slave: use arduino to recieve messages

Hello users,

I have tried a couple of days now to read slave devices from an existing i2c network (it's a satellite unit which updates the display with i2c messages). We are able to read statuses but during dishpointing the reads of the arduino interfere with the master updates from the satbox. It looks like we need to use som sort of i2c sampling solution which catches some i2c messages when the master sends them. I found the following code:https://billgrundmann.wordpress.com/2009/03/03/sniffing-the-i2c-traffic-of-a-nunchuk/ which exactly does this, but my c knowledge is not good enough to convert this to capture write-only messages to a slave address in realtime and act on de data value, and disregard all other messages.

Does someone have experience in this or can help me convert this code into a i2c sampling application?

What do you want to achieve?

The linked code is some kind of I2C bus sniffer that simply sends all I2C traffic to the connected PC. If that's all you need, use that code. If you need something else, tell us what that is. And you might have to tell us more about what devices are on your I2C bus you want to sniff.

Sounds like he wants to capture, buffer and filter the existing traffic from the master so that it doesn’t collide with his traffic. Aren’t there I2C multiplexors available for this?


Sorry about not replying any sooner, i was out for 2 weeks.

What i want to achieve: The satellite unit updates a LED display through I2C. For instance, which satellite is selected, and when unit is off, searching or pointed. I have build a solution which uses I2C on the arduino which reads register values on slave address 0x67. When it's a specific value we know a Internet SAT is found so we need to activate a servo so the correct LNB is switched on the dish. The problem with this appoach is that the I2C bus hangs because the existing master of the SAT unit isn't multimaster aware. Even when the arduino is using the I2C bus the master of the SAT unit starts it's broadcast on the bus. Strange things the happen:-)

So as i only want readonly access to the bus (not requesting a read but intercept messages from existing master to slave address 0x67) it's best to not use the I2c chip on the arduino but intercept these messages digitally as this will not interfere with the bus at all.

So i want to use the code from the example, filter out all messages to 0x67, followed by a specific register, followed by a specific value. When all of these are met, i want to do a servo action.


After giving it some thought it would be better to use the i2c hardware of the arduino and setup i2c as slave with the same address as the existing slave IC we are interested in. To get this to work we should be able to disable ACK's on the arduino and even write's on the i2c bus, making arduino completely passive. Only reading incoming messages is enough. Is it possible to do this with the wire library or another software library?

After giving it some thought it would be better to use the i2c hardware of the arduino and setup i2c as slave with the same address as the existing slave IC we are interested in.

I don't think so because in this situation the Arduino will acknowledge the messages on the bus interfering with the LED display which may block the bus too. The hardware is doing this automatically, so using the hardware interface is not the way to go here.

You don't need a whole I2C slave implementation in software, it's enough to have an instance listening on the bus and reacting on some. You need to check for start and stop conditions and store bits on rising edges of the SCL line (http://en.wikipedia.org/wiki/I%C2%B2C). If your arduino is doing nothing else, you can use pins 2 and 3 (INT0 and INT1) for the two wires which should enable you to react fast enough (with interrupt handlers) at least for standard speed I2C (100kHz).