ArduPilot Mega sensor shield testing report

Hi all,
We have been testing the new beta sensor shield for Ardupilot Mega.

Note that this is a beta version of the sensor shield to test components, the final version will be different (Jordi commented this on other blog post)

The FTDI and mini USB works great for programming the At1280 with Arduino.
First tests were focused on the external 12 bits ADC (ADS7844) and the results are that it works great!!
We developed the SPI code to read the ADC and we used Timer2 interrupt to make a free running ADC at 400Hz.
Because our main loop run at 50Hz, we need at least 100Hz sampling frequency (to avoid aliasing), so we have an 4x oversampling and averaging on the ADC readings (this is good)
We are using the most efficient way to read the channels (16 SPI clock cycles per conversion. SPI runs at 2MHz).
When the code was tested, we coverted it to a standard Arduino library so the interface is very simple for the user.

I´d really like the "library" aproach because our code is now fully integrated in Arduino IDE, users can use this codes for other DIY projects, it´s very simple to use and we always include an easy example to test the library (File->Examples)
To install an arduino library you only have to copy the directory into your arduino\hardware\libraries and restart the arduino IDE.
To insert a library go to Sketch->Import library or you can test an example in File->Examples.
In this case, we only need to call APM_ADC.Init() on setup() and when we need an analog reading use :
value = APM_ADC.Ch(1);
The ADC library works really great!, so I decided to make a quick adaptation of our IMU DCM code to the ArduPilotMega. It works fantastic, very smooth and with high precision (see the video).

Find more videos like this on DIY Drones

Finally we measured the performance of the codes:
ADC 7 channels at 400Hz uses 98us*400Hz= 3.9% CPU
Full IMU DCM code takes 2.65ms*50Hz = 13.2% CPU
So we have an 83% of free CPU procesing power.
It´s very important to keep this part of code highly efficient.

Next step is to test the DataFlash code (AT45DB161) and convert it to a standard library.
I have doubts about if we can share the SPI bus between ADC and DataFlash (because how ADC SPI is implemented) but if this fails we have a second option in mind (using one of the serial ports in SPI mode)...
Next will be to convert our GPS code to a standard library and test all together:
-Radio library (APM_RC)
-ADC library (APM_ADC)
-DataFlash log library
-GPS library
-IMU DCM code
Then we start to add the latest autopilot code...

Code: This is the Radio Library (radio input and servo outputs)
This code uses hardware support for reading the radio input (input capture interrupt) and pulse servo outputs (Output Compare) so it´s very efficient, high accurate and uses very little CPU.
Code: This is the ADC library to read analog data from gyros, accelerometers and diff pressure sensor.
Code: IMU DCM algorithm for ArduPilot Mega Hardware (test code).
Note: All this codes are betas.


Views: 3912

Comment by Doug Weibel on March 17, 2010 at 11:00am
Jose and Jordi - Nice work!
Comment by Darren on March 17, 2010 at 11:12am
Sweet, just ran APM_RC and is working on mine. Cant wait for the IMU board... :)
Comment by Dave_fr on March 17, 2010 at 11:12am
Fantastic ! Getting one step closer !

3D Robotics
Comment by Chris Anderson on March 17, 2010 at 12:47pm
Very impressive, Jose! Just curious: why is there no differential pressure sensor on that board?

Comment by Mark Colwell on March 17, 2010 at 1:25pm
Very impressive, smooth with very low latency, modular code base!! Sweet.

Comment by John Arne Birkeland on March 17, 2010 at 1:32pm
Well commented and easy to read code. No "uhuuu... why did he?" moments so far reading it. :) Keep it up!

Comment by Jose Julio on March 17, 2010 at 1:33pm
Chris, I think that Jordi didn´t mount the differential pressure sensor because this board is mainly to test the external ADC, IMU components and the DataFlash logger.
Comment by Morli_ on March 17, 2010 at 3:00pm
Just a dumb question , will the 4 jumper wires seen picture needed in production version too ?

Comment by Jordi Muñoz on March 17, 2010 at 3:41pm
@Morli, "No because this board is mainly to test the external ADC, IMU components and the DataFlash logger.", the board was made just to test the sensors and be able to add or remove wire connections as needed. The final version will be different and everything will be routed using the PCB traces (after is deeply tested).

BTW the 12 bits ADC (ADS7844) is pin compatible with the TI BB 16-bit ADC for those that requires more resolution...
Comment by Morli_ on March 17, 2010 at 3:45pm
ok , thanks Jordi , Jose,team for good work you guys are putting into it.


You need to be a member of DIY Drones to add comments!

Join DIY Drones


Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service