Stuff related to MAV's (and UAV's) from a hobbyist's point of view. Info

Autopilot module - revision 2

I just finished another prototype for my autopilot module. The biggest changes are:

  • SMD components!
  • Runs on 3.3V: more sensor stability.
  • Possibility to use an external crystal instead of the internal oscillator.

The software is finished for about 80-90%. For the moment it looks promising. At only 8MHz (that only 2MIPS!), the module does the following, 50 times per second:

  • Decode (and glitch filter) PPM pulse train from RC-receiver.
  • Send PWM signals to the servos.
  • Sampling of the sensor values and filtering them with a 4th order runge-kutta filter.
  • Decode GPS input at 2Hz.
  • Kalman filtering pitch and roll.
  • A simple PID algorithm for stabilization.

Looks nearly finished… however, testing in a real MAV and finetuning everything will take a lot of time!

28 December 2007, 14:54 | Link | Comments [12]

Kalman demo application

A lot of people saw I purchased a 5DOF module from SparkFun and even made a test-PCB for it. Obviously, they asked me if I was willing to share my code. Well alright, here you have it.

A simple embedded kalman filter, nicely documented. Also featuring, for the interested:

  • Using the ADC hardware module in a dsPIC30
  • Using the UART module in a dsPIC
  • Using the timer module in a dsPIC
  • How to organize your code! I’ve seen some hideous projects on the web.

The code is written using Microchip’s C30 compiler . The non-optimizing version is free!

I wrote a small app to visualize the output better:

And last but not least: downloads!

There is a bug in Microchip’s latest libs. You need to add: #define UART_ALTRX_ALTTX 0xFFE7 /*Communication through ALT pins*/
to uart.h or to the code that references it.

5 December 2007, 21:47 | Link | Comments [48]

Testing Kalman filters

A lot of people think they need great electronics skills, a lot of time, and embedded programming skills to experiment with Kalman filtering of IMU-data. Think again! The key to all your success stories is simulation!

One of the easiest tools that can help you with those simulations, is a great flight sim called Flight gear. It uses advanced aerodynamics simulation libraries, among which some were created by the NASA. Good enough for our purposes! On top of that, you can easily configure Flightgear to log all the data you need. I updated my config file to log the following variables:

  • Roll
  • Pitch
  • Acceleration along the 3 axis
  • Gyro reading along the 3 axis
  • Heading
  • Airspeed
  • ...

All the available fields can be found in FlightGear\docs\
I added the following lines to the configuration xml:

  <log n="0">
   <entry n="0">
   <entry n="1">
   <entry n="2">
   <entry n="3">
   <entry n="4">
   <entry n="5">
   <entry n="6">
      <entry n="7">
   <entry n="8">

Then I created a small VB tool (Yeah, kalman filters in VB ;-) ) to filter the data. This is the result:

One thing you can see, is that if I calculate the centripetal acceleration, and substract it from my y and z acceleration, the resulting roll angle has a standard deviation of only 2 degrees. Not bad!

Files for you download pleasures:

20 November 2007, 21:55 | Link | Comments [19]

Sparkfun's 5DOF

After my experiments with the thermophile sensors, I decided to give Sparkfun ‘s 5DOF a try. Thermophile sensors worked well, but you need 6 sensors to be able to make nice turns. Then it becomes annoying and a lot heavier than this 5DOF module. It’s not that much cheaper eather (10$ per thermophile sensor, 110$ for the 5DOF).

Anyhow, after some troubles with the creation of the test board, it is finally done:

I also needed a new programmer to program the dsPic I’m planning to use. Ebay pointed me to a chinese ICD2 clone. Not bad :-)

Now the electronics side of the tests is finished, I can move on to the software side (Kalman filter!) which is more my cup of tea.

7 October 2007, 09:59 | Link | Comments [5]

Older articles | Newer articles