Home-Brew Electronic Altimeter
A while back, I decided I wanted an altimeter to record how high my rockets were flying. I didn't want to buy one, since a) they aren't cheap (at least, not the ones which do everything I want them to do), and b) buying one is far too easy. I considered the CP Technologies kit, which is based on the Missile Works RRC2, but that didn't do everything I wanted anyway. So I decided to design and build my own.
The first version of the altimeter only has a barometric pressure sensor to record air pressure. It is based on Shaun Wilson's altimeter on his homepage. Later versions will include an accelerometer, temperature sensors and (hopefully) a magnetic field sensor to do apogee deployment. It will also do main chute deployment at selectable altitudes. But as of now, all it does is record air pressure.
The "brain" of the altimeter is a Parallax Basic Stamp 2 microcontroller. This is a neat device, programmable in Basic from a PC via the serial port. It has built-in commands for RS232 serial communications, which makes it very easy to download the acquired data to a PC for display in, e.g. Excel.
The pressure sensor is a Motorola MPX4115, which outputs an analogue voltage proportional to pressure. This output is fed into a Maxim MAX187 analogue-to-digital converter, which converts the analogue voltage into a form readable by the Stamp. The resulting data is then stored in a Microchip 25LC640 serial EEPROM.
For a picture of the completed altimeter, and the altimeter bay of the Brains Rocket, click here. From left to right, you can see the voltage regulator and EEPROM, the Basic Stamp 2, AD converter and the pressure sensor. The wires hanging off the board are for programming the Stamp and downloading data. I haven't (and probably never will, as this board is only a prototype) got around to buying a proper connector so that it all looks neat. Thats something else for the next version. For more on the Brains Rocket, see the Model Rockets page.
Below are the schematic, the altimeter program, the program to download the data from the EEPROM, and the Excel spreadsheet I'm using to analyse the data. The programs are not too well documented, but should be easy to follow. The data that is currently shown in the spreadsheet was acquired when a friend of mine took the altimeter mountain biking up Kilvey Hill, Swansea to test it out. Thanks Tom! The code was adjusted slightly to take readings every six seconds or so, instead of continuously (seeing as a bike moves a little slower than a rocket!). When the delay is removed from the code, I find I get approximately 32 readings per second.
The terminal program I am using to read the data can be downloaded here.
Update. 31st August 2001
I lost the altimeter. On its maiden flight. D'OH!!! So work has started on the next version. Since the Basic Stamp 2 microcontroller is rather expensive, I've decided to switch to a Microchip PICmicro (specifically, the PIC16F84A), since it is much cheaper. And as the Electronic Engineering department here in Swansea uses the Pic Basic Pro compiler, I don't even have to learn assembly language (although, as Dave Culley points out, that is cheating somewhat!).
This version will have barometric, acceleration and temperature sensors right from the beginning. In addition, I have switched to a Microchip 24LC256 EEPROM for data storage, since it has 4 times the capacity of the 25LC640. I've left enough room on the board this time for the components to do dual deployment too. This means though that the altimeter no longer fits in a Brains SA can, but I did find in Victoria Wine some special edition 1 pint Scrumpy Jack cans, and it should fit in there.
Once again, the pressure sensor is a Motorola MPX4115. The acceleraton and temperature sensors are both by Analog Devices. They are, respectively, a ADXL190 and a AD22100. The analogue-to-digital converter this time is a Maxim MAX186 8-channel 12-bit ADC.
When I get around to it, full schematics and code will be posted here, so that anyone can build one of these. I will also leave the schematics and code for version one here, in case anyone wants to build that instead.
Update. 11th November 2001
OK, I finally finished it and got the software debugged. As I mentioned previously, it doesn't yet do deployment, although it will hopefully eventually do both apogee drogue and main deployment at a selctable altitude above ground level.
Note that this has not been tested in flight yet, but it seems to work on the ground fine. As soon as it is flight tested, I'll update this and post a report.
Update. 3rd March 2005
Wow! Hadn't realised that I haven't touched this stuff in years! I now have a modified version of the altimeter, that only records air pressure, but has dual deployment features. Drogue deployment is at apogee, main chute deployment is at 500 feet above mean sea level, although this is easily altered by re-compiling the code (alter the THRESHOLD value in the source code). This altimeter uses the PIC16F628 as its brain, because it's cheaper then the 16F84A I was using before, it has more code space (2K compared to only 1K for the 16F84A), and it does not need an external oscillator, as it contains an internal 4MHz oscillator. This last thing was particularly important for several reasons: a reduced part count, it frees up two pins for I/O, and oscillators are susceptible to vibration.
The .zip file containing the schematic, parts list, PIC BASIC Pro source code, compiled HEX file for programming the PIC, and a short text file with instructions for operating the altimeter, can be downloaded by clicking here.
Also, several people have emailed me asking where I get the pressure-altitude relationship from in the Excel spreadsheet that I use to analyse the data. Sorry, I should have said where this came from originally (hopefully no offence caused). It's from the "Programming by Pete" website, specifically this page.