Basic Stamp Based Altimeter

19,620

Circuit Image

A method for determining altitude involves the use of barometric pressure; however, it presents certain challenges. The relationship between pressure and altitude is not linear but rather complex, a concept developed by the army in the 1930s. The equation for calculating altitude involves the pressure at an unknown altitude (P) and the pressure at sea level (P_0). Both P and P_0 can be expressed in any unit since they are computed as a ratio. This formula is intricate, but with some effort and mathematical manipulation, it can be computed using the Stamp microcontroller. Figure 1 illustrates the non-linear relationship between pressure and altitude, showing that as pressure decreases, altitude increases, but the rate of change in pressure diminishes at higher altitudes, creating a steeper slope in the curve. To address the limitations of the Stamp, which lacks logarithmic or floating-point math capabilities, a method known as linearization will be implemented in the Stamp code to accurately represent the equation. Linearization involves approximating the non-linear curve with several linear segments, making it computable by the Stamp. The core component of the altimeter is the MPX4115 pressure sensor from Motorola, which is temperature compensated from -40 to 125 °C, ensuring that temperature fluctuations do not affect pressure readings. The sensor outputs an analog voltage proportional to pressure, governed by a linear equation, and features on-chip signal conditioning that provides an output range of 0.2V at 15 kPa to 4.8V at 115 kPa. However, since the analog-to-digital converter (ADC) used has a maximum input voltage of 4.096V, additional signal conditioning is necessary. These attributes make the MPX4115 pressure sensor suitable for altimeter applications. A one-channel, 12-bit serial peripheral interface (SPI) ADC from MAXIM Integrated Products will be utilized to read the output voltage from the op-amp. The MAX187 features an internal 4.096V voltage reference, with the option for an external reference, which defines the full-scale input of the ADC. The internal reference is preferred for improved resolution and simplified voltage calculations. The ADC's resolution is determined by the equation: Resolution = Voltage Ref / Counts. An 8-bit ADC has 256 counts, while a 12-bit ADC has 4096 counts, making the internal reference advantageous as each count corresponds to 1 mV. The MAX407 from Maxim provides a dual op-amp suitable for this project, operating on a single +5V supply and consuming less than 1.2 µA per amplifier, beneficial for battery-operated applications where minimizing current draw is critical. Figure 2 displays the complete schematic diagram of the altimeter circuit. The op-amp circuit is essential for achieving high accuracy and resolution in the altimeter. The op-amp serves two primary functions: enhancing resolution and limiting the maximum output voltage of the pressure sensor to prevent exceeding the ADC's full-scale input. The voltage read by the ADC corresponds to the output of the op-amp, necessitating the calculation of the input voltage to the op-amp.

The circuit design for the altimeter leverages the MPX4115 pressure sensor, which provides a reliable analog output voltage that varies with pressure. The sensor's output is first processed by the MAX407 op-amp, configured to amplify the signal while ensuring it remains within the ADC’s input range. The op-amp's gain can be adjusted based on the desired output voltage range, ensuring that the maximum output does not exceed 4.096V.

The ADC, specifically the MAX187, samples the amplified voltage from the op-amp, converting the analog signal into a digital representation that can be processed by the microcontroller. The choice of a 12-bit resolution allows for a finer granularity in altitude measurements, as each step in the digital output corresponds to a precise change in voltage, and thus pressure.

The linearization technique employed in the microcontroller code is critical for translating the non-linear relationship between pressure and altitude into a form that can be easily computed. By dividing the altitude range into segments and applying linear approximations, the microcontroller can effectively estimate altitude based on the pressure readings.

Overall, the combination of the MPX4115 pressure sensor, MAX407 op-amp, and MAX187 ADC creates a robust and efficient altimeter circuit capable of accurately measuring altitude over a wide range of environmental conditions. The design emphasizes low power consumption, making it suitable for portable applications while maintaining the necessary precision for reliable altitude determination.A method of determining altitude is by the use of barometric pressure; however, it is not done without difficulty. The relationship of pressure vs. altitude is not a linear one, it is actually a fairly complex one, which the army came up with in the 1930`s.

This is the equation for calculating altitude: Where P is the pressure at an unknown altitu de, and P_0 is the pressure at sea level (zero feet). P and P_0 can be expressed in any unit because they are computed as a ratio. As you can see this is a fairly complex formula, but with a little bit of work and some math it is possible to compute with the Stamp. Figure 1 shows the non-linear relationship of pressure vs. altitude. As you can see on the graph as pressure decreases, altitude increases, but the higher the altitude gets the less pressure changes.

In other words the higher the altitude gets the stepper the slope of the curve gets. That is what gives the curve its non-linearity. Since the Stamp will be calculating altitude and doesn`t have log or floating point math capabilities a method know as linearization will be implemented in the Stamp code to get an accurate representation of the equation. The theory behind linearization it is that straight lines changing in slope at intervals along the curve can represent a non-linear curve.

In other words, one non-linear equation can be represented by multiple linear ones that the Stamp is capable of computing. The heart of the altimeter is the Motorola`s MPX4115 pressure sensor. The sensor is temperature compensated from -40 to 125 C, this means that when fluctuation is temperature occur, it will not effect the sensors pressure reading.

The sensor outputs an analog voltage proportional to pressure using this linear equation. The sensor also has on-chip signal conditioning to produce an output range of 0. 2V at (15Kpa) to 4. 8V at (115Kpa). The signal conditioning makes the output much easier to work with. However, the analog-to-digital converter (ADC) I`m using only has a maximum input voltage of 4. 096V, so additional signal conditioning will have to be implemented. All of these features make the MPX4115 pressure sensor ideal for altimeter applications. The one channel, 12 bit, serial peripheral interface (SPI) ADC from MAXIM Integrated Products ( will be used to read the output voltage of the op-amp. The MAX187 has internal 4. 096V voltage reference (REF) as well as an option to use an external reference. The voltage reference determines the full scale input of the ADC, which in this case its 4. 096volts. I chose to use the internal reference because it will give you a better resolution and makes it easier to calculate the voltage.

The ADC`s resolution is determined by the following equation: Resolution = voltage Ref/Counts. The number of counts the ADC has is determined by how many bits it is. Eight bit ADC`s have 256 counts and a 12 bit ADC has 4096 counts. So as you can see by using the internal voltage reference it makes it much easier because each count is equal to 1mV. The MAX407 from Maxim provides a dual op-amp that will suit the bill for this project. The MAX407 operates on a single +5V supply and requires less then 1. 2uA per amplifier, which is a good for battery operated projects where current draw should be kept to a minimum.

Figure 2 shows the complete schematic diagram of the altimeter circuit. The op-amp circuit is a very crucial part in getting good accuracy and resolution out of the altimeter. The op-amp portion of the circuit will serve two purposes; one is to increase resolution. The second is to reduce the maximum output voltage of the pressure sensor so it doesn`t exceed the full-scale input of the ADC.

The voltage that the ADC reads is the output of the op-amp. However, to determine pressure the voltage into the op-amp must be known. This can be calculated using the following equation: Now that the voltage output of the pressure sensor is kn 🔗 External reference