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

Thread: I2C Port Expander Shield - Teensy 3.1 Project guidance

  1. #1

    Smile I2C Port Expander - carrier Shield - Teensy 3.1 Project guidance

    Hello,

    I am building an aquarium controller/monitor using a Teensy 3.1. I wanted to ask for some general advice before I get my fingers burnt.
    I am going to use quite a lot of sensors to monitor my marine saltwater tank; here is the list so far:
    TMP102 (i2c ambient room temperature - 1.4 to 3.6VDC) x1
    DS18B2 (1-Wire Digital Thermometer - 3.0-5.5V input voltage) x2
    eC circuit (i2c salinity meter - 2.7 to 5.5V) x1
    pH circuit (i2c PH meter - 2.7 to 5.5V) x1
    TSL2561 (i2c Light Sensor - 3-5VDC - I2C 7-bit address 0x29) x1
    TCS34725 (i2c Colour Sensor - 2.7-3.6V - I2C 7-bit addresses 0x39, 0x29, 0x49, selectable with jumpers) x1

    So you can see already I have quite a few I2C devices to attach, so I wanted to build an expander shield to stack on top of the Teensy to allow me to connect maybe 5-8 I2C sensors in total.
    I don't know if it complicates things, but aswell as monitoring using I2C, I will be controlling two 24V pumps, and two 52W LED arrays, using PWM, and maybe eight Solid State Relays for 240VAC.

    There seems to be quite a few I2C port expanders ICs out there, and I was hoping that you guys with experience would help me choose a shortlist of chips to experiment with.
    When choosing a component like this, what criteria do you use to compare ICs?
    For me, all I would like is something that is code friendly to a newcomer, and something that is small enough to fit on top of a Teensy. I will need to add small easy to plug connectors for each device on to the shield (maybe small JST?).

    I would be really grateful if you guys could advise me which port expanders to use, I don't have the experience in this field, and would really welcome some advice so that i can experiment & learn.

    Carlos
    Last edited by rootScript; 03-25-2014 at 01:48 AM.

  2. #2
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    Consider too, how to properly buffer the I2C signals if the wire length becomes significant.

  3. #3
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,228
    Why do you need an I2C port expander? All those devices could be wired on the same bus - unless some of them have the same I2C address.
    Also, couldn't you use a DS18B20 for ambient room temperature instead of a TMP102?

    Pete

  4. #4
    Senior Member
    Join Date
    Mar 2013
    Location
    Austin TX
    Posts
    426
    If you don't mind using the SMT pads on the underside, there is a 2nd I2C bus on the Teensy 3.1. You could use that also to remove any address collisions (if you use a max of 2 identical devices with matched addresses).

  5. #5
    @ stevech
    I read this somewhere (is this related to buffering the I2C signals due to wire length, that you mentioned?):
    "I2C is a bus, with multiple slave devices on a single pair of wires. You can chain a number of devices off the same pair of wires, up until you exceed the 400 pF total capacitance of the combined inputs on your devices as well as the total length of cables."
    So does having a port expander help alleviate this sort of problem of exceeding capacitance on one bus? (I don't know how to calculate total capacitance, I just suspected it might be an issue because I have 2 temp devices on 1.5 metre cables, & the colour & lux sensors on 1.5 meter cables, the eC & pH are circuit boards that can be close to the Teensy, but both have BNC connectors going by 1.5 meters to probes inside the tank).

    @el_supremo
    I could use another DS18B20 for room temp, but I already have the TMP-102 sitting on my desk. I may even add another ambient room temp sensor of a different type too as a failsafe (as I don't want to rely on just one sensor type/chip). I am not sure if the DS18B2 have unique addresses or if I can set them.

    I also read somewhere that pH sensors can be quite sensitive, so I thought it might be sensible to separate it from the other sensors (also might need the probe to being galvanically isolated from its peers).
    Does having all the devices on the same bus introduce or using a port expander make it easier to wire & plug unplug devices?
    Can I take simultaneous readings & unplug devices without disrupting the others?

    @nox771
    I suppose I could use the 2nd I2C bus on the underside, maybe that would help to separate any sensitive probes/sensors as well. Do I need any special pins or the underside pads, I could buy them if I knew the part number.

    Thanks to all of you for your advice, all these suggestions are helping me to consider which might me the best approach to take.
    )
    Carlos

  6. #6
    Senior Member
    Join Date
    Mar 2013
    Location
    Austin TX
    Posts
    426
    Regarding the bottom pads, it depends on what you want your end solution to be like. If you plan on socketing the Teensy, then I would stick with your original plan, use the top-side bus only. To use the SMT pads I would recommend something like this: http://www.tindie.com/products/loglo...y-31-breakout/ (seems like it includes the SMT parts also).

    However, it occurs to me there is another way. Since your application is single-Master, you can use the builtin bus multiplexing to drive two buses. The top-side I2C bus (I2C0) can drive both pins 18/19 or pins 16/17. Normally it is configured to drive only one pair, but with some cleverness you can drive both. Essentially between complete I2C commands, you can reconfigure the pins you are using. Refer to the multiplexed_master example sketch in the lib here. Doing that you don't need to mess with the SMT pads, and it will give you a 2-way mux free.

  7. #7
    @nox771
    I have ordered the breakout you suggested (I will be able to use it here or in another project, I have two purple Teensys on the way too)
    When you say my "application is single-Master", and talk about "builtin bus multiplexing", I confess I am lost (I will have to study the thread that you linked to), but I do appreciate not having to mess with the underside pins, they look like they could be delicate.

    It is 4am here in London, so I better get some sleep, It looks like I have a lot of reading to do tomorrow so that I can do my best to understand all you clever guys. I wish I studied this stuff at school; I am really enjoying the challenge. In the past I have just tried to figure things out by myself, but the forum here is very solid, and the topics are complex enough for me to justify asking for some guidance (If I had tried to do this by myself I think I might take me 2 years to piece it all together).

    I am VERY grateful to you all
    )
    Carlos
    Last edited by rootScript; 03-25-2014 at 05:35 AM.

Tags for this Thread

Posting Permissions

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