Hardware


Block Diagram

The major hardware components are:

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.


Hardware Theory of Operation

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).

Microprocessor

Clock
The clock is connected to a 4mhz crystal and 2 22pf capacitors, as described in the microprocessor manual.

MCLR*
MCLR is connected to Vdd through a 1N148 diode and a 1K ohm resistor. The diode serves to protect the rest of the circuit from programming voltages.

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.

Analog

Accelerometer
The ADXL150 is connected to an LMC6482 rail-to-rail Op-Amp as described in the accelerometer's data sheet. The capacitor across the op-amp came from a Circuit Cellar rocket accelerometer article. It causes the op-amp to function as a low-pass filter, getting rid of any noisy momentary spikes.

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/g

A 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.

Altimeter
Altimeters calculate altitude based on air pressure (see the Links page for references about calculating altitude from pressure). I'm using a Motorola MPX4101A series pressure sensor. This sensor is manufactured as an automotive Manifold Absolute Pressure (MAP) sensor. Other altimeter projects use the MPX4115 sensor; the difference between the 4101 and 4115 is the pressure range. The MPX4101's range is 15 to 102kPa while the 4115 is 15 to 115kPa. When I selected the sensor, I did not realise that pressure at sea level is 101.325kPa (14.696 psi) so this sensor just barely has the proper range, and in fact might not work at sea level on some days. The fields I fly from are 850 and 900 feet so I don't expect a problem.

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 ) +- Error

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
I have not gone through the error calculations on page 4.

+++ 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-06

Where:

Pa
pressure at altitude
Po
Sea level pressure = 101325 Pa
Hc
altitude in feet
Notice 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: This won't be as precise as the former two methods, but should be adequte for immediate gratification.

Digital Inputs / Outputs
I have several extra pins that could be used for additional inputs and outputs.

SEEPROM Data Storage
The two 32Kbit (4K byte) Serial EEPROM chips communicate with the 16F872 over an I²C bus. Some of the bus protocol was handled with the processor's synchronous serial port, while the command protocol was software driven.

This protocol took a lot of development time.

Mode Inputs
There are two switches which tell the software what mode to use, and a third momentary switch which is pushed (actually jumpers that are shorted) to operate in that mode.

Currently the modes are:

00
Record Data
01
Playback Data
10
Input Test
11
Output Test

High-Current FET outputs
I haven't built this part of the circuit yet, but I intend to use a high-current MOSFET (such as an IRL 510). Each output will have an accompanying input for continuity checking.

When I write the software for these, I intend to record for each channel:

Buzzer
I connected the buzzer to the output of the 16F872's Pulse Width Generator module, giving me asynchronous operation of the buzzer. The piezo element I selected did not have it's own driver circuit, so I have to pulse the line at the frequency I want the buzzer to operate at.

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


Author: Glen Overby Home YAFC
$Revision: 1.3 $ $Date: 2006/10/21 02:42:18 $