[previous] [index] [next]

Example 8: Radio-Controlled Airplane Servomotor Control

This example demonstrates the control of a pair of radio-controlled (RC) airplane servomotors via the parallel port. The motors used are Futaba S3003 motors, but the protocol is standard and works with most RC servomotors.

Futaba S3003 RC Servo with a 3-wire interface. The red wire is power, 4.8V to 6V; the black wire is ground; and the white wire is the signal, 0- to 2 millisecond pulses 20 milliseconds apart.

The parallel port can't drive this motor directly. Use a Darlington pair line-driver chip, e.g., ULN2003. Connections, parallel port (PPT) to ULN2003:

PPT pin 2 to ULN2003 pin 1, PPT pin 3 to ULN2003 pin 2

ULN2003 pin 8 to ground, pin 16 to 20 K-ohm to +5V, pin 15 to 20 K-ohm to +5V

Futaba red wires to +5V, black to ground, first motor's white to ULN2003 pin 16, second motor's white to ULN2003 pin 15

Refer to the commented real-time source code and the commented application source code for the details.

Principle of Operation

Running the Demo

To run the demo, change to the 'ex08_rcservo' subdirectory of the top-level tutorial directory, and run the 'run' script by typing
./run
Alternatively, change to the top-level tutorial directory and run the 'runall' script there by typing
./runall
and selecting the "RC Servo Motors" button.

A small GUI will pop up, with sliders that let you change the positions.

See the Real-Time Task Code

See the Linux Application Code


Next: Example 9, LED Wand Clock

Back: Example 7, Semaphores