Step 9: Programming

Please understand how to work with AVR microcontrollers first. You should know how to compile a project from command line and how to use AVRDUDE. Also keep in mind I am using Arduino 0023, do not attempt to use Arduino 1.0 because my instructions here won't work and my code won't compile without some changes.

Although I can use an AVR programmer to load code into the microcontrollers, the way I designed the PCB makes it slightly inconvenient. Using a serial port bootloader is easier for this job. So I will use an AVR programmer just once to get the bootloader flashed into the microcontroller first, and use the bootloader the rest of the time.

The AVR programmer must support 3.3V circuits. My USBtinyISP is capable of this, but I needed to supply the 3.3V into it in order for it to know to use 3.3V.

Although the transmitter uses a 2X5 male header connector, YOU MUST NOT PLUG IN THE ISP TO IT DIRECTLY, because the pin mapping does not match. Connect the ISP to this header using wires instead, while following the pin labels carefully. (The adapter I used is from SparkFun, but you can make your own really easily)

First thing to do is to program the fuse bits of the transmitter microcontroller, which tells it to use the 16 MHz crystal, to run the bootloader on reset, and how big the bootloader is.
  • lfuse = 0xF7
  • hfuse = 0xD8

The bootloader is derived from the Arduino bootloader, I'm using a modified version of the Zigduino port of the Arduino bootloader. Flash the bootloader atmegaboot_picopter.hex file into the transmitter microcontroller.

Note: You may encounter a verification error while trying to flash the bootloader, this appears to be caused by a bug in AVRDUDE where nothing is read back (I was unable to even obtain a basic memory dump) for the ATmega128RFA1 (I don't know if this applies to any other chip). Ignore this error unless you are sure that the bootloader is malfunctioning.

At this point, make sure you've plugged in the transmitter circuit to your computer via USB, and have powered it on. Install the drivers if you need to. Remember the name of the serial port that it shows up as.

The bootloader is activated by placing a jumper between GND and SER<, and then powering on the transmitter circuit. Once activated, the red LED should blink 3 times and green LED will stay on. The green LED will also indicate busy status by blinking really fast (technically it is toggling once per byte).

Before you open up Arduino, you need to add the following entries into Arduino's "board.txt":


Copy the core files inside "picopter_core" into where you install Arduino cores. Copy the bootloader files inside "picopter_boot" into where you install Arduino bootloaders. Copy the libraries "PicopterWiiClassicCtrler" and "PicopterRadio" into where you install Arduino libraries. Copy the sketches "PicopterTransmitter" and "Multiwii_Picopter" into your Arduino sketch folder.

Also since Arduino is built using an outdated version of AVR GCC, it will not support ATmega128RFA1 properly, I had to overwrite the contents of the folder called "tools" with the contents from an up-to-date version of AVR GCC (obtained from MHV AVR Tools).

Open Arduino, open the "PicopterTransmitter" sketch, select the board to be "picopter_station", and select the right serial port. Activate the bootloader on the transmitter, then compile and upload the sketch.

The transmitter firmware has a neat feature: if you do not connect the Wii Classic Controller when you turn it on, it will go into ISP mode (indicated by really fast alternating red-green LED flashing, also flashes when busy), where it becomes another AVR programmer (protocol is stk500v1, baud rate is 115200). So now, connect the quadcopter circuit to the transmitter circuit. Using the command line and AVRDUDE, set the fuses of the quadcopter microcontroller to be:
  • lfuse = 0xF7
  • hfuse = 0xD9

Open the "MultiWii_Picopter" sketch, select the board to be "picopter_flier", and compile & upload the sketch. You have just programmed the quadcopter firmware using the transmitter.

Note: You might get a verification error while trying to upload firmware to the quadcopter using the Arduino IDE, if you do, then use AVRDUDE in command line to force a chip erase (using the "-e" option) and then try again. This is because Arduino forces the "-D" option while uploading.
Hi, great project! What kind of modificativos would I have to do on aeroquad motor library to Adjust PWM for brushed motors with MOSFET instead of ESC?
<p>I'm new to the site so I don't quite get it, only premium accounts have access to the pdf file? My cousin would love this, though</p>
<p>only if i had money and acsses to those parts... !</p><p>Awesome project :D</p>
<p>I don't understand how you made the circuit board and receiver.. You just took a PCB you had laying around, took all the componets off of it, and BOOM! quadcopter! Can you explain this to me?</p>
<p>They were custom designed and ordered from on online PCB manufacturer. BatchPCB is a popular one. He then soldered all the necessary components on.</p>
<p>I ordered the PCB's and built this. This is an advanced user project. The chip packages are QFN and a challenge to solder. Total cost was approx $200. I could not get parts of the TX code to compile, and had to modify. The author considers this a &quot;old&quot; project and does/will not support or help.</p>
<p>Hey there, your <strong>Picopter </strong>got me inspired and all and made we want to build a copter on my own for like $40. I will have some access to a <strong>3D printer</strong> so that will add another $5-10 to the cost. Here is the plan and I need suggestions and comments.</p><p>First of all, I'm not going to print a pcb but I will be using a 3D printed plastic frame and the same motors I think you did.</p><p>- <a href="http://www.ebay.com/itm/221541787818?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT" rel="nofollow">DC 3.7V 48000RPM Coreless Motor Propeller</a></p><p>That leaves me to a question if the copter will even lift itself if I use the following electronics which add on some more weight.</p><p>- <a href="http://www.ebay.com/itm/251383404458?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT" rel="nofollow">3.7V 200 mAh Li-polymer Rechargeable Battery Li-Po</a></p><p>- <a href="http://www.ebay.com/itm/321361180496?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT" rel="nofollow">NRF24L01+ 2.4GHz Antenna Wireless Transceiver</a></p><p>- <a href="http://www.ebay.com/itm/131231041891?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT" rel="nofollow">MPU-6050 3 Axis Gyroscope and Accelerometer Sensor Module for Arduino</a></p><p>- <a href="http://www.ebay.com/itm/400362466832?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT" rel="nofollow">HMC5883L Triple Axis Compass Magnetometer Sensor</a></p><p>- <a href="https://www.sparkfun.com/products/retired/11780" rel="nofollow">Tennsy 3.0 32 bit ARM Cortex-M4 48 MHz CPU, 128K Flash Memory, 16K RAM</a> (about the same weight as the Arduino Pro Mini)</p><p>You didn't specify the weight of your copter but I bet you give me a suggestion.</p><p>Thanks OP!</p>
<p>how to make pre account.... i want this download</p>
<p>Brilliant you made one! I bought one of the Hubsan branded ones which is fantastic, far easier but far smaller than the massive 5 foot bladed gas powered 60 size XCEL I had in my youth - that things was lethal!</p><p>Nifty way to charge it and avoiding RF interference. I am impressed, did you get three or one gyros in there?</p><p>Call it 'Quaddy' or 'Quadtastic!&quot; or &quot;4play&quot; </p>
<p>i wanna this pdf and iam not haver premium account</p><p>plz can any one send to me <br>on teet_totti@yahoo.com</p><p>pleas</p>
<p>Awesome!</p><p>Will you sell this project as a kit?</p><p>How much you will charge for one?</p><p>I want one for me.</p><p>Congratulations.</p>
<p>first time to know about ATMega128rfa1..<br>and i wanna get one.</p>
<p>Very nice man. Less of a project than I would have imagined it to be actually.</p>
<p>I dont have the wii remote controllers can I use any thing else? How to use it? </p>
want :0 how much? :3
<p>Hit us with that price :3</p>
i want one too :D
how much would it cost to buy one from you?
<p>does it fly???</p>
1) can you add a wireless camera on the picopter 2) can you add a gps module on the picopter 3) can you controll th picopter from anything other than the wii classic remote
Hi, <br>I have viewed this project you have built, and was quite interested in making one my self, would you be able to help me out with getting the PCB's and programing it?
you did a great job with this <a href="http://www.intorobotics.com/5-best-examples-of-how-to-build-a-diy-quadcopter/" rel="nofollow">powerful DIY quadcopter</a>
sir,i'm getting more confusion at the time of programming.can u show me how to install every code into picopter.from so many days,i'm working on it.i'm completed the hardware stuff fully,but totally failing in programming.please give me a installation video or step by step installation.kindly thanking you
can you give step by step instructions, its for my son's school project and i want to thelp him but unfortunately i only to operate a computer
sir , <br>from where to get those 2 green plates 1 for quadracopter and 1 for transmitter and what is there plate number .plz tell fast i wanted to make and sir as i wanted to order somethings at digikey.com there are comming 3 options all are same but there is comming tape and reel,cut tape and digi reel. which one i should select...... plz tell fast sir plzzzzzzzzzz
sir plz tell me name of all parts and their types used in making picopter.plz mail me the list at ckhurana79@yahoo.com . plz tell me fast. i love makin this type of things
How much did this project cost?? My friend got one of those really cool Parrot AR Drones and i want to build something similiar so we can do cool stuff with them. Maybe even launch this thing off of the botton of the big one. Where did you order the custom PCBs?? would love to build this!
Just fyi: <br>I ordered all parts at Digikey, Sparkfun &amp; ebay and ended up paying 190 euro incl. shipping to EU and printing 3 qc/tx pcbs. I was expecting something among 100 euro but I didn't want to go back after ordering the first parts :) <br>Batch ordered, a kit might cost something around 150 euros I'd guess. <br> <br>It's amazingly easy to find everything you've listed here; no exotic parts or anything, in fact, hardest part is finding a cheap li-po. <br> <br>Do you have any idea how much payload this thing can carry? Or what flight time you achieve with whatever battery you're using? <br> <br>Impatiently waiting for my orders... 8)
Any chance you have the parts list still? I seem to be overlooking it or just don't know where to look. Thanks.
would you consider makeing this as simple kit that can be bought. You would make some serious cash.Also is there a way that bluetooth can be implumented into the circuit somehow.
great little device, like to see it flying <br> <br>Maybe i got an idea for you to use different propellers. <br>The problem with these propellers is that people put their fingers to near to it, or they get damaged when you hit something during flight, Maybe you remember thse kid toys : <br>http://www.papstar-products.com/papstar_pe/prodpic/4-Toys-Flying-propeller-18909_b_0.JPG <br> <br>i think if you raise the outer circle a bit (strip of thin hard sheet) it would improve the blade too (better earodynamics for end of proppellor.)
Very neat. <br> <br>Instead of using jumper blocks, have you considered these plunger switches? <br> <br>http://www.goldmine-elec-products.com/prodinfo.asp?number=G15214 <br> <br>They're less of a hassle and they'll fit the same footprint assuming you're using 2 * thru hole .1 inch headers. If you're using SMT headers for the jumpers, still doable but will require bending the switch pins and perhaps a dab of hot glue.
hi,sir i need quadcopter's blank circut's print can iget it sir <br>
please sir please sir help me
sir can you write the list of parts used in the circut board <br>
if you can't find this stuff on here, what makes you think you can build this thing?
sir can you write the list of parts used in the circut board <br>
A complete product and a true feat of engineering. This is excellent!
hai frank you make all this by your self .... wow it's cool i want the make this where i can get the component???
You can get the components by searching DigiKey for the part numbers I provided, they have almost everything. Some of the stuff you can't find, you'll need to visit SeeedStudio, SparkFun, and Google.
For the mainboard ?? Were I get that?
You have to send the design to a PCB manufacture to have it made for you
you make this circuit board all By yourself?you are amazing,my dream is make a flying tiny robot but too bad i not pro in electrical : (
Are you planning on producing these boards to sell? If so, I will gladly buy one!
I would like to try, maybe attempt a &quot;Kickstarter project&quot; or something.
Kickstarter could be a great way to do this. You'll need a solid business plan and some flashy videos of your prototype flying well, but I think you'd get a lot of interest now that quadcopters are all the rage.
I agree, this could really take off on a service like kickstarter. it's small, open source, uses standard inputs from the wiimote, well designed, and developed privately to be a legitimate tool/aircraft. The geek media is clamoring for stuff like this, especially since the release of the <a href="http://youtu.be/_sUeGC-8dyk" rel="nofollow">quad copter videos at Upenn</a>.<br> <br> -yes there is a pun

About This Instructable


581 favorites


Bio: I am an electrical engineer. I graduated from U of Waterloo. I used to work for Adafruit Industries as an EE. Now I work for ... More »
More by frank26080115: LED Pocket Watch Easy Cord Wrapping Around Power Bricks Using SMD Components on Breadboards
Add instructable to: