Shop OBEX P1 Docs P2 Docs Learn Events
Altimeter MS5607 with LCD Readout — Parallax Forums

Altimeter MS5607 with LCD Readout

aparis1983aparis1983 Posts: 22
edited 2013-11-12 11:00 in Accessories
I found this YouTube video: http://www.youtube.com/watch?v=NWwsqczhNyw
I'm planning on including it as part of the payload equipment of a high-altitude balloon in Florida.
He uses the MS5607 altimeter, the propeller BOE, and an LCD screen to show altitude and temperature. I used the same spin code as him, the same diagram, checked my baud rates. But every time I load the EEPROM I get a false reading of 68 degrees (it's about 75 in my house), and -6,844.09 ft (notice the negative....6,844 below sea level). There's no variation when I move the board up or down, and no variation in temperature when I put my finger on the temperature sensor.

Has anyone tried this same project? Has anyone had this same reading? If so, how were you able to fix it?

I would appreciate any input or clues. Mind you I'm fairly new to the entire subject. I did follow instructions to the T. But maybe there's something I missed that is not shown in the diagrams, spin code, etc.

Here's the code I'm using:
OBJ


LCD : "FullDuplexSerial.spin"
alt : "29124_altimeter"


CON


_clkmode = xtal1 + pll16x ' Change to xtal1 + pll8x for Propeller Backpack.
_xinfreq = 5_000_000 ' Change to 10_000_000 for Propeller Backpack.


TX_PIN = 2
BAUD = 19_200


START_ALT = 460 ' Your starting altitude in feet.


PUB start | a, t


LCD.start(TX_PIN, TX_PIN, 00, 19_200) ' Start Parallax FullDuplexSerial.
waitcnt(clkfreq / 100 + cnt) ' Pause for FullDuplexSerial.spin to initialize
LCD.tx(17) ' Turn on LCD backlight
alt.start(alt#QUICKSTART, alt#BACKGROUND) ' Start altimeter for QuickStart with background processing.
alt.set_resolution(alt#HIGHEST) ' Set to highest resolution.
alt.set_altitude(alt.m_from_ft(START_ALT * 100)) ' Set the starting altitude, based on average local pressure.
repeat
a := alt.altitude(alt.average_press) ' Get the current altitude in cm, from new average local pressure.
LCD.str(string("Alt:")) ' Print header.
LCD.str(alt.formatn(a, alt#TO_FEET,8)) ' Print altitude in feet
t := alt.current_temp ' Get the current temperature.
lcd.str(string("Temp:")) ' Print header.
lcd.str(alt.formatn(t, alt#TO_DEGF,8)) ' Print temperature in Farenheit
LCD.tx(13) ' Line feed



Thanks,
Andrew

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-10-23 09:34
    Andrew,

    Welcome to the forums. Please remember to post only one thread on a subject in the appropriate forum. As to your issue, you mentioned what the original author of the project used and that you're using the same diagram and code, however you did not mention if you're using the same board. If you are then I see your problem. Your code is configured for a QuickStart board, not a Propeller BoE. Please see the following line of code. You must set the correct constants in this line (obtained from the altimeter object).
    alt.start(alt#QUICKSTART | alt#MS5611, alt#BACKGROUND)
    
    

    In the original author's video it shows him connecting to specific pins, so you might want to look at the code on his site and see which constant he used.
  • aparis1983aparis1983 Posts: 22
    edited 2013-10-23 19:01
    Hi Chris,
    I'm using the Propeller BOE. I noticed his spin code was slightly different than the code than can be obtained in the Altimeters download section (as far as I could tell). So, I updated it to what he was using.
    I'm still getting a reading of some -6,844 feet and 32 degrees Farenheit (yesterday it was reading 68). No variation in measurement when moved up or down or when there's a temperature change. I'm not sure how to configure it for a Propeller board.
    I've included a picture of the spin code I'm currently trying to use and the diagram.

    Thanks!
    .
    diagram.jpg
    Altimeter Code.jpg
    1000 x 650 - 333K
    600 x 900 - 108K
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2013-10-24 09:05
    I notice your most recent listing has

    alt.start(alt#QUICKSTART | alt#MS5611, alt#BACKGROUND)
    but for the MS5607, do not include the | alt#MS5611

    Since you don't have the quickstart board, it's better to start the object with the generic method that lets you pick whatever pins you want for scl and sda. For the quickstart as Phil set it up, scl and sda are on p6 and p4 respectively. With the following method you can try different pins. Your wiring diagram looks okay, but the usual precautions apply -- Be sure all of the springs are making good contact!

    alt.start_Explicit(SCL, SDA, alt#BACKGROUND)

    The basic datum returned is the local pressure. Try displaying that on the debug screen and simultaneously on the LCD

    p := alt.average_press ' Get the average pressure.
    fds.str(0,string(13, " Local pressure:")) ' Print local pressure ...
    fds.str(0,bar.formatn(p, bar#MILLIBARS, 8)) ' ..in millibars.

    That should be in the neighborhood of 1000mb.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-10-24 09:29
    What I would recommend in any situation is to test known good code first. For example, either the demo code for the sensor from the Parallax website or the code from the project you mentioned. In both cases you want to use the same exact connections for everything. This way you can hopefully narrow down where the issue is. With modified code it's hard to determine if the code, the hardware or the wiring is at fault. This is especially important if you don't necessarily understand the changes to the custom code. In any event using the QuickStart constant is fine so long as you wire everything according to the pins used by this constant. For the QuickStart you should have P6 connected to SCL and P4 connected to SDA. In the demo code the Chip Selection constant should be set to MS5607. I would test these settings using the demo code we provide and see if you get the expected results on the Parallax Serial Terminal (PST) window. If so then you'll know your sensor and wiring are good and that the issue is in the custom code.
  • aparis1983aparis1983 Posts: 22
    edited 2013-11-12 11:00
    Received my new Altimeter module yesterday after it was determined that the original one sent was faulty. Tested it last night and after modifying the code a bit got a good reading....80 degrees and 19 feet above sea level (Florida)
    image.jpg
    1024 x 768 - 56K
Sign In or Register to comment.