Motivation and Audience:Motivated by one of the article from circuit cellar, I want to trace the author's steps to see how the G-Force machine work. The author wrote an article on how to build a machine, that measure acceleration using a PIC 16F84 and a acceleration sensor.
Audience will require expience in programming PIC Microcontroller (intro to microcontroller) and basic electrical backgroundPart List
US-based vendors include Jameco, Digikey, JDR and Radio Shack.The Parts
ADXL202AE is a 2-axis accerlerometer with analog or digital output. The digital sifnals whose duty cycles (ratio of pulsewidth to period) are proportional to acceleration. The duty cycle can be measure by using a microprocessor counter. Algorithm is posted later in this tutorial. The duty cycle period is adjustable from 0.5ms to 10ms by adjusting the resistor attach to Rset.Acceleration experienced by the ADXL202 may be calculated by the following formular:
if the nominal duty cycle output of the ADXL202 is 50% at zero g and 12.5% duty cycle change per g. Therefore to calculate acccerlation from the duty cycle:Acceleration(g) = ( ( T1/T2 ) - 50% ) / (12.50%)
Duty Cycles: think of this as a square wave, the longer the pulse of the wave is, the higher is that value. And have a counter count how many time of certain interval that the pulse stay high and low will give us the value.The duty cycle = (pulse interval) / (period).
The voltage regulator will ensure a correct level of voltage supply to component.
Figure2 and Figure3
The LCD: We are using a DCM-16L207 LCD. This LCD has 2 line, 16 character per line display. The x207 has capability of displaying ASCII characters.Note: The Lcd has port 1 -> 14, the circuit use port 14 -> 11 for 4 bit data transfering, port 6,5,4 for LCD control, port 2 for drive voltage and port 1 for ground. Missing from the circuit is port 3 which drop through a resistor or a potential resistor to controll the contrast of the LCD. Missing this resistor will leave the LCD blank and you won't see anything. I use a 3.5K Ohm for this, anything near it will be ok. insert picture of LCD here
Building the circuit require time and determination. Since the ADXL202 sensor is very small, having a mounted board for this chip will make work easier. I didn't think of it when I build this circuit so you can see that my board is kind of messy. But as long as I have the sensor oriented correclty, this won't affect the performance You can find the program by downloading it from here,GFORCE3.asm,GFORCE3.hex,GFORCE3.pbp.
The author write this program using Picbasic Pro Compiler, which you can find an evaluation copy here PicBasic Complier. Building this tutorial was a good experience. I get to learn about the ADXL202 sensor, PWM, DCM the LCD and best of all, I get to play with more electrical toys.
Note: As you can see, I have made mistake not connect any resitor to pin3 of the LCD, it take me some delay to figure out this mistake. When debug your circuit, all part are significant. I kind of take that for granted and didn't check the LCD carefully.
The test run
Figure6 Image display the calibration routine
You can find the program by downloading it from here,GFORCE3.asm,GFORCE3.hex,GFORCE3.pbp.
The author write this program using Picbasic Pro Compiler, which you can find an evaluation copy here PicBasic Complier.
Building this tutorial was a good experience. I get to learn about the ADXL202 sensor, PWM, DCM the LCD and best of all, I get to play with more electrical toys.References