Espritmodel.com Telemetry Radio
Reply
Thread Tools
Old Aug 29, 2009, 12:45 PM
Suspended Account
Brunswick, OH
Joined Nov 2005
5,547 Posts
Discussion
Remzibi OSD (Poor Man's OSD) integration with ArduPilot

Update 8/15/2010: Please note, this thread has been largely superceded by http://www.rcgroups.com/forums/showthread.php?t=1234310 which includes this same information and a newer version of the ArduPilot firmware. This project is a moving target because I don't think that the ArduPilot project will ever stop development. Please refer to the newer thread for slightly more up-to-date information.

---------------------------------------------------------------------------------------

This thread is a place to discuss the integration of Remzibi's OSD (Poor Man's OSD) and the ArduPilot Opensource Autopilot project. It assumes you're already familiar with Remzibi's OSD and the OSD configuration tool and does not contain any troublshooting on getting your OSD setup and programmed for the first time. The functionality below also requires a minimum firmware version on Remzibi's OSD of 1.60.

NOTE: So far I have had almost no success getting anything to work with the ArduShield. I am unable to upload firmware, get GPS lock or do much of anything with the ArduShield attached. Everything below assumes you are not using the ArduShield.

NOTE: The instructions and software below have been tested and are intended to be used with ArduPilot V2.3.1 source code.

What you need to get started:
Rembizi's OSD: ~$110 (Contact Remzibi about ordering).
The OSD comes with a the GPS unit and a USB to serial programming cable. For more information about the OSD, please visit http://remzibi.happykillmore.com.

ArduPilot: $25
ArduShield (Optional - Has pressure sensor for airspeed and throttle control): $47
FTDI Cable: $20
Bind Plug (for later use when you're actually flying): $1.25
XYZ Sensors: $100
Several rows of Straight Headers: $0.69/ea
Female to female jumpers (you might want to get a bunch of these): $3/ea

Optional (will help with debugging):
Servo Tester: $8
EasyCap (video capture device): $11

Assembling the ArduPilot:
I recommend connecting the VCC pins together so the FTDI cable will power both the ArduPilot and OSD during your testing. You will need to solder the straight headers in place and connect the "MUX" wire if you want the Ardu to control your throttle. Please note that it takes 47+ straight headers to complete the ArduPilot board and 18+ straight headers to complete the ArduShield so please buy accordingly (one will not be enough)...



You can tell I have soldering skills when you can see a strand of wiring hanging out of the insulation and a bunch of dog hair stuck in the left over flux I never got off my board....
My board also has a few rounded corners from some road rash while testing on my 50MPH Mini-T


Programming the ArduPilot:
The full ArduPilot manual can be found here: http://docs.google.com/View?id=ddjmqgw3_43gm6gvggf . Below is a brief overview of what software you'll need to download and modify to get the Ardu sending information to Remzibi's OSD. It might not contain all the details of getting the Ardu up and running.

1) Download and unzip the Arduino development environment. http://www.arduino.cc/en/Main/Software
2) Download and unzip the ArduPilot firmware sourcecode (Current is ArduPilot23.zip). http://code.google.com/p/ardupilot/downloads/list .
3) Next download my copy of the ArduPilot source and overwrite the files from step #2. http://www.happykillmore.com/Softwar...emzibiMods.zip
4) Make sure to copy the easystar.h file from step #2 into the arduino-0017\hardware\libraries\ArduPilot as explained here: http://docs.google.com/View?id=ddjmq...67775363847613
5) Open the Arduino 17 development environment and click File Open and browse to the folder in step #2 and open any of the files contained in that directory.
6) Connect your FTDI cable as shown below (you don't need to connect anything else right now)


7) Click Tools, Serial Port and make sure you have selected your correct COM port for the FTDI cable.
8) Click File, Upload to Board (CTRL + U). If the status box at the bottom shows "Uploading to I/O Board" and then "Done uploading" after about 30 seconds, move on to the next steps.

Configuring Waypoints on the ArduPilot:
1) Download and unzip the ArduPilot Config Tool and GPS Emulator: http://www.happykillmore.com/Softwar...ConfigTool.zip. You'll need to be on at least IE 7 and you'll need the .NET runtime 2.0 or greater.
2) Run the ArduPilotConfigTool.exe and setup some waypoints. Make sure to select "Set Manually" in the Home Info box.
3) Select File and specify your COM port.
4) Click Write to send it to the ArduPilot
5) Click File, Save Mission (this may be helpful for other testing with the emulator)



Running the GPS Emulator:
1) Open the GPSEmulator.exe that was a part of the ConfigTool.zip file from the step above.
2) Make sure you click Options, Baud and select 9600. The ArduPilot source above is meant to be used at 9600 baud. You can adjust this by changing the GPS_NMEA tab of the ArduPilot source. Edit the function called "init_gps" and change the line that reads "Serial.begin(9600)" to whatever baud your GPS runs. ie Serial.begin(38400).
3) Wire up the remaining connections shown above (CTRL to Serivo tester, connection between OSD and ArduPilot and Video Out to EasyCAP).
4) Specify your FTDI cable's COM port and click Connect and Start. After a few seconds, the blue light on the ArduPilot should come on solid. This means you have GPS lock. At this point, the ArduPilot should be sending GPS data along with the $M command string (see below) to the OSD.
5) Launch AMCap.exe (found in the C:\Program Files\Remzibi OSD folder - can be downloaded here http://remzibi.happykillmore.com) and make sure that under Options, Video Capture Filter, Image Tab you have selected the correct NTSC or PAL setting for your region and "Composite Video."

At this point you should see something similar to what's shown below in the EasyCAP window. This means it's working.



Running the GPS Emulator with feedback from the ArduPilot
The emulator has a feature that will allow you to capture output messages from the Ardu to simulate an actual mission. To enable this ability, you will need to add a line to the ArduPilot_EasyStar_V23 tab of the ArduPilot source. Change the void loop function to read:
Code:
void loop()//Main Loop
{
  
  navigation();//Calculate all the setpoints for the roll, pitch and throttle. Function localted in "Amain" tab.
  stabilization();//Control of all the actuators using IRs and Pressure Sensor... and the desired Setpoints for each one. Function localted in "Amain" tab.
  catch_analogs(); //Reads and average the sensors when is doing nothing... Function localted in "Sensors" tab.
  decode_gps();  //Reads and average the GPS when is doing nothing...
  print_remzibi(); //Function localted in "System" tab.
  //print_remzibi_debug();
  print_data_emulator(); //< ---- This is what you need to add
  if(gpsFix != 0x00)//No valid GPS
  {
  read_Ch1(); //reading the receiver with very short delays... Function localted in "Servos" tab.
  read_Ch2(); //Reading the receiver with very short delays... Function localted in "Servos" tab.
  }
  refresh_rate++;
}
Now, compile and upload the code. With just the FTDI cable and CTRL cables connected (optionally you can use the OSD output too), do the following:

1) Open the GPSEmulator.exe
2) Click File, Run ArduPilot Mission
3) Make sure your last uploaded mission file appears in the "Selected Mission" combobox (this is why you should save your missions in the ArduPilotConfigTool.exe)
4) Change the GPS Data Source to "GPS Emulator w/ArduPilot"
5) (Optional) Check the "Listen to Throttle" checkbox. Do not check this to begin with because the ArduPilot's output of the THH command is based on sensor data. Chances are good it will read 0 all the time.
6) Adjust the speed on the Emulator

The Status messages should tell you what's going on with the feedback from the Ardu. It includes what "mode" it's in (Manual, Waypoint or Return to Home), distance, pitch and turn information.



ArduPilot software interface with Remzibi's OSD and GPS Emulator (1 min 39 sec)


Configuring the $M command to the OSD:
The $M command was added by Remzibi in v1.60 of his firmware. It allows other devices including the ArduPilot to send commands to display variable data through the serial port. It's format is shown below:

Code:
$MXXYYLLEEabcd

$M - means that it is meassage to display (M must be uppercase)
XX - is a x coordinate on screen , must be hex value
YY - is a y coordinate on screen
LL - is leading character hex value from font table 
EE - is ending character hex value from font table 
abcd - is a "text message" to display (must be in upper case)

when LL or EE is Hx00 - then will be not displayed at all 
when text message is "" [empty] then also will be not displayed
So for example, $M0109B400TESTING would be in column 01, row 09 and would show the lightening bolt symbol, the words "TESTING" and then a blank space.

You can choose the large or small fonts by changing the X7 bit in the XX variable. So add 80 to the column you want it to appear in. For example, $M8109B400TESTING would use the small font set in column 01, row 09 and would show the lightening bolt symbol, the words "TESTING" and then a blank space.

There are 30 columns (XX) for both NTSC and PAL and 16 rows (YY) for PAL and 13 rows (YY) for NTSC.
Code:
.  X------>
Y 1 2 3 4 5 6 7 8 ... 29 30
: 2
: 3
: 4
v 5
. .
. 15
. 16
This information is included in the "System" tab of the ArduPilot source in a function called "print_remzibi"

Code:
void print_remzibi(void)
{
  static unsigned long timer1=0; 
  double nMult;

  int nMeters=0; //Change this to 1 for meters, 0 for feet
  
  if (nMeters==1)
    nMult=1;
  else
    nMult=3.2808399;
    
  if(millis()-timer1 > ATTITUDE_RATE_OUTPUT)
  {   
    digitalWrite(13,HIGH);
    
    Serial.print("$M");
    Serial.print("82"); // Hex Column (01h - 1Eh) for small fonts add 80h (81h - 9Eh)
    Serial.print("0A"); // Hex Row (01h - 0Dh for NTSC, 01h - 10h for PAL)
    Serial.print("BA"); // Hex address of First Character
    Serial.print("00"); // Hex address of Last Character
    
    if ((int)Tx_Switch_Status() == 0)
    {
      Serial.println("MANUAL MODE   "); //Min = 11
    }
    else if ((int)Tx_Switch_Status() == 1)
      if ((int)last_waypoint == 0)
      {
        Serial.print("HOME:"); //Min length = 7
        Serial.print((int)(wp_distance*nMult));
        Serial.println("       ");
      }
      else
      {
        Serial.print("WP"); //Min length = 6
        Serial.print((int)last_waypoint);
        Serial.print(":");
        Serial.print((int)(wp_distance*nMult));
        Serial.println("        ");
      } 
    else
    {
      Serial.println("RETURN TO HOME"); //Min = 14
    }
    timer1=millis(); 
    delay(10);
    digitalWrite(13,LOW);
  }
}

void print_remzibi_debug(void)
{
  static unsigned long timer2=0;
  
  if(millis()-timer2 > ATTITUDE_RATE_OUTPUT)
  {   
    digitalWrite(13,HIGH);
    Serial.print("$M");
    Serial.print("81"); // Column
    Serial.print("09"); // Row
    Serial.print("A9"); // First Character
    Serial.print("00"); // Last Character
    Serial.print("P:");  
    Serial.print(pitch_set_point);  
    Serial.print(",R:");  
    Serial.print((int)roll_set_point);  
    Serial.print(",T:");
    Serial.print((int)throttle_set_point);
    Serial.print(",S:");
    Serial.print((int)airSpeed());
    Serial.println("        ");

    timer2=millis(); 
    digitalWrite(13,LOW);
  }
}

void print_data_emulator(void)
{
  static unsigned long timer3=0;
  static byte counter;
  
  if(millis()-timer3 > ATTITUDE_RATE_OUTPUT)
  {   
    digitalWrite(13,HIGH);
    Serial.print("!!!");
    Serial.print ("STT:");
    Serial.print((int)Tx_Switch_Status());
    Serial.print (",WPN:");
    Serial.print((int)last_waypoint);//Actually is the waypoint.
    Serial.print (",DST:");
    Serial.print(wp_distance);
    Serial.print (",RER:");
    Serial.print((int)roll_set_point);
    Serial.print(",THH:");
    Serial.print((int)throttle_set_point);
    Serial.print (",PSET:");
    Serial.print(pitch_set_point);
    Serial.println(",***");
    timer3=millis(); 
    digitalWrite(13,LOW);
  }
}
Also included in the "System" tab is a function called "print_remzibi_debug" which shows what the ArduPilot is currently trying to do to steer the plane. However, this function is now enabled in the source code above because of some timing issues with sending multiple commands (this may not be an issue, but I wanted to make sure I posted something that works).

Code:
void print_remzibi_debug(void)
{
  static unsigned long timer2=0;
  
  if(millis()-timer2 > ATTITUDE_RATE_OUTPUT)
  {   
    digitalWrite(13,HIGH);
    Serial.print("$M");
    Serial.print("81"); // Column
    Serial.print("09"); // Row
    Serial.print("A9"); // First Character
    Serial.print("00"); // Last Character
    Serial.print("P:");  
    Serial.print(pitch_set_point);  
    Serial.print(",R:");  
    Serial.print((int)roll_set_point);  
    Serial.print(",T:");
    Serial.print((int)throttle_set_point);
    Serial.print(",S:");
    Serial.print((int)airSpeed());
    Serial.println("        ");

    timer2=millis(); 
    digitalWrite(13,LOW);
  }
}
Connecting up your GPS to the ArduPilot and OSD
If you're using Remzibi's GPS that he shipped with the OSD, then you'll need to make a modification to the plug. I simply pulled out the white wire (TX) and put a single header connector on the white wire.


[IMG]


HappyKillmore is offline Find More Posts by HappyKillmore
Last edited by HappyKillmore; Aug 15, 2010 at 05:01 PM.
Reply With Quote  (Disabled)
Sign up now
to remove ads between posts
Old Aug 29, 2009, 06:28 PM
Putting FPV to Business
FPVExtremer's Avatar
Joined Jul 2009
573 Posts
Huge achievement guys, really, this demonstrates both the power of Remzibi's OSD as well as Ardupilot, and in general the Arduíno world too.

Congrats,

Enani
FPVExtremer is offline Find More Posts by FPVExtremer
Reply With Quote
Old Aug 29, 2009, 08:00 PM
Registered User
RacerX208's Avatar
Joined Apr 2004
1,353 Posts
Subscribed...and most of the hardware is headed my way.
RacerX208 is offline Find More Posts by RacerX208
Reply With Quote
Old Aug 29, 2009, 09:11 PM
Stupid gravity!
docphi's Avatar
Trinity, FL
Joined Jul 1999
1,514 Posts
Ok. Can't install the OSD software. Error is "Could not initialize installation. File size expected=9938948, size returned=3612672."
docphi is offline Find More Posts by docphi
Reply With Quote
Old Aug 29, 2009, 10:29 PM
Suspended Account
Brunswick, OH
Joined Nov 2005
5,547 Posts
Quote:
Originally Posted by docphi
Ok. Can't install the OSD software. Error is "Could not initialize installation. File size expected=9938948, size returned=3612672."
You are absolutely correct. That's odd. My upload function seems to be failing. I did it the "old fashioned" way and it should be good to go.

http://www.happykillmore.com/softwar...etup/setup.exe
HappyKillmore is offline Find More Posts by HappyKillmore
Reply With Quote  (Disabled)
Old Aug 30, 2009, 12:15 AM
Registered User
wallaguest1's Avatar
Joined Nov 2006
2,117 Posts
where can i get the 4 pin connector you us for gps ?
wallaguest1 is offline Find More Posts by wallaguest1
Reply With Quote
Old Aug 30, 2009, 02:36 AM
Registered User
S. Wales
Joined Jun 2008
447 Posts
Try Hanson Hobbies
http://hansenhobbies.com/products/co...1inconnectors/
jon davies is offline Find More Posts by jon davies
Reply With Quote
Old Aug 30, 2009, 04:20 AM
Registered User
titou206206's Avatar
Joined Apr 2009
34 Posts
Hello,

Are you going to cover the WII Motion Plus XYZ sensor project (seems to be alot cheaper than the regular one)?
It looks like it is possible to use it with the Remzibi/ Ardupilot.
titou206206 is offline Find More Posts by titou206206
Reply With Quote
Old Aug 30, 2009, 05:00 AM
Registered User
France/china
Joined Jun 2008
88 Posts
Yeah thanks Happykillmore and Remzibi for all your efforts !

The integration of the Wii sensor must be cover ;-)

And the detail wiring of the ardushield also :-)

So many ask but i am sure you will do . You have the power and the knowledge.

Ps i just order all , but not the XYZ sensors.
RCULONE is offline Find More Posts by RCULONE
Reply With Quote
Old Aug 30, 2009, 08:02 AM
Suspended Account
Brunswick, OH
Joined Nov 2005
5,547 Posts
I can take the photos of the ArduShield (because I have one and it's working). But I don't have any info on the Wii Motion Plus.... That stuff is a little out of my league. I'd be happy to add the info if anyone knows how to do it.

I hope to add close ups on the wiring of the ArduShield tomorrow....
HappyKillmore is offline Find More Posts by HappyKillmore
Reply With Quote  (Disabled)
Old Aug 30, 2009, 09:09 AM
Putting FPV to Business
FPVExtremer's Avatar
Joined Jul 2009
573 Posts
I guess mormotta was the one working on the WII stuff. Perhaps that can help make it become even cheaper...

Thanks again man, awesome work anyways.

Cheers,

Ernani
FPVExtremer is offline Find More Posts by FPVExtremer
Reply With Quote
Old Aug 30, 2009, 11:03 AM
Registered User
France/china
Joined Jun 2008
88 Posts
For the wii stuff it is not UPHIEARL ?

picture
http://www.rcgroups.com/forums/showp...postcount=1167

Code file
http://www.rcgroups.com/forums/showp...postcount=1136
RCULONE is offline Find More Posts by RCULONE
Reply With Quote
Old Aug 30, 2009, 11:12 AM
Putting FPV to Business
FPVExtremer's Avatar
Joined Jul 2009
573 Posts
Yes, that's right, sorry, my bad...
FPVExtremer is offline Find More Posts by FPVExtremer
Reply With Quote
Old Aug 30, 2009, 10:20 PM
Registered User
Perth, Western Australia
Joined Dec 2005
327 Posts
Fantastic work! I will spend some time next weekend testing this.
In regards to using the nunchuck and WiiM+; It is one things to get raw data from the sensors but it is entirely another thing to use these components to make an effective IMU... Such an advanced project would take many months of development let alone money.
nick.sargeant is offline Find More Posts by nick.sargeant
Reply With Quote
Old Aug 31, 2009, 03:20 AM
So Cal FPV Aviator
EyeFlyPlanes's Avatar
USA, CA, Santa Clarita
Joined Feb 2008
3,575 Posts
Happyk, nice work on the write up. As a quick note though, you can buy the xyz sensors directly from fmas website for $43. See here...

http://www.fmadirect.com/detail.htm?...778&section=20

If thats the same sensors updating the above info will definately help with the total overall cost. Just a thought.
EyeFlyPlanes is offline Find More Posts by EyeFlyPlanes
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Build Log A poor man's OSD remzibi FPV Equipment 5145 Jul 28, 2014 05:49 AM
Poor Man's Heat Shrink for Homemade Battery Packs... flytowner Parkflyers 28 Mar 12, 2010 11:45 PM
Discussion Instruments! OR a really poor man's OSD mylittlepony FPV Talk 7 Dec 03, 2008 02:59 PM
Poor man's Super Slow Stick fun flyer? uglyplane Parkflyers 1 Jul 03, 2003 11:54 AM
Kyosho 180 Poor Man's Power Fix??? Don Sims Electric Plane Talk 41 May 12, 2001 09:23 PM