My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
LoadingPage  
Updated Aug 23, 2011

Loading the code

Now it is time to load the software. Download and install the latest version of Arduino, if you do not already have it. If you've never used Arduino before, please use these setup instructions to become familiar with Arduino basics. Once you've done so, you're ready to load the ArduPilot code.

Here's a video tutorial (Part One, Part Two). Or just keep reading and following these instructions.

First, power on the board by plugging your ESC into a battery or using some other 5v power source (do not attempt to just power the board with the FTDI cable. We did not connect the power pins on the FTDI port to the processor to avoid power conflict when the board is powered by the Rx and you are using the FTDI as a serial monitor). The red power LED should go on. Now plug your FTDI cable into the board (with the black wire or, in the case of the Sparkfun board, the GND pin on the side marked "BLK") and plug it into your computer's USB port. If you have not already installed the FTDI drivers, download them from here and do so.

Important: if you're using Windows, you must go to the Control Panel/Device Manager and make a change to the COM port assigned to the FTDI cable. Find the USB Serial Port entry as shown here (your FTDI may have been assigned to a different port than the 3 shown here; it doesn't matter what number it's given) and under Properties/Port Settings/Advanced, ensure that the "Set RTS On Close" box is checked, as shown below. Once you've made this change, you won't have to do it again.

Now it's time to plug the cable into the board. Here's what the DIY Drones FTDI cable looks like when it's plugged into the shield:

Or, if you're using the Sparkfun FTDI board, this is what it should looks like:

Now download the latest ArduPilot code, which can always be found in the download section at right on the ArduPilot code page.

Uncompress the code to a folder on your desktop. You will find several folders inside: one, the ArduPilot code, which will be called something like ArduPilot2x (where X is the latest version).

Meanwhile, your code folder should look like this:

Now, open the Arduino IDE, go to the File menu, pick Open, navigate to your code folder and load the main ArduPilot "sketchfile", which will be called ArduPilot2x.pde (where x is the latest version), which will load the rest of files in tabs (there are about 12 tabs in all). The tab bar will look something like this:

You'll note that one of the tabs is called AP_Config.h. This is the configuration file for your airframe, which we'll be spending a lot of time working with later. If you use ArduPilot on different aircraft, you may want to have an airframe.h file for each one. Just ensure that the you edit the code in the top of the first tab to call the right header file when you're uploading the code. Here's an example:

#include "easystar.h"
//#include "AP_config.h"
//#include "miniMag.h"

In this case, I've commented out the standard "AP_Config.h" file and inserted one to call "easystar.h", which has his custom settings for that plane. Before I edited that file for my Easystar settings, I copied the AP_Config.h file and renamed it easystar.h in the same directory, so it shows up as its own tab in the tab bar.

Now in the Arduino software in the "Tools" menu make sure you have selected the right serial port (the FTDI cable will create a new one). If you're not sure what com port number your PC assigned to the FTDI cable check in the Windows Device Manager (found in the Control Panel). It will look like this:

Also ensure that the board selected in the Arduino IDE Tools menu is "Arduino Duemilanove w/ATmega328":

If you're not using the V2 shield (the blue one), you should unplug the GPS module. The Arduino code will not load if the GPS module is attached, because they share the same serial port. If you are using the V2 shield, it will handle this for you so you can leave the GPS plugged in.

Now press the "Upload to I/O board" icon (the little arrow point to the right). Nothing should happen for about 30 seconds as the code is compiling, then the ArduPilot LEDs aside from power will go out while the board is reset and the code downloaded. (If you are using the Sparkfun 3.3v FTDI board, you will see a red LED on that board flash a few times and stay on for about ten seconds as the code is being downloaded). In less than a minute, at the bottom of the Arduino IDE the software should report that the sketch was successfully uploaded by reporting "Done uploading".

If you are having problems uploading the code (you get a bunch of error messages in red) follow ALL of the debugging tips here.

Now you can disconnect the FTDI cable and reconnect the GPS module.

Comment by gadgetm...@gmail.com, Jun 28, 2010

I just downloaded the ArduPilot_2_6_1.zip file and its missing the easystar_25.h but I'm guessing its suppose to use a file called AP_2_6_header.h since its listed as an include in the main PDE. Just making sure.

Comment by gadgetm...@gmail.com, Jun 28, 2010

After reading further it tells you to use the ap_2_6_header.h file. You might want to remove the block below from this section of the wiki since its correctly talked about later.

"You'll note that one of the tabs is called EasyStar?_2x.h. This is the configuration file for your airframe, which we'll be spending a lot of time working with later. If you use ArduPilot on different aircraft, you may want to have an airframe.h file for each one. Just ensure that the you edit the code in the top of the first tab to call the right header file when you're uploading the code. Here's an example:

//#include "easystar_25.h" #include "jason_EZStar.h" //#include "miniMag_25.h" In this case, Jason has commented out the standard "easystar_25.h" file and inserted one to call "jason_EZStar.h", which has his custom settings for his plane. He's also copied the easystar_25.h file and renamed it jason_EZStar.h in the same directory, so it shows up as its own tab in the tab bar."

Comment by project member analogue...@gmail.com, Aug 1, 2010

@gadgetmerc. Thanks for the catch (the code changes since the manual was written). I've updated it so it's correct now.

Comment by ngmin...@hotmail.com, Aug 3, 2010

What does these programs actually do?

Comment by rena...@rdslink.ro, Sep 2, 2010

Is there any chance to use other cable than FTDI whose driver doesn't feature "Set RTS on close" setting. Why is this required ?


Sign in to add a comment
Powered by Google Project Hosting