Artificial horizon
Despite of the lack of fresh messages on my weblog (no, I’m not abandoning the hobby UAV scene :-) ), I still get a lot of emails with questions and requests.
Some people emailed me for the code of the artificial horizon I published some time ago. Unfortunately that one was a quick hack and I was planning to rewrite it in clean and well documented .Net code and post them on my weblog. But honestly, so far it works for me and probably will for you, so why should I put more time into it? :-)

So: here’s the VB.net code: ArtificialHorizon.zip
Usage: Build it, drag the user component on your form, update pitch and roll properties.
8 October 2008, 21:37
| Link |
|
Hey Tom, Long time since your last post :-). Looks like nice interface. I’ve been working with a friend of mine on the AP and also have a ground station in C++ Builder that interacts with Google Earth. How is your AP going? Great to read you are back!
— Mariano, 9 October 2008, 19:53 | #
Hey Tom, this looks nice! I need to reimplement something similar in GTK2 for our NG! :)
Thanks for your nice blog articles Tom, I enjoy them for a while now! Especially your Kalman articles helped me a lot to get started with our own project!
— Amir, 22 October 2008, 11:12 | #
Hi Tom,
Good to hear that you are still in this hobby.
I am working on your source code, and have two questions;
1) ADC_X_NEUTRAL is 33400, but you used 33300 on float accelero_x() return (float)((long)adc_read(ACCEL_X_ADC) – 33000) / (39600.0-33000.0);
Is this a typo ?
2) If my gyro_roll neutral is 1.3v, should I replace 1.5 to 1.3 on
return -(((float)adc_read(ROLL_ADC) / 65500.0*3.3)-1.5)/0.002;
thanks a lot in advance
Dong
— Dong, 7 November 2008, 20:05 | #
Hello Dong,
1) Yes apparently I forgot to use this variable…
2) Yes, but this is less crucial because the Kalman filter will track the bias (neutral value) of the gyro anyway. However a good initial estimate is never a bad idea :-)
Tom
— Tom, 8 November 2008, 12:02 | #
Hi Tom,
Thanks for the answer, and your code is working fine.
I plotted Roll_angle, and tmp with Labview, and it clearly showed kalman filter was working well. Thanks for great work!!
(If you are interested in Labview code, I will send to you, so that you can post it here).
For the next step, I want to test both Roll and Pitch. Are you willing to share the code which does both Roll and Pitch?
Or, could you give me a direction how to modify the existing code to add for pitch?
Thanks
Dong
— Dong, 8 November 2008, 16:52 | #
Hi Tom,
Thanks for this contribution, I am successfully using your artificial horizon in my project (Quadcopter with IMU based stabilization), more info on my blog at http://vrhome.net/vassilis
Thanks,
Vassilis
— Vassilis, 8 January 2009, 00:52 | #
Hi Tom,
I’m trying to get your code working with a dsPic33f. I don’t understand a part of your code:
in accelero.c,
accelero_x() return (float)((long)adc_read(ACCEL_X_ADC) – 33000) / (39600.0-33000.0)
what is the (39600.0-33000.0) part? I don’t understand why I need this normalization..
Thank you for sharing your knowledge!
Regards,
Alberto
— Alberto, 14 January 2009, 16:07 | #
Hi, i’m pretty new to vb .net, and was hoping to try out your artificial horizon. can someone help me with how to build that component and identify which is the user component in the files?
— charles, 27 August 2009, 20:02 | #
also, anyone know how to fix “Type ‘ArtificialHorizon.ArtificialHorizon’ is not defined” when i click debug? much thanks
— charles, 27 August 2009, 20:55 | #
Hi there, I am looking for this for VB6, do you maybe have something like that available?
— Marius W. Hechter, 13 October 2009, 12:45 | #
Hi Guys, here http://diydrones.com/profiles/blogs/gui-for-tuning-kalman-filter
the code is completely free and multi-platform!
— Alberto, 28 February 2010, 11:39 | #