Design, Build, Test, Iterate

Reduce noise on Arduino 400 kHz I2C with external pull-up resistors

Yesterday I wrote about how sensitive the I2C bus was to noise induced by merely touching exposed leads with a finger.

I2C clock line freaks out when I touch it with my finger.

I2C clock line freaks out when I touch it with my finger.

A friend suggested that increasing the current flow on the bus might help drown out the noise. Indeed, a quick google search turned up this article on the effects of various pull-up resistor values on the I2C bus. Essentially, if the pull-up resistor on the I2C bus is too resistive, the I2C pins do not go high fast enough, so the effective I2C bus operation frequency is lower than what the code tries to do.

It makes sense that I would have this problem. Arduino’s I2C library comes configured for 100 kHz operation by default. Then it is likely that the Arduino hardware (and the Seeeduino hardware) was designed for 100 kHz operation as well, and the internal pull-up resistor of the ATmega was probably good enough for that speed. However, I modified the code to run I2C at 400 kHz and did not realize I had to make hardware modifications, as well.

Fortunately, adding a few (1.5 kOhm) resistors takes no work at all, and now I have a beautiful, square waveform:

I2C clock line with 1.5 kOhm resistor. The capacitance of my body now has a lot smaller effect!

I2C clock line with 1.5 kOhm resistor. The capacitance of my body now has a lot smaller effect!

That said, this is only an improvement in that if I breathe on the circuit long enough, I can still make the signal go haywire. Nevertheless, that takes long enough to guarantee that the electronics will not fail all the time in humid Oregon. Besides, I would not expect this to work with a screwdriver laid across the leads, would I? (Or water. I tried running the circuit with a drop of water on the gyro breakout board, but it didn’t work.)

Categorised as: Projects


  1. Joegeek says:

    An employee at HSC (Halted) Electronics in Santa Clara actually did some noise testing in the Phillips I2C bus. I had a great conversation with him and learned a little bit of history on the chip from him. I don’t recall his name, but he and I did discuss the I2C and noise. He said he tested the I2C against noise and fount it very hardy. HSC is an electronics surplus store with a handful of employee who are pretty knowledgeable in electrical engineering. if I head back I’ll get more details next trip. I’ll also find the particulars as t what type of noise. It you tested the I2C bus against inductance – it’s different than Electrical Noise – from my understanding the architecture is subject to finding the correct pullup resistor value with different wire lengths.

    • Soo-Hyun says:

      You are right that “noise” is not the correct term for what I observed on the I2C bus. It may have been inductance, as you say. I just noticed a kind of capacitive effect when the wires were in contact with anything that could hold a significant charge, like moist air or my finger.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>