Electronic – arduino – Strange I2C behavior: sometime it works, some time it doesn’t

arduinocommunicationetherneti2cwire

I am using Arduino Ethernet with PoE and Arduino Uno boards. In recent days I implemented a working I2C bus by using the Wire library and all it seemed almost to work: the two boards was communicating correctly, except in some cases.

Until yesterday I2C bus was working, now it doesn't. I didn't changed the physical location of any wire or sketch code: I just started the PC in order to give power to boards, and the communication over the I2C bus just stop working. Then, after a bit and some "reset" / "sketch re-upload" (note: I didn't changed any sketch code), it started to work again.

It is not the first time that this situation happens, and I am in trouble to catch the exact problem.

What could be the problem?

Best Answer

It sounds like it's right on the margin of working; all sorts of tiny effects like EM noise from the computer, capacitance from the human body, and temperature are pushing it from "working" to "not working".

The general solution is to slow down the I2C or shield it more thoroughly.