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 |
|
Very Compliments!!!, Can I use the code for projects balancing robot? (code kalman filter for dspic)
— Michele, 28 December 2007, 16:24 | #
Sure.
These are the conditions: * Please leave a reference to me or my website in the code.
* Report bugs/improvements to me.
* Let me know how the project turned out :-)
Tom
— Tom, 28 December 2007, 16:33 | #
Hello Tom, thanks for the response, sorry for my English, I’m doing experiment with the gyro melexis MLX90609-N2, seems different from that you are used (5DOF IMU), so this morning I buy from a sparkfun
— Michele, 29 December 2007, 10:19 | #
Nice work, I enjoy your blog a lot. How are you designing and building these circuit boards? Are they hand soldered?
— Andrew Birkett, 29 December 2007, 12:38 | #
Hello Andrew,
I design the PCB’s in Eagle. Then create the PCB prints themselves using the laser printer method (http://max8888.orcon.net.nz/pcbs.htm).
They are handsoldered using components I got as samples or bought cheap on ebay :-)
How about your UAV? (read about it on your blog)
— Tom, 29 December 2007, 14:17 | #
Fantastic progress Tom. Are you having any problems with vibrations affecting the IMU performance?
— Daniel Wee, 4 February 2008, 00:49 | #
Hi Daniel,
I don’t seem to have any vibration problems. However I still need to buy some sort of datalogger.
My biggest issue for the moment is the pitch stability. If the roll angle is 10 degrees wrong, you hardly notice it, but if your pitch angle is 10 degrees down for several seconds instead of being level, you’re in big trouble :-)
— Tom, 4 February 2008, 08:39 | #
Another thing Tom – you may want to modify the delta angle that gets fed into the KF so that you don’t have angular discontinuity problems when you roll the plane a full 360 degrees. Just a bounds checker to keep the delta within +-180 degrees, I think will work. As it is, when you roll more than 360 degrees, your KF will go haywire for a while requiring re-convergence.
— Daniel Wee, 4 February 2008, 15:01 | #
Hi Daniel,
Yes I know… However I keep postponing it because I’d like to switch to quaternions, but then again I want to keep my code as readable and understandable as possible…
— Tom, 12 February 2008, 21:00 | #
Hi,
Congratulation for your project! I would like to build your autopilot revision 2… will you publish soon the PCB layout and the sources? I also live in Belgium (Brussels). If you need, I can help in PIC programming, PCB, SMD, Modelism… but not in mathematics ;-(
— Marc, 13 August 2008, 11:12 | #
Tom,
I am trying to produce an autopilot for my 300 series heli. I have all of the components based on an Arduino 168 with the IMU5DOF. My problem is that I can interface all of this but my coding skills are weak. kalman…forget it. I just cannot figure it out. Would you be willing to coach me to get thru this? I am an EE old school and trying to have a little fun at the same time. Could I see your code provided I conform to your rules?
— Bill, 20 August 2008, 17:55 | #
Hello Bill,
Pitch and roll on a hoovering heli should be controllable with the Kalman filtering code I provided on my website. To control the yaw as well, you should need a magnetometer too!
Feel free to email me if you have any questions.
Tom
— Tom, 20 August 2008, 18:32 | #