Report by Manuela Donoso and Luca Shapiro - January 31, 2012. Based on an original report by Grace Kim - November 1, 2005

The ADXL202E is a dual-axis accelerometer made by Analog Devices that can measure between -2g and 2g. It belongs to the ADXL series, which includes the ADXL213, 203, 202, 311, and 210. According to the datasheet, the ADXL202E measures “both dynamic acceleration (e.g., vibration) and static acceleration (e.g., gravity).” The ADXL202E is available at Sparkfun for $11.95.

Accelerometers are simple MEMS (Microelectromechanical System) devices and are used to measure position, motion, tilt, shock, vibration, and acceleration (the rate of change of velocity). They are available with one, two, or three axes.


Accelerometers are used everywhere. In transportation, they are used in aircraft stability and control systems, missile guidance systems, and testing the smoothness of paved roads. Domestically, they are being added to washing machines that can balance loads, leading to faster drying times. Accelerometers are also being included in car alarms to detect if the car is being towed away. They are also used in user interface devices, most notably in cell phones and video game controllers, where the user rotates the device to control the screen instead of pushing buttons.

For fun, here is a project by a MediaLab student, measuring the roughness of Cambridge roads on his bike ride home.


Sparkfun gave a spare schematic of how they hooked up the pins of the ADXL202E to their breakout board. Analog Devices supplies the datasheet.

Electrical Characteristics

The ADXL202E operates from 3.3 to 5.25 V, and uses 0.6 to 1.0 mA. It has two analog outputs and two digital outputs. In other words, there is one analog output and one digital output for each axis. On the Sparkfun breakout board, the analog output pins are labeled as "XA" and "YA" (X and Y Analog on the sheet) and the digital output pins are labeled "XP" and "YP" (X PWM and Y PWM on the sheet).

2 mg resolution at 60 Hz (very sensitive). Reads from -2 g to 2 g. The outputs are analog voltage or digital signals whose duty cycles (ratio of pulsewidth to period) are proportional to acceleration. The duty cycle period is adjustable from 0.5 ms to 10 ms via a single resistor (RSET).

Pin Description

These pin descriptions refer to Sparkfun's breakout board. Sparkfun has helpfully added the necessary capacitors and resistors to each output pin so you don't have to. Here is the schematic of the Sparkfun breakout board. (

  • Vcc – Voltage
  • GND – Ground
  • X-Analog – X-Analog Output
  • Y-Analog – Y-Analog Output
  • X-PWM – X-Digital Output
  • Y-PWM – Y-Digital Output
  • ST – Self Test

The ST or Self Test pin is activated when sent a logical. This causes the chip to apply a deflection voltage to the inner structure of the accelerometer. It will send out -5g of force. By measuring this output, the user can verify that the accelerometer is working. In practice, this means that if you connect the "ST" pin to power, and you notice that the output values drastically decrease, your accelerometer is okay.

Microcontroller Connections

Connection with an arduino:

Connection with a PIC 18F252:

Code Sample

Code for Arduino

Code source.

Code for PIC 18F252:

Pic Code

I'm planning on using the accelerometer in a wearables project. In brief, the accelerometer (sewn into the hem of a skirt) will detect when its wearer sping. As the wearer spins faster, more lights on the skirt will illuminate. To visualize this, I made a processing application.

Processing Code

Note that in this version of the code, I used the PWM pins on the accelerometer instead of the analog pins. It is very important that you don't have both sets of pins hooked to the microcontroller at the same time, or else you won't get any output.

Also, note in the Processing code that there is a delay set in the function "processByte" before the code sends an A out to the pic to let it know that it's ready for more data. Otherwise, Processing will not receive any data. My theory is that the pic is a bit slow in spitting out data from the accelerometer, so if Processing sends an A out right away, the pic won't be ready. I could be wrong, though.

A Bit More About the ADXL202

On a micro level, The ADXL202 uses moveable polysilicon masses to detect various movements. Any movement drives the mass out of phase with the plates that surround it, inciting the differential capacitor formed between them to produce a square wave whose amplitude is proportional to acceleration.

Images from

--What is a duty cycle?

A duty cycle describes an output pulse, measured in percentage. The percentage indicates what percent of the output cycle is high. When it detects forward acceleration (above 0g), it outputs a duty cycle above 50%. When it detects backwards acceleration (below 0g), it outputs a duty cycle below 50%.

Accelr8 Project

A representative project that uses this chip is the accelr8 project by user Jesper. It uses the ADXL202 which routes to a display indicating the amount of acceleration in G forces. From his site: The schematic show that the AccelR8 only uses 3 IC's. An AVR 8515 microcontroller do the calculation work and controls the other circuits. An MAX603 controls voltage and power-on/power-off. And the chip that makes it all possible, the ADXL202 from Analog Devices measures the acceleration.

This chip is a small wonder. It uses a tiny micromachined polysilicon structure on the silicon wafer. The structure is part of a capacitor, so deflection of the structure (by acceleration) can be measured. The ADXL202 can measure acceleration in two axes, and if you have a Microsoft Freestyle Gamepad, you already have an ADXL202 !

In this case, we only use one of the axes, and the ADXL202 outputs this data as a variable duty-cycle squarewave. The 8515 calculates the acceleration by measuring the pulsewidth/period relationship. The acceleration is then used in further calculations, and the resulting data is show on the display.

See the full documentation here: