Cheapest altitude sensor?

What's the cheapest, easiest to interface, altitude sensor? Light weight would be useful too, as I am considering putting such a thing up a kite or tethered balloon. I'm guessing some sort of barometric technique, but I don't know much about them.

The normal method is to use a absolute pressure sensor where the launch site becomes your 'zero' elevation pressure value and as a rocket gains altitude the pressure decreases proportional to hight. You will have to work out the conversion math and sometimes it's best to just store the raw readings and later do the math in excel or some other PC application.

Something like this can be made to work:


The perfectflite that I have uses a Freescale pressure sensor (MPXA6115, IIRC). It's a simple device that provides a 0V-5V analog signal proportional to the pressure.

The formula to convert pressure to altittude involves some floating point exponentiation, though. Not sure if the arduino/AVR math libraries are up to a pow() with floating point arguments.


kg4wsv, yes, you can call double pow(double,double) from the Arduino/libc available. (Lots of newcomers seem to find that function and try to use it, when bit shifting or other integer math is more appropriate.)

I looked at both datasheets, I can definitely use something like this.

Another way to avoid floating-point calculations is to use a pre-computed look-up table. Put it in PROGMEM to save using up RAM.

use a pre-computed look-up table.

At first I thought "Huh?" but after a bit of rational thought, this is probably the way to go. It would be fast, and would only take 2k - probably not a big deal for a 168 or 328. How much room does the floating point code take, anyway?



I'm doing a similar project - going for a weather balloon release.

At the moment I'm planning on GPS + pressure sensor. The pressure sensor I'm looking at is the HP02D - it's relatively cheap, communicates over i2c, and there is some arduino code for it floating around already.

At the moment I've got some GPS code that reads the GPGGA NMEA string and outputs altitude. I know that GPS isn't the most accurate for altitude, but I'm not worried about +/-10m when I'm up at 30,000m.

Floating point is to be avoided on the ATMega chips, and just about any cost. It bloats the code enormously and slows it to a crawl. Pre-computed lookup table or a fixed point library are the way to go.

I'm aware of the overhead of floating-point code on the platform. It's just an eight-bit architecture, with no operations to help the 32-bit IEEE float computations. So yes, it's slow. And yes, it's going to need to pull in a lot of compiler operation library routines. In some cases, though, it's important to have floating-point support.

I'm not interested in fixed-point libraries until I see someone go through all the debugging necessary to make it work in a general case with all the standard operations, either. It's a more delicate problem than you'd expect, as evidenced by the recent avr-gcc version that couldn't even get 32-bit unsigned long integer multiplication right.

However, I wasn't asking about pow() or floating-point or fixed-point. When I said "I can use something like this," I meant the pressure sensor parts that folks were suggesting. I can precompute points of interest on the altitude schedule, or I can compute trajectory after the flight, on the ground.

trialex: Your GPS may not work at 30 km. Commercial/consumer GPSes have software lockout preventing them from working above 60k ft altitude and 1000 fps velocity. Some GPSes implement this as an 'AND' lockout (i.e. both conditions have to be true to lockout) and some implement it as an 'OR' lockout (i.e. only one has to be true). I believe the Garmins all implement it as an 'AND' lockout, but I am not entirely sure.

kg4wsv: I've seen those Freescale parts, and I don't think they're all that great for altitude sensing because their range is a poor match. The top of the range is twice atmospheric pressure, and the bottom of the range corresponds to only about 38k ft. The first problem can be ameliorated by amplifying the signal so that you get the full ADC range, but the second can't without going to a better suited part. The Futurlec ones are a better match -- the top of the range is a hair above standard atmospheric and the bottom of the range corresponds to about 55k ft. Depends on how high you want to go.

hmm... i wonder if that thing would fit a small project i prepare in my mind atm... Would you think it is possible to put this part into some non electrical fluid and try to use it to sense water 'depths' rather than heights?

According to the freescale datasheet shows that there is a voltage varriance only between 20-250 kPa. According to the barometric formula, that means you can only go abou 1 km high before your reading bottoms out.

Also temperature affects pressure, so you would need some sort of temp sensor in your rig.

halley, I use the HP03 from futurlec and its quite good for an inexpensive unit. I would be happy to send you the Arduino Library I have written for it to calculate altitude, send me a PM if you are interested.

darudude: check your math -- 20 kPA is ~38 kft.

The top of the range is twice atmospheric pressure, and the bottom of the range corresponds to only about 38k ft. …The Futurlec ones are a better match – the top of the range is a hair above standard atmospheric and the bottom of the range corresponds to about 55k ft. Depends on how high you want to go.

I’m thinking the 6115 worked to somewhere around 50k’ during our flight that used it, but I can’t get to the data at the moment to verify. There are Freescale models with lower limits; we flew the 6115 because I happen to have some on hand for designing a rocket altimeter.

55k isn’t much over half our typical balloon flights, so it’s really no better than the Freescale I mentioned. The original poster is using a kite or tethered balloon, so no problems there.

Besides that, recent forum posts seem to indicate that dealing with Futurlec can be problematic. I have no personal experience, YMMV.

Very very few GPS units will work above about ~20km. The Garmin GPS18 (PC, or LVC, and probably the 5HZ) work well. There’s a GPS module that can be made to work (needs an alternate firmware loaded), but I can’t seem to recall the name. Let me know if it’s important and I can dig it up.


darudude: check your math -- 20 kPA is ~38 kft

Sorry! typo. Meant to say 11km not 1 km