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

  • sir how abt the obstacle avoidance feature?

    can we expect this feature in the next version of arducopter code?

  • Thanks Randy. I'll give it a shot :-)
  • Developer

    Yogi,

         i guess you picked up the code from the blog above?  that's quite old.  you'd be better going to the arduCotper wiki and getting the latest code from the download area.  step-by-step instructions can be found on the wiki.

    -Randy

  • 3692174995?profile=originalHi

    I'm getting the following error every time I try to compile the code. I've saved the APM_ADC libraries in their appropriate folders. Someone please help, this is my first time using Arduino, and I am quite lost!

     

    Yogi

  • Hi Jose:

    The performance is so so impressive!! I am wondering why it is still called beta Ver.

    May I know that what software you are using to show the trans/rotating movement virtually? Can share?

    Many thanks.

    Alex
  • 3D Robotics
    Steve, the 2.51 code is an intermediate step on the way to 2.6, which will be the stable release version of the code for ArduPilot classic. It will support both thermopiles and the IMU. It will also be the foundation of the ArduPilot Mega code--we're going to try to run both APs (and other spin-offs to be announced later) off a shared code base as long as possible.
  • I actually got my mega talking to the arduIMU using 2.5.1 and the new IMU code, but that seams to be an entirely different project at this point.
  • With the new libraries, I was able to modify a copy of 2.5.1 to run on the mega beta board, and is able to see the ublox, and the radio receiver (ch5 controlswitch, throttle w/failsafe, elevator, and rudder.) cant wait for the imu!
  • Scott,
    Please read the recent response by Chris and see the thread here for components
  • What are he components on this board...I see the FTDI, USB, reset, ADC obviously, then what? which gyros? Data Flash logger?? (I didn't think this was going to include logging) accelerometers? How final are you on these components?
This reply was deleted.