Developer

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: APM_RC.zip 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: APM_ADC.zip This is the ADC library to read analog data from gyros, accelerometers and diff pressure sensor.
Code: APM_IMU_test.zip IMU DCM algorithm for ArduPilot Mega Hardware (test code).
Note: All this codes are betas.

Jose.
E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Developer
    Jose,
    I would like to try to use your Python IMU tester screen on my Mac, Can you hook me up?
  • 3D Robotics
    Steve, check out the bottom of this thread, where Jordi first unveiled the board as a contest to guess the components. Freddy Gauss won. We'll be formally announcing the product in a few weeks.
  • Ah, this is interesting. I had assumed that the shield would be similar to the arduIMU in that it would have an ATMega328 processing the data from the sensors. Is there any benefit to doing all of the processing inside the Mega,or is the extra processor simply not nessasory? As of now, do you have a parts list available for what is to be included on the shield?
  • Developer
    Randy, the aplication is a python code that I use to check the IMU. You need to install python and some libraries, if you have interest on it, let me know and I share it.
    Steve, the shield has no procesor, only the sensors, an ADC, DataFlash logger and an FTDI (USB port). All the calculations are done inside the Mega.
  • Just wondering, but are you doing you DCM calculation on the shield, or are you doing that on the mega processor?
  • Developer
    I think the one in the video is something Jose put together. There is a labview viewer that features a "cube" versus the "slab" for a graphical representation. It is available in the repository as part of the download .zip package.
  • Developer
    Excuse my ignorance but what is that application running in the back that i always see people using when they're checking DCM? Where can I get it? I guess it's labview..
  • ok , thanks Jordi , Jose,team for good work you guys are putting into it.
  • Developer
    @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...
  • Just a dumb question , will the 4 jumper wires seen picture needed in production version too ?
This reply was deleted.