TinyCircuits Forum

General Category => General Discussion => Topic started by: EKMallon on November 13, 2013, 09:00:19 PM

Title: Do the SDA & SCL I2C lines need pullup resistors on the tiny duino?
Post by: EKMallon on November 13, 2013, 09:00:19 PM
Please forgive another newbie question:

In the absence of a tinyduino native RTC, which I know is in the works, I need to use a Chronodot RTC communicating via I2C to SDA (analog input pin A4) and SCL (analog input pin A5). According to my reading, I²C uses open-drain IO pins, so pull-up resistors on the SCA and SCL lines are generally required. But confusingly I have read that the Wire library, which does the
I2C communication, enables internal pull-up resistors by default. More confusing for a newbie like me, I see photos of  projects on the web, where people are using chronodots RTCs with other 3.3v boards like the pro mini, with no sign that they have installed the pullups, but they still seem to be working.

Do the SCL and SDA lines on the tinyduino have internal pull-up resistors that are automatically enabled by the wire library, or do I need to run my own 4.7KΩ(?) resistors from the SCA pin to VCC, and the SCL pin to VCC.

And finally, my final unit will also have the Tiny-circuits accelerometer in it, which is also an I2C device with a level shifter. Does the presence of that level shifter, affect this question? Ie, does the level shifters connection to the SCL & SDA lines mean I dont have to worry about pulling up SCA & SCL for the other I2C devices that would also be connected?
Title: Re: Do the SDA & SCL I2C lines need pullup resistors on the tiny duino?
Post by: EKMallon on November 14, 2013, 07:32:21 PM
I found a nice explanation of the pull up resistors function here:
http://www.dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors.html

And a more detailed I2C reference here:
http://gammon.com.au/i2c

And as I interpret my way through that information, I am left thinking that I am probably safer to add the I2C pullups on the RTC, even if they already exist in the circuit, than to go without them. But I am still left without knowing what the Tiny accelerometer is already doing to the SDA and ACL lines (just going by the pdf - cant get the eagle files to open with the freeware version)  and I just dont know how to interpret the level shifter's effect on the I2c lines.
Title: Re: Do the SDA & SCL I2C lines need pullup resistors on the tiny duino?
Post by: EKMallon on November 15, 2013, 05:08:00 PM
Found the reference I was looking for wrt the level shifter on the Tiny accelerometer board:

http://www.dsscircuits.com/i2c-level-converter.html

So the devices connected via the level shifter do not need pull up resistors (which is why I could not find them in the schematic pdf).  However the graphs further down the page, refer to "using the I2C Level Translator .... AND external pullup resistors shows a vastly improved improved signal for both standard speed and high speed communication." I interpret this to mean that the other devices on the I2C lines, that are not behind the level shifter, should have pullups applied as normal.

So I am adding 10k pullups on the RTC, which, even if they parallel the internal 10k's on the level shifter, will leave me with 5k overall, which should be ok. Will post to let folks know if this works ok.