PDA

View Full Version : [Question(s)] Understanding accelerometrs data

tomerbr
11-29-2012, 06:38 AM
Hi,

My name is Tomer and I like to build robots and automated machines as a hobby.
Lately I started working with digital accelerometers and Gyros.

I bought this gyro and several other accelerometrs from ST.

my question is a general one that concern to all digital accelerometers (at least those from ST).
I am having problem translating the data I receive from them. I have a few questions:
1. for the simplest example: I tried to convert the data of an 8 bit accelerometer based on 2 application notes: AN2988 and AN2989, in both of them there is an example of the acceleration value and the value received in the register (section 2.4.2).
a. How do I convert the number from the register into g?
b. since they are both 8 bits, why are the values not the same?

AN2988: http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD00236138.pdf
AN2989: http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD00236147.pdf

2. when using a 12 bit accelerometer I receive the data in 2 registers, that is 16 bits. when I combine them, should I ignore bits 15-12 or 0-3 (working in the default mode of Little Endian) can you please show me how to convert the register values into acceleration values in AN3308 section 3.2.3.
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD00290365.pdf

Thanks,
Tomer.

jwatte
11-29-2012, 02:13 PM
since they are both 8 bits, why are the values not the same?

Because it measures acceleration in two different directions. Those directions should be spelled out in the data sheet, and are relative to the chip itself. Btw: most modern accelerometers measure 3 cardinal directions. Also, the G force of the Earth will be part of the reading, so whatever part of your axes point downward will see that.

How do I convert the number from the register into g?

The data sheet should tell you, but generally, if you know that the range is [-X to +X] then typically an unsigned value will map 0 to -X, and 255 to +X, and a signed value will map -127 (or -128) to -X and 127 to X. You can then recover the "g" reading by doing simple scaling. There may be calibration/offsets you want to add, too.

tomerbr
12-02-2012, 07:38 AM
[QUOTE=jwatte;54156]Because it measures acceleration in two different directions. Those directions should be spelled out in the data sheet, and are relative to the chip itself. Btw: most modern accelerometers measure 3 cardinal directions. Also, the G force of the Earth will be part of the reading, so whatever part of your axes point downward will see that.