Hobbies And Interests
Home  >> Science & Nature >> Science

How to Measure an Angle With a Parallax Accelerometer

In the fields of robotics and mechatronics, engineers are required to develop systems that depend on making actions instantly based on measurements taken from basic sensors operating thousands of times a second. For variables such as speed, distance or time, the measurements can be derived using simple sensors, but attempting to work out a variable as complex as an angle is a difficult task. Currently engineers will use accelerometers to measure the changes in g-forces, calculating a series of positions and therefore the angle swept out over a period in time.

Things You'll Need

  • 32 kHz crystal oscillator
  • +5V power supply
  • Serial data port
  • HyperTerminal
Show More

Instructions

    • 1

      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.

    • 2

      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.

    • 3

      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.

    • 4

      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.


https://www.htfbw.com © Hobbies And Interests