Object MS5534.spin in OBEX - how to set reference point for current barometric
LarryG
Posts: 50
I have given up on the idea of using GPS for altitude. Enough people have told me the values are useless and I need to use a barometric means to get altitude. I found an object in the OBEX that looks close to what I want. But from all of my reading this week it seams you need to somehow set a baseline barometric value before each use since that changes with the weather. I don't understand where that value comes from, and if it is practical to do a calibration of some sort before each use of the device. Has anyone actually ever used the MS5534 to measure altitude, and can offer advice on this?
Thanks
Larry G.
Thanks
Larry G.
Comments
So it depends on what you want to do. If you are looking for difference altitude from a time e.g. altitude from takeoff for a copter then you can use that for the reference, if you dont have that then you need to input a reference probably pressure at sea level at a location near to you which you can get from weather info sites.
I am wanting to use the altimeter on my bicycle. So it will be moving, and change in altitude for any given day can be as much as 5,000 feet. I want the altimiter to be accurate because I will also use the reading to calculate grade of road.
Here is what I don't get: Right now where I live the reported barometric pressure is 30.03 inches according to the weather guys. Do I enter that as a one time reference into an equation and forget about it? Or do I somehow have to check the current reported pressure from the weather guys every day and enter it in to get an accurate reading?
You probably need to think about combining multiple sensors perhaps gps and pressure. Pressure changes over a short period of time use as altitude change, with gps uses to stablization drift of the pressure over long periods of time. Maybe use sometime like a kalman filter to combine gps and pressure, there some discussion on this here http://diydrones.com/profiles/blogs/barometric-altitude-sensor-1
Altitude is calculated from sensor reading + a correction for weather pressure changes. Or A = S + C. If you are only calculating grade, you need A1-A2 or S1 + C - (S2 + C) = S1 - S2. This is assuming your time between measurements is small enough that C has not changed. For a day long ride, C may change due to changes in weather and/or changes in location. For altitude during a ride, set it before leaving and hope it doesn't change too much. If you record data by time/location it could be post processed with recorded data pressure data. Remembering way back to my flying days, we set our altimeter before takeoff, sometimes during flight (I cannot remember when), and before landing.
John Abshier
The easiest thing to do is to use your known starting altitude and measured starting pressure as your reference, and then calculate change in elevation from subsequent changes in pressure. For example, if you start at at elevation of 643 feet, your station pressure will be somewhere near 990 millbar. But whatever it is, make note of it and record its value as "P1". At that elevation, the rate of change with pressure will be close to +28 feet per millibar decrease in pressure. You find that from the equations by plugging in the parameters to the equation for the first derivative. You don't know sea level pressure and temperature? Look them up online for a nearby source or take a good guess. Subsequently, as you ride, calculate
elevation = 643 + (P1 - P) * 28
where P is the real time pressure measurement in millibar. That will be sort of okay. However, the multiplier is not constant. If you ride up to 1200 feet, the multiplier will be closer to 28.5 feet per millibar. To lessen the error, add a second order correction.
elevation = 643 + (P1 - P) * (28 - 0.025 * (P1 - P))
The factor 0.025 is in units of feet per millibar per millibar and comes from the second derivative. That accounts for the changing density of the atmosphere with altitude and should cover a bike ride pretty well. Whenever you come to a waypoint with a known elevation, recalibrate.
Recalibration at waypoints is essential and especially so on an extended trip. There are lots of approximations involved in using a barometer for altitude. If during your trip a low pressure front moves in, so the sea level pressure drops from 1013.25 to 1000 millibar, then the slope constant at 1200 feet will increase from 28.5 to 28.7 feet per millibar.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 7/28/2010 4:03:20 PM GMT
<edit>
Ouch! Just moved the GPS and I'm apparently now at 763.3m!
</edit>
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
www.norfolkhelicopterclub.com
Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
Post Edited (simonl) : 7/27/2010 9:58:42 PM GMT
1. h = 44330 * (1 - (Pressure/GroundPressure)^0.19) - in mm
2. h = ln(GroundPressure/Pressure) * 292.712 * (100*T + 27315) - in mm, T is temp in C
This is a float version of 1, with GroundPressure fixed at 1013.25hPa
This is a fixed point version of 2 with GroundPressure the measured pressure when the system starts so it measures altitude difference from system start. The temp I used was system start temp I didnt change it based on current temp.
If you are getting one of the sensors I have used I2C SCP1000, bmp085 or hp03 let me know if you want to driver code.
The other thing I found is all the sensors are noisy so I feed them all through a low pass filter before using the pressure value.
After reading your prior post a few days ago, I did order 3 of the HP03D modules (have not received them yet). If you have anything specific to share about that sensor, I would appreciate it.
Larry G
The correction for weather changes can be substantial. Suppose you you sit home without taking the ride, and a low pressure front moves in with a sea level pressure drop from 1013.25 to 1000 millibar. The instrument would (without the correction for base pressure) erroneously indicate that you climbed from 600 ft to about 1000 ft elevation without breaking a sweat!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Some things to note with the hp03
While it is a i2c device it has the same address as the eeprom so you need to attach it to the prop using different pins that the eeprom.
It also needs a clock, the driver uses a prop counter to generate the clock.
There are some delays from requesting the pressure to being able to read the pressure ~40ms. The driver call GetPressure can either be called and it will return immediately returning true if a pressure value is returned and false if not or it can wait until the pressure is ready and always return a pressure value. To calculate pressure it needs temperature which takes another 40ms - calling getpressure gets both and does all the necessary caculations to get pressure.
@Timmore- Thanks for the objects. I missed the part in the datasheet that the sensor has the same address as the eeprom. Too bad it cannot be changed.
but can you tell me how to use hp03 with basic stamp?
thank