Picopter’s maiden flight!

Over the past few weeks I've been working on a raspberry pi powered quadrocopter, finally cumulating in todays first test flight! This flight went infinitely better than I expected, as it seems I have guessed nearly perfect PID gains.

The Picopter is currently based on the same filtering and control algorithms as my previous platform, however now all of the processing is handled by the on-board Raspberry Pi. This initially seems rather counter intuitive, as time sliced operating systems like Linux are not as predictable in their execution time as a simple real-time microcontroller program, but I've found in practice preemption allows the main control loop to run at a very reliable frequency. This now means the copter can perform the same as a basic microcontroller powered platform, but also has heaps of CPU time leftover to run things such as an SSH interface to my laptop via a wireless adapter, the logging of every scrap of data imaginable to the on-board SD card (think 200MB per flight), and the potential for complex route mapping and real-time integration into something like Google maps.

I'll continue PID tuning over the next few days, and will hopefully be able to acquire a better camera to obtain some better quality video. For now, here's some more phone quality pictures:

Comments (22) Trackbacks (22)
  1. I’m very interested in your projects!
    I would try to make some quadcopter and the control unit with all the stuff.
    However, my problem is that I don’t know anything about the required hardware. I read a lot about ESC, Motors, etc… but I don’t know a good and tested combination.
    Would you like to give me some details of your hardware(Basically, motors, rotors, ESC and battery)?
    Thanks in advance!

  2. What does “clever programming” mean exactly? I’ve done some embedded Linux work, albeit not on the Pi, where real time was not even close to reality. Just wondering what trickery you had to use.

  3. very nice! im working on a little quad project of mine too. its nothing special, but i just wanteddto see if i could even get my quad off the ground with my own firmware.i have everything else done except motor mixing. so i need to figure out how to incorporate the PID loops values for RPY + throttle into motor commands. advice?

    im thinking something like:
    motor[FRONT_L] = thrVal + axisPID[ROLL] – axisPID[PITCH] – axisPID[YAW];
    motor[FRONT_R] = thrVal – axisPID[ROLL] – axisPID[PITCH] + axisPID[YAW];
    motor[REAR_L] = thrVal + axisPID[ROLL] + axisPID[PITCH] + axisPID[YAW];
    motor[REAR_R] = thrVal – axisPID[ROLL] + axisPID[PITCH] – axisPID[YAW];

    code here:

  4. If you want to lower the latency even more and maybe even need realtime capabilities, have a look at RTLinux, a patchset which makes the Linux Kernel RT capable:

  5. I second the Jacob comment: having tried to do near-realtime with linux without RTAI or things like that, i was less than impressed by the results … so how did you achieve your picopter, nd what do you call “clever programming” ?

    Anyway, great job!


  6. hi,
    this is really nice.
    making linux timeslice more predictable use the RT extension.
    i do not know if these are available for your board.
    thanks for this nice posti!

  7. You are using an external ATMega CPU, Raspberry is useless, ATMega can do all processing without Pi.

    • It’s a dsPIC actually, and why confine yourself to an ancient chip with integer math if you can perform the same task from inside a rich execution environment like the Pi? Plus, doing it this way allows me to log around 30 double precision parameters at 400Hz, along with directly controlling and monitoring the quads execution state from anything with a network connection. If I tried doing this with the PIC I’d be completely bottlenecking the serial port to a max of around 20 or 30 updates a second, along with a massive execution time hit from such heavy use of printf. It’s thanks to this easy access to flight data that I’ve been able to progress so quickly, as matlab can identify any hidden problems and correct them without any of the usual trial and error.

    • So many noobs who don’t get what this is about…

      *le sigh*

    • I agree with the idea to use the raspberry pi as the main controller, in fact it gives a lot of power, interfaces and programming opportunities. I also agree though, that the external dsPIC could easily perform the fusion algorithm cycle with a good frequency rate leaving the raspberry executing more high level (and not so time critical) tasks.
      @jay: i think it is not fair, in this case, to blame people being a “noob”.

  8. Hi Matthew,
    Very interesting I think its great to do this type of project.
    What is the board that that the raspberry pi talking to? I am looking at the TI DRV8312 to control the brushless DC motors.
    Many thanks in advance

    • I’m not sure of the capabilities of the DRV8312, but if you just want simple power control then I would recommend looking at standard RC hobby speed controllers like this

      Once you wire them up these modules pretty much just work, and are very cheap thanks to Chinese manufacturing costs. The standard models are limited to a 50Hz update rate, but with a different firmware they can accept PWM data at 400Hz. This is what I have done, and it’s working flawlessly.

      Where you ask what board the pi is talking to, if you mean the overall PCB then it is my own creation, wiring up a sensor board and a MCU to provide PWM I/O.

  9. All I’m thinking right now is GPS dongle. Assuming you already thought of it, but tt would tie into your google maps idea rather nicely. Not to mention, if you added some sort of tracking data, it might allow you to program a failsafe that attempted to retrace a route back to its take off point in case of the loss of signal (or at least attempt to hover in one place until it regained signal). It would be pretty disappointing to damage something so awesome just because it flew out of range.

    Keep up the awesome work while I go take a look at your code 😉

  10. Can you share pcb angfle of board?

  11. Your flight control program is written in c++?
    I wanna develop a similar one with different implementation using different ESC/IMU sensors.

    May I join your development as a code contributor?
    I don’t wanna reinvent the wheel while you have completed a great start!

  12. And now… with the pi Camera… FPV….? 😀

  13. Hi!
    We’ve set up a similar project with Gumstix Hardware… but that should be interchangeable due to the nice OS abstraction:

    Besides the main C control service, some more stuff was added, such as:
    – service management using a command-line tool
    – an online parameter configuration daemon (for changing controller gains and filter settings in flight)
    – high-level mission interface in Python

    Our inter-process communication is handled via zeromq+protobuf+msgpack
    The code is experimental and not mature. But if you’t interested, just have a look 🙂

    Best Regards, Tobias

  14. bump on the first question about the hardware

  15. pleas i wanna make one
    i am a beginner in programming
    and i want you help me in this first step
    can u help me ???
    list of material
    and how i do that ??
    can i use a camera with a Raspberry Pi ??

  16. Hello, I have 2 raspberry pi and would like to be able to buld a quadcopter. Can I have list of materials and where to buy them. I would be nice if you can share the whole project with pi fans like me….

    Thank you for this hard work

Leave a comment