Quadrocopter controller

Since my first control theory class at the university I’ve been thinking about building a quadrocopter. There are several “off the shelf” kits you can buy that handles stabilization of the quad, KKMulticopter being the most popular one. As usual I did not want to use anything someone else made so I started building my own controller. This post will focus on the electronics of this controller but there will be more posts later on about the controller software and the mechanic construction of the quad.

Starting by defining the requirements on the controller

  • 4 PWM inputs from the radio receiver
  • 4 PWM outputs to the ESC
  • Power supply from one ESC
  • Processor capable of handling floating point Kalman filter
  • 3-axis Accelerometer & Gyro sensors (digital)
  • Capable of flashing several LED
  • Capable of measuring battery voltage

The ESC (Electronic Speed Controller) is a controller for running 3-phase BLDC (BrushLess Direct Current) motors. It takes a standard RC radio PWM pulse as input and outputs a synchronous 3-phase trapezoidal voltage to the motor. Most ESC of the size used in this project includes a 5 V 2-3 A linear voltage regulator to power the receiver from the main battery. This power will be used to power the controller as well through a 3.3 V LDO regulator.

The three axis accelerometer and two axis of the gyro are needed to estimate the pitch and roll of the quadrocopter using a Kalman filter. The third axis of the gyro is used to implement a simple heading hold control loop.

Let’s just say that I’m more of a software, than electronics, guy. Electronics is really fun and interesting but I’m no professional. If someone sees any errors or strange things I’ve done in this design, please tell me and let me learn from this.

If i start with the processor, I have previously used the Microchip dsPIC line of processors and like them very much. They are easy to work with and the student version of the C30 compiler works fine for my needs. I had some dsPIC33FJ32MC204 laying around at home from an old projects and these have a motor control PWM module with 4 outputs and 4 input capture modules capable of reading the signal from the RC receiver. A simulation of the Kalman filter code I’ve written told me that performance wasn’t an issue either.

I used the Free Version of Eagle Layout Editor to draw up a schematic

Schematic
Schematic

And create a PCB layout from this schematic. The layout was adapted to a 50 mm x 50 mm pcb since I found the extremely cheap PCB manufacturer ITead Studio which could make 50 mm x 50 mm PCBs for less than $10. The layout used two layers and looked like this.

Top Layer
Top Layer
Bottom Layer
Bottom Layer

The sensors are from Sparkfun and mounted on breakout boards, since this is my first PCB order I played it safe and didn’t want to solder the extremely small packages of the sensors.

ADXL345 on breakout board
ADXL345 on breakout board
ITG3200 on breakout board
ITG3200 on breakout board

ITead Studios is based somewhere in China and it took several weeks to get the PCBs but when they arrived the all seemed to be of good quality

Quad PCB from ITead Studios
Quad PCB from ITead Studios

I have a couple of these boards left, contact me if you want one.

I used a toothpick to apply solder paste from dealextreme to the PCB, placed the components and heated with an ordinary soldering iron. Quite time consuming but I’m pretty sure that the end result was better than if I would have used ordinary solder. Not the prettiest soldering job but it was my first using this technique.

Quad PCB Top
Quad PCB Top
Quad PCB Bottom
Quad PCB Bottom

Now the “only” thing left to do is build the mechanical part of the quadrocopter and create the software. But I save that for another post…

5 thoughts on “Quadrocopter controller”

  1. Hi! Nice attempts at RC flying. Can I have a copy of your plans for the Depron plane, I think I can adjust the CG. It is a beautiful design. Also any Quadcopter boards and accessories left? Would love to have them.

    Regards,

    VC

    1. Thanks!

      I will write a post tonight with the plans for the depron plane. I’m afraid I do not have the nice 12 page A4 prints that you stick together and cut out your template. I’ve got a one page drawing with all the measurements. I used the measurements to make a template using the kind of cardboard, you can buy at painters stores to cover your floor.

      I have the PCB’s for the quadrocopter, and some of the parts. I know that i do not have any more processors, but I could provide you with the things that I have together with the source code for the controller if you want.

  2. Hello,

    I was wondering why you use the 4 extra transistors to drive the ESC. It seems that they limit the voltage across the ESC to 2.6V (3.3 – 0.7). Wouldn’t it be better to use a different system so that you get the full 5V over the ESC?

    1. You are completely correct, design flaw by me. The goal was to use the 5V from the ESC internal voltage regulator instead of the 3.3V output from the dsPIC I/O. I was lucky enough that my ESC had no problem with the lower voltage on the PWM control signal.

      I have a new design on the way where I use the 5V-tolerant pins of a STM32 to send the PWM pulses instead.

Leave a Reply

Your email address will not be published. Required fields are marked *