Arduino Forum

Using Arduino => General Electronics => Topic started by: jasonvanwyk on Mar 22, 2013, 06:13 am

Title: Resistors with I2C usage in arduino
Post by: jasonvanwyk on Mar 22, 2013, 06:13 am
Hi,
I'm very new to electronics, specifically physical computing.
my first real project I'm trying to take on is to build a weather station.
I want to hook up my humidity sensor (HH10D), and through the reading that I've done it seems that is communicates via  I2C. my question is should i be using a resistor(s) when connecting it to the Arduino pins?
and if so where in the circuit should the resistors be?
my set up is as follows;
Vss - Gnd
Vdd - +3.3V
SDA - A4
SCL - A5
Some guidance and help would be greatly appreciated.
Thanks.
 
Title: Re: Resistors with I2C usage in arduino
Post by: fungus on Mar 22, 2013, 09:04 am

Hi,
I'm very new to electronics, specifically physical computing.
my first real project I'm trying to take on is to build a weather station.
I want to hook up my humidity sensor (HH10D), and through the reading that I've done it seems that is communicates via  I2C. my question is should i be using a resistor(s) when connecting it to the Arduino pins?


Only if you're having problems because of long wires, etc. Normally the devices have built-in resistors which are sufficient.
Title: Re: Resistors with I2C usage in arduino
Post by: majenko on Mar 22, 2013, 10:51 am
I²C uses open-drain IO pins, so pull-up resistors on the SCA and SCL lines are required.  Typically these are around 4.7K? and go from the SCA pin to VCC, and the SCL pin to VCC.
Title: Re: Resistors with I2C usage in arduino
Post by: pwillard on Mar 22, 2013, 12:44 pm
When longer wire lengths are used... the pull-ups may need to be slightly stronger to overcome the impact of copper length.  With 4.7K being the starting point, you might see improvement using 3.3K  or 2.2K instead.  Going to a lower is pull-up value is not ideal and should have you maybe re-thinking the solution... IE; maybe time to add a I2C repeater IC in the path.
Title: Re: Resistors with I2C usage in arduino
Post by: cmiyc on Mar 22, 2013, 09:15 pm
The Wire library, which does the I2C communication, enables the internal pull-up by default.  However, they are very weak (30-60kOhm).  So for relatively short runs, they'll work fine.

Even so I generally still put a 4k7 resistor on the lines, regardless if it is a "short" length.
Title: Re: Resistors with I2C usage in arduino
Post by: fungus on Mar 22, 2013, 09:36 pm

The Wire library, which does the I2C communication, enables the internal pull-up by default.  However, they are very weak (30-60kOhm).  So for relatively short runs, they'll work fine.


The I2C gadget on the other end usually has pullups, too...
Title: Re: Resistors with I2C usage in arduino
Post by: cmiyc on Mar 22, 2013, 09:44 pm

The I2C gadget on the other end usually has pullups, too...

True.

However, in this case, it doesn't appear the board has pull-ups:
https://www.sparkfun.com/datasheets/Sensors/Temperature/HH10D.pdf
Title: Re: Resistors with I2C usage in arduino
Post by: nickgammon on Mar 23, 2013, 10:50 am
Some oscilloscope screen-shots here showing what the pull-up resistors do:

http://gammon.com.au/i2c