cancel
Showing results for 
Search instead for 
Did you mean: 

Working with L3GD20

brandondutoit
Associate
Posted on October 05, 2016 at 10:46

I want to use my STM32F429 Discovery's on board L3GD20 to measure an angle from the horizontal, so I only need one axis. I am able to read the acceleration data but I am unsure about a few things:

1. What do I do with the sensitivity factor? I have it set to 500dps.

2. The datasheet says the value is given in 2's compliment, so do I have to reverse 2's compliment it to get sensible data? My high byte is always FF or FE?

3. How do I get an angle from the acceleration data? I've seen people say you need to  add all the angles together measured in a specific time, a discrete approximation to integration over time?

Thank you

#l3gd20 #gyroscopes
1 REPLY 1
louda.marian
Senior
Posted on November 18, 2016 at 18:17

Hello,

let me clarify your questions.

1. You set full scale to (+-)500 dps, in this case the real value in [mdps] = value read from registers * 17.5

2. 2's compliment is a standard way of signed number expression, it means that if MSB is set than it is negative number. If high byte is FF or FE it means that value is negative(-256..0) or (-512..-257).

3. for angle computation you will need data from all three axis, see Wikipedia for Euler angles computation. Don't forget to set BDU bit in CTRL_REG4 register to ensure data consistency.

Best Regards,

Marian