Shop OBEX P1 Docs P2 Docs Learn Events
Two MS5607's on one arduino — Parallax Forums

Two MS5607's on one arduino

gsagersgsagers Posts: 4
edited 2014-02-06 11:58 in Accessories
I'm fairly new to Arduino and the sensor world, but have made a couple of proejcts. My latest idea is to make a 2-zone greenhouse temperarture sensor/logger. I got a good deal on two MS5607 altimeter modules so I plan to use as them as temperature sensors, and either of them works great when connected to an Arduino Leonardo board (specifically, a tinkerkit LCD module). If I connect both to the arduino, neither works.

As near as I can tell, the problem is that both use the same 0x76 address for the I2C bus (verified with an I2C scanner program, one hooked up at a time). Some documentation found around the web suggests that the boards can be changed to use either 0x76 or 0x77, and one post shows a similar 5611 board from a different manufacturer that actually has solder pads to jumper to effect the change. I don't see any way in the datasheet or any place on the boards themselves to change this. Is there a way to change the Parallax mdel so one board uses 0x77?

If that's not possible, I have also seen passing references to "selectively enabling" each device, polling it, and then disabling it to poll the other in software. This would be fine for my purposes, as I only need readings every few minutes. Any suggestions on how to go about selectively enabling?

Comments

  • PublisonPublison Posts: 12,366
    edited 2014-02-03 09:14
    gsagers wrote: »
    I'm fairly new to Arduino and the sensor world, but have made a couple of proejcts. My latest idea is to make a 2-zone greenhouse temperarture sensor/logger. I got a good deal on two MS5607 altimeter modules so I plan to use as them as temperature sensors, and either of them works great when connected to an Arduino Leonardo board (specifically, a tinkerkit LCD module). If I connect both to the arduino, neither works.

    As near as I can tell, the problem is that both use the same 0x76 address for the I2C bus (verified with an I2C scanner program, one hooked up at a time). Some documentation found around the web suggests that the boards can be changed to use either 0x76 or 0x77, and one post shows a similar 5611 board from a different manufacturer that actually has solder pads to jumper to effect the change. I don't see any way in the datasheet or any place on the boards themselves to change this. Is there a way to change the Parallax mdel so one board uses 0x77?

    If that's not possible, I have also seen passing references to "selectively enabling" each device, polling it, and then disabling it to poll the other in software. This would be fine for my purposes, as I only need readings every few minutes. Any suggestions on how to go about selectively enabling?

    Welcome to the forums!

    I don't use Arduino, but I think you can just use two pins for each CS (Chip Select), and bring them low one at a time when you what a measurement.
  • gsagersgsagers Posts: 4
    edited 2014-02-04 07:31
    My impression from the datasheet is that the CS pins are only used when the device is in SPI mode. Is that not the case?
  • PublisonPublison Posts: 12,366
    edited 2014-02-04 07:57
    gsagers wrote: »
    My impression from the datasheet is that the CS pins are only used when the device is in SPI mode. Is that not the case?

    After reading the Data Sheet again, you are correct. The CS pin is only enabled in SPI mode, odd.

    Do you have enough pins available to run two separate I2C busses?
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-02-04 11:49
    In I2C mode the CS pin determines the address. High (default) for address $76 and low for address $77.

    Do you have the Parallax #29124 module? It supports all of the pins for either I2C or SPI modes.
  • PublisonPublison Posts: 12,366
    edited 2014-02-04 12:44
    In I2C mode the CS pin determines the address. High (default) for address $76 and low for address $77.

    Do you have the Parallax #29124 module? It supports all of the pins for either I2C or SPI modes.

    Tracy,

    I think that was one of the original question in the OP. Can you change the address on the Parallax product. I don't see a way to do that.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-02-04 13:10
    Here is a view of the 29124 module...
    Screen shot 2014-02-04 at 1.04.01 PM.png


    The CS is brought out on pin 7 and by default is pulled high by a resistor on the module. In I2C mode that selects address $76. Pull it low and you have address $77.

    Pin 3 on the module (PS) selects the interface. By default it is pulled high by a resistor on the module. That selects the I2C interface and makes the pins SDA and SCL active. Pull PS low to select the SPI interface. In SPI mode, CS becomes chip select, and SDA and SCL become SDI and SCLK respectively.
  • gsagersgsagers Posts: 4
    edited 2014-02-05 13:27
    Thanks, that looks simple enough. I'll try it tonight when I get home.
  • SRLMSRLM Posts: 5,045
    edited 2014-02-05 13:57
    I agree with Tracy: you can have 2 MS5607s (or MS5611s or MS5803s...) on the same bus by making sure that you have them set to different address.

    But Publison made me think of an interesting point: can you have more devices as long as you can dynamically control the CS pin? I'm thinking you keep all the devices in $76 address. When you want to read a single device, you set it's CS pin to $77 address. It seems like this should work. The $76 devices don't put anything on the bus, and only respond to requests for the $76 address which will never come.

    If it's possible, it seems to only be a pin savings if you have an odd number of sensors that you want to use. If you have an even number you might as well just use multiple I2C buses (at least with the Propeller).
  • PublisonPublison Posts: 12,366
    edited 2014-02-05 14:00
    Here is a view of the 29124 module...
    Screen shot 2014-02-04 at 1.04.01 PM.png


    The CS is brought out on pin 7 and by default is pulled high by a resistor on the module. In I2C mode that selects address $76. Pull it low and you have address $77.

    Pin 3 on the module (PS) selects the interface. By default it is pulled high by a resistor on the module. That selects the I2C interface and makes the pins SDA and SCL active. Pull PS low to select the SPI interface. In SPI mode, CS becomes chip select, and SDA and SCL become SDI and SCLK respectively.

    Tracy,

    Where did you find that information? I could not find it in any of the documentation Parallax supplied.

    This need to be added to the Data Sheet.

    Jim
  • SRLMSRLM Posts: 5,045
    edited 2014-02-05 14:10
    Publison wrote: »
    Tracy,

    Where did you find that information? I could not find it in any of the documentation Parallax supplied.

    This need to be added to the Data Sheet.

    Jim

    It's on page 11 of the MS5607 datasheet:
    The MS5607-02BA address is 111011Cx, where C is the complementary value of the pin CSB.
  • PublisonPublison Posts: 12,366
    edited 2014-02-05 14:30
    Thanks Cody,

    I'll have to bring that into the "reading room" in the morning to digest that.. :)
  • gsagersgsagers Posts: 4
    edited 2014-02-06 07:52
    Yep, pulling the CS pin low does change the address properly. Thanks for the help. It might be a nice addition to Parallax's datasheet for the 29124 to document the feature. That's the datasheet I was working from.

    It would be interesting to try pulling the pin low when needed, rather than permanently, to save pin count, but for my application, I don't suppose I'll bother; I have headers to spare.

    The prototype in action....

    2014-02-06 09.31.48.jpg
    1024 x 597 - 53K
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-02-06 11:58
    gsagers, nice to see that it worked out!

    I've also used the MS5803 version of the pressure sensor, which is packaged in a TO5-size can and filled with gel for environmental protection, same firmware.

    SRLM's suggestion could be implemented with a shift register or i2c port exander, so as not to use up so many CPU pins. I can imagine where you might want muliple pressure sensors for test chambers or something like that.
Sign In or Register to comment.