The 9DOF Razor IMU incorporates three sensors - an ITG-3200 (MEMS triple-axis gyro), ADXL345 (triple-axis accelerometer), and HMC5883L (triple-axis magnetometer) - to give you nine degrees of inertial measurement. The outputs of all sensors are processed by an on-board ATmega328 and output over a serial interface. This enables the 9DOF Razor to be used as a very powerful control mechanism for UAVs, autonomous vehicles and image stabilization systems.
The board comes programmed with the 8MHz Arduino bootloader (stk500v1) and some example firmware that demos the outputs of all the sensors. Simply connect to the serial TX and RX pins with a 3.3V FTDI Basic Breakout, open a terminal program to 57600bps and a menu will guide you through testing the sensors. You can use the Arduino IDE to program your code onto the 9DOF, just select the ‘Arduino Pro or Pro Mini (3.3v, 8mhz) w/ATmega328’ as your board.
The 9DOF operates at 3.3VDC; any power supplied to the white JST connector will be regulated down to this operating voltage - our LiPo batteries are an excellent power supply choice. The output header is designed to mate with our 3.3V FTDI Basic Breakout board, so you can easily connect the board to a computer’s USB port. Or, for a wireless solution, it can be connected to the Bluetooth Mate or an XBee Explorer.
Features
It might be good to power up the Razor a few minutes before calibration, so the sensors can warm up. Calibrating the sensors the first time can be a little tricky, but let’s go:
If you didn’t change the firmware defaults, you should see lots of output like this:
#YPR=-155.73,-76.48,-129.51Set the firmware output mode to calibration by sending the string #oc. You should now see output like this:
accel x,y,z (min/max) = -5.00/-1.00 25.00/29.00 225.00/232.00Calibrating the magnetometer:(磁场校准)
You should now have something like this in your Serial Monitor:
magn x,y,z (min/max) = -564.00/656.00 -585.00/635.00 -550.00/564.00Put these values into Razor_AHRS.ino.
Calibrating the gyroscope:(陀螺仪校准)
You should now have output that looks like this:
gyro x,y,z (current/average) = -29.00/-27.98 102.00/100.51 -5.00/-5.85Try to rotate the sensor in a way so that you cover all orientations so you produce dots that more or less evenly cover the sphere.
In a mostly undistorted environment this could look something like this:
Hit SPACE and watch the Processing console - you’ll find some lines of code that you have to put into the firmware under "USER SETUP AREA" / "SENSOR CALIBRATION" and you’re done.
The collected data (the dots) are also written to a file magnetom.float in the sketch folder. Now in case you own Matlab, underMatlab/magnetometer_calibration you’ll find a script called magnetometer_calibration.m that uses this file and produces some plots for you, so you can visually check the calibration.
Ellipsoid fit and corrected values:
Sampled raw magnetometer values:
Ellipsoid fit and corrected values:
Sampled raw magnetometer values:
Ellipsoid fit and corrected values: