"Cross-talk" on the I2C bus?

My DiddyBorg has started to misbehave. He's running headless as a WIFi access point on a Pi 3 with a PS3 controller. In automode runs around the room following directions from "left" and "right" symbols printed on card using OpenCV (he even gets it right if the lighting is good!).
I recently added an UltraBorg and ultrasonic sensors and an XLoBorg to get his compass heading, all of which work well. I have also added rotary encoders to the wheels either side to get an accurate distance run. (Using the scroll wheels and encoders from "Poundland" mice).
Diddy has started to misbehave after the addition of the two extra I2C boards, even when in manual mode and the PS3 controller not to hand he will suddenly and randomly operate the drive motors, either shooting forwards, backwards or starting a spin. I've tried giving him a good telling off but it makes no difference.
I am wondering if there is any way that the new boards could be interfering with the PicoReverse board on the I2C bus. There isn't a direct address conflict, I am using the default addresses for each board.
My Python code uses several threads, for vision, encoders and compass and will soon be joined by a thread for the ultrasonic sensors.
I am a little concerned as my old Cocker Spaniel was better behaved than Diddy at the moment and that's saying something.

piborg's picture

It is possible that there is some noise on the I2C wires causing trouble here.
The longer the distance the I2C connections run for the more they behave like antennas.

The best thing to try would be to make up some shorter cables for the 6-pin connections.
The shorter the connection the less interference that will be received.

Alternatively you can try shielding the cables from noise.
As a starting point you can try wrapping the cables in tin foil and see if the behavior changes.
If he is better behaved then noise will be the problem.

Subscribe to Comments for ""Cross-talk" on the I2C bus?"