Step 10: Firmware

The core files are derived from Zigduino's core files, which are mostly just minor additions to the original Arduino core files for use with the ATmega128RFA1. I made some modifications regarding the activation of the 2nd UART on the ATmega128RFA1.

During the planning stages of this project, I purchased two Zigduinos as a test platform for code involving the radio transceivers of the ATmega128RFA1. I decided I needed a high performance radio code, with maximal data rate, minimal latency, and minimal overhead. I chose to dig into uracoli, which is a free and open source library that supports many radio transceivers including the ATmega128RFA1, and developed the ZigduinoRadio library for Arduino. Then from there, I increased the performance even further and developed the PicopterRadio library specifically for this project.

PicopterRadio is designed to quickly replace traditional RC signal inputs. Instead of having a microcontroller read pulse widths using pins, PicopterRadio delivers data that represents what would have been measured directly in a digital fashion. This makes it faster and more accurate.

The ATmega128RFA1 also has a built-in random number generator (not psuedo random, this is true random good enough for cryptography) which I used to allow a random frequency to be generated and used by both the quadcopter and transmitter. The user connects these two pieces together and press a button, a frequency will be randomly selected and both units will switch to the new random frequency.

There are 16 available frequencies possible on the ATmega128RFA1 but I found some of them to be unreliable, at least in my house (with Wifi and cordless phones everywhere). So I've limited the number down to the few that I know works.

PicopterWiiClassicCtrler is a library I wrote to read the Wii Classic Controller using twi.c and twi.h (originally from the "Wire" Arduino library). It features detecting disconnections and automatic calibration.

My other quadcopter used AeroQuad flight software, which is free and open source, written with Arduino. I tried to port that code to the ATmega128RFA1. When I finished and decided to test it using the configurator, I had some wonky results. Tried fixing it, didn't have much luck. I then tried to port over MultiWii's code, which is also free and open source and Arduino, except it's more C style, instead of AeroQuad's C++ OOP style. The port is surprisingly successful. The GUI utility for MultiWii is written in Processing.org so it's just Java. while AeroQuads GUI utility is a huge LabView application. MultiWii is superiour in terms of how the software is written, but I heard AeroQuad's code might be better in terms of how stable the quadcopter flies But in the end, I'm using MultiWii because my port is working.

I customized MultiWii's code, mainly to add in my libraries, and to change some functions to using buttons instead of joystick action combinations. The orientation of the sensors does not match what the code expected, so I had to make a small edit that changed the orientation. The PWM output's range was not designed for MOSFET controlled DC motors so I had to make a small math adjustment for the PWM duty cycle.

"Version 2" added a MPU-6000, which is relatively new on the market, I had to add in some custom code for this sensor myself, where as the ITG-3200 and BMA180 was already supported in the original MultiWii code. The MPU-60x0 chip is very similar to the ITG-3200, so most of the initialization parameters stayed the same.

I also cut out a lot of irrelevant code so it's easier for me to read. MultiWii supports a lot of difference sensors and input methods, I deleted the stuff that is not what I am using.

Because MultiWii is written in a much more efficient way than AeroQuad, I was able to make the quadcopter wirelessly configurable by redirecting serial port data to the radio instead. So the user can plug in the transmitter to the computer instead of plugging in the quadcopter itself.

The bootloader is adapted from the original Arduino bootloader. The "ISP mode" is implemented by modifying the "ArduinoISP" sketch.
<p>Hey man,</p><p>This is awesome, I've been going back and forth in this as I created my own PiCopter, much bigger and more powerful - that I now sell as a kit in London ;) Check it out at http://www.picopter.org !</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>you can get similar kits online for about $120 using ps2 controllers. Supposed to be the fastest quads on the market</p>
<p>you can get similar kits online for about $120 using ps2 controllers. Supposed to be the fastest quads on the market</p>
<p>you can get similar kits online for about $120 using ps2 controllers. Supposed to be the fastest quads on the market</p>
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>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>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!

About This Instructable




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: