Home

PICmicro

Projects

Web Design

Forums

Links

Contact

 

 

 Interfacing the ADXL202 Accelerometer to the PIC

 

The ANALOG DEVICES ADXL202 accelerometer sensor can easily be interfaced to a microcontroller, in this instance a Microchip PIC16F84A microcontroller. A single ADXL202 accelerometer is able to sense the Pitch and Roll experienced by a stationary or moving platform.
The ADXL202 outputs are Duty Cycle Modulated (DCM) signals, whose duty cycles (ratio of pulsewidth to period) are proportional to the acceleration in each of the two sensitive axes(pitch and roll). The outputs may be measured directly with a microcontroller counter requiring no A/D converter. The DCM period is adjustable from 0.5mS to 10mS via a single resistor (RSET). If an analog output is desired , an analog output proportional to the acceleration is available from the ‘XFILT’ and ‘YFILT’ pins, or may be reconstructed by filtering the duty cycle outputs. When the tilt angle is varied along the sensitive ‘X’ and ‘Y’ axis the Accelerometer vector changes and the ADXL202 responds by changing the PWM duty cycle output.  As the horizontal plane of the project board is altered, by physically moving it, the accelerometer PWM duty cycle changes accordingly, the program converts the PWM data to digital data and then displays it on the LCD, giving a visual indications of the programs performance. Accelerometers have many applications, a feature of interest being the orientation control of Quadcopters and similiar flying vehicles. 

 

>>Block Diagram

 

 

Accelerometer Module (bottom view)

 

The sensor is the small square shaped IC(bottom left) it measures 4.5mm square. Can be a little tricky soldering it to the PCB module. The module plugs into the main program development board.

 

 

ADXL202 PWM Duty Cycle Output

 

lcd display 2 001

 

 

 

 

Duty Cycle is more than 50% when the Pitch angle is greater than 0g.

 

 

 

 

 

 

 

 

Duty Cycle is 50% when the Pitch angle is 0g. The sensor is level to the horizontal plane.

 

 

 

 

 

 

Duty Cycle is less than 50% when the Pitch angle is less than 0g.

 

 

 

 

 

 

 

 

The Roll PWM Duty Cycle output is not shown its similiar to the Pitch PWM Duty Cycle.

 

 

 

 

Main Hardware:  Microchip PIC16F84A 18 pin microcontroller - ADXL202 Accelerometer - 16x2 LCD

 

Software:  Assembly Code - Programmed with the Microchip PICKit2 programmer.

>>>>>Source Code