RC Helicopter Autopilot

From RC-Autopilot Wiki

Jump to: navigation, search


Designing an RC Helicopter Autopilot


The initial idea was to use a small (4m length) helium-filled RC blimp for aerial camera shots. Because of the large size and expense of helium (several 100€ per filling!) and the sensitivity to wind, and the limited travelling speed, I started thinking instead of using an electric RC helicopter. Again, there are several working products already out there, but they all involve gasoline-driven helicopters, rather heavy (>1kg) cameras, and skilled pilots for manual flight. Or they are very expensive (>15.000$). I was thinking, why not use a powerful microcontroller and miniaturize the electronics so that the complete payload is under 500g. That can be carried by a medium sized electric model helicopter (usually about 1-2 kg takeoff weight, about 100cm rotor diameter) and with modern LiPo batteries having 3 times the energy density of NiCd or NiMH, the helicopter can still fly for 20-30 minutes at a time, which is sufficient for most aerial photography uses.



When choosing a microcontroller, I found a teriffic site (http://sprut.de) that got me hooked on PICs. Many people use Atmel, they both have similar features, so it doesnt really matter. For my first buy I settled for the 28-pin PIC18F2550 with 1k RAM, 32k Flash ROM, max 48Mhz CPU clock, about 25 I/O lines including RS232, USB, I²C, PWM, about 10 A/D converters, and digital I/O lines (not all usable at the same time, each I/O pin can have one of 3 or 4 functions).


My trial model airplane
"moviestar" airplane, made for carrying a camera in the cockpit
has 2 servos and a motor controller (total 3 channels), a helicopter needs at least 5 channels (roll, pitch, yaw, throttle, blade pitch), I want 2 available for steering the camera angle, so I'll plan for 8 servo channels to be controllable. That may prove too few if and when more features are added, but for the moment it should be fine.


I aleady had a high quality (480 TV lines) miniature video camera from another project, which produces very good (broadcast quiality) video. This camera (about 25x25mm square PCB with a 25mm lens sticking out the middle) will be mounted pointing straight forward for the moment (pilot's view), later on I want to add 2 servos to control the camera pan and tilt. Tilt is more important, panning can also be done by rotating the helicopter, unless there is a breeze coming from a different direction (not the one being filmed).

I also got a used miniDV camcorder off ebay, with a broken tape drive, for under 50€. The monitor and camera parts still work. Someday I'll take it apart and see if there is any way to extract the imaging part (camera chip and lens array) and use that, the main objective being to have a remote-controllable motor zoom lens, which I couldnt find in miniature format on the market. Even if I cant take off any of the electronics, but need to keep all 3-4 little pcb's together to keep it working, it might be small and light enough to be interesting.

Video transmitter

The original contents of the video transmitter
What I stripped it down to

My first video transmtter experiment was with a 30€ off-the-shelf transmitter and receiver set from an electronics retailer. After looking at the PCB I realized the whole transmitter was all in the tin box, all it needed was a stabilized voltage (about 9-12v) and a couple of pins grounded to select which channel it transmits on. The piece of PCB underneath everything is actually the patch antenna which was in the square plastic thing on top. The second photo shows the abovementioned camera stuck on with tape.

Even with this quick setup I was able to get a decent video from the plane, after replacing the receiver antenna with a 15dBi wireless LAN antenna, which we kept pointing at the plane during flight. I had a 230V inverter in my car, and hooked the receiver, a monitor, and an off-the-shelf DVD recorder together and recorded the flight directly to DVD. (This was the highest quality recording method I could think of, other than miniDV tape, which needs either a DV cam with video INput (rather rare) or a DV recorder (around 1500€).

Now I use a much smaller miniature transmitter (24x24x10mm) which I got from Lechner

Video Receiver

round 2.4Ghz antenna (15dBi gain) 900g

For video reception over more than 30-40m we need a directional, high-gain antenna pointed straight at the UAV at all times.

For this I suggest 2 strong servos (assuming 180° H+V FOV is sufficient) which point the antenna (mounted on a tripod) controlled by a base station controller using the GPS data from the UAV to calculate where to point. Since we want a fixed GPS receiver on the ground anyway to generate our DGPS signal, we can use that data (or a one-time reading) to triangulate the target direction.

To maximize the video signal strength, mount the video receiver directly on the back of the antenna, and take the composite video signal directly from there.

GPS reciever

For the first tests I just got any old serial GPS mouse, took it apart (unfortunately my hopes that I would find an easily accessable serail TTL output were disappointed, but one transistor+resistor in the circuit solved that) to reduce weight (more than half the weight was the plastic case, a long thick cable, and magnetic foot) and hooked that to the µC. It sends NMEA data at 4800bps at 1Hz repetition, which is nice for knowing roughly where you are, but no good for autopilot navigation. Later I'll get one from http://u-blox.com which has a 4Hz update rate and can use a faster, binary protocol. The data is read by the µC via the integrated RS232 reciever with an interrupt routine. In the current version the data is just written directly to the OSD, when we start actually using it we'll store it in global variables.

The currently available GPS recievers in the 100-EUR-class provide about 10m precision horizontally, the vertical precision is much worse. 95% of the data is within 5m, 50% is within 2m, but thats not very accurate for our purposes. I want to get 2 identical ones and try out the so-called "poor mans DGPS" by putting one at the base station (which is stationary), averaging the position readings for i.e. 5 minutes, which should give us a 1-2m accurate position, and then sending realtime differential data (averaged position minus the current GPS reading) to the autopilot, so it can hopefully improve the accuracy of it's onboard readings.

While testing my cheapo reciever I noticed that the GPS reading does not randomly jump all over the place inside a specific radius, but moreover the consecutive readings are rather close to each other, and the measured position slowly wanders around. Thats actually good news to me, because that means that (without correction) the helicopter will wander around slowly in a 10m radius, which is better than getting readings that jump all over the place, which would confuse the autopilot quickly.

For the height, we cannot rely on GPS at all, since thats one of the most critical variables for flight (especially since we'll usually be flying in low heights under 100m, usually even 10-20m high). So:


Radio Altimeter

For precise height sensing in low heights (<10m) above ground, an ultrasound sensor could be used, but is only reliable over hard ground. Soft grass does not reflect the signal and so appears like empty space, which is dangerous for our purposes.

Optical Altimeter
  • Sharp GP2Y0A02YK (max 2m range but has been successfully used, in contrary to ultrasound) Datasheet 20-30€ in Europe, only 10$ here
Barometric Altimeter

For keeping track of height in greater heights, or when the helicopter is not rightside up, we should implement a barometric altimeter. There are solutions out there, I'm sure there is a matching pressure sensor (0-1.5 bar with high resolution analog output 0-5V) out there somewhere for <30€, I havent found a specific one yet though. Might need to adapt the voltage with opamps to a useful range. Theoretically we could project the most important range for us (0 to 500m altitude, taking different weather situations into account) (1.2 to 0.8 bar?) over the full 5V so we get as precise a reading as possible from our A/D converter. A resolution of 10cm with 50cm precision should be achievable.

Quoting Marc: From experience, to get a 10 Hz update rate, at sea level with a high quality sensor (I use MSI 1230s) and significant over-sampling (100-200 Hz sampling), a 12 bit ADC will get you within +/- 8 feet, 15 bits +/- 1 foot, and 18 bits +/- 2 inches or so. Getting that 2 inch accuracy isn't easy, and requires careful attention to electrical and atmospheric sources of noise.

Quoting Brian: I gave up on ultrasonics for low level height detection and I now use the Intersema above 2 metres and the Sharp GP2Y0A02YK below 2 metres. The Sharp detector is only rated to 1500 mm but in my experience it works very well to just past 2000 mm. The Intersema MS5534A gives a 15 bit result to 1100 mB. That is, it will give one tick for approximately 1/30th of a mB. (1 mB is approx 10 metres altitude change). This translates to about 3 ticks per metre or about one tick every foot in the old money. I use the Intersema transducer with great success in the height hold and altimeter system on my fixed wing UAV. They can be bought direct from Intersema as samples (no freebies) at about $30 each. I drive them with a PIC and code them using PICBasicPro from Melabs. My guess, from in-flight observations, is that the height hold locks to within +/- 2 metres.

  • MS5534A Datasheet
  • MPXA4115A Datasheet (MOQ:20, 16€/each, rs-components.de) (Farnell: 20€ each) I have ordered a sample


A complete Gyro unit
A single Gyro component

In common RC model jargon, a gyro is understood to be a unit usually used on the tail rotor of helicopters, plugged in series between the receiver and the servo, which automatically couteracts the vehicle's turning by automatically controlling the servo to counteract the turn. It manipulates the signal from the receiver, so when the pilot is not steering (much), it holds the heading, but if the pilot moves the yaw lever, indicating he wants to turn, the gyro lets this command through, but stabilizes it.

Technically the Gyro is only the main component in this unit, which unusally also consists of a microcontroller, and maybe some means of adjusting the sensitivity and calibration. This readybuilt unit is not useful for UAVs however, because it is made for a fixed purpose.

What we want in our sensor array is the direct output from the actual Gyro (which is just a single electronic component) to tell our CPU what the current turn rate is, so it will either counteract, or let the turn continue, depending on what the desired action is. The gyro puts out an analog or digital signal which can be read by the µC.

TODO: What does it actually do and how does it work (wikipedia link?) also talk about drift, and how thats going to impact our usage, and discuss the drift problem, earth rotation an issue? (1°/4mins)

Another suggestion would be the ADXRS300, unfortunately these come in CSPBGA packages (ball contacts underneath, not solderable by hand, unless by heating the whole board) and as if that wasnt enough, the rotation axis is perpendicular to the mounting surface, so you actually need a seperate PCB plane for every direction you want to sense (that design sucks, if you ask me)

NOTE: The Tokin gyros are a tuning fork gyro with a fixed frequency of oscillation. you can buy units with different frequencies, however if you have 2/3 of the same frequency unit mounted close to each other they will interfere with each other causing incorrect readings. See http://www.nec-tokin.com/english/product/pdf_dl/sensors.pdf pg 21/22 for more info _PS_


The autopilot.sourceforge.net project uses the 2-axis ADXL202EB accelerometers. They cost 65€ each (in low quantities) so I'm looking for cheaper ones. The ADXL202JE only cost 23€, the ADXL202AE 26€ (all prices from rs-components.de). There is also a ADXL202JQC for 41€. Update: The 202AE should be fine as far as I can see from the datasheets.

I already got a Motorola MMA7260Q to experiment with (3-axis, 15€, not available from rs-components.de anymore), still need to compare the datasheets and see if it's going to be of any use.

Update: this IMU prototype board uses the MMA7260 so I have hope it will work for me.

Current suggestions:

  • Kionix KXM60-1120 with a low noise density of 35 ug/rtHz
  • ADXL103 with a Noise Density of 110 ug/rtHz
  • ADXL202E 2-axis, low-cost (26€), 200 ug/rtHz
  • MMA7260 3-axis, low-cost (15€), 350 ug/rtHz


Current Suggestions:

Optical Horizon Sensor

Base Station

  • 2.4ghz tracking antenna
  • tracking video camera
  • video reciever
  • gps reciever for tracking & DGPS generation
  • pressure sensor for keeping barometer calibrated on long flights during weather change
  • telemetry & sensor data logger
  • moving map display
  • click on map moves heli, click in video picture pans/zooms video


Servo control

Need to program an interrupt routine to control the 8 PWM channels, using as little CPU time as possible. Not very complicated in assembler.

Project Files

current PCB layout (incomplete) 5x8cm
current schematic (incomplete)

Currently playing with the PCB design. At the current stage it would even fit on half a credit card! (with components on both sides)

Interesting Links

Helicam operators

Personal tools