Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Multiple teensy on i2c, multiple pull-ups?

  1. #1
    Junior Member
    Join Date
    Jan 2016
    Posts
    17

    Multiple teensy on i2c, multiple pull-ups?

    Hi,

    I'm planning on connecting 10 teensy on an i2c bus over a distance of 8 feet.

    Should I have pull-up resistors on every teensy or just on the master teensy at the beginning of the chain?

    Thanks!

  2. #2
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    You only need one set of pullups. 8 feet is quite a bit of distance for I2C devices. My suggestion woud be to not exceed the 100KHz I2C bus frequency.

  3. #3
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,633
    don't know what is "best"..perhaps i'd try to add them add the end of the bus.

    Question: what is the best in this case ? two in the middle..or distribute them (=more than one per line, with higer individual resistance) over the full length?

    I'm curious.
    Last edited by Frank B; 01-20-2016 at 07:47 PM.

  4. #4
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,988
    You might want to look at this document which discusses varying the resistance used for i2c buses: http://www.dsscircuits.com/articles/...l-up-resistors.

  5. #5
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    Based on my experience with 11 devices on a 14 out I2C bus I don't think it makes much a difference when run at 100KHz. Thats about all I'd attempt on 8 feet of wire and 10 Teensy without an I2C bus buffer and on 3.3V.
    It may or may not work. Use the smallest resistor value you can get away with. The maximum current a the SDA pin can sink per I2C spec is 3mA and at 3.3V according to ohms law that results in a 1.1KOhm resistor. Perhaps use a 1.6 or 1.8K resistor.

    You could also use a use a bus buffer such as the PCA9600 that also at the same time can work as a level shifter to 5V which provides better signal to noise ratio on long lines. The PCA9600 supports the FM+ I2C standard and works up to 1MHz of I2C frequency and the Teensy 3.x and LC bards can easily support that frequency.
    Ive used that several times in my lighting system over 14 feet of distance and it works rock solid. I've have a system in almost continuous running mode for 4 years and another one that has run 24/7 for the last 7 months without a hiccup.

    However, I'd test if it will work without bus buffers first and if it turns out that you do have to add hardware such as bus buffers I'd really use RS485, not I2C. You have enough processing power with each Teensy for a little bit of RS485 protocol.

  6. #6
    Senior Member
    Join Date
    Jan 2014
    Posts
    152
    I was wondering where to put the resistors myself. I have 8 Teensy 3.1. I chose to put the Teensy Master in the middle and then use both Teensy i2c channels (with resistors on both SDA and both SCL). This, effectively, halved the wire length.

  7. #7
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    I am not sure it matters too much. On an I2C bus the resistors are not there to reduce reflections and thus are not impedance matched to the cable like "normal" termination resistors.
    However, the effects are easy enough to test with an oscilloscope.

  8. #8
    Junior Member
    Join Date
    Jan 2016
    Posts
    17
    Great info thanks,

    I should also say that the i2c will be traveling the 8 feet mostly on pcb traces with just an inch of wire between each pcb, don't know if that makes a difference?

    I'm trying to figure out the PCA9600 to use it in the simplest fashion. I would need to connect SX and SY to the teensy with pullups and then connect TX and RX together and TY and TX together? (that last part seems odd). Do I need to put another pullup on that line that goes to another PCA9600?
    To keep the circuit simple I was thinking of keeping the current at 3.3v.

    On the other teensy do I need pullups between the PCA9600 and the teensy? Sorry, couldn't find too much info or tutorials on this chip.

    Click image for larger version. 

Name:	Screen Shot 2016-01-21 at 14.48.32.png 
Views:	143 
Size:	75.8 KB 
ID:	6164

  9. #9
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    I'd first try to see if you can get your set-up running without a bus buffer, if not, yes, you'd need a bus buffer for each Teensy.
    You need pull up resistors between each Teensy and each chip. You'll also need a pair of pull-ups on the I2C bus between the chips.

    Splitting the I2C bus in half by placing the Teesny in the middle and using both I2C busses available as Richard Ferrano has done is also an excellent way of possibly avoiding the additional hardware and complexity.

  10. #10
    Senior Member
    Join Date
    Jan 2014
    Posts
    152
    Question: If the i2c pins on the Teensy 3.2 are 5v tolerant, and the i2c bus only talks to other Teensy 3.2, then will it help signal to noise ratio by pulling up to 5 volts?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •