# First Arduino IMU test

I'm trying to develop an IMU for my Arduino-based UAVS (heli) project. In my first test I just used a three-axis accelerometer, but it didn't work because the motor vibration generated too much noise. I then tried it just with gyros, but of course the the gyros drifted. So I learned through experience what everyone already knows: that the only way to make a good IMU is by mixing accelerometers with gyros and Kalman Filters, which is eventually what I did ;-)

I ran a test to see how my IMU is responding, and I made a line chart to see the results. The test consists of rotating the device to 70 degrees and then shake it, to see how the filters reduce the "noise". It looks pretty good:

The samples was taken every 20 miliseconds, the blue line is just accelerometer and the red line is Accelerometer+Gyros+KalmanFilters.

Source code here: ArduIMU Beta1

Special thanks to Tom Pycke

Views: 2553

Comment by Jason Striegel on January 14, 2008 at 8:44pm
Nice work!

Have you experimented with using the accelerometer data alone, but averaging the samples over time, only allowing each reading to contribute to some percentage of the estimated measurement?

3D Robotics
Comment by Jordi Muñoz on January 14, 2008 at 9:54pm
yes, but slow down the system, and the helicopter vibration is so heavy, that is almost impossible to read. For example 1023= +2G's, 511 is neutral, 0 = -2G's, the reading is jumping +-400!!! and with average +- 50, and that is no enough... Remember, for a helicopter you need fast response and precision, maybe in an electric airplane, would be a good idea (to save money and code), but remember this:
"There are more forces working on a flying airplane then just good old gravity! Just think about the centripetal force when following a circle path. We’ll need gyroscopes to correct this."
Comment by Jason Striegel on January 15, 2008 at 2:44am
Thanks for the reply and the Tom Pycke link. The importance of the gyro measurement is becoming more clear to me now. I'm wondering now, on top of detecting roll/pitch, could you use long term averaging of the accelerometers to also control for external drift inducing forces such as wind?

I'm looking at gyros now... I wonder if I can get away with a 2 axis setup.

3D Robotics
Comment by Jordi Muñoz on January 15, 2008 at 7:29am
The vibration of the engine is called "White Noise" (or Constant noise), the same noise made by a blender, vacuum, blow dryers, etc. The Kalman Filters reduce the white noise from the accelerometers (because is calculable, you need to adjust it in the code, depending your project), but not reduce the acceleration caused by centripetal force, descent/climb forces and turbulence, all that forces are detected "wrong" by the accelerometer. So the gyros came to help us.
http://en.wikipedia.org/wiki/White_noise
By the way, the white noise calm down Crying babies:

About accelerometers: the most famous (used by tom p.) is this:
http:/sparkfun.com/
commerce/product_info.php?products_id=741
Dual axis gyroscope with +-500 degrees per seconds, and 3 axis accelerometers +-2G's, is nice, but i bought this:
http://sparkfun.com/commerce
/product_info.php?products_id=395
For money reasons, and use Nintendo Wii Accelerometer (Is called the Mexican way, survive with less). =)

3D Robotics
Comment by Jordi Muñoz on January 15, 2008 at 7:47am
Be careful, you CAN'T use "IMU 5 Degrees of Freedom" with arduino, unless you use an external ADC with more resolution (more trouble), because ADC with 10 bits of resolution is not enough. This is the other reason why i bought the "ADXRS300", works with 5volts, and use less resolution, and in the future if you wanna upgrade your IMU and add the third GYRO to control yaw, is going to be easier. The yaw gyro is very useful in the real world (and more for helis), because if you have high winds, the gyro detects yaw rotations and correct them.
Comment by James Hall on January 15, 2008 at 9:12am
You are going to go work at NASA aren't you? Geez..I am very impressed with all your efforts on your project.

3D Robotics
Comment by Jordi Muñoz on January 15, 2008 at 9:40am
Tom Pycke: Kalman Filters for IMU's explanation:
http://tom.pycke.be/mav/71/kalman-filtering-of-imu-data

3D Robotics
Comment by Jordi Muñoz on January 15, 2008 at 9:41am
James Hall--> Thanks =) i hope, even someday touch NASA like a tourist.
Comment by Jason Striegel on January 15, 2008 at 9:54am
Is there a common amplifier IC that converts 3.3v to 5v? 3 of those ADXRS300s are going to be expensive :(

3D Robotics
Comment by Jordi Muñoz on January 15, 2008 at 10:20am
No, arduino have a ref pin, (to adjust the maximum voltage value to whatever you choose), the problem is, ok you adjust Arduino to 2.5 v (max output voltage of the Gyro = +500 degrees/s), you going to have:
1023 (10bits)/ 2500 mVolts = 2.44, so Arduino is capable to represente a decimal value every 2.44milivolts.
The gyro is +-500degrees/s, when is neutral the output voltage is 1.5Volts, when you rotate the gyro to a positive way, the max output is going to be 2.5Volts@+500 degrees/s, and the negative way is going to be .50Volts@-500 degrees/s.
That means we have a range of 2Volts (2000 mVolts) and 1000 Degrees/s, so if we divide: 2000mVolts / 1000 Degrees/s = 2mV/Degree/s.
Arduino only detect changes every 2.44mvolts, and the gyro change every 2mV/Degree/s. So, is not enough. We need an ADC of 12 bit of resolution or a gyro with less range (300 degrees/s is enough)

Comment

Join DIY Drones

1

2

3

4

5

6

7

8

9

10

## Groups

290 members

96 members

1799 members

76 members

• ### Melbourne

83 members

Season Two of the Trust Time Trial (T3) Contest has now begun. The fifth round, 3D model building requiring contestants to survey and reconstruct a building or natural scene from aerial images.

A list of all T3 contests is here.