Shop OBEX P1 Docs P2 Docs Learn Events
Parallax's New Altimeter/Barometer Module - Page 4 — Parallax Forums

Parallax's New Altimeter/Barometer Module

124»

Comments

  • RosevilleRobRosevilleRob Posts: 4
    edited 2013-07-27 20:54
    Thanks so much. I haven't had a chance to work on this today but at least I know it's likely a setup issue and not the code. I will let you know how it turns out, thanks again!
  • graymelongraymelon Posts: 6
    edited 2013-07-30 14:43
    I'm trying to use the MS5607 sensor as an altimeter for an autonomous flying robot. I've connected the sensor to a BS2px chip after reading about the memory issues encountered with the regular BS2 chips. I tried running the demo I2C program that one of the mods posted using the same wiring setup as the attached picture. While the temperature reading is correct (~20C), the barometer reading is way off. Using my cell phone barometer, I determined that the pressure should be about 1009 mbar, which is consistent with the altitude chart that was linked above. The program is saying 0.08 mbar along with an "overpressure error." Debugging a little, the error comes from the temperature_correction_slope subroutine, but I'm not exactly sure what my problem is.

    I noted the light-sensitivity affecting other users' data, but even covering the sensor with some black foam did not alleviate the issue. In fact, covered or not from the light, the pressure reading is the same at 0.08 mbar and the error message is the same.

    I'd like to try to use the sensor as an altimeter, but first I need help diagnosing my barometric pressure problem. Have any of you had similar problems?
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2013-07-31 21:09
    graymelon,

    Welcome to the forums!

    Maybe the parameters are not being read correctly from the barometer at initialization? Add a debug line to show you the value of the variable x0 just after the I2CIN command in the ms_read_params: subroutine. If those are all zeros or all 65535, then there is probably something wrong with the wiring. Do you have the pullup resistors installed?
    I2CIN 8,msadrs,[x0.BYTE1,x0.BYTE0]
    DEBUG CR,DEC idx, TAB, DEC x0
  • graymelongraymelon Posts: 6
    edited 2013-08-01 11:33
    I just tried what you suggested and x0 was 65535. I don't have any pullup resistors installed. I thought those were only necessary in SPA mode based off the other comments in this thread. Where/how do you suggest I install pullup resistors?

    Edit: Tracy, post #16
    For I2C mode, the pullup resistors on sda and scl are built into the module.

    I also should have mentioned that I am using a parallax 29124 altimeter module, not just the MS5607.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2013-08-01 13:25
    The #29124 does have internal pullups, so the problem must lie elsewhere. I don't think I ever tried my code with a BS2px, but it should work fine. You mentioned an attached picture--Was that something you had intended to upload? Also please upload the exact program you are using for test.

    The pin labeled "CS" selects the i2c address. It should be high (or input, or left open) to set the 8-bit slave address.
  • graymelongraymelon Posts: 6
    edited 2013-08-01 14:56
    Ah, I must have forgotten to attach the photos. Here you go. One overview and two close-ups.

    The program I'm using is the demo program you uploaded, Tracy, from post #30. I'll upload it again just to make sure I didn't make any accidental changes.

    Altimeter.bpx

    IMG_20130801_173449.jpg
    IMG_20130801_173511.jpg
    IMG_20130801_173517.jpg


    The 9V battery is connected to VIN and to the ground line on the lower edge of the board. VSS is also connected to the ground line.
    VDD is connected to the power line on the top edge of the board.
    I draw the 5V for VIN on the module from the VDD pin via this top edge.
    SCL is connected to PIN4.
    SDA is connected to PIN5.
    PIN8 is connected high to select IC2 according to the comments in the program.

    Thanks for your help!
    1024 x 768 - 113K
    1024 x 1365 - 173K
    1024 x 1365 - 194K
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2013-08-01 16:50
    You have sda and scl hooked to Stamp pins p5 and p4 respectively. Oops! I see that the program from post#30 is not at all clear, but the pin numbers for sda and scl have to be p8 and p9. Give that a try.

    The p series stamps have the native I2CIN and I2COUT commands, but they can only be used with the specific combinations for sda/scl:
    p0/p1, p8/p9, x0/x1 and x8/x9. The x pins are only available on the stamps with 32 i/o pins. In the program you have, the i2c interface is hard coded to p8/p9 for sda/scl.

    I apologize for the confusion, which is due to llegacy code from the SDI version of the program. I have a version "c" that ihas better comments and makes clear which pins to use. I'll find that and upload it later.
  • graymelongraymelon Posts: 6
    edited 2013-08-01 16:55
    Gotcha, I'll try that tomorrow and let you know how it goes!
  • graymelongraymelon Posts: 6
    edited 2013-08-02 16:18
    Alright, SDA is connected to pin8, SCL to pin9, and pin10 to high to set the msmode variable correctly. Yet, I'm still getting the same "overpressure error" and x0 is still reading out 65535 at the initialization step.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2013-08-06 13:05
    Hi Graymelon, Try this. It is my more recent program. It mentions the MS5803, but that is the same firmware-wise as the MS5607 that is on the Parallax #29124 module. This one defaults to using pins p0/p1 for sda/scl, and for the BS2pe.
  • RosevilleRobRosevilleRob Posts: 4
    edited 2013-08-07 18:17
    Tracy just wanted to let you know I got a new module and everything is working as expected. Temp and Pressure readings look accurate with your program, using SPI. Thanks again
  • graymelongraymelon Posts: 6
    edited 2013-08-08 16:36
    Hey Tracy, thanks for your help! I am now able to get correct temperature and pressure readings. How would you go about converting these values to altimeter data given that you can't simply mimic the equation for altitude in terms of pressure and temperature?
Sign In or Register to comment.