Moving Motors

Moving motors with your PC computer requires a couple basic devices that can channel signals from your PC to your motor platform. There are many solutions to creating movement via control of your personal computer so only the most common technique is discussed. With a few modifications this platform can also be used to control any generic DC based motor.

The motor control solution is based on a PC type computer (either a desktop PC, buiscuit board, PC104, etc.) which communicates via serial to a servo controller which then generates the needed PWM signals to one or more servos.


RC based servos are recommended as they are quite reliable, somewhat cheap ($20-$100), easily purchased and well supported amoungst the hobbiest RC and Robotic communities. Servos are special motors that can be commanded to move to a particluar orientation based on a special electronic signal referred to as PWM or "Pulse Width Modulation". This electronic signal is continiously sent to the servo to ensure the servo maintains its position. To move a servo to another orientation the width of the 'on' pulse is increased or decreased accordingly. Note that this PWM signal is NOT compatible with serial, parallel or USB type connections that are typically associated with your desktop computer.

Servo Position

Servos are not sensors. They cannot 'tell' what position they are currently in. When servos are powered up it is the servo controller's responsibility to send a default position to the servo. This is needed to ensure that before any application begins using the servos that they are in a known position. However, if a servo fails to move to a desired orientation there is no feedback mechanism that is returned to the servo controller or the controlling PC that a failure has occured. Servos are write only devices.

To bridge the gap between a PWM signal and your PC serial signal an additional device is needed. This device is typically called a servo controller and is sold by several manufactors including Parallax which provides a controller for around $40.00 that accepts serial commands from your computer (or other embedded CPU type device) and can control up to 24 seperate servos. For most applications that are used to drive a mobile robot only 2 servos are required. For more advanced robotic applications such as humaniod robots many more servos are required.

Most servo controller cards understand a simple command based language used to perform basic tasks such as moving servos, setting the serial baud speed, or detecting that the board exists and is connected. The PC connected via serial to a servo controller board needs to send these appropriate signals to the servo controller card in order for the card to understand what to do. If your PC is not running an application that is written to specifically send the appropriate commands the card may indicate serial activity is occurring (by blinking an led light) but the card will not understand the signal being sent and therefore remain inactive.

Incremental Servo Movement

Moving Servo's relative to their current position requires a servo controller or PC based program that can add or subtract to the current servo position value. This position value is maintained in the servo controller or in your PC based servo program. The controller will always send an absolute value to the servo. The relative servo movemement will have to maintained by the servo controller or PC program.

Servo Modifications

A simple way to provide locamotion is to use a servo directly as motors. This provides a convienient way to create a mobile based platform without having to work with an additional power system. Servos that are used for this purpose have to be modified to allow for continious rotation. This involves removing the servo case and tweaking some of the hardware. These modifications can be used to create a variable speed servo motor. See Seattle Robotics Article for more information about these modifications.

Electronic Speed Controls

Servos are easy to use when it comes to needing a device to perform some form of movement based on a PC command. However, using servos for robot locamotion can have some drawbacks such as low speed and low strength. Instead of changing the platform of serial and PWM control signals you can use the RC based electronic speed controls that accept PWM signals to regulate the amount of current permitted through the device. Thus it is possible to control a large amount of current using lower current PWM control signals. This current seperation also reduces feedback from DC motors connected directly to the CPU or control system current. Electronic speed controls allow a PWM based platform to control higher current systems without replacing all components.

Servo Commands

Servos have a range of 360 degrees. This range is typically represented by a 0 to 255 number. Thus each increment of a servo position moves the servo in 1.44 degree increments. Programs that use a servo controller card will send a single position number from 0 to 255 to represent the desired position. 128 is considered the middle or default position.

Mapping Sight To Movement

In order for you to move a servo in correspondence to a visual image you need to determine how you will map an image artifcat to servo 0-255 numeric ranges. Most images have thousands of pixels/numbers while to move a robot only requires a left and right (or two) motor values. The reduction in numbers is quite large but working with images you should quickly see that usually more information is available than actually needed.

An example in reducing an image to motor values is an images COG or Center of Gravity. The COG specifies an X value that indicates the position of the center of gravity of an image. This is a single number that can be used to map from screen coordinates (0-320 in RR) to servo ranges (0-255).

RoboRealm Support

Several controller boards exist that can be used to control PWM based servos. RoboRealm has serval modules used to control servo contoller boards (including Parallax) and has been written to speak their language. Unlike device drivers that are current distributed with hardware device manufactures there is no standard technique or language when communicating with servo controller cards. Drivers for servo controller cards have to be written for each type of card.