Altimeter MS5607 with LCD Readout
aparis1983
Posts: 22
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
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
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).
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.
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!
.
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.