# What is minIMU v2. Gyro's output units?

Hi! Sorry it’s my first time using minIMU. I’ve successfully obtained data from all sensors through I2C using mbed,
However, I could not figure out what the units of returned values are?

1. The Gyro (L3GD20) returns some large number (1000-9000 if fast enough)
when I spin with my hand in certain axes (I set the 3G_CTRL_REG4 to be 2000dps).
I believe the angle is not degree per second. Is there a certain proportion I need to divided by to get degree per second?

2. At stationary (upright), the Accel (LSM303DLHC) has a Z-axis value around 1000.
Do I divide that by 1000 to get G’s?

here’s the code for combining high/low bytes:

``` a.x = ((int16_t)(value[1] << 8 | value[0]))>>4; (For Accel) g.x = (int16_t)(value[1] << 8 | value[0]); (For Gyro)```

I’ve tried to read the datasheets for both sensors but not getting any answers.
Did I miss some important calculations and information?

Thanks for who replies and reads this post!

Best,
Jay

Hi, Jay.

The units of the output from each of those sensors will vary depending on the value you have set the sensitivity bits to. You can find this information under the “Sensitivity” parameter of the “Mechanical characteristics” table on page 9 of the gyroscope’s datasheet, and under the “Linear acceleration sensitivity” parameter of the “Sensor characteristics” table on page 9 of the accelerometer/magnetometer datasheet.

When FS is set to 2000dps, the gyroscope’s output data will be in units of 70mdps (1000mdps = 1dps) and for the default sensitivity of the accelerometer, the output should be in units of 1mg/LSB (1000mg = 1g).

Thank you so much! That’s exactly what I need. I apologize that it is my first time using gyro, IMU related products
even though I had heard of them (And that’s why I want to give a try).
I totally missed the sensitivity section when reading the datasheet (and I probably wouldn’t have figured it out).

Thanks,
Jay

Hi there,

i want to jump into this conversation after i properly got my atmega32 properly to work with the mini IMU 2.

i have as well a unit question, though I already found the information about the sensitivity of the sensor.
I am using the default of Ctrl register 4, that leaves my board with a detection range of up to 250deg/s. as per previous comments and per datasheet, 1 bit equals a turn rate of 0.00875 deg/s. vice versa, a value of around 114 means a turn rate of 1 deg/s.
so far so good, thats pretty fine.
my test is now of course very poorly established, but if i thought of turning the imu around the x axis by 90 degrees within one second should give a more or less turn rate of 90 (lets say plus minus 20, or how shaky my hand might be).
for some reason, the best i can get is a value of maybe 10. find below the registry value and the calculated angle (precision is only int) of some “testruns”:

gyro_x reg:-12 p: 0 deg/s
gyro_x reg:179 p: 1 deg/s
gyro_x reg:-15 p: 0 deg/s
gyro_x reg:-13 p: 0 deg/s
gyro_x reg:-716 p: -6 deg/s
gyro_x reg:-1413 p: -12 deg/s
gyro_x reg:-1040 p: -9 deg/s
gyro_x reg:-1029 p: -9 deg/s
gyro_x reg:-295 p: -2 deg/s
gyro_x reg:244 p: 2 deg/s
gyro_x reg:-18 p: 0 deg/s
gyro_x reg:185 p: 1 deg/s
gyro_x reg:894 p: 7 deg/s
gyro_x reg:1276 p: 11 deg/s
gyro_x reg:1255 p: 10 deg/s
gyro_x reg:1129 p: 9 deg/s
gyro_x reg:242 p: 2 deg/s
gyro_x reg:21 p: 0 deg/s
gyro_x reg:-11 p: 0 deg/s
gyro_x reg:-28 p: 0 deg/s
gyro_x reg:-4 p: 0 deg/s
gyro_x reg:-12 p: 0 deg/s
gyro_x reg:-27 p: 0 deg/s
gyro_x reg:-3 p: 0 deg/s
gyro_x reg:-23 p: 0 deg/s
gyro_x reg:-19 p: 0 deg/s
gyro_x reg:-260 p: -2 deg/s
gyro_x reg:-1029 p: -9 deg/s
gyro_x reg:-1037 p: -9 deg/s
gyro_x reg:-1085 p: -9 deg/s
gyro_x reg:-782 p: -6 deg/s
gyro_x reg:-172 p: -1 deg/s
gyro_x reg:84 p: 0 deg/s
gyro_x reg:-44 p: 0 deg/s
gyro_x reg:-5 p: 0 deg/s
gyro_x reg:206 p: 1 deg/s
gyro_x reg:109 p: 0 deg/s
gyro_x reg:509 p: 4 deg/s
gyro_x reg:1019 p: 8 deg/s
gyro_x reg:1788 p: 15 deg/s
gyro_x reg:1534 p: 13 deg/s
gyro_x reg:-7 p: 0 deg/s
gyro_x reg:-15 p: 0 deg/s
gyro_x reg:83 p: 0 deg/s
gyro_x reg:-16 p: 0 deg/s
gyro_x reg:-3 p: 0 deg/s
gyro_x reg:-12 p: 0 deg/s
gyro_x reg:121 p: 1 deg/s
gyro_x reg:-78 p: 0 deg/s
gyro_x reg:-833 p: -7 deg/s
gyro_x reg:-1039 p: -9 deg/s
gyro_x reg:-549 p: -4 deg/s
gyro_x reg:-289 p: -2 deg/s
gyro_x reg:-29 p: 0 deg/s
gyro_x reg:-58 p: 0 deg/s
gyro_x reg:-17 p: 0 deg/s
gyro_x reg:374 p: 3 deg/s
gyro_x reg:763 p: 6 deg/s
gyro_x reg:1013 p: 8 deg/s
gyro_x reg:1661 p: 14 deg/s
gyro_x reg:182 p: 1 deg/s
gyro_x reg:-6 p: 0 deg/s
gyro_x reg:-19 p: 0 deg/s
gyro_x reg:-32 p: 0 deg/s
gyro_x reg:-41 p: 0 deg/s
gyro_x reg:-139 p: -1 deg/s
gyro_x reg:-801 p: -7 deg/s
gyro_x reg:-1063 p: -9 deg/s
gyro_x reg:-1092 p: -9 deg/s
gyro_x reg:-324 p: -2 deg/s
gyro_x reg:-5 p: 0 deg/s
gyro_x reg:191 p: 1 deg/s
gyro_x reg:-7 p: 0 deg/s
gyro_x reg:58 p: 0 deg/s
gyro_x reg:115 p: 1 deg/s
gyro_x reg:593 p: 5 deg/s
gyro_x reg:492 p: 4 deg/s
gyro_x reg:535 p: 4 deg/s
gyro_x reg:1735 p: 15 deg/s
gyro_x reg:457 p: 3 deg/s
gyro_x reg:-50 p: 0 deg/s
gyro_x reg:-46 p: 0 deg/s
gyro_x reg:-3 p: 0 deg/s
gyro_x reg:-33 p: 0 deg/s
gyro_x reg:-266 p: -2 deg/s
gyro_x reg:-1292 p: -11 deg/s
gyro_x reg:-535 p: -4 deg/s
gyro_x reg:-523 p: -4 deg/s
gyro_x reg:-259 p: -2 deg/s
gyro_x reg:-49 p: 0 deg/s
gyro_x reg:-19 p: 0 deg/s

this is a +90deg turn, then wait shortly and come back to 0. my mcu runs with 12mhz. i am not exactly sure what is the period the reading routine is called, i am going to use a timer but for now just put it into the main routine without any other routine (apart from the serial outputting).

Is there an issue with the timing of the routine? (now as i am reporting it, i am thinking about this…). i know for the integration of the turn rate to an angle i will need to take care of the timing, but i thought for the simple reading of the registry that should be fine…

thanks for your help!

Hello.

Could you post your full program and explain more precisely what you are doing to the sensor as the program runs (I want to get a sense for how the program output syncs up with what actions you are performing with the sensor)? Are you sure you are really rotating the sensor about its x axis? Can you post some pictures of your setup?

- Jeremy

Hi Jeremy,

please see attached my main program.

i also included some pictures of my self soldered evaluation board.

basically i am turning the board around the x axis to get a turn rate. as i described and as you can see in my output i am not really seeing the values in the registers i expected.
i am not sure if i am missing something.

thanks for the help.
SimpleTesting.c (3.26 KB)

Hi Jeremy,

one further thing just came to my mind concerning the high and low registers of the IMU:
are both (high and low) interpreted as signed bytes?
I think I am currently checking the High as signed, and the low as unsigned. Is that right? when i am reading them this way i get the results as shown in the little log from above.

thanks

soooo, thanks god i found some time to look into it again.

for some reason I shifted the register value only by 4. So, shifting it by 8 gives by far better results!
what i was expecting was a value around 90 (as i was turning the gyro by 90 degrees within around 1 second). now I got it in the right range.

I’m glad you figured it out and got it working. You are correct: you need to shift that register value left by eight bits rather than four as you were doing.

- Jeremy