[TriEmbed] Basic I2C Question

Rodney Radford ncgadgetry at gmail.com
Thu Sep 11 10:39:45 CDT 2014


As long as the I2C devices are close to the microprocessor, you do not need
additional pull up resistors.

However, as you increase the distance (say to an extra sensor board), the
long wires add additional capacitance to the I2C lines, turning those sharp
edges into something that looks more like a sine wave.  The same occurs as
you add more devices as each device has it's own internal capacitance. The
additional pull up resistors help correct this, allowing you to put your
sensors further away (or add more sensors).

So if you are going off-board with your sensors, yes, i would definitely
recommend adding pull up resistors. The lower the value of the resistors,
the more pull up you get and the sharper your edges become - at the
increase of additional current required for your device, so it is a trade
off.

I worked on a setup years ago where I used I2C as a communication bus for a
large aquarium monitoring system where I had I2C temperature sensors in
each aquarium, I2C port expanders to drive small 2x16 line LCD displays,
and port expanders to control turning on heaters to each aquarium.  The
aquariums were in an external storage shed that was not insulated, so by
measuring the external temperature we could start increasing the water
temperature as the external temperature dropped, to prevent the water from
getting too cold before the heaters cut in.  In hind site, it may have been
easier to insulate the shed, but the system worked well for years.  I was
running I2C lines over CAT-5 30' and it worked like a charm.  I did
optoisolate the I2C lines back to the computer (which was a Windows PC that
was bit-banging the I2C out the PC's parallel port) to prevent lightning of
other high static charges from damaging the port.

Of course now I would replace all of that with a few small microprocessors
and a Raspberry Pi, but this was back in the early/mid 90s...

On Thu, Sep 11, 2014 at 11:28 AM, Charles McClelland <chip at mcclellands.org>
wrote:

> Adam,
>
> Thank you for the response your and Jon’s note raises another question:
>
> Is there an advantage to putting resistors on the circuit board versus
> simply using the Arduino’s internal pull-ups?  Power savings or - as Jon
> mentioned - the ability to tune for performance?
>
> On the RTC - here is my reader’s digest version of the bewildering variety
> that Maxim offers:
> - DS1337 - Great but no battery backup to keep clock set when I change the
> batteries
> - DS1338 - Adds battery backup but drops alarms
> - DS1339 - Battery backup, alarms and an alarm pin - and it is cheaper
> than the DS1338.
>
> I am hoping the library / commands for all three will be similar and
> similar.  Thoughts?
>
> thanks,
>
> Chip
>
>
> On Sep 11, 2014, at 8:50 AM, Adam Haile <email at adamhaile.net> wrote:
>
> There's no need for them at all.
> I2C only needs pull up resistors on the bus as a whole, NOT for each
> device.
> Also, the Wire library in Arduino automatically enables the internal
> pullup resistors when you call begin(). You can also do the same by setting
> a pin as an input and then writing HIGH to it, but Wire takes care of it
> for you.
>
> Sure, having extra won't help but you certainly don't need more than one
> set.
>
> For the RTC, check out the DS1337, it is the DS1307's big brother and
> includes alarms. However, there are no alarm pins, you just have to poll
> for if the alarm is "going off". But there is lots of code out there
> already for the DS1337. If you need alarm interrupts, I'm not sure what to
> use... nothing I'm familiar with that has separate alarm pins.
>
> On Thu, Sep 11, 2014 at 8:28 AM, Charles McClelland <chip at mcclellands.org>
> wrote:
>
>> First, I wanted to thank Paul for the excellent presentation on
>> interrupts.  I now have a Watch Dog Timer routine which is saving me from
>> having to put a clock on one project.
>>
>> On my other project though, I still need a clock.  And since I am already
>> using an I2C bus, I thought I could simply add one to that bus.  That way I
>> will have two I2C sensors connected to an Arduino (ATMEGA328).  My question
>> is how to best implement the pull-up the resistors.  Should I put resistors
>> on each (perhaps 10k since they will effectively be in parallel) or should
>> I put one set of pull up resistors on the main board for both?  It seems
>> like the latter is the better approach but I did not know if there was some
>> reason to do one over the other.
>>
>> On a related note, I need a 3.3V I2C Real Time Clock with Alarms - I am
>> looking at the DS1339 and hoping I can use some of the DS1307 library since
>> they are both from Maxim.  Any other suggestions?
>>
>> Thanks,
>>
>> Chip
>>
>>
>>
>> _______________________________________________
>> Triangle, NC Embedded Computing mailing list
>> TriEmbed at triembed.org
>> http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
>> TriEmbed web site: http://TriEmbed.org <http://triembed.org/>
>>
>
>
>
> _______________________________________________
> Triangle, NC Embedded Computing mailing list
> TriEmbed at triembed.org
> http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
> TriEmbed web site: http://TriEmbed.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20140911/10e10a89/attachment.htm>


More information about the TriEmbed mailing list