Encoder Front Page
SRS Home | Front Page | Monthly Issue | Index
Search WWW Search seattlerobotics.org


The Air Mail Stamp:


A Robotic Aerial Vehicle Using the Parallax Basic Stamp™ Microcontroller




Dan DeGard





This paper describes development, construction, and flight testing of an aerial vehicle using a Parallax Inc. Basic Stamp® microcontroller as part of the flight control system.


The aerial vehicle consists of a Radio-Controlled model airplane carrying a Parallax Basic Stamp® microcontroller. The Stamp accepts the inputs from the pilot (using the standard R/C control transmitter) and modifies them as needed to accomplish the programmed mission. A switch on the pilot's transmitter can give the Stamp autonomous control of the air vehicle. As of this date, the vehicle has been flight-tested in the telerobotic mode, with the Stamp controlling the rudder only according to commands given by the pilot. Sensors and software for autonomous operation have yet to be developed.


Electronic and computing

      Parallax Basic Stamp (BS2SX)               ( www.parallaxinc.com )

      Ferrettronics FT639 servo controller         ( www.ferrettronics.com )

      Prototype circuit board

Airframe and powerplant

      DynaFlite Butterfly model airplane

      O.S. Max 20 2-cycle model airplane engine (max. 0.5 hp at 7000 rpm)

      Airtronics R/C electronics (transmitter, receiver, servos)

      Sanyo Ni-Cad battery packs


Prototype circuit board


The Stamp, FT639, 9V battery with voltage regulator, and R/C receiver are all co-located on a circuit board. Connections between components are accomplished with 22-guage hookup wire and soldering. External connections are via headers that accept standard R/C servo connectors. Communication with a PC is via a 5-pin DIN connector mounted to the side of the airplane fuselage. A power switch for the Stamp and terminals for checking the voltage of the 9V battery are also mounted to the side of the fuselage.

The 9V battery and the R/C receiver are held to the circuit board with adhesive-backed Velcro, which is excellent for vibration attenuation. The entire assembly is wrapped in vibration absorbing "bubble wrap" and held in place inside the fuselage by simply wedging the package into place. (A powered R/C airplane is a high-vibration environment due to the eccentricity inherent in a single-cylinder engine, and due to slight imbalances in the propeller.)




Currently, the Stamp has control only of the rudder. The other two functions (pitch and throttle) are operated directly by pilot via standard R/C equipment. This is done for safety reasons, in that if control of the rudder is lost, the airplane can be brought to earth within a short time (gracefully?) using pitch and power commands.


The Stamp2SX allows multiple programs to be stored. Control is passed between programs using the "Run" command. For this air vehicle two programs are loaded into the Stamp. The first operates the rudder of the air vehicle in a telerobotic mode, much like a standard R/C airplane. This program reads the signal from the R/C receiver and converts it to a command for the Ferrettronics servo control chip. See Appendix B for details. No modification is made to the signal in this mode and the rudder moves in proportion to the movement of the rudder control stick on the transmitter. The program periodically checks another channel of the R/C receiver to determine if the pilot has given permission to assume autonomous operation. The channel used is the one commonly used to operate the landing gear, and so has a simple toggle switch on the transmitter for "up" or "down". If the switch is in the "up" position, the Stamp remains in program 1 (telerobotic operation). When the switch is placed in the "down" position, the Stamp switches to program 2.


Program 2 is available for autonomous command of the rudder, and ignores any rudder control inputs from the pilot. The landing gear channel is periodically checked, and if it detects the transmitter switch has been placed back in the "up" position, control will pass back to program 1. The actual code used is included as Appendix A. Currently Program 2 does not exist. See the section on ‘Future Plans’ for more information.


Airframe and Operation



The aerial vehicle chosen is the DynaFlite Butterfly. The Butterfly is a modest performance sailplane fitted with an internal combustion engine for self-launching, as well as for sustained level flight in times of insufficient atmospheric lift. This air vehicle consists of a large wing (8 ft wingspan) based upon the Clark-Y airfoil. The Clark series airfoils are basic, flat-bottomed airfoils of moderate thickness. Such airfoils provide substantial lift at low speeds and gentle stall characteristics. The Clark series airfoils are favorites for R/C airplanes because the flat bottom lends itself to easy construction (no special jigs or fixtures needed - the wing can be built accurately upon the flat surface of the workbench). Also, their excellent flight characteristics at the low Reynolds numbers of sub-scale airplanes makes the Clark series a good choice for modelers. In addition, the wing is polyhedral, meaning the outboard third is set at a greater angle of dihedral than the inboard portion.  Polyhedral wings are typically used in airplanes that do not have ailerons, and use the rudder for roll control. With a polyhedral wing, displacing the rudder will cause yaw, which due to the polyhedral of the wing, will couple very strongly with roll, thereby causing the airplane to bank and turn. Also, when no turn is commanded, the polyhedral wing has a strong tendency to remain in wings-level flight, a desirable characteristic for an autonomous air vehicle.



Launching is accomplished simply by throwing the airplane into the air with some forward velocity and with the engine at a high power setting. The large wings support the airplane well at low airspeeds, and give adequate lift even at such low airspeeds. Since the air vehicle has no landing gear, landing is accomplished by (gently) sliding the airplane onto a grass runway surface at a low airspeed. Prior to landing, the engine is stopped with the propeller oriented horizontally.



The engine, a 0.20 cubic inch two-cycle, is used for launching and climb to altitude, where it is typically throttled to a low power setting. With a 4-ounce tank of fuel, this engine will continue to operate about 20 minutes, thereby keeping the Butterfly aloft even if there is not sufficient thermal lift. The fuel used is a mixture of methanol alcohol, lubricating oil, and nitromethane. While sounding very exotic, this type fuel is purchased at hobby shops and is typical for this type engine.


In this experimental air vehicle, the common electronic components of the R/C airplane (servos, batteries, charging jack and switch) have been relocated forward and aft of the central fuselage, leaving a generous empty volume for experimental equipment. The dimensions of the central fuselage are approximately 3 by 8 by 4 inches deep, and are located at the center-of-gravity of the airplane. This allows payload to be added without undue concern for fore-and-aft balance.



No testing has been done to determine the maximum payload capability of the air vehicle. However, given that the weight of the air vehicle, including fuel and required R/C equipment, is approximately 30 ounces, a rough guess at the payload capability would be at most 16 ounces. Such a payload is adequate for the Stamp with its batteries and various sensor circuits. The current circuit board, components, and battery weigh 3.5 ounces (100 grams).


Ground Testing


The cargo compartment of an R/C airplane is a high-vibration environment. The propeller, which can never be perfectly balanced, is a major source of vibration. In addition, a single-cylinder engine inherently causes vibration. Therefore, it is wise to test onboard circuitry before committing it to flight. The vehicle was placed on a platform and secured as little as possible to allow the airframe to vibrate as naturally as possible while the engine was operated throughout its' speed range. The airframe has distinctive points where vibration peaks (resonances). The engine was purposely operated at those points for 5 to 10 minutes each. No electronic components displayed adverse effects from the ground testing, and on that basis the vehicle was cleared for flight testing.


Flight Testing


The model airplane used for this project had been flown extensively for entertainment over the past several years. Therefore, the flight characteristics of the airplane were well-understood prior to conversion to robotic operations.


To date the air vehicle has been flown successfully several times with all the robotic equipment installed and operating.


The imposition of the Stamp in the control system is almost transparent to the pilot as concerns flight characteristics. That is to say, the airplane flies with the Stamp controlling the rudder in a very similar fashion to “pure” R/C control. However, with the current software, the relationship of transmitter stick movement to rudder movement is more pronounced. Rudder deflection is linearly related to stick movement, but with the current program full deflection of the rudder is reached prior to full stick deflection. Therefore, small rudder corrections require less stick movement. This characteristic is easily compensated by adjustment to pilot technique.


Preflight operations with the prototype circuits are somewhat more complex. Concern must be given not only to battery life of the “flight pack” that powers the servos, but also to the health of the 9V supply for the stamp. (Battery failure in flight typically results in loss of control of the airplane.) Also, routine recreational R/C flying does not typically require access to a laptop PC at the flying field. In the current state of the project (telerobotic control only), integrity of the software can be checked by visually observing the control surfaces moving in concert with movement of the control sticks on the transmitter. In one case, the preflight check prior to the first flight of the day resulted in discovery of a non-flight program loaded in the Stamp. The PC was needed to load the correct program. (Careful preflight is essential!) Once autonomous operation is commenced, preflight of the software will undoubtedly be much more complex as well.


Lessons Learned


Ø       Good to use an airplane with predictable and understood flight characteristics

Ø       Make a checklist of equipment to take to the field – a robotic airplane needs lots of support equipment and you will probably forget something critically important.

Ø       Good to use a servo controller chip – frees the microcontroller to multi-task  (more powerful microcontrollers may not need a servo controller chip).

Ø       Take your time – don’t get rushed when at the flying field. Think first, then fly.

Ø       Fly on good-weather days only (better weather than what would be tolerated in recreational flying). In rough air it is difficult to see whether the airplane is responding to control inputs or to turbulence.

Ø       BattleBots pales compared to making an autonomous aerial vehicle that operates in 3-D space.

Ø       Connecting a PC to your airplane at the flying field does tend to draw interest from fellow pilots. Be prepared to give an enlightening description of the project. Support comes from unexpected places.

Ø       Airplanes are interesting things. They do not act as predictably as wheeled robots because they are operating (actually, floating) in a fluid.

Ø       Alpha, Beta, and Gamma-test the software before committing to flight. Make the software work in ways you wouldn’t expect it to – I found complete servo reversal at the extreme ends of servo travel; an unexpected event that would have been disastrous in the air.


Future Plans


Need to make sensors and software for Autonomous operations. This aerial vehicle is ready for advanced applications.

Currently in work is a simple “Sol Sensor” using two photoresistors to “see” where the sun is, and provide steering commands to track relative to the sun. This sensor is to be mounted on a servo, allowing tracking on any given track relative to the sun. (i.e. travel with the sun off the left wingtip, straight ahead, off the right wingtip, etc.)


Note to Roboticists:

I am open to proposals for additions to this project. What I have now is a fairly robust vehicle that needs the ability to sense the environment and operate autonomously. If this is of interest to you, please send your proposals. I will carefully evaluate all submittals.



Appendix A - Program Code


'Program: ABot.V2: version 2 of the program for the aerial robot. This is the initial program which throughputs the commands from the transmitter directly to the servos without modification. The Gear switch on the transmitter is used to give permission to switch to program AUTONOMOUS.


'{$Stamp BS2SX,Autonomous}                      ‘Autonomous program will be used in the future


'Pin assignments:

'pin 8           FT639 com line

'pin 7           input from RX ch 4(rudder)

'pin 5           input from RX ch 5(gear)

'servo 2       rudder servo


permission  var        word:    ruddinput           var        word:    Position            var        word

Lbyte          var        byte:     Ubyte                var        byte:     interim  var        word

RX5in          con       5:         RX4in                con       7


'These constants are used by the FT639

pin              con       8:         baud                 con       17405:  header con       103

pulse          con       90


gosub setup                        'these steps initialize the FT639

gosub setpulse                    '

gosub setheader                  '

gosub setactive                    '


‘The following subroutine first checks to see if the “gear” switch has been changed. Then, it reads the length of the square-wave pulse from the R/C receiver. The time value of the pulse is converted arithmetically to a number between 0 and 128. This position number is then split into two 4-bit nibbles and sent to the FT639 chip (all this is just to create the required syntax for the FT chip).



Pulsin RX5in,1,permission

If Permission < 1900 then Autonomous                ‘1900 is a safe value for a mid-point (if the value is less than 1900, then the gear switch has been moved to the “autonomous” position).

Pulsin RX4in,1,ruddinput                                     ‘measure the rudder command from the pilot

Position =(ruddinput - %10010111010)/%1000      'subtract 1210,divide by 8 to make a number ‘between 0 and 128

Interim = Position & %00001111                         'keep last 4 bits

Lbyte = Interim | %00010000                               'create lower nibble for servo 2 (0001 means “lower nibble for servo 2” in FT639-speak

Interim = Position & %11110000                        

Ubyte = (Interim >> 4) | %10010000                    ‘create upper nibble for servo 2 (1001 means “upper nibble for servo 2” in FT639-speak

Serout pin,baud,[Lbyte,Ubyte]:pause 10               'sends command to FT639

goto check



debug "going to program 1"         ‘currently there is no program 1 for autonomous operation so there is no branch to that program



'* * * Subroutines * * *

setactive:          serout pin,baud,[117]:return                    'sets active mode

setup:         serout pin,baud,[122]:return                    'sets setup mode

setpulse:     serout pin,baud,[pulse]:return                  'sets pulse length

setheader:   serout pin,baud,[header]:return                'sets header length


Appendix B


Description of servo position commands:


Standard R/C servos operate upon the command of a square-wave. The length of the wave tells the servo which position to assume. A standard R/C transmitter with its’ receiver provide this square-wave input to the individual servos. Each servo is on a separate channel (frequency), and can therefore be controlled independently. The square wave length (actually the time the wave is “high”) varies between a duration of 1 millisecond to 2 milliseconds. At a duration of 1 ms the servo will assume a position at one extreme end of its’ travel. At the other extreme of 2 ms the servo will travel to the opposite extreme of travel. Therefore, a square-wave input of 1.5 ms will command the servo to position its’ output arm to the mid-position. These square-ware pulses are delivered to the servos approximately every 30 ms. A servo controller chip can maintain these pulses even while the microcontroller is busy with other activities. The microcontroller only needs to send a command to the servo controller when a change is required. You may conclude that a servo can reposition its’ output arm every 30 ms or so. In practice, this is quickly enough to provide accurate control of a model airplane’s control surfaces. During critical times of flight (such as during approach and landing) a microcontroller needs to provide new position commands to the servo controller at least every 30 ms.