Skip to content
Arthur Benemann edited this page Mar 15, 2013 · 1 revision

Note: you must be using Arduino 022 (or higher) to use APM. You can get the latest version here.

Once you have Arduino, download the latest APM software. It will be named !ArduPilotMega(version number).zip. Unzip this main folder to your desktop. Inside the main folder there should be two folders: "!ArduPilotMega" and "libraries". Drag them to the Arduino Sketchbook folder you defined in the previous steps. My example shown here (yours should be the same, minus my name!):

http://ardupilot-mega.googlecode.com/svn/ArduPilotMegaImages/sketchfile.png

And here's where I put the libraries and APM code folder (highlighted).

http://ardupilot-mega.googlecode.com/svn/ArduPilotMegaImages/folders.png

We recommend you use exactly this file configuration. If you modify it, Arduino may not be able to find the libraries and you'll get compile errors.

Important note: DO NOT drag the whole APM(version) folder into your sketchfile directory. If you do, the code will not compile. Instead, just drag the two individual folders within it--!ArduPilotMega and libraries--in the sketchfile folder as shown above. Once you've placed them in the sketchfile folder, you can delete the APM(version) folder on your desktop.

Now open the Arduino IDE and from the file menu, select "open" and navigate to the !ArduPilotMega folder and click on "!ArduPilotMega.pde". That will open all the files in the folder, which will all appear as tabs in the IDE.

Now you should be able to compile and upload the code to your APM board. Ensuring that the USB is attached the APM shield/board and you've selected the right board from the Tools menu. If your board uses an ATMega1280 processor (the big chip on the APM board will say "ATmega1280") select "Arduino Mega (Atmega1280)". If you've got an ATMega2560 chip, select "Arduino Mega 2560". Make sure you've selected the COM port that Windows assigned to your board (you can find out in the Windows Device Manager) and click on the upload button.

It will take a minute or two for the code to compile, after which the Arduino IDE will report "Binary sketch size: XXX bytes (of a 126976 byte maximum) " in the status window at the bottom. Then it will start uploading the compiled code to APM, during which the RX and TX LEDS on the IMU shield will rapidly flash (showing data transfer). After about a minute, the LEDs will go out and the Arduino IDE will report that the code upload is complete. At this point your APM board is programmed.

Troubleshooting

http://ardupilot-mega.googlecode.com/svn/ArduPilotMegaImages/error.png

If you're having trouble or Arduino shows an error like the above, run through ALL of the debuugging tips here.

Clone this wiki locally