The ADXL150 and MPX4101 connect to the PIC's analog inputs via op-amps.
The processor communicates with the 24LC32 using a 2-wire I²C bus. The 16F872 has hardware support for the I²C bus.
The serial port is 100% software driven.
The high-current FET outputs are allocated, but not implimented yet. They're indended to have a continuity check, so each output includes an input.
Not pictured are mode switch inputs and a buzzer to report status.
For this dicussion, it may be useful to bring up the Schematic in another web browser window. This can usually be done by clicking mouse button 2 (when using Netscape on Unix systems) or by clicking the second mouse button and selecting "Open link in new window" (I think this works for Netscape on Windows).
There could have been another diode between Vdd and the microprocessor to avoid powering up the entire board during in-circuit programming. However, there is a .5v loss across the diode and that would have put the processor at it's minimum operating voltage.
The resistor selection is 100K/39K to give a +- 20G scale. This amplifies the 38mV/g output to 97.4mV/g.
39mV/g * R3/R1 => 0.038 * 100,000/39,000 = 0.0974V/gA 10-bit A/D converter can measure 5v/1024 = 0.0049V/step
This gives 19.87 A/D steps for 1G acceleration; thus, I can only measure 1/20G. I can live with that precision.
The data sheet for the MPX4101 has two formulas for the output transfer function, one in Figure 4 on page 3 and another on page 4:
Vout = Vs * ( 0.01059 * P - 0.152 ) +- ErrorI have not gone through the error calculations on page 4.Vout = Vs * ( P * 0.01059 - 0.10941) +- (Pressure Error * Temp Factor * 0.01059 * Vs)
Where:
- Vout
- Output voltage.
- Vs
- The supply voltage to the sensor
- P
- Air pressure
+++ That big op-amp thing +++ Why resistor values: - using all 1K-Ohm resistors didn't work -- the input was drawn down too low - using 1M-Ohm resistors did work! But larger value resistors are more succeptable to noise than smaller values. - I picked a compromise, around the halfway point between 1K and 1M. I used resistors that I had from a Digi-Key resistor assortment (thats why I ended up with weird values). In the future, I plan to run the output of the pressure sensor into the inverting input of an op-amp (I have one unused op-amp in the 6482) and amplify it by 2X or 3X. This should give me more precision at the cost of maximum altitude. The maximum altitude for this device is about 35,000 feet -- I'm not flying rockets this high yet.
There are several good web pages that go into this calculation, so I won't describe the details here. When I'm processing the data on a laptop PC after the flight, I use the equation:
Hc=(10^(Log(Pa/Po)/5.2561)-1)/-6.87535E-06Notice that this involves a logarithm which won't be easy to do in an embeded controler chip with no floating point and limited memory. So I include a second calculation that uses a table and does linearization between points in the table. When I do this calculation into the flight computer, I may just use a 3-column table:Where:
- Pa
- pressure at altitude
- Po
- Sea level pressure = 101325 Pa
- Hc
- altitude in feet
This protocol took a lot of development time.
Currently the modes are:
When I write the software for these, I intend to record for each channel:
In the future I may want to use this module to drive a servo or provide a pulse input for a piezo gyroscope (the type that RC Helcopters use). When that happens, I'll switch to a piezo with a driver (Radio Shack sells one cheap).
Next: On-Board Software
YAFC Home
Hardware
On-Board Software
Flight Results
References
Home
YAFC