Picarus is an attempt to make a small PICMicro Microcontroller circuit to automatically pilot radio controlled airplanes. The idea would be to completely remove all radio circuitry from the plane and replace it with Picarus. Picarus would be programmed to make the plane take off, fly around to specified locations, come back to the starting point, and perform a landing.Why?
I've always wanted a radio controlled airplane, but I'm probably too stupid to be able to fly it, so I figured it would be easier to build a small computer based off a PICMicro Microcontroller and program it to fly the plane. The fun part of this project is I have absolutely zero airplane experience other than computer flight simulators. I will be programming Picarus to fly a plane based on common sense and flight experience from Ace Combat 04 on my Playstation 2 (plus other games) :).News
March 8, 2007: I haven't touched this in a while so I think I'm going to go ahead and just post the source code to both the PIC assembly and the PalmPilot application. It will probably be up in a couple days along with an explanation of what I did to make it work.
August 20, 2005: Last night I programmed the Palm to control the circuit. I have a picture of it here. Well, that's proof I still work on this thing every once in a while.. I rarely have time anymore :(.
April 30, 2004: I haven't worked on this in a long time, so a week or two ago I decided to bring it out again. I got the servos working and I'm currently working on building the plane.Pictures
You can see some images of my breadboarded prototype by clicking on the links here:May 2003
Prototype circuit board with some stuff soldered on
Another pic of the same protype board
The backside of the prototype (yes I suck at soldering :( )
A cheap toy plane I bought a while ago to try to test picarus with
Breadboard prototype from a distance
Breadboard prototype closer
Breadboard prototype directly from the top
picarus-2007-03-09.tar.gz (Source Code)
How It Works
Servo motors in R/C airplanes and other R/C toys work by pulse width modulation. The motor expects a pulse every 20ms where the width of the pulse is between 1ms and 2ms. If the pulse is 1ms long, the motor turns all the way to the left and if the pulse is 2ms long it turns all the way to the right (or maybe the other way around :). Pulses in between 1ms and 2ms will move the motor an amount between, for example 1.5ms pulse will center the motor.
So the trick here is to write some PICMicro assembly that will firstly watch the serial port for commands from the main computer and secondly send pulses to 4 or 5 servo motors based on the position the main computer requests. The picarus code has basically 3 sections to do this: an initialization section, a main section that polls the serial port, and a timer interrupt to handle the 1-2ms pulses every 20ms.
The way the timer interrupt works is this: my circuit uses a ceramic resonator at 4MHz, which is divided by 4 so internally I have a 1MHz clock. I set up the 8 bit TIMER count ratio to 16:1 so the timer increments every 16 cycles. So if each CPU clock cycle takes 1us, every TIMER increment will take 0.016ms. Since it's an 8 bit timer and fires on an overflow from 255 to 0, the timer interrupt should fire every 4.096ms. I use a variable called Servo to count how many times the interrupt is called, and every 5th time I send 1ms to 2ms pulses to each of the servos to control their positions.
More coming soon... including schematics and source code...
Copyright 1997-2023 - Michael Kohn