Things You'll Need
Instructions
Configure the pin connections to the accelerometer. Although accelerometers from different manufacturers may place the input and outputs on completely different pins, each accelerometer is developed to a common interface as described within the schematics supplied with your device. Start by connecting the power pins (usually found on pins 2 and 3) to a +5V power supply and a 0V ground terminal.
Attach a crystal based oscillator to the clock pin, commonly found on pin 8. It is important that the oscillator is of a known frequency, ideally operating at 32,000 hertz. Next a digital switch or square wave pulse generator is connected to the CS pin, normally found at pin 7. When a positive voltage value is recorded or a switch is pulled high at the CS pin, the accelerometer will begin to output positional data based on the timing of the clock.
Connect the data pin (pin 1) to a 5V serial data port found on the rear connection panel of a computer tower. Using software such as HyperTerminal you can now read the raw data stream output of the accelerometer when the CS pin is triggered. The output should be a series of integer numbers representing g-force changes as the accelerometer is used; check the schematic of your device to see if you need to make conversions to your data before it is usable.
Calculate the angle swept by movement of the parallax accelerometer. First the data stream must be converted from raw bits to rotational data using the formula [rotation = ((data/6) - 500) / 64)]. Using the rotational data and multiplying it using the conversion formula [angle = rotation * 56.25 * 256] will give a result for the angle swept by the accelerometer in degrees.