Pages: [1]   Go Down
Author Topic: Resistors with I2C usage in arduino  (Read 718 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
 
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 143
Posts: 5301
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Cumming, GA
Offline Offline
Edison Member
*
Karma: 20
Posts: 1643
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: March 22, 2013, 06:47:39 am by pwillard » Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6106
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 143
Posts: 5301
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6106
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Some oscilloscope screen-shots here showing what the pull-up resistors do:

http://gammon.com.au/i2c
Logged

Pages: [1]   Go Up
Jump to: