Razor 6DOF IMU + Arduino + DCM

I recently got SparkFun's 6 IMU board and played with it a bit. Basically I connected Arduino and Razor 6DOF board and ported DCM code. Code is ArduIMU v13 but just made to work with Razor board. I am not sure what to think about gyros on that board as it takes them a while to "warm-up". Below you can see run from cold start for over an hour and "zoom' on first minute or so (just raw ADC values). On the link referenced above, you can see same data plots for both gyros and accelerometers.

I also modified ArduIMU Labview code - mainly that "cube" is within main window rather then separate one. I haven't compiled the code but whoever has LabVIEW should be able to run it (developed with version 8.5)

E-mail me when people leave their comments –

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

Join diydrones


  • @automatik   i am also doing a similar project. i am building an automatic leveling platform using RAZOR 6DOF IMU, arduino uno board and standard servo motors. i used the offset program given in the page http://voidbot.net/razor-6dof.html. this offset program working fine.
     but my problem is that the DCM code given is not working. i am not using GPS. can you tell me how you made the DCM code work. did you edit the code or used it as such? please reply ASAP

    if without GPS not possible means, help me to control pitch and roll motion with this dcm code.

    This is my error while using DCM code.3692204491?profile=original

    This domain may be for sale!
  • First congrats for your work. I just got the new version of imu 6DOF Ultra-Thin. Ive tryed the dcm code that youve wrote and everything works fine except the yaw. You say that in order to properly adjust the yaw a gps is needed. My problem is that the yaw value keep increasing even if the board is stable. Is that because of the lack of gps in my setup? Is there any way to fix this problem without a magnetometer and without a gps?(my project is indoor so i cant use a gps)
  • Thank you automatik :)
    I m going to take a look at the code
  • "..I wanted to use a GPS to correct yaw and to calibrate it."
    Take a look at ArduPilot code for GPS correction and see if you can adopt it for your needs
  • Dear all,
    I bought the same board (Razor 6DOF) and start developing my IMU code since I wanted a complete indipendent IMU.
    In your link automatik you write:

    "In the DCM code, in order to properly adjust for yaw, GPS needs to be connected and you need to be moving (it can also be done with magnetometers but it needs code change, although it wouldn't be too difficult)"

    Now I wrote code using the Kalman Filter (as I already posted somewhere else on this forum) and didn't adopt the DCM code.
    My Kalman Filter works really really good with pitch and roll, but yaw needs to be calibrated (as you state in your comment).
    Now...since I didn't want to change my code (it wuold be really really difficult to adapt kalman to consider Magnetometer readings too) I wanted to use a GPS to correct yaw and to calibrate it.

    Can anyone give me information or say me whether it is possible or should I forget the 6DOF and go for the 9DOF with magnetometer???
    Do I miss something in my setup?!?!?

    Thank you very much guys
  • I am working with Razor 6 DOF( Hi pass filter capacitors not removed on 6 DOF razor) & 9DOF IMU's from sparkfun.
    1. For 6 DOF Razor i ported the DCM code provided at http://voidbot.net/razor-6dof.html and i followed same circuit connections. With rotations on x,y,z axis i collected data( Euler angles) and drawn plots.
    2. 9DOF Razor ported the AHRS code provided by sparkfun. with python AHRS interface. it works well. With rotations on x,y,z axis i collected data( Euler angles) and drawn plots.

    I observed both the plots, i found 6DOF razor unable to reach maximum rotations on Roll(x) & Pitch (y).
    I wold like to clarify, is it due to filter capacitors or due to any mistakes in code ported to 6 DOF ?
    I am trying to apply these rotations to graphical object in Visual C++ to see the same result as Python interface with 9DOF has given.
    If anyone here familiar with mapping these rotations to graphical object in VC++, I would like to share.....
    This domain may be for sale!
  • Hi Aldo,
    I never tried this on a helicopter, quadcopter, etc. but I would guess that vibrations would be more pronounced then on a fix wing plane. I described some of those affects on gyros and accels in Arduino - Razor6DOF IMU : gyroscope and acceleration vibration tests .
    Also you might want to eliminate high pass filter ( I did) as well.
    This domain may be for sale!
  • Hi!!!

    Im having a lot of problems with vibration!!!

    Im using the razor imu for a helicopter, and more or less at a little more than half throttle, the helicopter position is lost!!! as you can see in the picture, i try a lot of padding and stuff like that.

    The last thing i use was rubbers, i "suspended" the arduino on the helicopter's landing gear, with rubbers, and it appers that it absorbes more vibration, but i still have that problem...

    At more throlttle, the reading are soooooooooo wrong....



  • Hi Automatik,

    I'm trying to rework your project at http://voidbot.net/razor-6dof.html

    I have same arduino and razor board configuration (pins connection and razor's position),

    but i have some problem, the cube on labview doesn't rotate as it supposed to. also on Accel Z data, it gives wrong value, after I check the code, maybe the gravity on "AN_OFFSET[5]=AN[5]+GRAVITY;" should have minus sign instead of +.

    jusk wanna ask you whether you give the correct .pde files or not, i doubt it as you put the .pde's on different folder.

    refer to http://voidbot.net/images/RazorIMU_DCM_v1_0.zip

    This domain may be for sale!
  • I created separate post for vibration tests as it might have more applicability to ArduIMU as well

    Andrus and Doug - I agree with both of your comments and thanks for the input !
This reply was deleted.