OscarPi
Posts: 6
Joined: Tue Mar 10, 2015 4:04 pm

Altimeter

Tue Aug 25, 2015 9:43 am

Hello,
I was wondering if it would be possible to make an altimeter with the astro pi pressure sensor. I have looked at this site:
http://www.srh.noaa.gov/images/epz/wxca ... titude.pdf
and I wonder if I could just use the pressure reading as the station pressure? (I think station pressure might be corrected to account for weather?)
Thanks!

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Altimeter

Tue Aug 25, 2015 10:55 am

Yes you can.

As you have indicates you just need to calibrate it each use with the local ground level air pressure.

The same pressure sensor is also available on its own rather than being part of the Astro pi.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

W. H. Heydt
Posts: 12431
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Altimeter

Tue Aug 25, 2015 2:44 pm

Adjustments would also be needed for changing weather conditions. One would probably get better results using the GPS although that could be used for the pressure calibration, I suppose.

knute
Posts: 550
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas
Contact: Website

Re: Altimeter

Wed Aug 26, 2015 12:07 am

Your sensor will measure air pressure and that changes all the time. It needs to be corrected for that and elevation. The simplest method to correct it is to find an airport near you and get their altimeter setting. This is their pressure reading adjusted for their elevation. If you are in the U.S. these pressure readings are in inches of mercury elsewhere in millimeters of mercury.

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2351
Joined: Thu Jul 11, 2013 2:37 pm

Re: Altimeter

Thu Aug 27, 2015 7:08 pm

knute wrote:Your sensor will measure air pressure and that changes all the time. It needs to be corrected for that and elevation. The simplest method to correct it is to find an airport near you and get their altimeter setting. This is their pressure reading adjusted for their elevation. If you are in the U.S. these pressure readings are in inches of mercury elsewhere in millimeters of mercury.
Yep.

QNH/QFE are typical parameters received by pilots when requesting "weathers" prior to commencing an approach.

They're also usually available from weather services like the Met office in the UK.
Rockets are loud.
https://astro-pi.org

richrarobi
Posts: 271
Joined: Sun Feb 08, 2015 1:13 pm

Re: Altimeter

Wed Nov 18, 2015 1:41 pm

A bit late in the day for your thread, but the attached is from my pi recording the pressure from an BMP180 sensor on i2c bus, similar to the LPS25H used in the sense hat. I used RRDTOOL to keep the data.
http://oss.oetiker.ch/rrdtool/
(Before GPS)....Long distance pilots would use the local air traffic advisory to get the local barometer pressure before approaching their destination. Even on my flight simulator, I prefer to use radar altimeter!

The dip in my attached graph (November 18th) shows the dip in barometric pressure as our latest "storm" hit the UK.
pressure20151118.png
pressure20151118.png (7.52 KiB) Viewed 5670 times
The variation in atmospheric pressure locally or due to weather changes is enough to make the difference between a safe landing and ending up in a hole in the ground. (You also need to know the altitude of your airport, and that of the surrounding terrain. (!))

RichR

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Altimeter

Wed Nov 18, 2015 4:12 pm

richrarobi wrote: (You also need to know the altitude of your airport, and that of the surrounding terrain. (!))
If you know your elevation from a GPS receiver you can use that to calibrate your BMP180. Here's a bit of python to help, beware it's got my elevation (112.2m) hard coded into it.

Code: Select all

#!/usr/bin/python
import math
import sys
import argparse

if __name__ == '__main__':
   parser = argparse.ArgumentParser()
   parser.add_argument('-a', '--altitude')
   parser.add_argument('-p', '--pressure')
   parser.add_argument('-m', '--msl')
   args = parser.parse_args()
   if args.altitude is None:
      args.altitude = 112.2  # Value from my GPS for my house
   if args.pressure is None:
      print "Pressure value required"
      sys.exit(40)
   if args.msl is None:
      args.msl = 1013.25
   args.pressure = float(args.pressure)
   args.altitude = float(args.altitude)
   args.msl = float(args.msl)

   print "Alt:", args.altitude, "Pressure:", args.pressure, "MSL:", args.msl
   print "Sealevel:",args.pressure/pow(1-(args.altitude/44330.0),5.255)
   print "Alt:",(44330.0*(1-pow(args.pressure/args.msl,1/5.255)))
Running that
pi@pi:~/bmp180$ ./msl_pressure.py --altitude 112.2 --pressure 996.4
Alt: 112.2 Pressure: 996.4 MSL: 1013.25
Sealevel: 1009.75816444
Alt: 141.238109908
pi@pi:~/bmp180$

That's as at 16:03Z in my sitting room.


pi@pi:~/bmp180$ ./msl_pressure.py --msl 1009.75 --pressure 996.4
Alt: 112.2 Pressure: 996.4 MSL: 1009.75
Sealevel: 1009.75816444
Alt: 112.13196452
pi@pi:~/bmp180$


That matches quite well with current observations from EGLL and EGVO translated using https://www.aviationweather.gov/adds/metars/
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

richrarobi
Posts: 271
Joined: Sun Feb 08, 2015 1:13 pm

Re: Altimeter

Wed Nov 18, 2015 4:42 pm

I should have said, my graph is adjusted to sea level. But thanks anyway...

Code: Select all

# Set the altitude of your current location in metre
altitude = 169
psea = pressure / pow(1.0 - altitude/44330.0, 5.255)
RichR

User avatar
Kratos
Posts: 395
Joined: Sun Apr 12, 2015 12:41 pm

Re: Altimeter

Thu Nov 19, 2015 7:26 pm

Is it possible to find altitude using just the sense hat? I realize it would not be very accurate, but, is it possible? If so, how? (Python code would be very helpful.) Thanks!

Kratos
I have posted mostly with a Pi 2 running either Ubuntu MATE, or Raspbian.

richrarobi
Posts: 271
Joined: Sun Feb 08, 2015 1:13 pm

Re: Altimeter

Thu Nov 19, 2015 8:33 pm

Short answer is no, not absolute altitude.
Using pressure, you would need to know the atmospheric pressure at sea level at your location. Then your altitude is given by the difference between the sea level pressure and your current pressure. Formula as given above by Dougie.
Note that it doesn't tell you the altitude of your local terrain, either.
BUT -
IF you want to use pressure locally and for relatively short durations (e.g. for radio control flight altitude) - the altitude pressure difference would be fine to use - i.e. relative altitude to your own base location.
RichR
p.s. This is why GPS has become so important to aviators.
(SF : Interstellar Space Navigators will need to use a similar system based on pulsars rather than satellite stations!)

User avatar
TideMan
Posts: 259
Joined: Fri Jun 22, 2012 8:08 am
Location: ChCh, NZ

Re: Altimeter

Thu Nov 19, 2015 8:42 pm

I don't think you can figure out the altitude because the sense hat pressure transducer has an arbitrary offset.
In my case, the local port publishes MSL atmospheric pressure at 10 min intervals.
To match the sense hat pressure with the port's MSL pressure, I must SUBTRACT 5.3 hPa from the sense hat data.
Using the equation listed above, this implies my sense hat is below MSL, but I can assure you it's not.

Of course, once you've determined the offset, you can take your sense hat to the top of a mountain and use it to figure out the altitude, but I'm not sure about the accuracy.

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Altimeter

Thu Nov 19, 2015 9:16 pm

With any barometer you can find altitude if you know MSL pressure and local pressure at your elevation.
You can find MSL pressure if you know your altitude and local pressure at your elevation.

One or the other, not both.
TideMan wrote: Of course, once you've determined the offset, you can take your sense hat to the top of a mountain and use it to figure out the altitude, but I'm not sure about the accuracy.
Once you climb the mountain, unless you do it very rapidly in a helicopter you can be just about 100% sure the MSL pressure will have changed. You need two matched Sense HATs. One at a know elevation and one that's mobile. Take an observation from both simultaneously and you can use the data from the fixed observatory to calculate the data at the mobile observatory.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
Kratos
Posts: 395
Joined: Sun Apr 12, 2015 12:41 pm

Re: Altimeter

Thu Nov 19, 2015 10:10 pm

Brilliant, thanks!

Kratos
I have posted mostly with a Pi 2 running either Ubuntu MATE, or Raspbian.

Return to “Astro Pi”