HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Jul 18, 2011, 09:24 AM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
809 Posts
Build Log
Diy osd (Arduino and opensource)

As this project is almost finish, I think it's time for a little update/summary here in post #1.

Lets start with a little video-clip showing the OSD in action
DIY OSD flight test (software v 0.14) (3 min 5 sec)


The main purpose of this project was to make a DIY OSD that can be made with;
  • Opensource software
  • Simple and cheap hardware
  • Only little technical knowledge required

It's not intended to be a graphic-heavy OSD, but an easy readable OSD with the most important info. But it's opensource and you can do whatever you want with it.

Quite a few updates and features have been added by request from users - and I hope to continue this. Feel free to post suggestions - but be reasonable. I don't mind to implement a feature - but I'm not gonna rewrite it all for another purpose etc.

I decided to make this project freely available and opensource - and I don't plan to earn anything on my work. Neither do I intend to sell or produce anything - but others are welcome to use it as they want.

If you don't want to make the hardware yourself the software also supports SimpleOSD OPEN (16 mhz with arduino bootloader and LM1881 sync seperator). It's should be available from here:
http://flytron.com/osd-headtrackers/...uino-boot.html

The OSD support theses features at the moment:
  • Easy hardware design with Arduino
  • Easy setup section added to code
  • Speed from GPS
  • Altitude from GPS
  • Flight timer from GPS
  • Position from GPS
  • Heading from GPS
  • Current from current sensor
  • mAh used
  • Auto set home position
  • Calculate Line of sight
  • dimming of text background
  • Arrow pointing home
  • Speed in km/h
  • Flight summary (max altitude, max speed, max LOS, total distance traveled and average speed)
  • Support NTSC and PAL
  • Support SimpleOSD open 16 mhz version with arduino bootloader

This is the schematic I use at the moment (Please note, AIN0 and AIN1 is NOT pin A0 and A1 on Arduino).


Same schematic but with a bit further explanation/text by Enthlapy (Dimming/brightness resistor value is a bit different, but you can just change these to what you prefer).


Fritzing-drawing, made by thnilsen


Old first post:
A work in progress. This post will be updated with more pictures text etc. Please be patient

A few weeks ago i started to play with a DIY-OSD. There is a lot of commercial OSD's available, but I figured it would be fun to make one myself. I wanted to make the hardware as simple and cheap as possible, so everything has been made using only an atmega micro-controller and a few standard components (resistors, capacitors and diodes). This makes it possible, to build an OSD for less than 10 $ (without GPS and current sensor).

I have chosen to make it all compatible with Arduino – so the code can be used directly with a simple arduino board, atmega with bootloader etc. This makes it pretty easy and cheap for everyone who wants to try it out. No SMD components or extra chips are needed.
At the moment it works just fine, and only LOS and an arrow home needs to be added (this is now done).

So far it has been made for a PAL video signal, but it shouldn’t be very difficult to make it compatible with NTFS.

In general;
A normal analog video-signal can be seen here;

The start indicates that a new line is starting and the variation in voltage is simply a way to express the color. A high voltage (about 1 volt) equals white and lower voltage is darker. Please see Wikipedia for further info on PAL/NTSC video signal.
http://en.wikipedia.org/wiki/PAL

The trick is to detect a new line, count the lines and show the pixels at the right time.
And off course reset the linecount when a new frame is detected.

The hardware:
The hardware is based on an atmega micro-controller and only a few normal components. New line and frames are detected with the analog comparator in the atmega mikro-controller.
As the sync pulse in the video-signal can have a little DC-offset, a few components is needed. To control this offset, the video-signal is AC-coupled. The sync-pulse will then be a negative voltage. To change this, you can add some DC-offset with a positive biased clamping circuit;
http://en.wikipedia.org/wiki/Clamper_%28electronics%29
It's now possible to get a positive video-signal where the sync-pulse is very close to ground. The voltage reference should match the biased video-signal’s synch pulse.
In theory you can bias the video-signal so the sync-pulse goes a bit below ground. This makes it possible to use ground as reference voltage. I have tried and it seems to work fine, but I wouldn’t recommend it.
To show the pixels you can use SPI or USART to shift out pixels very fast. The USART in SPI mode works perfect as it is double buffered. The problem is that you probably want to use the USART for communication with a GPS module. I don’t think the USART pixel generation is of any interest, but I have the code if anyone wants to see it. The SPI is only single buffered (8 bit) so you will have about 2 clock cycles (1 ekstra pixel) that will be the same as the last one, but this is only a minor issue.

The brightness is simply adjusted with a resistor. To avoid the pin from draining a simple diode should be used as well.

Test-video
OSD test (0 min 19 sec)


First test with Arduino duemilanove


A breadboard test;


Simple print-test;


An early test from the breadboard;


Another example. Can't decide if I want to use small or large numbers. Any preferences?
Might add a smaller resistor to make the text brighter.


Later breadboard version.


I plan to use this little arduino pro board. That should make a really small and simple OSD.


Prototype finished;




The circuit at the moment;
C1 = 0.1 uF
R1 = 50 K pot
It might be a good idea to lower R2.


Made so far:
  • In general the hardware is finish and works
  • Working OSD
  • Small ASCII table
  • Communication with GPS
  • "Extracting" data from GPS strings
  • Speed from GPS
  • Altitude from GPS
  • Time from GPS
  • Position from GPS
  • Heading from GPS
  • Current from current sensor
  • mAh used
  • Set home position
  • Calculate Line of sight
  • dimming of text background
  • Arrow pointing home
  • Speed changed from knots to km/h
  • Flight summary added (max altitude, max speed, max LOS, total distance traveled and average speed)
  • Support for NTSC and PAL
  • Support SimpleOSD open 16 mhz version with arduino bootloader

Should be finish soon
  • ...

Ideas for improvement:
Notes to the code;
The code for writing characters, numbers etc. is currently not very flexible if you want to re-arrange the text, numbers etc. As I don't plan to re-arrange the text I don't really care, but a "cleaner" solution could probably be implemented.
The main problem is, that timing is very critical. Even the use of while-loops instead of repeating makes a big difference. While-loops takes quite a few clock-cycles, which is clearly visible.

The code can be opened with notepad++ or Arduino IDE. Please rename to .pde instead of .txt when using with Arduino.

use of the code;
The code can be used as you want. Feel free to change, update delete etc.
Use of the code in a commercial product is welcome as well - but it would be great to know.

GPS:
The software have been written and tested with a MTK GPS and 2 GPS-simulation programs. The software should more or less work with all GPS'es, but I don't guarantee anything. It's recommended not to use lower than 1 hz update rate, and it's preferable to configure the GPS to only send RMC and GGA NMEA strings.







version 0.04;
  • Speed changed to km/h
  • Number of satellites added
  • Now only "active numbers" will show. This means 5.5 meter altitude will show as 5.5 and not 0005.5. Speed will show as 10.5 instead of 010.5. Done with speed, LOS, altitude, current and mah consumed.
  • Altitudes higher than 999 meters will now show as xxxx.x instead of xxxx.

Version 0.05
  • Support for SimpleOSD 16 mhz
  • Voltage and current input can be choosen in beginning
  • Battery voltage added
  • A few danish comments translated/removed
  • Few minor changes/cleaning in code

Version 0.06
  • Flight summary added with:
  • Max altitude
  • Max Speed
  • Max LOS
  • Total distance traveled.
  • Flight time
  • Wrong baud-rate settings will no longer crash the controller

Version 0.07
"look" changed - and some minor changes.

Version 0.08
Small bug fixes from version 0.07
  • Black line removed
  • total distance up to 99 km supported
  • Error in total distance calculation corrected

Version 0.09
  • GPS code updated
  • LOS and heading should work for everyone (no matter location)
  • Alarm function added on LOS, altitude, battery-voltage and mah used
  • Avg speed added to flight summary
  • Baud rate can be set in the setup-section (by just writing 9600 etc)
  • The line where analog-readings and current calculation is done have been added to #define line section
  • corrupt serial data will no more "fill the buffer" and block valid data
  • Topline moved a bit, might help NTSC users.

Version 0.10
  • NTSC support (line numbers from Melih used)
  • mah code updated to support timing in NTSC video signal
  • In setup it's only necessary to choose controller and video system (PAL or NTSC)
  • The input used for current-sensor and voltage-divider can be set by just writing the pin-number
  • Calibration for voltage-divider added to setup-section
  • Dimming added to SimpleOSD version (thanks Melih)

Version 0.11:
  • Auto altitude offset added
  • No altitude info from GPS (with altitude offset on) will no more show as 6220 meter (thanks to mrfliboy - noticed this on his movie)
  • Maximum speed in summary should be fixed (showed a weird string now and then)
  • Parameters added to flight summary, it's now possible to choose when flight summary is displayed
  • Couple of small changes
  • CUR and VLT replaced with A and V. What do you prefer?

Version 0.12:
  • Start-up screen added. Shows number of satellites, sat-fix, delay (from sat-fix to set-home) and the time (this can be used to check if the gps update-rate is right)
  • Possible to hide GPS-coordinates if altitude > x (but can be set to show every x second anyway)

Version 0.13
  • Some of the code changed a bit and re-arranged to be more efficient.
  • Option added to "align" text - all the text can be moved left and right to fit/center perfect
  • Summary centered

Version 0.14
  • Now possible to show mah / km - can be used to find optimal cruise speed etc. (need to be turned on under setup)
  • Speed/altitude decimals can be turned off in setup
  • Minor fix with GPS-coordinates that was alligned wrong (when using hide when over x meter and only show every x second - guess no one have discovered this yet)
  • Example added to config "show summary" for plane and quad
  • Dimming added to text
  • Delay for align screen moved - gives quite a few more clock cycles for every line for anything else

Version 0.15
  • Menu added (configuration also saved when power-off)
  • Support for US units (altitude offset must be on)
  • Dimming removed from top characters (when showing decimals)
  • Version-number added on startup-screen
  • Plane-position can be shown (in degrees)

The menu will allow you to change these settings:
  • Show mah/km (on/off)
  • Show decimals (on/off)
  • Text alignment to center text
  • Show plane position (on/off)
  • Altitude alarm (set value)
  • LOS alarm (set value)
  • Volt alarm (set value)
  • mAh alarm (set value)
  • Arrows updated a bit
  • The word "max" was bugged in summary - now fixed
  • Menu and start-up screen fixed a bit (only look)
  • A little more free space available.

Version 0.16
  • Arrows updated a bit
  • The word "max" was bugged in summary - now fixed
  • Menu and start-up screen fixed a bit (only look)
  • A little more free space available.

Exit must be chosen to save data. All data will be saved to eeprom, so they will stay until new data is written.
First time you load the new firmware the settings will be saved to the eeprom.
Even if you reload/flash the software the old values will be saved. If you want to update the values there is an option in the file to overwrite previously data. Just be sure to change the value back to 0, otherwise settings will be reloaded everytime.

Version 0.17
  • RSSI support added (can also be used to read voltage on second battery etc)
  • If alarms are set to 0, they will be off
  • Bug with negative altitude showing an arrow instead of minus is fixed

Version 0.18
  • Updated for Arduino IDE v 1.0
  • Splitted into multiple files and cleaned a bit
Dennis Frie is offline Find More Posts by Dennis Frie
Last edited by Dennis Frie; Apr 20, 2012 at 02:55 AM.
Reply With Quote
Sign up now
to remove ads between posts
Old Jul 18, 2011, 09:28 AM
Don't leave it Stock
mrfliboy's Avatar
USA, IL, Round Lake
Joined Feb 2004
2,506 Posts
Very nice!!
mrfliboy is offline Find More Posts by mrfliboy
Reply With Quote
Old Jul 18, 2011, 09:28 AM
Registered User
Joined Sep 2001
6,190 Posts
Subscribed.
cactus is offline Find More Posts by cactus
Reply With Quote
Old Jul 18, 2011, 09:29 AM
Registered User
GregSilver's Avatar
United States, FL, Plantation
Joined Nov 2005
655 Posts
awesome.... please keep this project updated. I have a little exp. with arduino and would love to follow your steps!
GregSilver is offline Find More Posts by GregSilver
Reply With Quote
Old Jul 18, 2011, 09:49 AM
Registered User
mark the shark's Avatar
United Kingdom, England, Darwen
Joined Aug 2007
456 Posts
Very nice..
mark the shark is online now Find More Posts by mark the shark
Reply With Quote
Old Jul 18, 2011, 10:07 AM
Registered User
Österreich, Burgenland, Eisenstadt
Joined Aug 2010
40 Posts
Cool, I'm in! Seems to be the perfect project after MultiWiiCopter
maexx is offline Find More Posts by maexx
Reply With Quote
Old Jul 18, 2011, 10:15 AM
Bugs!!!!!!!
viper6549's Avatar
USA, OK, Wayne
Joined Sep 2009
222 Posts
Sweet, I would love to have a peak at the code.
viper6549 is offline Find More Posts by viper6549
Reply With Quote
Old Jul 18, 2011, 10:56 AM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
809 Posts
There seems to be quite a few interested, great

The code is not too pretty, but it's well commented.
I will upload the current version shortly.
Dennis Frie is offline Find More Posts by Dennis Frie
Reply With Quote
Old Jul 18, 2011, 11:01 AM
aka Nigel Uno
Italia, Lazio, Monterotondo
Joined Sep 2004
363 Posts
Nice work!!

Ciao

Luca
gtrick90 is online now Find More Posts by gtrick90
Reply With Quote
Old Jul 18, 2011, 11:22 AM
Just another user
Dennis Frie's Avatar
Denmark, Capital Region of Denmark, Naerum
Joined Feb 2011
809 Posts
Code has been attached. I haven't done any cleaning yet, but feel free to take a look

New image attached as well.
Should I go for small or large numbers?
Dennis Frie is offline Find More Posts by Dennis Frie
Last edited by Dennis Frie; Jul 18, 2011 at 11:33 AM.
Reply With Quote
Old Jul 18, 2011, 01:15 PM
Registered User
charlienofun's Avatar
United States, CA, Santa Clara
Joined Mar 2008
374 Posts
Subscribed.
charlienofun is offline Find More Posts by charlienofun
Reply With Quote
Old Jul 18, 2011, 01:30 PM
Registered User
Joined Sep 2001
6,190 Posts
Quote:
Originally Posted by maexx View Post
Cool, I'm in! Seems to be the perfect project after MultiWiiCopter
+1. There is currently only one OSD using the Gyro and ACC data from the MultiWiicopter to show an Artificial Horizon. That one is closed source and there is not much documentation on it and it's very pricey.
Tom66 is working on an OSD as well and I started working on some sudo code to take the IMU data from the IC2 on a MultiWii and generate a AHI line for his code base.

What I like about the OP's solution is that it's Arduino based and so is MultiWii. So, we might finally have an open source AHI OSD solution for Wii based flight controllers!
cactus is offline Find More Posts by cactus
Reply With Quote
Old Jul 18, 2011, 03:13 PM
RC = FUN
Fort Wayne, Indiana
Joined Aug 2008
3,629 Posts
This is pretty awesome!

I'd say go for the big text, but that's just me. And, put an arrow pointing home! -Tyler
flyboy321 is offline Find More Posts by flyboy321
Reply With Quote
Old Jul 18, 2011, 03:14 PM
Registered User
SW England
Joined Aug 2009
799 Posts
Maybe you would also be interested in this opensource, Arduino RC hardware
http://www.rcgroups.com/forums/showthread.php?t=1446653

Hardware:
http://www.flytron.com/16-openlrs
Forum:
http://forum.flytron.com/viewforum.php?f=7

Nigel.
Devonboy is offline Find More Posts by Devonboy
Last edited by Devonboy; Jul 18, 2011 at 03:27 PM.
Reply With Quote
Old Jul 18, 2011, 03:22 PM
Registered User
Italia, Lombardia, Milano
Joined Jun 2010
146 Posts
Hi dennis,
please continue, I like this idea to built my own OSD as i like fly , programming and electronics.
Please submit a schematic.
Ciao, Carlo
carlonb is offline Find More Posts by carlonb
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Diy osd karl k FPV Talk 2 May 03, 2011 12:31 AM
Idea New DIY OSD? atari7202 FPV Talk 1 Mar 25, 2011 12:08 AM
Discussion see my own diy OSD video Passion Aerial Photography 7 May 27, 2010 01:28 AM
Discussion REAL homebrew DIY OSD - Check it out! jafoca FPV Talk 8 Jun 29, 2009 06:52 PM
Discussion picoOSD DIY PIC12F683 based OSD in C kbosak FPV Talk 6 Jan 31, 2008 07:47 AM