Noise on the I2C bus killing communication?

March 18, 2012

Originally, I soldered the gyro and accelerometer breakout boards directly to the tricopter’s main board, thinking that using headers would make them wobbly and unreliable. Recently, I have found myself wishing more and more that the boards were easily separable, so I rewired the board (it turns out quality headers don’t wobble at all).

Wires.

The soldering was fairly easy to do, and there is not much to say about it. I spent the majority of my time in the lab today tracking down a problem that I think had existed before but I had never noticed until now.

Usually, it takes the microcontroller about 2 milliseconds in total to read the gyro and accelerometer. I have complained before that this is too slow. I have also noticed in the past that communication would stop randomly, though infrequently enough that I explained it away by assuming that my code caused these random crashes.

I never suspected these two issues could be connected, but after hours of troubleshooting, I have narrowed the problem down to the reading of the gyro and accelerometer. For some reason, my I2C circuitry on the protoboard is extremely susceptible to interference… of some kind. Touching the exposed leads makes things die. Breathing on them (i.e., adding moisture, thereby slightly decreasing the resistance of the air and making the circuit warmer) makes things die even faster.

Interestingly, the loop times increase gradually before the system dies, which makes me think that the interference makes it harder for the microcontroller to read from the I2C bus, and once the interference gets bad enough, it simply gets stuck in the read loop, waiting forever to receive data.

The following video shows some of the symptoms. The blinding red LED is the power light. The dimmer green LED indicates TX (communication) activity. Whenever I so much as touch the leads of the I2C lines, it dies.

I tried to mitigate this phenomenon by insulating the exposed leads with hot glue (which is easily removable, lest I wish to do so later). Improvement was marginal in that the hot glue only delayed how quickly communication died. This suggests that it is temperature, not moisture or static discharge from my fingers, that is the culprit.

Frustratingly (fortunately?), this does not occur if I wire the breakout boards straight to the I2C lines on the Seeeduino without using my protoboard circuit. That said, I really don’t want to have to mount the breakout boards separately from the main circuit board. They don’t even have mounting holes, anyway.

Anyway, this is a serious problem I will need to fix before doing any more flight tests. I don’t need communication to go dead when the tricopter is 40 feet in the air above a parking lot.

3 Comments

Reducing the resistance of the pullup resistors on your I2C bus might help reduce the noise. You would need to check to see how much current the IO on the arduino and I2C slaves can safely sink to choose a good value. By reducing the resistance you will increase the current in the bus, thus reducing noise.