DragonOSD+ - ArduIMU+ V2 firmware modification

Support related stuff, for various products
Daniel Wee
Site Admin
Posts: 2070
Joined: Wed 25 Feb 25 2009 8:00 pm

DragonOSD+ - ArduIMU+ V2 firmware modification

Post by Daniel Wee » Mon 05 Apr 05 2010 3:21 pm

This instructional is to be used with the ArduIMU+ V2 (flat) found here:-

https://store.diydrones.com/ProductDeta ... ArduIMU-20

To use the ArduIMU+ V2 (flat) with the DragonOSD+, you will need to program the IMU with a specialized firmware. In order to do that, you will need to download the Arduino development environment from:-

http://www.arduino.cc/en/Main/Software

Download the latest version (currently 0018) for the operating system you are using and extract the ZIP file to your drive. Also, download the attached firmware source files to your computer (preferably in a different location from where you extract the Arduino development environment to.)

Next, click on the Arduino.exe file in the arduino-0018 (if this was the version you downloaded) directory. Doing so will open it up with a "sketch" file open already. You will not be using this file. Click on the "File" menu item and select "Open":-
Arduino-a.jpg
Arduino-a.jpg (47.79 KiB) Viewed 25385 times
Now, navigate to the directory where you extracted the firmware source files. Under the "arduimu" sub-directory, select the file "arduimu.exe" and open it. This will open up another instance of the Arduino IDE. At this point, you may close the first IDE window (the one with the "sketch") as it will no longer be needed.

You will need to configure the board type for the Arduino. To do so, go to the "Tools" menu item, and under "Board", select:-

Arduino Duemilanove or Nano / ATmega328
Arduino-d.jpg
Arduino-d.jpg (117.87 KiB) Viewed 25385 times
At this point, you can click on the "play" button or go to the "Sketch" menu item and click on "Verify / Compile":-
Arduino-b.jpg
Arduino-b.jpg (72.51 KiB) Viewed 25385 times
This will take a few moments and after a while, you should simply get a single line in the output window (bottom) saying:-

Binary sketch size: 17166 bytes (of a 30720 byte maximum)

Next, you will need to configure the serial port for uploading the firmware. Be sure that you have the USB serial-ttl port attached and that you know the COM port number. Under the "Tools" menu item, select "Serial Port" and select the COM port you want to use:-
Arduino-e.jpg
Arduino-e.jpg (105.27 KiB) Viewed 25385 times
Up to this point, you should not see any error messages (red text) in the lower output window. If so, you are on the way to programming the board. Now, connect the serial port to the ArduIMU+ V2 board, being mindful of the correct pinouts (as per silk-screened labels on the underside of the board. The pins you are interested in are:-

TX
RX
5V
GND


It is important that your serial port is supply 5V to the 5V-pin as this is what powers the IMU board during the firmware update process. If for some reason your serial port does not have the 5V present, you should be have to power the board using the VIN(>6V) pin with a 2S Li-Po battery. Again, be very sure of your connections as a power reversal could destroy the board. If you are externally powering the board (ie. not via the 5V on the serial port), you should connect anything to the 5V pin.If you have a DMM handy, you may verify that 5V is present across the 5V and GND pins.
ArduIMU+ V2 003a.JPG
ArduIMU+ V2 003a.JPG (57.21 KiB) Viewed 25385 times
ArduIMU+ V2 007a.JPG
ArduIMU+ V2 007a.JPG (67.41 KiB) Viewed 25385 times
At this point, if everything works, there should be some LED lit on the board. You may then proceed to click on the "File" menu item and select "Upload to I/O Board":-
Arduino-c.jpg
Arduino-c.jpg (70.61 KiB) Viewed 25384 times
Wait about 5-seconds and then press the reset button on the ArduIMU+ V2 board. This will initiate the firmware update and there will be a progress indication. The upload will take around 15-20 seconds if all goes well. When does, the board will re-start itself and will flash the LEDs during the start-up initialization phase.

It should be mentioned that the ArduIMU+ V2 board will attempt to determine what "level" is during this phase and so it would be important to keep the IMU orientation level until the lights stop flashing.

kempo has put up a very nice video that helps visualize the above steps:-



Daniel
Attachments
Ardu-IMU16-I2C.zip
ArduIMU+ Version 1.6
(22.49 KiB) Downloaded 860 times

Daniel Wee
Site Admin
Posts: 2070
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: DragonOSD+ - ArduIMU+ V2 firmware modification

Post by Daniel Wee » Wed 14 Apr 14 2010 4:31 am

Version 1.6b

1. Tuned loop performance to greatly favour gyros
2. Disabled YAW correction for better speed

This version should hold better in turns but likely to take longer to correct if gyros saturate.

On a side note, when you click "Upload", the file automatically compiles so the preceding compile is redundant. Wait till the compile is complete with the "Binary sketch ..." message in the output box below before pressing the reset button to initiate upload.

Daniel
Attachments
Ardu-IMU16b-I2C.zip
(22.57 KiB) Downloaded 690 times

Daniel Wee
Site Admin
Posts: 2070
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: DragonOSD+ - ArduIMU+ V2 firmware modification

Post by Daniel Wee » Thu 15 Apr 15 2010 7:32 pm

Version 1.6e

1. Restored original tuning values
2. Increased gravitational vector sensitivity to error
3. Hard calibrated accelerometer

In order to use this version, you would need to perform some hard calibration procedures. You will need a secure serial connection to accomplish the steps necessary. The steps involved would be:-

1. Extract firmware 1.6e
2. Set HARDCAL to 1
3. Upload firmware 1.6e
4. Open terminal software to 38400baud on the COM port for the IMU
5. Orientate the IMU and record the minimums and maximums
6. Enter recorded minimums and maximums into firmware
7. Set HARDCAL to 0
8. Close terminal software
9. Upload firmware 1.6e
10. Open terminal software to 38400baud on the COM port for the IMU
11. Verify that error is around 1.0 for most orientations

In step 2, after you have opened the arduimu.pde as you would do for firmware uploads, you will need to edit the file to enable hard-calibration mode. To do this, look for the section:-

Code: Select all

//**********************************************************************
//  Calibrate values here
//**********************************************************************

#define HARDCAL 1        // Change the 0 to 1 for calibration
#define AN3MIN 407.0
#define AN3MAX 614.0
#define AN4MIN 403.0
#define AN4MAX 612.0
#define AN5MIN 433.0
#define AN5MAX 636.0
You will need to change the first line from:-

Code: Select all

#define HARDCAL 0        // Change the 0 to 1 for calibration
to

Code: Select all

#define HARDCAL 1        // Change the 0 to 1 for calibration
Save the file and select "Upload to I/O Board". Once you see the words "Binary sketch size: ...." appear in the bottom status window after you select upload (which can take up to 20-seconds), press the reset button on the ArduIMU+ board to initiate the transfer. This will take another 15-seconds or so to complete.

This brings you to stage 3. If you have correctly opened your terminal software to 38400baud, you should see text similar to the following scroll past your screen:-

Code: Select all

!!!VER:1.6e,  0.99,511.52,510.50,  -0.48,508.00,507.50,  100.28,636.29,534.50,***
!!!VER:1.6e,  0.61,511.13,510.50,  -0.48,508.00,507.50,  100.26,636.26,534.50,***
!!!VER:1.6e,  1.07,511.61,510.50,  -0.48,508.00,507.50,  100.47,636.48,534.50,***
!!!VER:1.6e,  1.36,511.91,510.50,  -0.48,508.00,507.50,  100.52,636.52,534.50,***
!!!VER:1.6e,  0.79,511.32,510.50,  -0.48,508.00,507.50,  100.04,636.05,534.50,***
!!!VER:1.6e,  0.76,511.29,510.50,  -0.48,508.00,507.50,  100.76,636.77,534.50,***
If you do not see this - then you've either not properly opened or configured your terminal software, or you've not correctly uploaded the firmware.

Assuming that this works as described, you are now ready to calibrate the unit. The numbers you are interested in are highlighted in bold below:-

!!!VER:1.6e, 0.79,511.32,510.50, -0.48,508.00,507.50, 100.04,636.05,534.50,***

Let us refer to these three numbers as AN3, AN4 and AN5 respectively. Have a pen and piece of paper handy. We will start with AN5 - the third of the three highlighted numbers. Keeping your IMU board flat on the table, this number should be over 600.0. What you need to do now is to adjust the level of the IMU board slightly in any directly so as to maximize this number. While doing this, there should not be any sudden movements. Everything needs to be moving slowly. Ignore spikes and aim for the most repeatable and highest value you can get. Write this number down under AN5MAX.

Now, turn the board upside down and the number should be in the 400+ region now. In the same manner as above, adjust the level of the board but this time, for the lowest possible stable and repeatable value. Don't worry too much about the decimal points but try to keep as steady a hand as possible. When you are satisfied, write this down as AN5MIN.

Now, stand the board on it's side (edge) with the serial connector at the top. At this point, you will be looking at the AN3 number. This number should be around 400 or so. Adjust "verticalness" of the board slightly in any direction to get the lowest possible stable value, ignoring spikes. Write this value down as AN3MIN. Again, the decimal values aren't critically important although if you see the numbers all clustered, you should round it to the nearest integer. So if you are getting 407.8 407.9 407.9, you may want to write this down as 408. Note that in practice, the decimal numbers will see a lot of fluctuation.

Now turn the board so that it is standing on the opposite edge, ie. with the serial connector at the bottom. The numbers should be in the 600+ region. Repeat for the highest possible stable value and write this down as AN3MAX.

Turn the board on the side and stand it on the edge with the I2C port at the bottom edge. We are looking for the lowest possible stable value for AN4 now. Write this value down as AN4MIN.

Turn the board to the opposite edge and repeat for the maximum possible stable value and write it down as AN4MAX.

At this point, you should have 6 numbers - AN3MIN, AN3MAX, AN4MIN, AN4MAX, AN5MIN, AN5MAX. These numbers, if calibrated correctly, represent the hard calibration numbers for your accelerometer. Edit the numbers already in the arduimu.pde file to reflect your measured numbers.

#define AN3MIN 407.0
#define AN3MAX 614.0
#define AN4MIN 403.0
#define AN4MAX 612.0
#define AN5MIN 433.0
#define AN5MAX 636.0

Change the HARDCAL from 1 back to 0 as follows:-

Code: Select all

#define HARDCAL 0        // Change the 0 to 1 for calibration
Save the file and upload to the board again. Make sure that the serial terminal is closed when you are doing this. Once completed, you will need to verify that your calibration is correct. This is stage 8, where you will need to open the serial terminal again, at 38400baud. Nothing will be output until the flashing LEDs stop and the orange LED comes on (which can take a few seconds.)

This time, instead of the many numbers, you will only see one column at the left as follows:-

Code: Select all

!!!VER:1.6e,0.94,***
!!!VER:1.6e,0.97,***
!!!VER:1.6e,0.97,***
!!!VER:1.6e,0.95,***
With the board stationary, this number should be between roughly 0.95 to 1.00 when sitting flat, upside down, or standing on any of it's edges vertically. If this is correct, you have correctly calibrated your IMU.

Bear in mind when installing the IMU into your plane that it should be kept as level as possible within the plane's level flying frame of reference. That is to say, in the attitude which your plane assumes when flying level. During the initialization, the plane needs to be completely stationary, though not necessarily level. This needs to be done until the LEDs stop flashing.

Daniel
Attachments
Ardu-IMU16e-I2C.zip
(47.35 KiB) Downloaded 757 times

Daniel Wee
Site Admin
Posts: 2070
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: DragonOSD+ - ArduIMU+ V2 firmware modification

Post by Daniel Wee » Fri 16 Apr 16 2010 10:24 am

Version 1.6f

1. Made accelerometer de-weighting very much more aggressive
2. Tweaked parameters to provide better stability
3. Position recovery may still be a bit slow
4. When connecting to the serial port, use 115200 baud now, instead of 38400 baud as before

Note that the hard-calibration routine still needs to be performed if you have not done this. If you have already done this, just copy the ANxMIN, ANxMAX values into the latest firmware at the appropriate locations. See instructions in above post for version 1.6e on how to perform this calibration. If you skip the calibration, you can expect the IMU to work very very poorly. The calibration data is not saved anywhere on the board. It needs to be entered into the source code as described in the procedure above.

Daniel
Attachments
Ardu-IMU16f-I2C.zip
(47.38 KiB) Downloaded 820 times

John Lee
Posts: 105
Joined: Thu 26 Feb 26 2009 12:24 pm

Re: DragonOSD+ - ArduIMU+ V2 firmware modification

Post by John Lee » Wed 21 Apr 21 2010 1:15 pm

Some are still having troubles hooking up the AurduIMU so I put together a easy to understnad photo to help those and I hope ths clerifies things.

John
Attachments
P1020767.JPG
P1020767.JPG (223.55 KiB) Viewed 25213 times
P1020766.JPG
P1020766.JPG (279.12 KiB) Viewed 25213 times

Daniel Wee
Site Admin
Posts: 2070
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: DragonOSD+ - ArduIMU+ V2 firmware modification

Post by Daniel Wee » Sun 16 May 16 2010 8:56 pm

For those who are a bit more adventurous, you may want to try the 1.6g code. In this code, I basically completely reject any accelerometer information if the gravitational vector is less than 0.98. This means that it is very important during your hard calibration process that the vector reports better than 0.98 (best is 1.00) in all orientations or this firmware is not going to work well for you.

The calibrations done for 1.6e need to be applied to the code in 1.6g. Just copy the values from your calibration before and insert them into this version at the appropriate places.

Daniel
Attachments
Ardu-IMU16g-I2C.zip
(23.18 KiB) Downloaded 859 times

TooSlow2Care
Posts: 4
Joined: Wed 09 Mar 09 2011 1:24 pm

Re: DragonOSD+ - ArduIMU+ V2 firmware modification

Post by TooSlow2Care » Fri 17 Jun 17 2011 1:50 am

Daniel,
I hate to bring this up because i know you are busy.
I have updated my ARDUIMU V2 Flat with the Firmware (F) provided on this thread. Gone through the Calibration process illustrated by Kempo on Youtube.
I Also have the Barometric Pressure Sensor from DIY Drones.
the DOSD runs flawlessly as a stand-alone or with the Barometric Sensor attached via I2C. my problem arrises when i connect my ARDUIMU.

I cannot have both of them connected at the same time on the I2C port. I have a 4 pin plug on my DOSD V2+ which have a Y harness on it. one set of all four wires goes to the Barometric Sensor & the other set (with the 3.3v wire removed & proper orientation) goes to the ARDUIMU V2 Flat.

looking at my Video Monitor, the DOSD will not even boot, when both are connected. I only see a message in the top left about 'DOSD Daniel Wee Copywrite ...' I don't have it in front of me at the moment.
when i hook up my laptop and run the DOSD software it does not recognise that the ARDUIMU is attached and my Barometric reading go to about -30psi.

please tell me i've simply overlooked something, and i haven't burned or broken anything.

thank you for any help you can provide,
Brian

Daniel Wee
Site Admin
Posts: 2070
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: DragonOSD+ - ArduIMU+ V2 firmware modification

Post by Daniel Wee » Fri 17 Jun 17 2011 3:12 pm

You may not have removed the resistors from the ArduIMU? Keep in mind that you cannot power the IMU off the 3.3V pin from the I2C header.

Daniel

TooSlow2Care
Posts: 4
Joined: Wed 09 Mar 09 2011 1:24 pm

Re: DragonOSD+ - ArduIMU+ V2 firmware modification

Post by TooSlow2Care » Fri 17 Jun 17 2011 10:16 pm

I had no idea that i needed to remove any resistors or make any other harware changes to the ARDUIMU.
Can you give me a link or a picture illustating what needs to be done?

I am powering the ARDUIMU with a 2cell LiPo and the 3.3v pin is not connected to anything.

thank you very much,
Brian

EDIT:
after about 30seconds of searching i came across the posts from Daniel on RCGroups. regarding the Pull-Up resistor removal due to the fact that the DOSD already has them. so this spawns two new questions-
1: on the ARDUIMU, is the pull-up resistor mod the same as the High-Pass fileter removal? http://diydrones.com/profiles/blogs/how ... -high-pass
2: should i remove the pull-up resistors on both the ARDUIMU and the Barmetric pressure senser? http://store.diydrones.com/product_p/br-0011-01.htm

thank you again for your help and patience,
Brian

Daniel Wee
Site Admin
Posts: 2070
Joined: Wed 25 Feb 25 2009 8:00 pm

Re: DragonOSD+ - ArduIMU+ V2 firmware modification

Post by Daniel Wee » Fri 17 Jun 17 2011 10:46 pm

Hi Brian,

The high-pass filter mod is a completely different mod. We''re talking about the pull-up resistors and they should be removed from most of the stuff you get from Sparkfun. The SFE guys completely failed to design for where multiple devices would be used together and hence all their products have pull-ups, which when cascaded - results in impaired function of the I2C bus. This is what causes the boot-up process to hang.

In some cases you may get away with them if you are not cascading multiple devices but in all cases it is actually better to have them removed since the DOSD+ already incorporates a master pull-up system.

Daniel

Post Reply