Posts tonen met het label firmware. Alle posts tonen
Posts tonen met het label firmware. Alle posts tonen

donderdag 2 februari 2012

IMU Source Code

Finaly I have the time to post my current Razor 9DOF IMU 100hz firmeware source code.

Some things you will have to do and also keep in mind before uploading my code to your own IMU:
  • use only on the same IMU hardware version or make sure it's compatible to mine.
  • use only at your own risc! :)
  • make sure your arduino i2c works @ 400kbps. Check this howto. (find twi.h change speed)
  • I compiled my sketch with arduino v0.22. Other arduino versions migth give errors while compiling and/or will give less performance (fps).
  • after uploading my firmeware to the IMU you can't read the output with arduino serial monitor. So you will have to test the output with another arduino board or a pc application that can handle 250kbps serial communication.
  • I have changed the output function to get beter performance to my own needs. Output is DCM Euler angles and Raw Gyro data. Currently in my PID calculations I use DCM euler angles in my P term and use de raw gyro data in my D term.
  • Notice that my output is euler_angle*100. When using this value you will first need to divide it by 100. Also consider that maybe you will have to inverse some of my values in your own application.


If you would first like to test my firmware with the arduino serial monitor, you just have to change the serial baud rate to 115200. Then you can read the output string with the arduino serial monitor. Notice that you will not have 100hz (fps) when using the serial on 115kbps.

download the firmware: SF9DOF_AHRS_WIPO.zip

donderdag 12 januari 2012

IMU 100hz Firmware

I finally got my Razor 9D0F IMU running at 100hz. The problem with the 8mhz atmega328p is that DCM calculations take more than 5ms. Knowing that 1 loop cycle can max be 10ms to get a 100hz output it's very hard to get all other things done withing this time. DCM code itself is to much math for me so I'm only able to tune output/input speeds.


The original Razor 9Dof AHRS firmware has a main loop running at 50hz. This main loop contains an subloop running at 10hz for compas readings. All i2c data is read at 100000bps and uart output is at 57600bps. So every 20ms this board pushes an update over the serial.




My own new AHRS firmware  has a main loop running at 100hz. So every 10ms my firmware pushes an update over the serial. To achieve the 100hz rate all i2c data comunication is at 400000bps and uart output is at 250000bps! I also tuned the serial output code. The original AHRS output code is simple arduino style, but it is really slow that way. Main loop runs at 100hz and my subloop runs at 50hz. My firmware has a faster update rate and should also be more accurate.

zondag 27 november 2011

IMU firmware

Today I managed to upload the AHRS firmeware to the Razor 9DOF IMU. To achieve this you need to download the arduino platform software and of course the new firmeware (see link in previeous post). You also need to connect the 9dof IMU to the pc via a usb to serial uart (FTDI) converter.

The converter I use is this one: http://www2.conrad.be/goto.php?artikel=197326. This converter can operate in 3.3v or 5v TTL signal. The razor 9DOF IMU uses a 3.3v signal on the TX and RX pin. To power the IMU board you can connect the vbus pin from this converter to the external powerconnector on the razor imu board. So no need for an external power supply because all boards will be powered by the usb connection (max 100ma for this ftdi board). 

More info about uploading the new firmeware to the 9DOF IMU can be found on this step by step tutorial: razor firmaware upload