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!
- Eagle schematics: 5DOF_Tester_v0.2.zip
- MPLab project files and c-code for the C30 compiler: KalmanTestBoardV1.zip
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.