ArduIMU_V3 DCM Code with Calibration

Seeing that many are having issues with getting this IMU board up and running, I am uploading code that hopefully will help further progress on your own projects.  This code only addresses the task of getting consistent roll, pitch and yaw angles.  This means, no drift, especially in the yaw component.  To this end, this code contains calibration procedures for the accelerometers, gyros and the magnetometer. 

Since this board can accommodate GPS, the code also supports various units but I have only tested with the MTK16.  The code is liberally commented and modular such that you can cut & paste routines into your own project.  As it stands, you can use this as is for a AHRS system or head tracker.  By sending the serial data to another Arduino, you can create autopilot or an Orientation/GPS data logger. 

Compile options will let you output comma delimited values which my Processing sketch will display a rotating cube OR output data compatible with the HappyKillmore Test app.

This code relies on libraries found on the ArduIMU project site which you must put into your own Arduino IDE environment under Libraries. Specifically : AP_Common, AP_GPS, AP_Math and FastSerial.

File  "ArduIMU_V3_Layout.txt"  is general information about this board as far I could determine.  It may not be completely correct but provides some good reference source.

File  "ArduimuV3_v1.zip"  is the main code.  Download, unzip and open file ArduimuV3_v1.ino.  Included with the code are detailed steps on how to perform the calibration.

After you have successfully calibrated and have comma delimited data display. You can download "ArduIMU_V3_Cube.zip"  which is a Processing sketch to display a rotating cube with roll, pitch & yaw data as well as GPS data if available.

If you comment out the OUTPUT_DELIMITED #define, you can output data that is compatible with the ArduIMU v1.1.19 Test application by HappyKillmore.  On my computer the response was very sluggish but YMMV.

Good Luck!

 

 

 

 

 

 

ArduIMU_V3_Layout.txt

ArduimuV3_v1.zip

ArduIMU_V3_Cube.zip

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hello  Andy here

    I am trying your ArduinuV3_v1 code above but i keep getting loads of install errors.

    I am using Ardunio 1.0.5

    The first error i get is 'AP_GPS_MTK' does not name a type

    I do not have a GPS attached

    What am i doing wrong

    Regards

    Andy

    • Andrew, very near the top of ArduImuV3_v1.ino file is a link to the DIY drones code respository.  Since this app is using libraries there you will have to download the 1.9.6 zip file to get all the required libraries into your system.  I am using Arduino 1.0.1 but I think it should still work on 1.0.5

  • Does your code fuse the GPS heading data into the calculations?

    • Nope, just uses gyro, accel and mag data.  Does gyro/accel cals and stores in eprom.  Likewise with mag data.  After calibration, all you can just read cals and come up running.  No cals at each turn on. Have managed to get good yaw data - no drift.

      I am reading GPS and Baro data but just displaying them.

  • Standing ovation! This is great. Al, nice work, seriously. Uploading to my board now...

  • Here is a link to the Processing sketch demo:

    https://www.youtube.com/watch?v=xfNXg9M0yLk&feature=youtu.be

This reply was deleted.

Activity

Gremsy liked Gremsy's profile
Mar 12
DIY Robocars via Twitter
RT @chr1sa: Donkeycar 4.4 released with tons of new features, including path learning (useful with GPS outdoors), better Web and Lidar supp…
Nov 27, 2022
DIY Robocars via Twitter
RT @NXP: We are already biting our nails in anticipation of the #NXPCupEMEA challenge! 😉 Did you know there are great cash prizes to be won…
Nov 24, 2022
DIY Robocars via Twitter
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer https://t.co/GKcEjImQ3t
Nov 24, 2022
DIY Robocars via Twitter
UC Berkeley's DIY robocar program https://roar.berkeley.edu/
Nov 24, 2022
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars autonomous car race at @circuitlaunch will be on Sat, Dec 10. Thrills, spills and a Brazilian BBQ. Fun…
Nov 24, 2022
DIY Robocars via Twitter
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup https://t.co/PHBYwlFlnE
Nov 20, 2022
DIY Robocars via Twitter
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/Y2hMyj1…
Nov 20, 2022
DIY Robocars via Twitter
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs https://t.co/Rrf9vDJ8TJ
Nov 8, 2022
DIY Robocars via Twitter
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/kK686Hb9Ej
Nov 8, 2022
DIY Robocars via Twitter
RT @PiWarsRobotics: Presenting: the Hacky Racers Robotic Racing Series in collaboration with #PiWars. Find out more and register your inter…
Oct 23, 2022
DIY Robocars via Twitter
RT @Hacky_Racers: There will be three classes at this event: A4, A2, and Hacky Racer! A4 and A2 are based around UK paper sizing and existi…
Oct 23, 2022
DIY Robocars via Twitter
Oct 23, 2022
DIY Robocars via Twitter
Oct 19, 2022
DIY Robocars via Twitter
Oct 18, 2022
DIY Robocars via Twitter
RT @NeaveEng: Calling all UK based folks interested in @diyrobocars, @f1tenth, @donkey_car, and similar robot racing competitions! @hacky_r…
Oct 13, 2022
More…