servo2008 07

84
0 7> Vol. 6 No. 7 SERVO MAGAZINE ROBOTICS HISTORY ENCODER MATCHING BIG MAMA GEAR MOTOR CES ROUNDUP July 2008

Transcript of servo2008 07

Page 1: servo2008 07

07>

Vol. 6 N

o. 7

SERV

OM

AG

AZIN

ERO

BOTICS H

ISTORY

•EN

COD

ER M

ATCH

ING

•BIG

MA

MA

GEA

R M

OTO

R•

CES ROU

ND

UP

July 2008

Cover.qxd 6/4/2008 7:36 PM Page 1

Page 2: servo2008 07

Let your geek shine.Meet Leah Buechley, developer of LilyPad—a sew-able microcontroller—and fellow geek. Leah used SparkFun products and services while she developed her LilyPad prototype.

The tools are out there, from LEDs to conductive thread, tutorials to affordable PCB fabrication, and of course Leah’s LilyPad. Find the resources you need to let your geek shine too.

©2008 SparkFun Electronics, Inc. All rights reserved.

»Sharing IngenuityS P A R K F U N . C O M

Full Page.qxd 3/5/2008 4:10 PM Page 2

Page 3: servo2008 07

Free Book with Kit

Full Page.qxd 6/2/2008 11:33 AM Page 3

Page 4: servo2008 07

Features28 BUILD REPORT

Apollyon

30 MANUFACTURINGHigh-Performance Drill Motor Modification

32 PARTS IS PARTSMag Motor Upgrades and Repairs

Events33 Results and Upcoming Competitions

Robot Profile31 Billy Bob

06 Mind/Iron

07 Bio-Feedback

22 Events Calendar

24 Robotics Showcase

26 New Products

70 Robo-Links

71 SERVO Webstore

81 Advertiser’s Index

Columns08 Robytes by Jeff Eckert

Stimulating Robot Tidbits

12 GeerHead by David Geer

Lewis, the Robot Photographer

16 Ask Mr. Roboto by Dennis Clark

Your Problems Solved Here

58 Twin Tweaksby Bryce and Evan Woolley

There’s a New Humanoid on the Block

64 Robotics Resources by Gordon McComb

Stocking Up with Surplus Electronics

67 Different Bitsby Heather Dewey-Hagborg

Random Bits

74 Appetizerby Kym Graner

Dusting Robots

77 Then and Now by Tom Carroll

Robotics — A Historical Perspective

PAGE 12

4 SERVO 07.2008

THE COMBAT ZONE ...

Dep

artm

ents

TOC Jul08.qxd 6/4/2008 3:41 PM Page 4

Page 5: servo2008 07

07.2008VOL. 6 NO. 7

SERVO 07.2008 5

34 CES 2008 Robot Roundupby Ted LarsonThe annual Consumer Electronics Show does not disappoint with itscoverage of robotics in theTech Zone.

39 Encoder Matchingby Robert DoerrScaling and inverting encoder values to fit your particular application.

44 Big Mama Gear Motorsby Fred EadyLearn what it takes to design, build,and code a heavy duty DC motordriver module.

50 Loki Crosses the Pond — Part 2by Alan MarconettThis final installment examines the QwikFlash controller board and the software that runs Loki.

SERVO Magazine (ISSN 1546-0592/CDN Pub Agree#40702530) is publishedmonthly for $24.95 per year by T & L Publications, Inc., 430 Princeland Court, Corona,CA 92879. PERIODICALS POSTAGE PAID AT CORONA, CA AND AT ADDITION-AL ENTRY MAILING OFFICES. POSTMASTER: Send address changes to SERVOMagazine, P.O. Box 15277, North Hollywood, CA 91615 or StationA, P.O. Box 54,Windsor ON N9A 6J5; [email protected]

PAGE 44PAGE 39

PAGE 34

Features & Projects

TOC Jul08.qxd 6/4/2008 3:42 PM Page 5

Page 6: servo2008 07

Published Monthly By T & L Publications, Inc.

430 Princeland CourtCorona, CA 92879-1300

(951) 371-8497FAX (951) 371-3052

Webstore Only 1-800-783-4624www.servomagazine.com

SubscriptionsToll Free 1-877-525-2539

Outside US 1-818-487-4545P.O. Box 15277

North Hollywood, CA 91615

PUBLISHERLarry Lemieux

[email protected]

ASSOCIATE PUBLISHER/VP OF SALES/MARKETING

Robin [email protected]

EDITORBryan Bergeron

[email protected]

CONTRIBUTING EDITORSJeff Eckert Tom CarrollGordon McComb David GeerDennis Clark R. Steven RainwaterFred Eady Kevin BerryRobert Doerr Ted LarsonAlan Marconett Kym GranerBryce Woolley Evan WoolleyHeather Dewey-Hagborg Nick MartinMike Jeffries Bryan Ruddy

CIRCULATION DIRECTORTracy Kerley

[email protected]

MARKETING COORDINATORWEBSTORE

Brian [email protected]

WEB CONTENTMichael Kaudze

[email protected]

PRODUCTION/GRAPHICSShannon Lemieux

Joe Keungmanivong

ADMINISTRATIVE ASSISTANTDebbie Stauffacher

Copyright 2008 by T & L Publications, Inc.

All Rights ReservedAll advertising is subject to publisher’s approval.We are not responsible for mistakes, misprints,or typographical errors. SERVO Magazineassumes no responsibility for the availability orcondition of advertised items or for the honestyof the advertiser.The publisher makes no claimsfor the legality of any item advertised in SERVO.This is the sole responsibility of the advertiser.Advertisers and their agencies agree toindemnify and protect the publisher from anyand all claims, action, or expense arising fromadvertising placed in SERVO. Please send alleditorial correspondence, UPS, overnight mail,and artwork to: 430 Princeland Court,Corona, CA 92879.

Small is Big

When it comes to robot

components, small is big. If you’ve

followed the robotics news lately, you

know that academic and military

R&D communities are busy at work

developing robots that mimic – in

form and function – small crawling

and flying insects. Need to locate

survivors in the rubble of a collapsed

building? Simply release a swarm of

heat-seeking crawling robots that can

squeeze through cracks without

disrupting the rubble and

endangering trapped victims. Need

an up-close view of a hostage

situation? A swarm of flying

microbots with photosensors could

provide police with a composite,

real-time image of the victims and

their captors.

Despite ongoing advances in

research laboratories, there are

numerous challenges that must be

overcome before practical

autonomous insect swarms can

become a reality. There are issues

of how to provide communications

between each insect-sized robot and

their human masters, local

computation, sensors, power, and

of course, powerful, lightweight,

controllable micromotors. And there’s

the underlying issue of cost.

A recent advance in the area

of micromotors has been the

commercial availability of linear

micromotors from New Scale

Technologies (www.newscaletech.

com). Their series of Squiggle motors

fills the void between the microscopic

nanomotors and the miniature servos

and electronic/pneumatic linear

actuators popular among robotics

enthusiasts.

I had the opportunity to evaluate

New Scale’s mid-sized offering — the

Squiggle SQL-1.8-6 linear motor —

shown in the photo. As the name

suggests, the motor is a mere 1.8

mm in width. The rectangular motor

body is 6 mm long, with a 12 mm

axial screw running through its

center. The 160 milligram SQL 1.8 is

capable of handling a 30 g load

when driven by a 400 mW, 40V, 171

kHz pulse. The even smaller SQL 1.5

linear motor can work with a 20 g

load. As illustrated in the photo, the

electrical connection to the Squiggle

motor is via a flex printed circuit

strip.

With a PC-based control

application and USB-to-Squiggle

interface, I was able to vary the travel

rate from micrometers per second to

millimeters per second, with an

impressive 0.5 micrometer resolution.

Although the relatively fragile motor

was glued to a polycarbonate mount

Mind / Iron

by Bryan Bergeron, Editor

Mind/Iron Continued

6 SERVO 07.2008

Piezoelectric Squiggle micro motor onpolycarbonate mount shown next to a six-pin DIP for size comparison.

Mind-Iron Jul08.qxd 6/4/2008 2:22 PM Page 6

Page 7: servo2008 07

for evaluation purposes, I could easily envision a

spider-sized eight-legged walker, powered by 16

skeleton-mounted Squiggles.

The size of the peripherals that accompanied the

motor — a wall wart power supply, a USB driver card, and

a three-foot USB cable — not to mention the desktop PC

and software — explains why the robotics shops aren’t

offering autonomous robots sporting Squiggle-based

grippers and actuators. Even a six-pin DIP dwarfs the

Squiggle, much less a PIC or BASIC Stamp. However, the

control issue should be partially solved by the time you

read this. New Scale has a miniature ASIC driver under

development that could form the heart of a Squiggle

spider robot.

Power issue is another matter. The smallest battery

packs that I’ve used are thin-film lithium-polymer cells

designed for miniature indoor R/C aircraft. The thin,

dime-sized cells power a single-motor aircraft for about

five minutes. As such, an autonomous eight-legged

Squiggle spider would likely have a lifespan measured

in seconds with current battery technology. Even so,

in some applications, 20-30 seconds of operation

could be worth the cost of a swarm of insect-sized

microbots.

On the topic of microsensors, with the exception of

Hall-effect devices, I haven’t seen any commercial sensor

offerings that come close to the level of miniaturization

required for an insect-sized microbot. I’d like to have an

affordable ultrasonic or IR rangefinder comparable in

relative size to the Squiggle. However, consider the

challenge in creating a suitable IR rangefinder with

standard components. A typical IR LED alone is about the

size of an insect’s head. And the available ultrasound

rangefinders require even more volume. Clearly, when it

comes to microsensors for autonomous microbots, it’s time

for a new generation of SMT devices.

Although autonomous microbots made completely of

commodity — read affordable and readily available —

components may be a few years away, there are myriad

applications of micromotors in other areas of robotics. The

most obvious applications range from the manipulation of

camera optics and R/C mini helicopter control surfaces, to

control of microvalves in implantable drug delivery devices

to surgical robots. Although I expect to see the first

large-scale applications of micromotors in the consumer

electronics industry, the medical applications will likely

have the most profound effect on quality of life.

Consider that current surgical robotics rely on

standard-sized motors connected to scalpels and other

instruments through cables. Although these robotic

systems enable surgeons to operate with greater efficiency

and effectiveness than traditional methods, because of the

physical arrangement of cables and instruments, the

working area is constrained to only a few inches across.

The use of micromotors connected directly to instruments

would allow for a much larger work area for tele-surgeons,

as well as lighter, mechanically simpler surgical robots. Size

and weight can be critical factors if the remote patient

happens to be an astronaut on Mars, or a critically injured

US soldier in a remote area of the world. SV

SERVO 07.2008 7

Dear SERVO:

The “analog” servo block diagram, Figure 5, of the

Servo Buddy article in May 2008, is missing the velocity

feedback path from the motor to the local pulse

generator. Without this damping feedback, the servo will

oscillate. After the stretched drive pulse has ended, the

motor back EMF is used to modify the next local pulse.

In servos that use the NE544 IC, this feedback is from

pin 9 to pin 1 via a resistor. For the NJM2611 IC, from

pin 11 to pin 15.

It is interesting to note that years ago what is

now called an analog servo was called a digital servo.

Back then, an analog servo required an analog VOLTAGE

input.

— William J. Kuhnle

RESPONSE: While I tried to keep the diagram simple,

it might have been good to include that. Thanks for

pointing it out.

— Jim Stewart

SchmartBoard Is Looking forBeta TestersNew Website will be Social Networkfor Electronics Enthusiasts

SchmartBoard is looking for people to beta-test a soon

to be opened web space call Solder By Numbers™.

The website, which is due to launch in late summer,

will be a social network for electronics enthusiasts.

SchmartBoard is looking for all levels of testers from

professional engineers to novices who have an interest

in electronics. They are looking for people from around

the world.

According to SchmartBoard’s VP of Sales &

Marketing, Neal Greenberg, “SchmartBoard is not yet

ready to reveal specific details about the website,

except that it is web 2.0 for electronics enthusiasts.

Solderbynumbers.com will be a place to design and

build your electronic circuits while you create a worldwide

network of peers. The site will be much more than a

social network. It will be a place to collaborate, create,

communicate, and learn.”

To sign up to be a beta-tester, go to www.solder

bynumbers.com.

Mind-Iron Jul08.qxd 6/4/2008 2:23 PM Page 7

Page 8: servo2008 07

8 SERVO 07.2008

The Vulture Seldom ComesHome to Roost

On a more celestial level, DARPA

is also funding a competition to

develop an unmanned aerial vehicle

that will shatter endurance records.

The bird will draw 5 kW of power,

carry a 1,000 lb (450 kg) payload,

stay aloft for at least five years, and

remain in its assigned airspace 99

percent of the time while fighting

winds encountered at operating

altitudes, reportedly ranging from

60,000 to 90,000 ft (18,000 to

27,000 m). The goal is to provide

long-term intelligence, surveillance,

reconnaissance, and communication

missions over locations of interest.

Contractors for phase one are

Aurora Flight Sciences (www.aurora.

aero), Boeing (www.boeing.com),

and Lockheed Martin (www.lock

heedmartin.com). A variety of

propulsion approaches — including

solar and internal combustion — will

be considered; however, nuclear and

lighter-than-air designs have been

ruled out. The winning design must

comply with space — not aviation —

industry standards, because only a

“pseudo-satellite” will handle the

demanding requirements. A supervi-

sory engineer at NASA observed,

“What you don’t want to build is a

fragile, expensive pain in the butt.”

The Aurora offering will be based

on its “Odysseus”

design, which uses solar

power during daylight

hours and stored energy

at night. It combines

three “constituent

aircraft” in a 500 ft

(150 m), intriguing

Z-wing configuration.

Boeing is expected to

field a design based on

the existing British-built

Zephyr high-altitude,

long-endurance UAV,

from partner QinetiQ

(www.qinetiq.com).

Lockheed Martin is still

mum on the subject.

The competitors have 12 months

to come up with their initial designs

for DARPA review. Phase two will end

with a three-month flight test of a

subscale demonstrator, and the final

phase will require a 12-month test of

a full-scale vehicle.

Mini Network BotsAlso pulling down government

funding — in this case, up to $3

million over three years from the

Defense Advanced Research Projects

Agency (www.darpa.gov) — is

iRobot (www.irobot.com). Under

the grant, the company will develop

the LANdroid robot, a portable com-

munications relay device. According

to the contractor, “This robot will be

small enough that a single dismounted

warfighter can carry multiple robots,

inexpensive to the point of being

disposable, robust enough to allow

the warfighter to drop and throw

them into position, and smart enough

to autonomously detect and avoid

obstacles while navigating in the

urban environment.”

The objective is to enable

networking in urban areas where

buildings and other pesky objects

can block wireless operations. In

operation, each of the little guys will

wander around until it finds a good

spot to function as a node and then

join the rest of the swarm to form

the network. If one is destroyed, the

others will adjust their positions to

keep the system up and running.

New Touch TechnologyOne of the perennial problems in

robotics is improving the machine’s

Aurora’s Odysseus design:A possibleconfiguration of the Vulture UAV.

Photo courtesy of Aurora Flight Sciences.

Sneak peak at what the LANdroid robot will look like. Photo courtesy of DARPA.

by Jeff EckertRobytes

Robytes.qxd 5/29/2008 2:20 PM Page 8

Page 9: servo2008 07

sense of touch, and what could be a

better way to solve it than to learn

from our touchy-feely friend, the rat?

Enter BIOTACT (BIOmimetic Technology

for vibrissal ACtive Touch, www.

biotact.org), a project funded by the

European Union and involving nine

research groups in seven countries.

The goal is to emulate how such

mammals as rats and Etruscan shrews

can rapidly sweep their whiskers

back and forth to gather information

about their surroundings. Thus, a bot

fitted with hundreds of whisker-like

sensors may be able to seek, identify,

and track fast-moving target objects,

even in poorly lit places where machine

vision doesn’t get you anywhere.

The challenge is to develop new

biomimetic computational methods

and technologies that enable the

technology. But the consortium

has been granted four years and

$11.6 million to do it, so the odds

look good.

Showcase of RobotendersIt’s beginning to look like the

Germanic tribes have a curious

fetish about linking robotics with

such ostensibly unrelated fields as

sociology, philosophy, and art (see

last month’s Robytes). In this vein, the

upcoming 10th anniversary of the

RoboExotica conference recently

came to light. According to the

event’s Vienna-based

creator (www.robo

exotica.com), “Until

recently, no attempts

had been made to

publicly discuss the

role of cocktail

robotics as an index

for the integration

of technological

innovations into the

human Lebenswelt

[environment], or

to document the

increasing occurrence of radical

hedonism in man-machine

communication.” Imagine that.

But you can stop worrying, because

“RoboExotica is an attempt to fill

this vacuum.”

RoboExotica generally consists

of a series of events (exhibition,

conference, workshops, music, and

film presentations) held at various

locations in Vienna. But this year,

sometime after the December 4th

kickoff in Austria, it will be presented

in San Francisco, as well, “thus

facilitating the already existing

exchange of ideas between the West

Coast’s very much alive technology/

art scene and the RoboExotica

mother ship in Vienna.”

Unfortunately, the US incarnation

will not include the annual cocktail

robot awards, where you can enter a

machine in one of five categories:

serving cocktails, mixing cocktails,

bartending conversation, smoking

culture, and other achievements in

the sector of cocktail culture. To

participate, you’ll have to show up at

the Rote Bar/Volkstheater Wien

(www.volkstheater.at/rotebar

.html). The program is still under

development, so check the website

from time to time for details.

Bot Assists Endoscopy

This month’s device for taunting

the squeamish is EndoAssist, a robotic

endoscope manipulator offered by

Prosurgics Ltd. Used in invasive

thoracic and abdominal surgery, it is

particularly useful for ardiothoracic,

urological, bariatric, ob/gyn, and

general surgery. Perhaps the most

interesting feature is that the surgeon

controls camera angles simply by

moving his head. Glance left, and the

camera moves left, and so on. You

Robytes

Artist’s concept of the “ScratchBot”employing the BIOTACT sensor.

Photo courtesy of the BIOTACT project.

The EndoAssist robotic manipulator.Photo courtesy of Prosurgics.

A contestant from RoboExotica 2007.Photo courtesy of Roboexotica.com.

SERVO 07.2008 9

Robytes.qxd 5/29/2008 2:23 PM Page 9

Page 10: servo2008 07

can also pan, zoom, or modify the

view in any direction. For a video

demonstration that may affect your

ability to keep lunch down, visit

www.prosurgics.com/prosurgics_

endoassist.htm.

Uribot Tends Kobe AirportFinally, the strangest application

of robotics of late would be Dasubee,

a bot designed specifically to clean

urinals. One is already operating in

the Kobe, Japan airport. An astute

observer will note that it resembles

an elephant. Designer Susumu Kanai

revealed that this design was inspired

by the pachyderm’s trunk, which

resembles the powerful water cannon

employed by the bot. The ears are

handles, the eyes are the start and

stop buttons, and its little yellow hat

is the filler cap for the 13 gal (50 l)

tank. Reportedly, using

specially developed

antibacterial detergent,

Dasubee can shine up

a fouled privy in only

10 seconds.

If you’re still

reluctant to buy one,

consider that Kanai

has included “a

vacuum function to

breathe in a scraper

and the water of the

floor to be able to

wash the dirt scattered

to the floor together

on the function side.”

(Something may have

been lost in the

translation.) You can

pick one up for only

one million yen (about

$9,500). SV

Robytes

10 SERVO 07.2008

Dasubee, the urinal bot and its proud operator.Photo courtesy of Impress Watch Corp.

Perform proportional speed, direction, and steering withonly two Radio/Control channels for vehicles using two

separate brush-type electric motors mounted right and leftwith our mixing RDFR dual speed control. Used in manysuccessful competitive robots. Single joystick operation: upgoes straight ahead, down is reverse. Pure right or left twirlsvehicle as motors turn opposite directions. In between stickpositions completely proportional. Plugs in like a servo toyour Futaba, JR, Hitec, or similar radio. Compatible with gyrosteering stabilization. Various volt and amp sizes available.The RDFR47E 55V 75A per motor unit pictured above.www.vantec.com

STEER WINNING ROBOTS

WITHOUT SERVOS!

Order at (888) 929-5055

Robytes.qxd 5/29/2008 2:24 PM Page 10

Page 11: servo2008 07

Full Page.qxd 6/3/2008 11:06 AM Page 11

Page 12: servo2008 07

12 SERVO 07.2008

When Lewis the Robot

Photographer first enters a

crowded room, it gets atten-

tion. But, once people have adjusted

to its roaming around, looking here

and there, they forget all about it.

After all, it’s just a machine, another

object in their environment.

Lewis’ ability to blend in keeps

it from creating the kind of

apprehension that comes with a

live photographer who roams around

snapping candid pictures of people

(as a wedding photographer might

do, for example).

Because Lewis captures people at

ease, it can take a much higher quality

of photos — no blinking, phony smiles,

or stiff or awkward poses. Because

Lewis recognizes faces and quickly

snaps only the best photos, it takes

many more quality pictures in the

same period at gatherings, functions,

and on special occasions.

Looking for Faces

Lewis starts by scanning the room

for pairs of what appear to be legs.

This way, he can identify people and

then look up to find and identify

their faces. Then, Lewis uses face-

recognition technology that identifies

parts of images with lots of skin tones

grouped closely together.

Lewis separates real faces from

things that may look like faces to the

robot eye. Lewis eliminates anything

that is too big, too low, or the wrong

shape. Anything left is assumed to

be a face.

Lewis can take front-on and side

angle pictures of people. It continually

scans images for the criteria that

predict a face or group of faces. Once

it has detected a suitable image, it

adjusts the camera to take a quality

photo, moving it into position via

a series of zooming, tilting, and

panning.

The robot uses object avoidance

technology to guide itself around

objects and people, and maintains its

position within the mass of subjects

by recognizing a given object and

centering itself in the group based on

the position of that object.

Forming Pictures

How does Lewis form pictures of

faces? By following rules. One such

rule is the rule of thirds. The rule of

thirds says that if you split a picture

into thirds, first horizontally, then also

vertically, the primary point of visual

interest in the photo should be where

the lines cross. Lewis makes human

faces the points of greatest interest,

placing them at these cross points.

Contact the author at [email protected] David Geer

Lewis, the RobotPhotographer

At first brush, a robot that snaps people’s pictures might not imbue the mind with

a novel image. But, a photographer that sets its subjects at ease, circumvents their

shy and self-conscious natures and related facial reactions, and captures the essence

of the subject unawares, now that’s a wonder to see!

Full side view of Lewis.

Geerhead.qxd 5/30/2008 10:07 AM Page 12

Page 13: servo2008 07

Photographers try to avoid empty

space in their photos. This helps

ensure that photos contain as much

relevant visual information as possible.

Lewis weighs the rule of thirds and

the rule around empty space one

against the other whenever they

conflict, to take the best pictures.

Lewis can also think for himself

when taking photos. He is free to

break the rules altogether and take

feedback about his images. He uses

this information to learn which rules

to break and when in order to deliver

great photos based on a sort of

photographic instinct.

Live Test

Researchers tested the Lewis

robot photographer on a group of

5,000 subjects over a period of 40

hours. Lewis took 3,000 pictures in

that period. During this 40 hour run,

people (guests at a large technology

event) either ignored the robot

completely or tried to interact with it.

Because the robot wasn’t instilled

with the ability to interact, people

quickly dispensed with it and began

socializing with other people in

the crowd. Because people ignored

the robot, they relaxed and acted

naturally, enabling the robot to take

candid, natural pictures.

Results

Among other things, researchers

determined that the robot should

have a sort of bi-modal capability. If

someone is trying to interact with it,

it should stop what it is doing and

interact with those people, taking

their pictures where possible. If no

one is trying to interact with the

robot, it should blend into the

background and continue to take

candid shots. This version of the robot

is only capable of blending in. So, the

robot will ignore people who want to

interact with it or who specifically look

to have their picture taken.

People will be more likely to

interact with the robot on some level

if they know what it is up to. What’s

it there for? In this version

of the robot it made a noise,

sounding an alarm or signal

when it had taken a picture. However,

the sound wasn’t loud enough for

most people to hear.

If the signal were louder, this

would communicate to people in the

robot’s proximity that it had just taken

a picture. This would form some level

of communication between the robot

and those people, and provide some

simple basis for interaction.

The robot had no way of telling

people to hold still or say cheese. It

took four seconds for the robot to line

up shots, in which time people might

hold still to get their picture taken, or

they might move around. After the

robot’s test run, people suggested

that the robot actually say cheese or

show a picture of a “birdie” (as in,

look at the birdie) to signal that it was

about to take a picture.

People waiting in front of the

robot hoping to have their pictures

taken were often disappointed when

the robot was navigating, getting its

bearings, or homing in on a landmark

instead of taking pictures at that

particular moment. However, the

Sharing a more whimsicalmoment with Lewis are members of the Media andMachines Lab (from left):Assistant Professor WilliamSmart; Assistant Professor CindyGrimm (seated): two of thelab’s founders, ShannonLieberg, Engineering Class of ‘04and research assistant MichaelDixon, B.S./M.A. ‘03; and NikMelchior, a fifth year B.S./M.S.student in computer scienceand engineering. Members areshowing off the “playful props”used by Lewis in the lab.

Lewis close-up head shot with camera. Lewis has workedphotographing at a real live

wedding reception.

SERVO 07.2008 13

GEERHEAD

Geerhead.qxd 5/30/2008 10:10 AM Page 13

Page 14: servo2008 07

14 SERVO 07.2008

robot was programmed to take

frequent pictures of human faces even

when it may not have had the

opportunity to focus in for a good

picture. To better interact with

subjects, the robot should have the

ability to communicate which mode or

“state” it is in to the subjects. So, if

the robot is available to interact, it can

communicate that, and so on.

Photographic subjects expected

the robot to respond when waved at,

like a human being would. However,

the robot didn’t have this capacity

either. When the robot did seem to

react — because it turned toward

someone by sheer coincidence when

someone had waved at it, for example

— people thought this meant it was

more intelligent than it actually was.

In particular, when the camera

pointed in their direction coinci-

dentally in response to trying to

hail the robot, this was mistaken

for eye contact.

Lewis seemed intelligent to

people when he did what

appeared to be a double take.

Because the robot face detection

code was not optimized, the cam-

era panned past the faces and

beyond by the time the software

determined it had detected a

face. The camera then returned to

focus on the face for the picture.

This apparent “double take”

humanized the robot in the eyes

of on-lookers, attracting people to

interact with the robot.

Likewise, other robot

behaviors made the robot appear

not so smart, even though these

behaviors were quite intelligent

for a robot in what they

accomplished. One such behavior

was looking at the wall (pointing its

camera toward the wall) or moving

along a wall in order to aid in its

navigation. While the robot was

trying to get its bearings, it appeared

not to “see” anyone around it, and so

looked dumb.

Conclusion

Continued research based on

Lewis should address whether Lewis

truly functions in two separate modes,

whether the level of sophistication of

the people interacting with Lewis has

an impact, and whether the robot or

the people around it should drive its

interaction. SV

Lewis, the Robot Photographerwww.cs.wustl.edu/MediaAnd

Machines/Lewis

The Media and Machines Labhttp://mm.cse.wustl.edu/about/

index.html

Washington University in St. Louiswww.engineering.wustl.edu

RESOURCES

Full frontal view of Lewis.

Here, Nik Melchior (left), a fifth year B.S./M.S.student in computer science and engineering, helps create the programming framework that

allows others to command Lewis. Shannon Lieberg(center) of the Engineering class of ‘04, works Lewis’

controls with Assistant Professor Bill Smart.

GEERHEAD

Geerhead.qxd 5/30/2008 10:51 AM Page 14

Page 15: servo2008 07

SERVO 07.2008 15

New breed of robots could soon wander Antarctica

By GREG BLUESTEIN, Associated Press Writer

Robotic rovers have patrolled deep space and the deepest seas,but scientists are still struggling to create drones that can

overcome the multiple challenges of exploring Antarctica.Georgia Tech researchers think the SnoMote — a small robotdesigned like a snowmobile — will be able to deal with the nastyweather and with slippery terrain that constantly cracks andshifts. They envision dozens of SnoMotes roving Antarctica's vast expanses to add to data already collected by satellites and a handful of weather stations and sensors. Ayanna Howard, an associate professor at Georgia Tech in Atlanta, has worked for two years under a NASA grant to perfect thetwo-foot-long robots.

Her initial designs with spider-like legs proved too cumbersome to navigate snowbanks. So, she and her colleaguesleaned on others' designs, outfitting a snowmobile designed forkids with sensors, gauges, and cameras, and then programming it.

She developed a program that lets the SnoMotes negotiatewith each other and “bid” on which site to investigate, allowingthem to decide for themselves how to dole out their assignments.

The next challenge, though, was to come up with navigation for the rovers. Other probes tend to use distinguishingcharacteristics like rocks to chart their paths. But such featurescan be hard to come by in vast icy expanses.

On a field trip to a Colorado glacier, Howard's team discovered they could use microscopic fissures in the ice andsnowbanks to guide their way.

“If you can come up with a way to classify these uniquely,you can come up with a way to navigate,” she said.

Simulations so far have proved her team's formula effective,but plenty of challenges await when the robot is put to the teston the glaciers of Alaska.

With Penn State University researcher Derrick Lampkin,Howard has designed a shell that weighs 60 to 70 pounds, canwithstand harsh winters, and eventually could include heaters tokeep computers and wiring running in the cold.

Lampkin said his goal is to develop a "scale-adaptable,autonomous, mobile climate-monitoring network."

The researchers hope the robots will ultimately cost around$10,000, relatively cheap for governments, researchers, and others seeking to document changing conditions in the world'smost remote places.

The more the better: Howard said in order for scientists tosay with certainty how climate change is affecting the ice, theyneed plenty of accurate data points to create climate models.

She envisions a field of 40 to 50 of the SnoMotes wanderingicy plains, a small army gathering data to shed light on globalwarming and other quandaries without breaking the bank.

“The whole concept is: How do you do this in the mostaffordable way?” she said.

The Mechanicrawl • Saturday, July 12, 2008Spend a summer day exploring the mechanical marvels along

San Francisco's North Shore! See giant running steam engines, turnof the century automata, mechanical computers, an eight foot highmechanical planetarium, and more. You'll be able to map your own

route for the event and spend as much time at each location as you'dlike. You can walk, bicycle, or use public transport for Mechanicrawl;maps, routes, and additional info are listed under Map Your Crawl onthe website. For all the details, go to www.mchanicrawl.com.

Page 15.qxd 6/4/2008 3:26 PM Page 15

Page 16: servo2008 07

16 SERVO 07.2008

Q. Every once in a while there is a question floated

around in my local robotics group that (I think) is

such an epiphany (read: slap forehead) that I think

it deserves a wider audience. This first question is one of

this nature:

Does anyone have any recommendations for an

inexpensive DC-DC converter that has 11-14 VDC in, 5 VDC

out (up to 3-5 amps)? I need a heftier supply for the low-

level control system on my robot. Currently, I’ve got a 12V,

12 Ah lead-acid battery with a 5V-1A converter, and I’m

reaching the limit of the converter when I add my sonars

and IRs ... later, I would prefer an off-the-shelf solution.

— Daniel Herrington

A. My first thought was the TI PT78ST105, which is a

1.5 amp 5V switching regulator that works with up to

38V. This nifty part has the same pin-out as the

venerable 7805 regulator and is way more efficient.

Another suggestion was the TI PTN78020 which has similar

input voltage maximums and a 6 amp output with high

efficiency since it too is a switching DC/DC converter.

However, this part has lots more pins; it still needs no

external components. These parts are easily found at places

like Mouser, pricing depends upon various options. As good

though, as these solutions are, they are not “off-the-shelf”

and would need a circuit board to use. Don Clay put

forward the solution of using a BEC that the R/C airplane

hobby crowd commonly uses on electric aircraft that use

large battery voltages. This is a very cool idea because it

can be connected to the robot’s main battery and will

efficiently give the needed 5V in a small, self-contained

unit, and it already has easily usable cabling. The one that

Daniel selected was the Castle Creations CC BEC which sells

for about $22 at good ol’ HobbyTown USA (www.hobby

town.com); see Figure 1. This device is very useful because

it can be set to output voltages from 4.8V to 9V by using

the Castle USB link adapter (not included). In case you were

wondering, BEC stands for Battery Eliminator Circuit. In the

“old days,” electric R/C cars had a battery for the motor and

another for the R/C electronics. The BEC “eliminated” one

of those batteries.

Q. I want to send commands to my robot using an

IR remote. I don’t want to build another IR remote;

I want to use one of the bazillions that I have lying

around the house. How do I use these? How can I decode

their output?

— George S.

A. Oh boy, I feel a marathon answer

coming up! I’m not going to go into

huge detail about every kind of IR

remote out there — there are a ton of web

pages that you can Google and find those

kinds of details. I’ll provide a selection of

them at the end of this answer for those

curious though. I did not find a lot of pages

that connected the dots between the various

formats and how to write a program to read

them, either. So, in this answer I’ll provide the

nitty gritty details of how the most popular IR

codes are created and provide some PIC code

that allows you to decode them. First, the

ugly details ...there are many, MANY different

Tap into the sum of all human knowledge and get your questions answered here!From software algorithms to material selection, Mr. Roboto strives to meet youwhere you are — and what more would you expect from a complex service droid?

byDennis Clark

Our resident expert on all things robotic is merely an email away.

[email protected]

Figure 1. CC BEC.

NEW

MrRoboto.qxd 5/30/2008 11:21 AM Page 16

Page 17: servo2008 07

IR encoding schemes out there. Wikipedia tells us that there

are literally hundreds of IR protocols! Fortunately for us, there

are three that are by far the most common: SONY SIRC,

NEC, and Phillips RC-5. If you pick up any odd remote at

your house, it will most likely be using the SONY or NEC

formats. Let’s discuss each of the “big three.”

SONY SIRC Format

First off, here are a couple of links that discuss this

format. There is a lot of useful information in these; I

disagree with a few things that they say (more on that later),

but since some of the data that I used to write my code

came from these links, most of what they say is accurate:

www.hifi-remote.com/infrared/IR-PWM.shtml

This site gives a lot of information on how to read the

universal IR remote entries that you use to program your

universal remotes. The author calls this “PWM,” or pulse

width modulation. It is more accurately called “PPM,” or pulse

position modulation, rather like R/C radio communications and

what we deal with when controlling hobby servos.

www.edcheung.com/automa/sircs.htm

This site gives some hints on how to write code to send

IR signals. Not what I was looking for, but you might be

interested in this if you wanted to have a robot wander into

your TV room and take over control of the TV set!

The SONY format has three timing values that we are

interested in, shown in Table 1. The Lead In is the header

before the data that tells us that the code is coming.

Everyone says this is to set up the AGC (automatic gain

control) in the receiver, but quite frankly, if it didn’t look

different from the rest of the transmission how could we

tell that a new command was coming? The rest of the data

is an asynchronous data stream of 1s and 0s like the serial

data in RS-232, but coming in over modulated IR radiation

instead of a pair of wires. When I say “On,” I mean that the

IR carrier is detected. An “Off” means that there is no IR

detected by the sensor.

The actual SONY IR command can come in three

variations: 12 bits, 15 bits, and 20 bits. In every variation,

we first have the Lead In header, then we have a seven-bit

command. Next, in the 12-bit protocol we have a five-bit

Device ID. The Device ID tells us what is being controlled,

for instance, a TV or a DVD. In the 15-bit format, the

Device Code is eight bits; in the

20-bit code, we have a five-bit

Device ID and then an eight-bit

Extended Command byte. All

of my remotes were either

12-bit or 15-bit. All of the

codes come in LSB first. This

means that the Least

Significant Bit is first and the Most Significant Bit (MSB) is

last. The packet format includes some kind of a Lead Out as

well, but it is really just a guarantee of some time spacing

before the next packet is sent. Don’t bother to look for it

since its length depends upon the data just sent; it doesn’t

seem to be consistent (see Packet 1).

When you code for this protocol, you need to

remember to assemble the bytes by putting the bits in

reverse order! Remember, they are LSB first.

When you press a button on a SONY remote, it will

simply repeat the command packet every 45 ms for as long

as you hold the button. Some buttons on my remotes

would only send a command once when you let up off of

the button, but the rest just kept repeating endlessly.

NEC Format

I found useful information on the NEC format here:

www.hifi-remote.com/infrared/IR-PWM.shtml

and here:

www.mcselec.com/index.php?option=com_content&

task=view&id=223&Itemid=57

The NEC format is a bit different. It includes some error

checking and has a different way of dealing with repeating

packets. The NEC protocol sends a Lead In, 32 bits of data,

and a Lead Out. Since we can count on the Lead In and 32

bits of data, don’t bother to look for the Lead Out here

either. The NEC format sends its data LSB first like SONY,

SERVO 07.2008 17

[Lead In] [0 | 1 | 2 | 3 | 4 | 5 | 6| 7] [0 | 1 | 2 | 3 | 4 | 5 | 6| 7] [0 | 1 | 2 | 3 | 4 | 5 | 6| 7] [0 | 1 | 2 | 3 | 4 | 5 | 6| 7] [Lead Out]Device ID ~Device ID Command ~Command

12 Bit Code [Lead In] [0 | 1 | 2 | 3 | 4 | 5 | 6] [0 | 1 | 2 | 3 | 4]Command Device ID

15 Bit Code [Lead In] [ 0 | 1 | 2 | 3 | 4 | 5 | 6] [0 | 1 | 2 | 3 | 4 | 5 | 6 | 7]Command Device ID

20 Bit Code [Lead In] [0 | 1 | 2 | 3 | 4 | 5 | 6] [0 | 1 | 2 | 3 | 4] [0 | 1 | 2 | 3 | 4 | 5 | 6 | 7]Command Device ID Extended Command

Description ON Time OFF Time

Lead In 2.4 ms 0.6 ms

Logic 1 1.2 ms 0.6 ms

Logic 0 0.6 ms 0.6 ms

Table 1. SONY timing values.

Description ON Time OFF Time

Lead In 9 ms 4.5 ms

Logic 1 0.56 ms 1.68 ms

Logic 0 0.56 ms 0.56 ms

Repeat 9 ms 2.25 ms

Table 2. NEC timing values.

PACKET 1

PACKET 2

MrRoboto.qxd 5/30/2008 11:24 AM Page 17

Page 18: servo2008 07

but there the similarity ends. The packet format looks like

that in Packet 2. By ~Device ID and ~Command, I mean

that it is inverted, or 1’s complement of its respective

Device ID and Command. To check for a proper reception,

all you need to do is AND the byte with its respective

complement; if it comes up all zeros, then you have a good

reception. When you hold down a button on the NEC

remote, it does not send out the same command over and

over; it sends out a special signal called the Repeat Code.

The NEC protocol has four timing values that we care

about, and one we don’t (the Lead Out). Table 2 shows the

ones that we pay attention to.

Phillips RC-5 Format

Some useful information on the Phillips RC-5 format

can be found here:

www.hifi-remote.com/infrared/IR-bi-phase.shtml

and here:

http://home1.stofanet.dk/hvaba/fprc5rx/index.html

The last of the big three formats that I’m going to talk

about is the Phillips RC-5 protocol. Rather than using PPM

encoding like SONY and NEC, the RC-5 format uses Bi-Phase

encoding. This means that the transition from a logic ‘1’ to

a logic ‘0’ and vice-versa is shown by a change in the bit

phase. If you are like most of us, your eyes just glazed over

at that description. This is one time that a picture is pretty

much needed to explain what I mean (see Figure 2).

Note that it isn’t the timing that shows what the bit is,

but rather the phase of the timing. But how — you ask — do

you know what a ‘1’ is and what a ‘0’ is? You know because

the bit stream of RC-5 starts out with two 1 bits and then a

toggle bit, which on the first press of the button is a 0. Figure

3 shows how a transmission is formatted. An RC-5 packet

consists of the preamble of 1 1 0, then a five-bit address and

then a six-bit control. RC-5 packets are encoded with the MSB

(Most Significant Bit) first. Because you know that the first

bit is a 1, then any bit transition from that point onward

you can track to know what the current bit is — a 1 or a 0.

Figure 3 may look a little odd because I put both same

and switch phases in every bit cell except for the start bits.

Just to make it more confusing though, I’ve read that the

start bits can be either 1 1 or 1 0. I hope not; it’d make it

hard to figure out the 1 startup. The RC-5 protocol will

repeat the button press every 113.8 ms, but every packet

after the first one will have the Toggle bit toggled

differently than the last start bit.

How to Decode IR Transmissions

Okay, now that the explanations are over with, how

18 SERVO 07.2008

Figure 2. Bi-Phase encoding.

Figure 3. RC-5 packet.

Figure 4. IR detector schematic.

Part Description

C1 110 μF 25V capacitor

C2-C4 .1 μF 25V capacitor

R1 10K 1/4W 5%

R2 2.2K 1/4W 5%

R3 1K 1/4W 5%

D1 Green LED

S1 N.O. button

U1 PIC16F688 DIP

U2 7805 regulator

U3 PNA4602 IR demodulator

J1 Power connector

J2 Four-pin male .1” connector

J3 RJ-11 six-pin connector

Table 3. IR detector parts list.

MrRoboto.qxd 5/30/2008 11:24 AM Page 18

Page 19: servo2008 07

can we use the IR transmissions from our remotes in our

robots? To see what is going on, I built a special IR

decoder board that has a Panasonic PNA4602 (38 kHz) IR

demodulator, a PIC16F688, a power plug, regulator,

programming header (Microchip ICD2 six-pin type) and a

plug for the Acroname RS-232 converter board. Figure 4

shows the schematic and Figure 5 is a photo of the finished

board with everything plugged in. This board was wired

together with a bunch of wire that I had lying around, so it

isn’t very sensitive to how you put it together. I just wanted

an experimenter board that would show me the IR

codes and allow me to experiment with decoding the IR

transmissions. Different remotes use different modulation

frequencies, but the Sharp PNA4602 will work with

frequencies between 36 kHz and 40 kHz just fine. I chose

the PIC16F688 because it had an interrupt line, a hardware

USART, two timers, and an internal RC oscillator that runs

at 8 MHz, all in a 14-pin package. These were all of the

hardware interfaces that I needed. Unfortunately, for some

reason Microchip requires some kind of dongle to debug

this chip which I didn’t have, so I debugged using “printf”

statements in the code.

The board isn’t particularly sensitive to the components

that you can use. My previous list just came from my parts

bins. The power connector was a barrel socket that fit the

various wall warts that I had lying around. I chose the pin

out of the RS-232 connector to match the Acroname Serial

Interface Connector that you can get from www.

junun.org/MarkIII for about $10. Finally, the

programming connector is chosen to fit the cable on

my Microchip ICD2 so that I can just plug in and program

the board without constantly taking the part out of a

programmer board and plugging it back into my test board.

If your programmer allows In Circuit Serial Programming

(ICSP), then get a connector that matches its cable.

Figure 5 shows what my board looks like. I put little

rubber feet on the bottom to make it extra spiffy looking. I

put a small three-pin socket on my board so that I could

swap around IR demodulators that have the same pin-out

as the Panasonic units, should I so desire.

Now that we understand the formats and we have a

board to look at the signals, how can we decode them?

The answer is software, of course. I like to use C as my

programming language, but the logic that I use here can be

ported to any compiler language that you feel comfortable

with. I should qualify that statement — any compiler that

allows interrupts to be used is required. In this case, my

compiler of choice is the CCS C compiler for the Microchip

14-bit cores (the PIC16Fnnn series.) I am not going to go

into the gory details about how to program a PIC; whole

books have been written on that subject and that isn’t my

intent with this column. However, you can benefit from my

line of reasoning for doing things how I did them and move

these procedures to your compiler or even your other

microcontroller if you wish. I’m only going to show SONY

and NEC decoding in my code. This is because I don’t have

any RC-5 remotes; all of mine were SONY and NEC formats.

My test code has two sections in it. The first is the

set-up of the interrupt routine that will capture the times

between pulses by measuring between falling edges on

the INT line. When the IR transmitter is On, this will be

detected by the PNA4602 and it will drop its output low.

This is why I chose falling edges; the output of the device

is normally high, or Off. Before I go into my logic for

detecting pulses and parsing them out, let’s get an idea of

how I set the PIC up to look for these transmissions. To do

that, let’s look at how to initialize this PIC. The code snippet

below shows how I set up the timers:

//Turn off comparatorsetup_comparator(NC_NC_NC_NC);

//We will be doing interruptssetup_timer_0(RTCC_INTERNAL | RTCC_DIV_128);//16ms timersetup_timer_1(T1_INTERNAL | T1_DIV_BY_4);//Gives 131ms max timeoutext_int_edge(H_TO_L);//IR IRQ on falling edge

CCS does a good job of hiding the ugly details of the

hardware from you, but you still need to read your data

sheets to understand what they are hiding! Here we turn

off the comparators because these pesky things default to

on in the PIC and will get in the way of those I/O lines.

We’re going to use TMR0 to time our pulses because it

is an eight-bit timer and we don’t want all that much

resolution in our times. This “slop” allows us to quickly

check a bit time and save it away; the coarseness of the

measurement allows us to read remotes that are close, but

not perfect to the specified times. We know that the pulses

in SONY and NEC are between 1.2 ms and 13.5 ms (see

Tables 1 and 2 again) so we want this timer to have a

maximum time before it rolls over that is near that

maximum time. Since our PIC is running on its internal

8 MHz clock (which is divided by four internally), we know

that if we use the prescaler on TMR0 at divide by 128, we

will have a maximum time of:

(1/(2MHz/128))*256 = 16.384 ms

SERVO 07.2008 19

Figure 5. IR detector board and Acroname serial connector.

MrRoboto.qxd 5/30/2008 11:24 AM Page 19

Page 20: servo2008 07

That is pretty close to 13.5 ms. Why are we using

TMR1? When we start saving times to measure for our

data bits, we need some way to stop looking if the signal is

interrupted, otherwise we’ll just appear to “hang” and do

nothing. TMR1 will be set to values that are just a little

larger than the inter-packet repeat rate. For NEC, this is

108 ms; for SONY, it is 45 ms. TMR1 is a 16-bit timer and it

only has four prescales to choose from, so I took the one

that got me close to 108 ms. Finally, I set the INT interrupt

to trigger on a high-to-low transition for my measurements.

Here is the code for the actual interrupt service routine:

#int_globalvoid isr(void)/** Lets handle all ISR save/recovery functions, the

default isn’t lean enough for * an ISR that is highly time critical.*/

{#asm//store current state of processorMOVWF save_wSWAPF status,WMOVWF save_statusSWAPF FSR,WMOVWF save_FSRBCF status,5 //Set to page 0 for SFR’sBCF status,6#endasm

//We only have two interrupts, so if it isn’tthis one, it’s the other.

if (bit_test(PIR1,0)) //Timer1 overflow IRQ{

bits[wBits++] = 255; //timed outbit_clear(PIR1,0); //Clear TMR1 int flagbit_clear(T1CON,0); //Turn TMR1 off until...

}

if (bit_test(INTCON,1)) //CCP1 capture IRQ{

bits[wBits++] = TMR0; //save the pulse timebit_clear(INTCON,1); //clear external

//interrupt flagTMR1H = t1h; //reset the timeoutTMR1L = t1l;bit_set(T1CON,0); //turn TMR1 back on so

//we can time outTMR0 = 0; //clear out the timer

}

if (wBits == MAXBIT) //rollover the bit //buffer

wBits=0;

#asm// restore processor and return from interruptSWAPF save_FSR,WMOVWF FSRSWAPF save_status,WMOVWF statusSWAPF save_w,FSWAPF save_w,W#endasm

}

I can hear the groaning now! I’ve used PIC assembly

language! In CCS C, the compiler flag “#int_global” means

that CCS will not handle the saving of registers that need

to be saved during an ISR call. This means that we need to

do it. Really, the only reasonable way to do this is with

some simple assembly code. This function needs to be

FAST and we do that by keeping it lean. I combine this

lean ISR with the definitions at the top of the program that

looks like this:

unsigned char save_w; //These next 3 bytes //are saved on interrupt

#locate save_w=0x7funsigned char save_status;#locate save_status=0x7eunsigned char save_FSR;#locate save_FSR=0x7dunsigned char wBits=0; //To make access to

//these variables fast#locate wBits = 0x7c //Keep them in common

//memory for ISR useunsigned char t1h;#locate t1h = 0x7bunsigned char t1l;#locate t1l = 0x7a/** Give me direct access to several SFR’s that CCS

doesn’t handle the way I want.*/

#byte TXREG = 0x15#byte T1CON = 0x10#byte INTCON = 0x0B#byte FSR = 0x04#byte status = 0x0#byte TMR1L = 0x0E#byte TMR1H = 0x0F#byte PIR1 = 0x0C#byte TMR0 = 0x01

Those confusing compiler directives tell the compiler to

put certain variables into “access RAM” that is available in

all data banks. This means that I don’t have to waste time

switching banks to save our timing measurements or our

saved registers. Make sure you look this up in the CCS

manual. You don’t have to do this in other micros that

don’t use banked data memory.

Now look at the ISR from above. When we get an

interrupt from INT, we record the value in the TMR0 register

in the next available data slot in our ring buffer (called ring

because it rolls over to 0 when it reaches the end of the

“ring”). If we time out on TMR1, then we stuff a 255 into

the buffer telling the decoding routine that we timed out

and we should ditch the entire set of numbers and wait for

the next start to be detected.

The second part of the program will decode the times

saved in the buffer and turn them into 1s and 0s. It uses its

own pointer into the ring buffer and knows when to look

for a value when the read pointer is different from the

write pointer. I’ve put lots of comments into this code, so

I’m not going to go over it line-by-line. Here is what the bit

decoding routine looks like:

20 SERVO 07.2008

MrRoboto.qxd 5/30/2008 11:24 AM Page 20

Page 21: servo2008 07

unsigned char DecodeBit(unsigned char time)/** This will determine if the bit is a 0 or a 1,* by whichever standard is in being used. * Returns a 1 if a logic 1 bit, 0 otherwise.*/

{unsigned char ret = 0;unsigned char val = 0;

val = time; //Can be used to “fuzzy” //the time for rounding

if (whichOne == NEC){if ((val <= NEC_ONE+FUZZY) &&

(val >= NEC_ONE-FUZZY))ret = 1;

else if ((val <= NEC_ZERO+FUZZY) && (val >= NEC_ZERO-FUZZY))ret = 0;

}else if (whichOne == SONY){if ((val <= SONY_ONE+FUZZY) &&

(val >= SONY_ONE-FUZZY))ret = 1;

else if ((val <= SONY_ZERO+FUZZY) &&(val >= SONY_ZERO-FUZZY))

ret = 0;}return ret;

}

There is more magic in DecodeCode() that shows how

to recognize the start of a transmission and how to end

one. This little routine above simply shows the decoding of

a single data bit. Notice the + and – FUZZY settings. IR

specs allow for about a 10% slop in the standard times.

This FUZZY setting gives us that. You can experiment with

how large you want that FUZZY to be since it is a #define

at the top of the program. I’ve found that a setting of 2

works well.

My code will “auto” detect NEC

code if you hold the button down.

This is because NEC uses the repeat

code frame that is distinct from any

other transmission. You don’t have to

do that if you don’t want to, and

you’ll need to reset the PIC to get it to

pay attention to SONY codes again

regardless. I have two modes of

operation that can be selected by the

setting of the TEST define. If this is set

to 1, then the program will only print

out the times. This is useful for when

you are trying to understand a new

format. If TEST is set to anything else,

then the program will decode either

SONY or NEC, and print out the

device and control codes when they

are received. The entire program

source can be found on the SERVO

website www.servomagazine.com).

It is called IRdecoder.c.

Conclusion

Figure 6 shows my collection of IR remotes that I used

to test my program. I found interesting departures from the

established standards in some of them; no doubt you will, too.

I’ve given you a powerful tool that you can use to

discover IR codes and a basic template that you can use

to embed the ability to control your robot using a common

household device: the IR remote. Have fun and be creative.

If you have any questions about this program or how I

“figured it all out,” send your questions to roboto@servo

magazine.com — I’m happy to answer! SV

NEWS FLASH! At the last possible moment I discoveredthis site. It is an excellent compendium of various IRremote formats: www.rhoads.nu/bjorn/hp48/remote.

SERVO 07.2008 21

Figure 6. A selection of IR remotes.

MrRoboto.qxd 6/4/2008 4:58 PM Page 21

Page 22: servo2008 07

Know of any robot competitions I’ve missed? Is your

local school or robot group planning a contest? Send an

email to [email protected] and tell me about it. Be sure to

include the date and location of your contest. If you have a

website with contest info, send along the URL as well, so we

can tell everyone else about it.

For last-minute updates and changes, you can always

find the most recent version of the Robot Competition FAQ

at Robots.net: http://robots.net/rcfaq.html

— R. Steven Rainwater

JJuu llyy

7-11 Africa Championship Robotics Competition

Pretoria, South Africa

Students from various countries and continents

will compete in several robot challenge

events.

www.nydt.org/home.asp?pid=963

8-10 European Micro Air Vehicle Competition

Research Airport, Braunschweig, Germany

Tiny, autonomous flying robots compete for

prizes. Every year, these things get smaller

and smaller.

www.mav08.org

8-11 Botball National Tournament

Norman, OK

Educational robot contest for middle and

high school students designed to use science,

technology, engineering, and math to solve

real world problems.

www.botball.org

13-17 AAAI Mobile Robot Competition

Chicago, IL

This year’s competition will take the form of

exhibits that demonstrate either robot creativity

or mobility and manipulation. Expect to see

robots that dance, paint, play musical instruments,

and much more.

www.aaai.org/Conferences/conferences.

php

14-18 K’NEX K*bot World Championships

Las Vegas, NV

This competition includes events for two-wheel

drive autonomous K*bots, four-wheel drive

autonomous K*bots, and the remote control

Cyber K*bot Division.

www.livingjungle.com

22-25 FIRA Robot World Cup

Shinan Software Park, Qingdao, China

This competition has events for every kind of

robot soccer imaginable, ranging from the

humanoid robot league down to the tiny

Khepera robot league.

www.fira.net

26 RoboBombeiro

Polytechnic Institute of Guarda, Guarda, Portugal

Autonomous fire-fighting robot contest.

http://robobombeiro.ipg.pt

28 AUVS International Aerial Robotics

Competition

Fort Benning, GA

Autonomous flying robots complete missions

that include dropping sub-vehicles and gathering

information. This event runs through August 1st.

http://avdil.gtri.gatech.edu/AUVS/IARC

LaunchPoint.html

29 AUVS International Underwater Robotics

Competition

Space and Naval Warfare System Center,

San Diego, CA

In this competition, autonomous underwater

robots built by university students must complete

an underwater course. This event runs through

August 3rd.

www.auvsi.org/competitions/water.cfm

TBA RoboCup Robot Soccer World Cup

Suzhou, China

Soccer Simulation — teams demo and test their

robots; Small-size Robot Soccer — F180 robots

play soccer; Mid-size Robot Soccer — larger robots

play soccer; Sony Legged Robot Soccer — legged

Send updates, new listings, corrections, complaints, and suggestions to: [email protected] or FAX 972-404-0269

22 SERVO 07.2008

Events.qxd 6/4/2008 9:37 AM Page 22

Page 23: servo2008 07

robots play soccer; RoboCup Junior — small robots

play soccer; Humanoid Soccer — humanoid robots

play soccer; Rescue Robots — NIST Standard

Rescue Robot Test Field; RoboCup@Home — real

world robot event.

http://www.robocup.org

TBA War-Bots Xtreme

Saskatoon Saskatchewan, Canada

“Robots” (RC vehicles) attempt to destroy each

other.

http://www.warbotsxtreme.com

AAuugguusstt

23-24 Motodrone AFO Competition

Finowfurt, German

Autonomous Flying Objects (AFOs) compete in

several areas including the ability to hover in

changing wind conditions, stable flight between

points, capturing photos of targets, recovering

from free fall, and automated take off and

landing.

www.motodrone.de

29 DragonCon Robot Battles

Atlanta, GA

Remote-controlled and autonomous robots fight it

out at the DragonCon science fiction convention.

www.dragoncon.org

TBA DPRG Robot Talent Show

The Science Place, Dallas, TX

Autonomous robots demonstrate their talents.

www.dprg.org/competitions

TBA Robot Fighting League National

Minneapolis, MN

“Robots” (RC vehicles) attempt to destroy each

other.

www.botleague.com

TBA Robots at Play

City Square, Odense, Denmark

Robots compete to demonstrate playfulness and

interactivity.

SERVO 07.2008 23

Events.qxd 6/4/2008 3:06 PM Page 23

Page 24: servo2008 07

24 SERVO 07.2008

DEVELOPERS IN ROBOTICS TECHNOLOGYFOR USE IN SPACEEXPLORATION RECEIVE2008 IEEE ROBOTICSAND AUTOMATIONAWARDContributions to AutonomousRobotic Operations Result inSignificant Data Collectionfrom Mars

IEEE (Institute of Electrical andElectronics Engineers) has named

Paul Backes, Eric T. Baumgartner, andLarry Matthies recipients of its 2008Robotics and Automation Award. Thethree are being recognized for theircontributions to different roboticstechnologies used in space flightsystems including the successful MarsExploration Rover (MER) missionrovers Spirit and Opportunity, whichto this day are still functioning onthe surface of Mars. The IEEE is the

world’s leading professionalassociation for the advancement oftechnology.

The award, sponsored by theIEEE Robotics and AutomationSociety, recognizes Backes,Baumgartner, and Matthies forcontributions to robotics enablingeffective autonomous operations ofscience investigations under extremeconditions on the planet Mars. Theaward was presented to the threeon May 23, 2008 at the IEEEInternational Conference on Roboticsand Automation (ICRA) inPasadena, CA.

The works of Backes (distributedand remote operations),Baumgartner (manipulator control),and Matthies (navigation systems)have advanced robotic technology,particularly rover operations, andmade possible the scientific exploration of Mars. MER is the firstlong-term mobile autonomous robotic exploration in an unknownspace environment.

An IEEE member, Backes is thetechnical group supervisor of theMobility and Manipulation group inthe Mobility and Robotic Systemssection at the Jet PropulsionLaboratory of the California Institute

of Technology in Pasadena. Heconceived and led the developmentof an interface system to allowscientists and engineers tocollaborate in generating activitysequences, which was used as theprimary science planning tool in the2003 MER mission. The interface alsoenables the public to view missiondata and simulate their own activitysequences. Backes holds sevenpatents, has won several awards,and has published numerous bookchapters, articles, and papers. Hewas associate editor of the IEEERobotics and Automation SocietyMagazine from 1993 to 1998.

Baumgartner contributed tothe MER project as the lead systems,test, and operations engineer forthe MER Instrument PositioningSystem. This system was responsiblefor the robotic deployment andplacement of four in-situ — meaning“in place” — instruments onto theMartian surface through the useof a five degree-of-freedom roboticarm. Presently, Baumgartner is thedean of the T. J. Smull College ofEngineering at Ohio NorthernUniversity in Ada. He has publishednumerous papers in the area ofmobile robotics and vision-guidedmanipulation and has receivedseveral awards for his efforts on theMER project.

Matthies’ work on autonomousnavigation of robotic ground andair vehicles led to the developmentof algorithms for descent motionestimation, visual odometry, andreal-time 3D perception with stereovision. These capabilities wereincorporated into the MER mission,providing landers with the ability toestimate horizontal velocity androvers with the ability to detectobstacles and measure slip. Hiswork can be found in terrestrialapplications including off-roadautonomous navigation and roboticvision systems. An associate memberof the IEEE, Matthies is an adjunctprofessor at the University ofSouthern California and a memberof the editorial boards of theAutonomous Robots Journal and theJournal of Field Robotics. He hasreceived several awards, holds twopatents, and is widely published.

BloBlow Outw Out

SpecialSpecial

$9.95!$9.95!

WWW.SERVOMAGAZINE.COM

Showcase Jul08.qxd 6/4/2008 2:08 PM Page 24

Page 25: servo2008 07

$146.

Ask for our FREE 96 page catalog

VISIT OUR ONLINE STORE ATwww.allelectronics.comWALL TRANSFORMERS, ALARMS,FUSES, CABLE TIES, RELAYS, OPTOELECTRONICS, KNOBS, VIDEOACCESSORIES, SIRENS, SOLDERACCESSORIES, MOTORS, DIODES,HEAT SINKS, CAPACITORS, CHOKES,TOOLS, FASTENERS, TERMINALSTRIPS, CRIMP CONNECTORS,L.E.D.S., DISPLAYS, FANS, BREAD-BOARDS, RESISTORS, SOLAR CELLS,BUZZERS, BATTERIES, MAGNETS,CAMERAS, DC-DC CONVERTERS,HEADPHONES, LAMPS, PANELMETERS, SWITCHES, SPEAKERS,PELTIER DEVICES, and much more....

ORDER TOLL FREE1 - 8 0 0 - 8 2 6 - 5 4 3 2

THOUSANDS OF ELECTRONICP A R T S A N D S U P P L I E S

Robotics ShowcaseRobotics Showcase

SERVO 07.2008 25

Showcase Jul08.qxd 6/4/2008 2:11 PM Page 25

Page 26: servo2008 07

Baby Orangutan B-168Robot Controller

Pololu announces the release of

the Baby Orangutan B-168 robot

controller, the latest addition to Pololu’s line of

Orangutan robot controllers. The compact module

has dimensions of 1.2” x 0.7”, and it can be configured

to fit in a solderless breadboard or a 24-pin dual in-line

package (DIP) socket. For applications with low I/O usage,

the Baby Orangutan B-168 board can also be configured

with pins on just one side of the module for use as a single

in-line package (SIP). The diminutive size of the Baby

Orangutan B-168 makes it well suited for primary control of

miniature robots or for auxiliary control on larger robots.

The Baby Orangutan B-168 is based on an Atmel

ATmega168 microcontroller running at 20 MHz with 16

KB of Flash program memory and 1 KB data memory.

The use of the ATmega168 microcontroller makes the

Baby Orangutan B-168 compatible with the popular

Arduino development platform. Free C and C++

development tools and libraries are also available.

Integrated motor control sets the Orangutan family

of controllers apart from other small microcontroller

boards, and the Baby Orangutan B-168 features dual

high-performance, MOSFET-based H-bridges to deliver up

to 1A per channel over the 5-13.5V operating range.

With hardware-based ultrasonic PWM generation, two

independent, bidirectional DC motors can be controlled

symmetrically and without any processor overhead.

The unit price is $29.95.

For further information, please contact:

PC Windows USB Interface forOWI-535 Robotic Arm

The robotic arm interface kit available from Images

connects OWI’s 535 Robotic Arm Edge™ to a personal

computer (IBM PC or compatible). The interface connects

to the PC’s USB port. The software for the interface

permits real time control and contains a built-in

interactive script writer. A user may write a script that

contains up to 99 individual robotic arm functions

(including pauses) into a single script file. Script files

may be replayed automatically for demonstrating

computer controlled automation and animatronics.

The Robotic Arm PC Interface creates a fun way of

learning and experimenting with computer automation

and animatronics.

The USB OWI-535 Interface (assembled and tested)

costs $99.95; the USB OWI-535 Interface Kit (requires

soldering and assembly) is $84.95.

The Interface Kit Includes:

• Windows 2000/XP/Vista program

• Printed circuit board for easy construction

• All components

For further information, please contact:

Motor Mount and Wheel Kit

It’s time to give your robot the mobility and style it

deserves with the new Motor Mount and Wheel Kit

with Position Controller from Parallax. Powerful 12 VDC,

150 RPM motors are combined with precision machined

6061 aluminum hardware to provide enough power,

strength, and beauty to make other robots jealous.

New Products

CONTROLLERS & PROCESSORS

INTERFACE

MECHANICS

NNEEWW PPRROODDUUCCTTSS

26 SERVO 07.2008

Website: www.imagesco.comImages ScientificInstruments6000 S. Eastern Ave. Suite 12-D

Las Vegas, NV 89119Tel: 877•7•POLOLU or 702•262•6648

Fax: 702•262•6894Email: [email protected]

Website: www.pololu.com

PololuCorporation

JUL08NewProd.qxd 6/4/2008 4:41 PM Page 26

Page 27: servo2008 07

Conveniently positioned

screw holes in the bearing

block make mounting this

kit a breeze, and the

included six inch

pneumatic rubber tires

perform well on a variety of

smooth or rugged terrains. The

kit includes two position controllers which

use a quadrature encoder system to reliably

track the speed and position of each wheel with

36 positions/rotation resolution and report the data

on command via a 19.2 kbps serial bus. The position

controllers can also be interfaced with HB-25 motor

controllers (sold separately) to automatically provide user-

definable smooth speed ramping and accurate position

control, which frees up the main processor to handle

more important tasks.

The entire Motor Mount and Wheel Kit (#27971) is

a value at $279.95.

For further information, please contact:

Flowcode for ARMMicrocontrollers

Matrix has recently

launched a new

version of their popular

graphical programming

language for micro-

controllers — ‘Flowcode

for ARM micro-

controllers.’ Now, 32-bit

ARM microcontrollers

are available for the

same price as eight

bit micros but offer

massive advantages to

developers: low power,

more I/O lines, several

times more ROM and

RAM than a typical eight bit micro, full floating point

and maths libraries, and a massive increase in processing

speed and power.

This new version of Flowcode provides

engineers and developers access to all of these features

of the ARM based on Atmel’s popular range of AT91

microcontrollers. Flowcode for ARM is also backwards

compatible with Flowcode for PICmicro®

microcontrollers and AVR® microcontrollers which

provides an easy migration route to 32 bit power.

ARM hardware development tools, based on the

Matrix’s E-blocks range, are also available. A fully

functional demonstration version is available on the

Matrix website.

For further information, please contact:

Four-Channel Digital BatteryTest System

The Cadex C8000 is an advanced battery test system

capable of performing complex lifecycle tests. These

tests may include discharging a battery with GSM,

CDMA, or other pulses of choice. Replicate battery

runtime of a power tool, digital camera, or computing

device by first capturing the current profile and then

applying the load on the test battery for verification. The

C8000 can also test the function of a Li-ion charger,

verify battery safety circuits, and read SMBus registers.

Automated programs assure safe charging and correct

discharge terminations; custom programs provide for

user-defined settings. Each of four independent channels

delivers up to 10A and 36V, with 0.1% FSR. Total power

is 400W on charge and 320W on discharge. The Cadex

C8000 runs as a stand-alone unit or with PC-BatteryLab™

software.

For further information, please contact:

SOFTWARE

TOOLS & TEST EQUIPMENT

Is your product innovative, less expensive, more functional,or just plain cool? If you have a new product that youwould like us to run in our New Products section, pleaseemail a short description (300-500 words) and a photo ofyour product to:

[email protected]

Show Us What You’ve Got!

Website: www.parallax.comParallax, Inc.

Website: www.matrixmultimedia.co.ukMatrixMultimedia

Website: www.cadex.com/c8CadexElectronics

SERVO 07.2008 27

JUL08NewProd.qxd 6/4/2008 4:42 PM Page 27

Page 28: servo2008 07

Featured This Month:

Features28 BUILD REPORT:

Apollyonby Mike Jeffries

30 MANUFACTURING:High-Performance DrillMotor Modificationby Bryan Ruddy

32 PARTS IS PARTS:Mag Motor Upgradesand Repairsby Nick Martin

Events33 Apri/May 2008 Results and

Jul/Aug 2008 UpcomingEvents

ROBOT PROFILE – TopRanked Robot This Month:31 Billy Bob by Kevin Berry

28 SERVO 07.2008

Idesigned this 12 pound,

Hobbyweight, robot with the

purpose of cramming as much

power as I could into the smallest

box possible. It’s low, it’s fast,

and it’ll just keep slamming its

face into your spinning weapon

until something breaks. The horns

on top allow it to

take its opponents

into the wall of

the arena while

wearing them like a

polished metal hat.

Apollyon won its

debut tournament

this past December

with a 3-1 record.

● by Mike Jeffries

Apollyon

BUILD REP RT

FIGURE 2

FIGURE 1

CombatZone.qxd 5/29/2008 2:26 PM Page 28

Page 29: servo2008 07

SERVO 07.2008 29

Figure 1 is a CAD model of

Apollyon drawn in SolidWorks. Some

minor changes were made, but most

of the parts are almost identical to

the ones in the drawing, for example,

the side and internal frame rails, as

well as the horns that are used to

catch other robots. The horns are

steel and the rest of the frame is

6061 aluminum (see Figure 2).

The sides of the frame are

lined up to show the profile of the

chassis, shown in Figure 3. The

holes in the top, front, and bottom

of the plate are tapped to allow

armor to be bolted directly to them.

Figure 4 shows the chassis with

the baseplate, drive motors, and inter-

nal portion of the front armor installed.

Figure 5 shows a mostly

assembled Apollyon sitting inside

the chassis of my 60 lb robot Ruiner.

In Figure 6, Apollyon has been

painted, the front steel wedge has

been mounted, and the robot is

almost ready for competition.

Take a look at Figure 7.

You’ll see an internal shot of

Apollyon the night before the

“Wreck the Halls” event in

Greensboro, NC. This shows

the layout of the electrical

components and the battery

mount. The piece of PVC pipe

in the back left of the robot

serves as a power distribution

block and battery mount.

Figure 8 shows Apollyon at

Wreck the Halls being prepared for

the first match of the competition.

Apollyon won the 12 lb class

with a 3-1 record (see Figure 9).

The damage was all cosmetic

and easily repaired. The shaft collar

on the visible axel was torn off in

combat. A new front wedge is

being designed to reduce

impacts on the chassis. SV

FIGURE 3

FIGURE 4 FIGURE 5

FIGURE 6

FIGURE 7

FIGURE 8

FIGURE 9

Parts ListITEM QTY PRICE• Victor 883 speed controller 2 $139.99• GB42 gearbox 2 $85.99 (no longer available)• Mini-EV motor 2 $8.99• 18V 1,650 mAh NiMH battery pack $62.50• Spektrum DX6 with BR6000 receiver 1 $199.99• 3” Colson wheel with hub 2 $25.00 (no longer available)

(www.cncbotparts.com)• GWS elevator/aileron mixer $14.99• S-BEC Super BEC 5V $46.99 (being replaced

with receiver battery packfor future events)

• MS-05 power switch 1 $48.00• 45A powerpole connectors $1.39/set• #8 ring terminals $1.99/25• Deans Wet Noodle Wire — 12 awg $1.25/ft• Raw metal, nuts, and bolts (www.mcmaster.com and www.onlinemetals.com)• Wood and plumbing pieces for battery mount — local hardware store• Machining (www.teamwhyachi.com)

NOTE: All items are from www.robotmarketplace.com unless noted otherwise.

CombatZone.qxd 5/29/2008 2:28 PM Page 29

Page 30: servo2008 07

30 SERVO 07.2008

MANUFACTURINGHigh-Performance Drill Motor Modification

● by Bryan Ruddy

Cordless drills are among the

richest sources of affordable

gearmotors for the robotics hobbyist;

from inexpensive, low-power imports

(such as the drills offered by Harbor

Freight) to high-performance, name-

brand drills (particularly DeWalt).

Unfortunately, drill gearmotors lack

convenient mounting features, often

have minimal bearings, and generally

contain slip clutches, making them

unsuitable for use in robotic drive

and mobility applications without

modifications. While there are

commercially-available modification

kits for some drill gearmotors, most

motors must be modified by the

hobbyist. The photos here document

my modifications to

DeWalt’s newest and

most powerful drill

motor. SV

PHOTO 1. The 36-volt DeWalt DC900KLcontains a gearmotor rated for 750 watts ofpower and is capable of a bone-crushing 200foot-pounds of stall torque in low gear. Onpaper, this gearmotor should be capable ofmoving a 200 pound robot at about five milesper hour in a 4WD configuration.

PHOTO 3. The original motor mount is shown on the left, withits twist-lock interface to the gearbox. An alternative mount— machined from a block of magnesium — is shown on theright. Long bolts will be used to assemble the motor mountto the new gearcase.

PHOTO 2. The gearbox (part #629059-00) and motor (part#639521-00) are shown without the drill casing. They aremounted to the casing by the small plastic tabs where themotor and gearbox meet. To mount the gearmotor securelyto a robot, we will make a metal replacement for the stockplastic gearcase.

PHOTO 4. As shown on the left, the first-stagering gear (part #628002-00) is free to rotate aspart of the clutch mechanism. To lock this gearin place, we can machine it down to a square,as shown on the right. The modified gearpresses into the motor mount.

PHOTO 5. The DC900KL uses a three-speedgearbox — for robotics use, the gears must be secured for a single speed. The stockgearcase (top) uses a set of molded-in teethto keep the ring gears (bottom) from turningwhen engaged; these have been duplicated inthe magnesium gearcase (right).

PHOTO 8. The completed gearcase, withmotor and gearbox parts installed, isshown here. The parts were made on CNCequipment, but could be made manuallywith slight simplifications. The motor,gearbox, and spare ring gears areavailable from www.dewaltservicenet.com, at a total cost of $110 permotor-gearbox assembly.

PHOTO 7. The gearbox output (left)uses a simple double-D shaftgeometry, duplicated in the hardened,high-strength shaft on the right. Thestep in shaft diameter allows the newgearbox to be protected from impactsby a bronze thrust bearing.

PHOTO 6. The stock gearboxoutput has an overrunningclutch to prevent back-driving.Since this can cause the output tolock up under some conditions,it must be disabled by removingthe five pins and outer ring.

CombatZone.qxd 5/29/2008 2:30 PM Page 30

Page 31: servo2008 07

SERVO 07.2008 31

ROBOT PR FILETOP RANKED ROBOT THIS MONTH

Billy Bob has competed in House

of NERC 2006, Motorama 2007,

RoboGames 2007, Franklin Institute

2007, and Motorama 2008.

Details are:

● Configuration — Vertical Spinner

● Frame — 2024 milled aluminum

frame

● Drive — Two AstroFlight 940s

with Team Whyachi gearboxes

● Wheels — Two 3.5” Colsons

● Configuration — Two wheel drive

in the rear

● Drive ESC — Two IFI Victor 883s

● Drive batteries — 21.6 volt A123

battery pack

● Weapon — Custom S7 tool

steel single tooth blade at 8,000

RPM

● Weapon power — 24 volt NiCd

2,400 mAh battery pack

● Weapon motor — Axi 5330 at

24 volts

● Weapon ESC — Castle Creations

Phoenix HV85

● Armor — Rubber shock mounted

steel and a rear titanium wedge,

along with various attachments for

other types of bots

● Radio system — Spectrum DX6

● Future plans — Four-wheel drive

version

● Design philosophy — Balance the

drive, weapon, and armor with

smart engineering, and make it

cool!

● Builders bragging opportunity —

Billy Bob went undefeated at its first

event. SV

All fight statistics are courtesy of BotRank(www.botrank.com) as of May 10,2008. Event attendance data is courtesyof BotRank and The Builder’s Database(www.buildersdb.com) as of May 10,2008.

● by Kevin Berry

Weight Class Bot Win/Loss Weight

Class Bot Win/Loss

150 grams VD 26/7 150 grams Micro Drive 7/1

1 pound Dark Pounder 44/5 1 pound Dark Pounder 23/3

1 kg Roadbug 27/10 1 kg Roadbug 11/4

3 pounds 3pd 48/21 3 pounds Limblifter 12/1

6 pounds G.I.R. 17/2 6 pounds G.I.R. 11/2

12 pounds Solaris 42/12 12 pounds Surgical Strike 17/7

15 pounds Humdinger 26/4 15 pounds Humdinger 26/4

30 pounds Totally Offensive 43/13 30 pounds Billy Bob 12/4

30 (sport) Bounty Hunter 9/1 30 (sport) Bounty Hunter 9/1

60 pounds Wedge of Doom 43/5 60 pounds Texas Heat 11/4

120 pounds Devil's Plunger 53/15 120 pounds Touro 10/0

220 pounds Sewer Snake 43/12 220 pounds Sewer Snake 11/5

340 pounds SHOVELHEAD 39/15 340 pounds Ziggy 3/0

390 pounds MidEvil 28/9 390 pounds MidEvil 3/0

Top Ranked Combat Bots

Rankings as of May 10, 2008

History Score is calculated byperfomance perfomance at all

events known to BotRank

Current Ranking is calculated byperformance at all known events,

using data from the last 18 months

History Score Ranking

Billy Bob – Currently Ranked #1

Historical Ranking: #9Weight Class: 30 lb FeatherweightTeam: Benson LabsBuilder: Brian BensonLocation: Winchendon, Massachusetts

BotRank Data Total Fights Wins LossesLifetime History 16 12 4Current Record 16 12 4Events 5

CombatZone.qxd 5/29/2008 2:31 PM Page 31

Page 32: servo2008 07

32 SERVO 07.2008

If you rely on the Satcom Mag

motor to deliver a deadly blow or

a punishing push to your robotic

opponent, you will want to follow

these simple tips for improved

reliability and performance.

Tape the Brush Covers

The quickest tip is to place elec-

trical tape over the four brush covers

(see Figure 1). They don’t often come

loose, but losing a brush cap during

an event can be a disaster. If your

motors get particularly hot, you

might need high temperature Kapton

tape, however I have never had a

problem with the cheap stuff.

Replace the CaseScrews (beginner)

The long case screws supplied

by Satcom are 10-32 by 3” stainless

steel with Phillips

drive heads. These

are not up to heavy

combat duty and

should be replaced.

I use hex socket

cap screws,

McMaster-Carr part

#91251A360, for

this; they can be

tightened more

than the original

screws and the

threads are better

formed (Figure 2).

The heads of these

screws are

sometimes

too tall for the counterbores in the

front of the motor, so start by

grinding the heads down by about

.016” (0.4 mm).

Grinding the heads down also

puts a small burr around the 5/32”

hex socket, making it a tight fit on

your hex driver. Use the driver to

wiggle the screw about until it

starts to thread into a hole; after

the first screw, this becomes very

easy. I like to apply a slathering of

Loctite 243 to make sure the screws

stay put. NOTE: If you have a newer

four screw motor, one screw is only

2-3/4” long; you will need to cut

one of the replacement screws

down to fit.

Replace the MountingScrews

The tiny 8-32 face mounting

screws always look inadequate to

me; if you are mounting the motor

with these screws, I recommend

up-sizing them to around 12-24 or

M6. Start by removing the front

plate of the Mag motor, leaving the

armature and case in place.

● by Nick Martin

PARTS IS PARTS:Mag Mot r Upgrades

and Repairs

FIGURE 1. Tapedbrush covers andthe timing marks.

FIGURE 2. Replacementcase screws. (Insert:

The replacements havefar stronger heads.)

FIGURE 3. Aligning themounting holes with a taperedpin. (Insert: Which screw sizewould YOU trust?)

CombatZone.qxd 5/29/2008 2:32 PM Page 32

Page 33: servo2008 07

SERVO 07.2008 33

Position the front plate

accurately on your drill press using

a tapered pin made from the shank

of an old drill (see Figure 3). This

will keep the new mounting points

accurately in position; important if

you have a pre-made gearbox to fit.

Drill each of the mounting holes

out to fit your preferred screw size;

5 mm for M6 and #17 for 12-24

sized screws.

Tap the new holes and take

extra care to remove all the swarf

from the inside of the plate; you

don’t want conductive chips falling

into the armature! Re-assemble the

motor as detailed in previous tips; if

you combine this tip with the

stronger case screw tip, you will

have one tough motor.

Neutral Timing

Mag motors can be timed

slightly advanced or retarded,

although I find that advanced timing

makes hardly any difference so I

leave them neutrally timed. If you

want to experiment or need to

adjust the timing after repairs, here

is the quick way to do it. Mark a line

along the case so it meets the rear

end bell, as shown in Figure 1. With

the case screws loosened enough to

just turn the case, rotate the

case left until the screws touch a

magnet. Mark the position of your

line on the rim of the endbell. Now

rotate the case left until the screws

stop on the opposite magnets.

Mark this position on the endbell

rim. The marks on the rim represent

the extremes of forward and

reverse timing; draw a line midway

between your two extremes

and this is your neutral timing

position — too easy! SV

You can contact Nick via his build thread atwww.robowars.org/forum/viewtopic.php?t=74&start=0.

Results Apr 14 –May 12, 2008

HORD

Spring

2008 was held

in Brecksville,

OH on April

19th. Twenty-

five bots were registered.

Rotunda Rumble was held at the

Mall Of America in Minneapolis,

MN on April 25th. Twenty-seven

bots were registered.

Smackdown in Sactown IV

was held on April 27th in

Sacramento, CA. Eight bots were

registered.

BotsIQ: The Competition 2008

was held April 30th–May 4th in

Miami Beach, FL. One hundred

thirty-five bots were entered.

Roaming Robots presented

Fenton Manor 2008 on May 4th

in Stoke On Trent, England.

Upcoming Events forJuly-August 2008

D. W. Robots will

present

Pennsylvania Bot

Blast 2008 in Bloomsburg, PA on

July 12th. Seventeen bots were

registered at press time. For more

details, go to www.dwrobots.

com/tournament.html.

War-Bots

Xtreme

will present

WBX-V

“Taking the

Fifth” on July

26th in

Saskatoon,

Saskatchewan, Canada. Nineteen

bots were registered at press time.

For more details, go to www.war

botsxtreme.com.

The North East Robotics Club will

present House of Benson –

Barnyard Brawl in Winchendon, MA,

on July 26th. Thirty-six bots were

registered at press time. For more

details, go to www.nerc.us.

Roaming

Robots

will present

Guildford

2008 in

Guildford, England on June 15th,

and UK Champs 08/RAF Fairford in

Gloucestershire, England on July

12th and 13th. For more details, go

to www.roamingrobots.co.uk.

RoboCore will present Winter

Challenge 4th Edition in

Amparo, Sao Paulo, Brazil on

July 26th–27th. SV

EVENTSResults and Upcoming Events

CombatZone.qxd 5/29/2008 2:33 PM Page 33

Page 34: servo2008 07

... including car audio, home audio, cell

phones, DVD players, laptops, digital

photo and video recorders, and of

course, massive plasma TVs. There was

a 150 inch TV at the Panasonic booth

that was the talk of the show. Imagine

a TV as big as a queen-sized bed

hanging on your wall? Seems like one

would have to reinforce the wall just to

keep it from falling down.

Most of the booths that are

technology specific are organized into

Tech Zones, such as USB, ZigBee,

Blu-ray Disc, HDMI, Mobile Internet and

WiMAX, IPv6, Sustainable Technologies,

CES 2008Robot RoundupCES 2008

As usual, in the second week of January,over 100,000 technology lovers convergedon Las Vegas for the 41st annual

Consumer Electronics Show (CES). The showwent on from 8 AM to 5 PM for four days, andeven then, it was almost impossible to seeeverything. CES took up 1.8 million squarefeet of trade show space, spanning all of themajor convention centers in Las Vegas. So muchwalking is involved for the attendees, you caneasily blow out your feet unless you are wearingrunning shoes.

Just about every electronicconsumer device is

represented at CES ...

by Ted Larson

34 SERVO 07.2008

Photo 1

Larson.qxd 5/30/2008 12:08 PM Page 34

Page 35: servo2008 07

and finally, Robotics. With just a few exceptions, most of

the robots and robot companies were on display in the

Robotics Tech Zone or in nearby booths.

The biggest exhibitor in the Robotics Tech Zone this

year was WowWee (www.wowwee.com). Every year they

seem to have many innovative, new designs and this year

was no exception. The most noteworthy items they brought

out were the Femisapien, Tribot, and Rovio. Femisapien is a

female counterpart for the popular Robosapien. She

dances, poses, and with her 9x degrees of freedom is

capable of 56 interactive functions. They had a nice demo

with three of them line-dancing together (Photo 1). She has

a learning mode where you can pose her and learn

sequences for playback, which seems like endless fun. I

thought the best feature of all was that when brought in

proximity to a Robosapien, she is the boss and tells him

what to do (sounds a bit like my wife). With an MSRP of

$99, I can see her ending up on the desks of many geeks

for fun and show.

Tribot (Photo 2) certainly received the most attention

out of the WowWee group, with the TV crews swarming

around him to get some footage of him doing his demo. I

was really surprised at how much personality he had when

they switched him on. He has animated ears and a pop-top

head, and goes on and on about how great it is that you

rescued him from his packaging when you turn him on for

the first time. He has an omni-wheel, holonomic drive

system which seems to be a new theme for WowWee

robots. Several of their newer products are now sporting

omni-wheels, including Rovio. Rovio is a WiFi capable,

omni-wheeled robot with a camera and navigation

capabilities. It can be tele-operated over the Internet,

with live streaming video of what it sees. The notable and

unique technology item here is that it is using the Evolution

Robotics (www.evolution.com) Northstar 2.0 system

for navigation.

Northstar is like “micro-GPS” for a robot. It uses

constellations of infrared energy beamed onto the ceiling

from a fixed point to determine its location within a room.

Rovio is the first use of this technology in a low-cost,

consumer package and it is quite impressive. One can set

waypoints for Rovio within the room and it easily find its

way back to them, even if the robot is picked up and

moved. At a retail price of $299, it is quite amazing that all

this technology can be packed into such a cool little robot.

Since I am on the topic of indoor positioning, it is a

good time to mention the booth of Hagisonic. Hagisonic

(www.hagisonic.com) is a Korean sensor manufacturer

which makes an indoor positioning system for robots called

StarGazer. StarGazer analyzes the image of an infrared ray

which is reflected from a passive landmark with a unique

ID, mounted on the ceiling. From this landmark, it is able to

determine its repetitive position down to 2 cm of accuracy.

The technology is similar to that of Evolution Robotics

Northstar system, although Evolution does not need to stick

anything to the ceiling. StarGazer is currently manufactured

as a module you can simply mount in a robot, place the IR

projectors in the room with the passive landmarks, and you

are ready to go. They had a nice demonstration of two little

robots navigating around on the floor, avoiding obstacles,

and mapping their positions (Photo 3).

Meccano showed their new additions to the Spykee

(www.spykeeworld.com) robot line-up. All the Meccano

robots are being sold under the ERECTOR brand as a robot

CES 2008 Robot Roundup

SERVO 07.2008 35

“The biggest exhibitor in the RoboticsTech Zone this year was WowWee ...”

Photo 2

Photo 3

Larson.qxd 5/30/2008 12:08 PM Page 35

Page 36: servo2008 07

Erector set. The four new robots in the line are Spykee Cell,

Spykee Miss, Spykee Vox, and Spykee Micro, three of which

are designed to cradle your iPod, and allow it to be voice

controlled and give it some personality (Photo 4). Spykee

Cell can be controlled from your cell phone via Bluetooth

and is targeted at both boys and girls. Spykee Miss is an

emotional electronic friend targeted at girls that gives you

advice when you ask her a question. Spykee Vox is also

voice controlled, an interactive friend, and can be either a

hero or a villain. It is targeted primarily at boys. Spykee

Micro is a small, little remote controlled robot that looks

similar to its larger counterparts, but is primarily just for

driving around and making noise. Again, all the robots are

kits — in the spirit of the ERECTOR brand — and some are

easier to assemble than others. When we were packing up

at the end of the show, the Meccano people were looking

to lighten their load for their trip home, so they gave us

several Spykee Micro kits. I brought two assembled units

home, and had great fun with my four-year-old daughter

having robot races in the hallway with them.

About 50 feet from the Robotics Tech Zone was the

iRobot booth. Among all the consumer robots they showed,

the two that were the standouts were the iRobot Looj

Gutter Cleaning Robot (Photo 5) and the new iRobot

Roomba 500. The Looj has piqued my interest ever since it

was announced, although I had never seen one in person

before. I have heard many rumors about what it can and

cannot do, so I thought I would ask the tough questions,

and see if I could clear some things up. In a nutshell, the

Looj is a remote controlled robot that is designed to be put

in a gutter and run up and down to dislodge any debris,

using a rotating rubber agitator. The idea is you climb up

the ladder to the corner of your house, put the Looj in the

gutter, and run it up each gutter section, thus minimizing

CES 2008 Robot Roundup

36 SERVO 07.2008

Photo 4

Photo 5

Photo 6

Larson.qxd 5/30/2008 12:09 PM Page 36

Page 37: servo2008 07

the number of times you have to go up and down the

ladder. They had a nice little demo with a piece of roof, a

gutter mounted to it that was filled with plastic leaves, and

they would drive the Looj down it and it would throw the

leaves all over the aisle in front of their booth (Photo 6). It

was great fun to see it go.

After asking many questions, I came up with all the

things it cannot do, to dispel any myth making. It cannot

climb the downspout, you cannot just throw it up on the

roof and let it do the rest, it cannot go around the corners

in your gutters, it is not compatible with ancient gutters,

with weird dimensions, and it won’t do the job all by itself

while you sit down on your lawn with a glass of lemonade.

What it can do, it does very well, and is quite amazing. Its

paddle is capable of blasting through all kinds of gunk in

your gutters, like pine needles, twigs, and sludge. If your

gutters are a standard 2-1/4” size, it is capable of driving

underneath the straps that hold the gutter to the house,

so you can clean long sections. If your house was perfectly

square, you would only need to ascend and descend the

ladder four times, thus minimizing your risk of life and limb

by falling off the ladder. It is certainly better than the old

method of climbing up there with gloves and a plastic

scoop, and at only $99 for the base unit, it is cheaper than

most lawn and garden appliances.

The iRobot Roomba 500 Series (Photo 7) was there,

driving around a little test carpet that anyone could scatter

all kinds of debris on, and it would happily slurp it up. Every

time I see a new version of the Roomba I think, okay, what

now, seen this before, ho-hum. However, this one has some

great new features that would make me upgrade. It has

anti-tangle technology, that detects if it sucked up a carpet

fringe or an electrical cord, and automatically backs it out

of the beater-brush before continuing along and restarting

to clean. It has upgraded bump switches which give it a

lighter touch to keep it from scuffing the baseboard or

furniture. Also, it has a new Virtual Wall, called a

Lighthouse, that the robot interacts

with to allow it to be contained to one

room until the room is clean, which

then allows it to move onto the next

room and so on, and so on. So, one

robot can clean multiple rooms, and

know when it has completed them all.

At $349, it is in line with the pricing

of previous Roomba robots, and offers

significant improvements without a

significant increase in price.

Roboware (www.roboware.

com.hk) had a booth in the Tech

Zone, where they were showing off an

impressive looking, three wheeled,

holonomic drive humanoid named E3

(Photo 8). I guess 2008 is the year for

holonomic drive humanoids?!?!

Roboware was founded by Mike Kim,

who previously was one of the

researches on the Canadarm space

robot on ISS, was part of the Hubble Telescope rescue

project, and has contributed to some WowWee projects

such as RSMedia, Elvis, and RSG products. According to

Mike, E3 stands for Education, Entertainment, and Emotion,

which makes it a platform much like a video game. E3 can

express its emotion through motions (head, arms, body,

wheel), light, and multi-media with customized content.

It has five login modes: Baby, Teen, House-Keeper, Single,

and Silver. Each mode has its own unique and updatable

personality according to the user’s age. E3 has WiFi built in

so it can be controlled remotely via the Internet and

through its ad-hoc networking capabilities can be voice

controlled, or stream or playback live video. It is even

capable of doing Sykpe teleconferencing. E3 has a big 5”

LCD mounted in his chest and runs Windows Mobile

edition, so he can do many PDA-type functions, as well.

The retail price range of E3 will be between $1,500-$2,000

and he will be available in the US around November of

this year.

Robotis (www.robotis.com) returned to CES again this

Photo 7

Photo 8 Photo 9

CES 2008 Robot Roundup

SERVO 07.2008 37

Larson.qxd 5/30/2008 12:10 PM Page 37

Page 38: servo2008 07

year with yet more new

things to show, such as

an updated version of

their Bioloid (www.

bioloid.com) educational

robot kit, their Dynamixel

high-performance servo

line, as well as their new

URIA Robot (Photo 9).

The Dynamixel servos

are designed specifically

for robotic actuator

applications, and are

networked together using

a communications bus

such as RS-485 or TTL

signaling. They are

powerful, metal geared

servos with torque up to

64 kg-cm. The Bioloid kits

(as well as URIA) are

constructed from these

servos. URIA stands for

Ubiquitous Robotic

Information Assistant, and

is designed as a research

platform for working

with humanoids. It has

a fully embedded PC onboard, running Windows XP, with

peripherals such as USB, LAN, Camera, VGA, WiFi, and a

microphone. He has a nice big LCD in his chest so you can

see what is going on with the PC.

Other interesting peripherals include a Passive

Infrared Sensor (PIR) and a six-axis gyro for measuring

motion. The robot stands 22 inches tall and weighs about

12 pounds. In comparison to most of the Robo-One type

humanoids, he is really, really big. They didn’t give exact

pricing on this monster humanoid, but they were quite

specific that it is designed for researchers and not the

hobbyist. With all the servos and PC onboard, I don’t

imagine he is going to be inexpensive.

OLogic was there with plenty of interesting robots to

show (www.ologicinc.com). OLogic is an outsourced

research and development company with a focus on

robotics, that I co-founded with Bob Allen. Of course, we

brought out some balancing robots to demonstrate our

capabilities to design difficult control systems. On the first

day of the show, we realized we could place one on top of

another and do a Las Vegas acrobatic act, in true Vegas

style (Photo 10). Needless to say, it always attracted a

crowd and the TV people whenever we stacked them up.

Dean Kamen, the inventor of many things including the

Segway, came by and we were able to snap some photos

of us with Dean and the balancing robots (Photo 11).

NPC Robotics (www.npcrobotics.com) commissioned

OLogic to build a robot to demonstrate a device they have

been reselling, called a Ribbon Lift (Photo 12). A Ribbon Lift

is a device that takes three stainless steel ribbons rolled up

on a spool like a tape measure, uses a motor to unwind

them, and stitchs them together into a self-assembling,

triangular shaped pole. Since we just finished the robot

before CES, we brought it out to show off. The robot is

appropriately named “Giraffe” due to its long neck it can

extend. The lift mounted in the robot is capable of raising a

50 pound load to 15 feet, and can collapse down into a

spool eight inches high by 20 inches in diameter. It is quite

amazing to see it unfurl, and some people commented that

it seemed like magic, like Ali-Babba’s magic rope trick. We

mounted a WiFi camera on the top and had it feeding a

big plasma display to demonstrate its use for surveillance

applications. We are looking forward to building some

robots using the larger version of the Ribbon Lift that can

lift a 500 pound load 25 feet in the air.

Two robots I missed at CES this year, but heard about,

were robots that showed up for just one day to make a

cameo appearance in the Robotics Trends booth (www.

roboticstrends.com). They were Pleo (www.pleoworld.

com) the Camarasaurus, made by UGOBE, and Zeno the

Revolutionary Robotic Friend by Hanson Robotics (www.

zenosworld.com). It was a bummer I missed them both,

but there was so much

to see, and certainly

one couldn’t see it all.

Hopefully, I will be able

to catch up with them

both next year. SV

Ted Larson is the CEO ofOLogic, Inc., and an activemember in the Home BrewRobotics Club of Silicon Valley.OLogic is an embeddedsystems research anddevelopment company witha focus on robotics. OLogicis currently working withclients across a wide spectrumof application domains suchas consumer electronics,toys, medical products, andeducation (www.ologicinc.com).

CES 2008 Robot Roundup

38 SERVO 07.2008

Photo 10

Photo 11 Photo 12

Larson.qxd 5/30/2008 12:12 PM Page 38

Page 39: servo2008 07

Getting a valid lower resolution reading of the encoder

is certainly better than high resolution unreliable data.

I needed to know how far the motors really moved but

didn’t necessarily need to know with as high of a resolution

as the encoders were providing. So, the task at hand was

a way to lower the resolution enough so that I could

always count on the readings and help keep track of the

movements. A bit of encoder resolution may be lost but it

should still be close enough for this particular project.

Symptoms oof tthe PProblem

I was watching the

encoder counts while running

some robot drive motors.

During the initial bench

testing, the motors weren’t

running at full speed and the

results I saw were just as

expected. However, things

got interesting when I started

ramping up the speed. A very

peculiar thing started happen-

ing. The encoder counts

started to rise as expected

but as the motors sped up,

the counts started going backwards! As it sped up some

more, it counted forward again. This cycle continued back

and forth a bit and then the counts were completely erratic.

It appears that the encoder was exceeding the polling time

used by the controller and would start missing pulses at

higher speeds. Obviously, the encoders were not matched

up well with the controller. I’ve seen this happen with my

robot drive base and also when I was using some salvaged

encoders from HP scanners and DeskJet printers. Whenever

you see symptoms like this, it should throw up a red flag and

make you take a look to see if this may be the problem.

Encoder processor board (component side). Encoder processor board (solder side).

One of the joys of the robotics hobby is mastering the art of interfacing. A lot of the parts arealready in front of us and we just need to make them work together. Recently, I ran into aproblem with a pair of quadrature encoders for the drive train on one of my robots. Theencoders themselves worked fine and were generating perfect quadrature outputs. However,they were sending out data faster than the controller could handle at higher speeds. As aresult, the encoder readings were worthless and could not be trusted.

SERVO 07.2008 39

by Robert Doerr

Doerr.qxd 6/3/2008 1:08 PM Page 39

Page 40: servo2008 07

40 SERVO 07.2008

Methods oof CCorrecting ttheProblem

There are a few different methods of fixing this

problem. In a nutshell, we just need to reduce the number

of transitions of the encoder per revolution. Obviously, the

encoder itself could be swapped out with a lower resolution

one. If feasible, it may be possible to replace just the

encoder disk with one that has a fewer number of holes.

Another option is to change the physical placement of the

encoder within the drive train. When it is directly attached

to the armature of the motor, it may send out too many

pulses. If it was moved downstream to the wheels

themselves or at some point in the gear train, it would slow

down the speed of the encoder. It will still be sending the

same number of pulses per revolution of the encoder but it

will be rotating slower so we get the effect we’re after.

Instead of altering the mechanics of the encoder — which

isn’t always an option — we can look into electronic means

of scaling the values. At first, I considered making something

up with standard logic ICs but an easier and more flexible

option was to use a small microcontroller to help match up

the readings. Whatever method is selected, we would like

the encoder to supply as high as possible a resolution

without sending them too fast for the controller to handle.

Microcontroller tto tthe RRescue

I’ve run into this problem with other encoders and

controllers. I wanted a flexible solution so I decided to use a

small microcontroller to scale the encoder readings. This

ended up being an excellent solution that can be used for

other projects, as well. I selected an SX28 processor and

wrote all the code in SX/B. This development went really

fast. I started building the encoder scaling board one

evening and had a working prototype with the core

functionality the next day. Everything is handled by the

single SX28 chip which costs under $3. A few more

features were then added and the code cleaned up to

make it more presentable.

One of the extra features is the ability to allow a host

controller to change the scaling factor on the fly. Since it

will accept commands via serial connection, I also added a

resonator for the clock timing to ensure the serial communi-

cations would be reliable. This microcontroller will be

installed in between the existing encoder and the controller.

This way, it can monitor the encoder, condition the signal,

and output a virtual encoder signal to the host controller.

Quadrature EEncoders 1101

Many of you already know how tachometers and

quadrature encoders work, but for those who don’t, here is

a quick review. A tachometer signal only has one signal and

therefore only provides speed information and not any

directional information. It will only tell how fast something

moved but not any details about the direction of travel. It

can be used to get an estimate on distance traveled as long

as the direction is known ahead of time. However, a problem

can come up if the tachometer stops at a transition (edge).

If there are any vibrations, it can toggle state back and forth

and mistakenly give the impression that it is moving. It is

more suited to regulate the speed of a motor where distance

/direction are not important; just the speed is critical.

Adding a second channel makes all the difference! A

quadrature sensor will have two signals 90 degrees out of

phase. These two signals are commonly referred to as

Channel A and Channel B. With these, both position and

direction can be determined. The direction is determined by

comparing if Channel A is leading Channel B or if Channel

B leads Channel A. The distance can be computed by

keeping track of the counts and factoring in the direction

of movement. Velocity can be calculated by counting the

number of pulses per second. I’ve seen some references to

encoders that state: “If A leads B, for example, the disk is

rotating in a clockwise direction. If B leads A, then the disk

is rotating in a counter-clockwise direction.”

That may be true for some encoders, but needs to be

verified for the particular encoder being used. I prefer to

just think of them as two channels of information and look

at which one is leading, then match that to the actual

direction of how it is installed in the robot. The clockwise/

counter-clockwise description isn’t something that lends

itself well to straight quadrature encoders, so keeping it

generic works out well. After all, it shouldn’t matter if it is

clockwise/counter-clockwise, right/left, up/down,

forward/back, etc. The important part is that two distinct

directions can be determined; the rest is relative.

Look at the examples of output from quadrature

encoder, through a few cycles.

Chan A 0 1 1 0 0 1 1 0 0 1 1 0

Chan B 0 0 1 1 0 0 1 1 0 0 1 1

Encoder assembly on robot base.

Doerr.qxd 6/3/2008 1:10 PM Page 40

Page 41: servo2008 07

Notice that if you follow the chart from left to right

and then from right to left you’ll see that one channel will

lead the other and that is what can be used to determine

direction.

How tthe EEncoder SScalingProgram WWorks

Using a microcontroller really makes this solution

flexible. As a starting point for this program, I used the

example in the SX/B help file for reading an encoder and

displaying it on a set of seven-segment displays. Since no

display is involved, all code relating to the display was

removed. The remaining code to watch an encoder became

the basis to build upon. Instead of just incrementing and

decrementing a counter for the encoder, we just need to

keep track of a small count which ends up being the

number we’re scaling the encoder value by. This will then

be used to walk up and down the virtual Channel A and

Channel B of our scaled encoder output. Whenever we

rollover our count of the scale factor, we then update

(either up or down) the count of our virtual encoder on

the output.

Upon start-up, the program does a bit of housekeep-

ing. It will check the status of four DIP switches to get the

initial scaling factor. If the scaling factor is 0, then no

encoder processing occurs and nothing gets passed to the

host. It made sense because micros don’t like dividing by

zero. This can be useful, more for troubleshooting, though.

If the scaling factor is 1, then we end up just passing the

values from the encoder to host as they are. After all, any

number divided by 1 is the same number. For any other

value (2-15), the encoder reading will be scaled by that

amount. In other words, if we have a DIP switch setting of

3, then it takes three transitions of the real encoder to

make one transition of our virtual one on the output of the

SX28. A setting of 15 means it would require 15 transitions

of the real encoder to make one transition of our virtual

one. The scaling factor goes like this:

DIP Switch Description

0 Encoders off

1 Encoders passed as-is to host

2-15 Encoder scaled down by number specified

There are also two DIP switches used to specify the

direction of the encoders. This is useful if the encoder is

going in the wrong direction. Instead of swapping any of

the wiring for Channels A and B, the DIP switch for that

encoder can be flipped to correct the direction. This feature

was easy to implement and makes this an even more

flexible gadget.

All of the heavy lifting is done in the ISR (interrupt

service routine). The main program looks for commands

coming in from the serial port to either change the scaling

factor or reset it to the ones specified by the DIP switches.

When looking at the source code in the ISR, we can

focus on half of it since the code for the second encoder is

exactly the same with the exception of the pins used to

watch the encoder and the output pins of the virtual one.

Schematic of encoder processor board.

SERVO 07.2008 41

Doerr.qxd 6/3/2008 1:11 PM Page 41

Page 42: servo2008 07

42 SERVO 07.2008

A LLook IInto tthe IISR

The initial ISR code deals with receiving serial data in the

background and buffering it. After that code is done, the

first thing that is checked is the scaling factor. If the scaling

factor is 0, then nothing needs to be done and we just exit

the ISR. Otherwise, we call the code to check and process

the encoders. There are a couple of important points here.

First, whenever you put code within an ISR routine you

must make sure there is enough time to execute the code.

It must all run within the ISR interval allocated to the ISR

routine. If you have too many instructions in there, you’ll

have to find ways to optimize your code or make the interval

longer so that you can execute more instructions in the ISR.

In the program presented here, it may seem odd to see

a GOSUB within the ISR. The code that is called still

executes within the ISR but needs to be moved to another

bank of memory due to the way SX/B structures the

compiled program. By moving things around, it resolved an

SX/B error on Pass 2. “Address xxx is not within lower half

of memory page.” I’ve had good results with SX/B so far,

and when errors like this crop up they can often be resolved

by re-organizing some of your program.

The code to process the encoder starts out by reading the

current value of the encoder port and masking off the bits so

that the current states of Channel A and Channel B on the

first encoder are used. Then, this value is XOR’d with the

previous encoder state. If there is no change in state, then the

value will be zero and we end up dropping down to check

the next encoder. If there was a change of state, then we

need to figure out what the direction of the change was.

This is again accomplished with our friendly XOR instruction.

In this case, we shift over the old state by one bit before

performing the XOR. We just need to compare bit 0 of one

channel to bit 1 of the other. It doesn’t matter which one you

use as the base, as long as you understand that using the

opposite set of bits will switch the direction of the encoder.

In the original program, it would see if the result from the

XOR operation was 1 which would specify to decrement

the counter. A 0 would then mean the counter should be

incremented. Instead of using a hard coded value, it compares

the XOR’d value with a DIP switch. This way, if the encoder

is going the wrong way, a flip of a switch will correct it! No

wiring changes or coding changes will be required.

Awh, YYou CCount FFunny

Whenever we decrement our counter so it rolls over or

increment it past our scaling factor, we need to update our

virtual encoder values on the output. When I did this, it was

late and I just updated a simple counter from 0-3 and sent

that value out as the scaled value. When I tested it, the

encoder output would only change by one up or down but

that was it. Upon looking at the code, I realized what I had

done. I forgot about counting funny. At least that is what my

kids would say. Instead of counting 0, 1, 2, 3, the proper

count was more like 0, 1, 3, 2, etc. This was due to the

gray encoding where only one bit can change status at a

time. This was easily fixed by using my counter as the index

for a LOOKUP command. This would then take the value that

was looked up and present that at the output. This results in

the correct gray code as the output for our virtual encoder.

The processing of the second encoder is identical. It

starts out slightly different, however, because the second

encoder is on a different set of pins. To accommodate that,

it has a slightly different mask of %00001100 to isolate the

two bits we need. Those two bits are then shifted right two

bits which will put them in the proper position so all the

calculations are the same as for the first encoder. The result

is then presented to the host controller on a separate set of

pins for the second virtual encoder.

The EExtras

Whenever I have leftover pins available on a microcon-

troller, I always seem to find a use for them. One of the

features I wanted to add is the ability to alter the scaling

factor on the fly. To accommodate this, one pin is used to

receive serial data from the host controller. The command

structure follows the AppMod style for compatibility with

other modules. The header is “!ES” for Encoder Scaler

followed by an address 0-3 and then the command. The

address must match those selected

by a pair of jumpers connected to

RC6 and RC7. If the address

doesn’t match, it will ignore the

command and wait until something

is directed toward it. The exception

is an address of 255 which would

broadcast out to all the modules of

this type, regardless of their config-

ured address. At the moment, there

are only two commands supported.

The command “S” is a scale value

followed by a binary number 0-63.

Anything higher than this gets

limited to the highest scaling factor

HP encoder assembly.High resolution encoder disk.

Doerr.qxd 6/3/2008 1:12 PM Page 42

Page 43: servo2008 07

of 63. This new scale value

overrides whatever value was

used at start-up from the DIP

switches. This is useful if a

higher scaling factor is needed

than what’s available on the

DIP switch or for changing the

scaling factor on the fly. The

“R” command will reset scale

value to the one specified by

the DIP switch setting. In a

future version, a couple more

commands may be added to

return a version number to

the host and also one for

returning the current scaling factor.

Conclusion

Adding an extra microcontroller to offload tasks can help

make the overall programming of the robot easier by letting

the main controller focus on higher level tasks. They are also

useful to handle odd interfacing and protocol issues that

come up. One example is the speech translation device

covered in the December ‘07 issue of SERVO. Another is

this encoder processor to help address a problem with the

data from a set of encoders. With the addition of this

encoder scaling processor, some encoders can now be used

for controlled closed loop movements at any speed. This

allows the encoders and host controller to work well

together. There are multiple ways of accomplishing the

same goals and using a microcontroller made sense for this

particular project. Keep those robots alive! SV

Robert Doerr can be reached via email at [email protected].

Dual I/R sensor withlinear encoder.

RobotWorkshop (Author’s website)www.robotworkshop.com

SX28 series processorsOffers free software development tools like SX/B

www.parallax.com

Online user forum for the SX series of microcontrollershttp://forums.parallax.com/forums/

Wikipedia article on encodershttp://en.wikipedia.org/wiki/Rotary_encoder

National Instruments article on encodershttp://zone.ni.com/devzone/cda/tut/p/id/4763

WEB RREFERENCES

SERVO 07.2008 43

Doerr.qxd 6/4/2008 5:24 PM Page 43

Page 44: servo2008 07

44 SERVO 07.2008

This month, we’ll pull together what it takes to design,

build, and code a heavy duty DC motor driver module.

First, we’ll look at the electrical theory behind the DC motor

driver electronics. Then, we’ll build up the DC motor driver

module’s “intelligence” and meld it with the DC motor

driver’s “brawn.” If all of that passes the smoke test, we’ll

code a simple RS-232 interface, which will allow you to

control the big DC motor with simple serial commands.

The DC motor driver IC of choice for this project is the

Allegro MicroSystems A3959. The A3959 is a DMOS Full-

Bridge PWM Motor Driver IC. Before we begin our DC motor

driver IC walk-thru, let’s take a look at the problem at hand.

Big Mama Gearmotor

The behemoth you see in Photo 1 is an Anaheim

Automation BDPG-60-110-24V-

3000-R326 DC brush planetary

gearmotor. This motor is really

not a “problem.” It’s actually our

project design point. The BDPG-

60-110 weighs in at four pounds,

10 ounces. From shaft to tail, the

BDPG-60-110-24V-3000-R326

measures in at 8.08 inches. The

planetary gear section is 2.65

inches in length while the shaft

adds 1.10 inches to the overall

length. The actual motor cylinder

comes in at 4.33 inches in length.

The BDPG-60-110’s maximum diameter at the motor cylinder

is 2.36 inches.

The BDPG-60-110’s name tells much of its story. All of

the planetary gear motors in the BDPG-60-110-24V-3000-

R326’s class share the same part number including the “R.”

The numbers that follow the R provide us with more

information about the planetary gearmotor. The R326 is

the most powerful gearmotor in the bunch as it can provide

4,166 ounce-inches of continuous torque. The BDPG-60-110

can peak at twice the amount of continuous torque. The

326 also tells us what the gear ratio is. In our case, the

BDPG-60-110-24V-3000-R326 has a gear ratio of 326:1. At

326:1, the BDPG-60-110 rotates its shaft at a brisk 9.2 RPM

unloaded. If you work the gearmotor, the shaft rotation will

fall to a loaded value of 7.7 RPM. Those RPM figures may

seem too low to perform any real work. However, when

you add external gearing to the

BDPG-60-110, I can assure you

that heavy loads will move about

relatively quickly. The 3000

number in the BDPG-60-110’s

part number is the speed of the

motor before the gearbox.

I initially gave you the

BDPG-60-110-24V-3000-R326’s

dimensions in terms of inches.

However, in reality the BDPG-60-

110 likes to be described

metrically. The body diameter is

called out in the part number as

There are times when a standard hobby servo just won’t do the job.The same goes for small DC motors. Sometimes parts of aluminumhumans require a bit more torque than servos and low-load DCmotors can provide. In these cases, a hefty DC motor fills the bill.However, a meaty DC motor needs a beefy DC motor driver.

Fortunately, there is inexpensive and easyto use DC motor driver technology that isavailable to us that will drive heavy iron.

PHOTO 1. This is one heavyduty motor all packed up ina relatively tiny package.

by Fred Eady

Eady.qxd 6/4/2008 9:51 AM Page 44

Page 45: servo2008 07

60 mm. The motor cylinder length

is also part of the part number

and is specified as 110 mm.

The 24V in the part number

calls out a 24 VDC gearmotor

operating voltage. By the way,

BDPG = Brushed DC Planetary

Gearmotor. Now that we know

all about what our “problem” is,

let’s move to the next step and

learn about our “problem solver.”

The AllegroMicroSystemsA3959

I’m experimenting with the

BDPG-60-110-24V-3000-R326 and

likewise with the A3959. So,

instead of building up a

professional printed circuit board

(PCB) in the dark, I decided to base the initial tests on

official Allegro MicroSystems A3959 electronics. We will be

working with the hardware you see in Photo 2. Before I

describe the Photo 2 basic circuitry to you, let’s take a close

look at the A3959 itself.

The A3959 in many ways is a pumped-up A3979. Recall

that the A3979 output current is limited to ±2.5 amperes with

a maximum motor voltage of +35 VDC. The A3959 doesn’t

contain all of the A3979’s internal logic as the A3979 is

designed to drive stepper motors. However, the A3959’s

power grid is much heftier than the A3979’s. The A3959 is

designed to drive DC brush motors at voltages up to +50 VDC.

The maximum current capability of the A3959 is ±3.0 amperes.

Like the A3979, the A3959 is capable of controlling its

attached DC brush motor using pulse width modulation

(PWM). And again, like the A3979, the A3959 can be com-

manded to operate in slow, fast, and mixed

current-decay modes. The current-decay modes all

work in conjunction with the A3959 internal fixed

off-time PWM current-control timing circuitry.

I’ve used a bunch of motor control ICs. I’ve

also released my share of motor control IC magic

smoke. To help avoid the release of the A3959’s

magic smoke, its designers have outfitted the

A3959 with internal circuit protection. If the

A3959 gets a bit too hot under the collar (165°

C), it will shut itself down. To avoid hiccupping

on and off as it cools off, a bit of hysteresis is

built into the thermal shutdown protection.

In the course of building custom motor drivers,

one also has to build a suitable power supply

for the motor and the motor driver electronics.

I have also freed the magic smoke

of many a power supply compo-

nent in my years of working with

electronics. The A3959 relies on a

charge pump to help keep its

internal H-bridge conducting and

the motor shaft turning. To

provide a measure of safety when

it comes to the power source,

the A3959 monitors the supply

voltage and the charge pump

voltage for undervoltage condi-

tions. When a problem occurs,

the A3959 goes into shutdown

and disables the H-bridge drivers.

Okay, we’ve read the sticker

on the A3959 window. Now, let’s

kick the tires and open the trunk and look under the hood.

I’ll add some important detail to Figure 1 as we walk around

the A3959. Since the A3959 is in a DIP configuration on our

A3959 demonstration board, all of our references to its pin

locations will be based on the DIP package from here on out.

The A3959 SLEEP function is controlled by pin 22. Just

because the A3959 handles monstrous motor winding

currents doesn’t mean it can’t be included in a low-power

application. By driving the A3959 SLEEP pin logically low,

we command it to enter SLEEP mode. The majority of the

A3959’s internal circuitry including the regulator and charge

pump will be disabled while it sleeps. If we choose not to

employ SLEEP mode in our application, we must drive the

A3959’s SLEEP pin logically high using a 4.7K pullup resistor.

To understand the functionality offered by the EXT

MODE pin — which happens to be pin 15 of our A3959 —

SERVO 07.2008 45

PHOTO 2. This is a shot of the “brawn”of our DC motor driver. Beforewe’re done, we’ll add homebrewedintelligence to this picture.

FIGURE 1. Once you understand what the A3959is and what it can do for us, this figure doesn’t

seem that busy anymore.

Eady.qxd 6/4/2008 9:52 AM Page 45

Page 46: servo2008 07

46 SERVO 07.2008

we must first have a firm grasp on the ENABLE pin. If we

wanted to control the speed of a motor, we would feed the

PWM speed control signal into pin 10 (ENABLE) of the A3959.

When the incoming ENABLE PWM signal swings logically

high, the A3959’s selected H-bridge sink and source pair are

activated. The H-bridge sink and source pair is selected with

the logic level present on the PHASE pin. The A3959 PHASE

input is located on pin 3. By driving the PHASE pin logically

high or logically low, we select alternate sink and source

H-bridge DMOS pairs and dictate the rotational direction of

the motor shaft. Driving the ENABLE input logically low will

switch off the source driver or both the source and sink

driver depending on the logic present at the EXT MODE pin.

When the ENABLE pin is at a logically low level, this is

called the chopped cycle. The EXT MODE input logic

determines the current path during the chopped cycle.

For instance, when EXT MODE is driven logically low, the

opposite pair of selected drivers will be enabled during the

chopped cycle. This is called External Fast Decay Mode.

Conversely, when the EXT MODE pin is driven logically high,

External Slow Decay Mode is invoked and both of the sink

drivers are activated during the chopped cycle.

All of the switching of the H-bridge source and sink

drivers generates current spikes. The A3959 contains

circuitry to synchronize the activation of the source and

sink drivers versus the current drawn through the motor

winding. A current spike could erroneously reset the source-

enable latch. To filter out the current spikes, the A3959

simply ignores its motor winding current sensing circuitry

for a period of time when the spikes are known to occur.

Driving the BLANK pin logically high provides twice the

blanking (ignoring) time of driving the BLANK pin logically

low. The BLANK timing is set via the A3959’s pin 12.

How much BLANK time is twice as much? Well, that all

depends on what we hang off of the A3959’s ROSC pin.

The datasheet recommends an internal oscillator frequency

of 4 MHz. To utilize the services of ROSC, we simply hang a

resistor from pin 4 to VDD. Here’s how we come up with

the 51K ROSC resistor value you see in Schematic 1 that

provides the basis for the 4 MHz clock:

NOTES:1. LED1 AND LED2 - MOUSER 606-4302F5-5V2. SP233ACP 20-PIN DIP

+5VDC

+5VDC

VBB

+5VDC

+5VDC

+5VDC

C1.1uF

C13

.1uF

C3

.1uF

C14.1uF

C10

.22uF

C2.1uF

C9

.1uF

U1

PIC18F4620

123456789

1011121314151617181920 21

22232425262728293031323334353637383940*MCLR

RA0RA1RA2RA3RA4RA5RE0RE1RE2VDDVSSOSC1OSC2RC0RC1RC2RC3RD0RD1 RD2

RD3RC4RC5RC6RC7RD4RD5RD6RD7VSSVDDRB0RB1RB2RB3RB4RB5RB6RB7

U2

A3959SB

765

17

3

4

14

15

8

9

16

1311

20

18

12

10

23

24 2 1

21

19

22

GN

DG

ND

GN

D

SENSE

PHASE

ROSC

REF

MODE

GN

D

VDD

OUTA

PFD1PFD2

VBB

GN

D

BLANK

ENABLE

VREGVCP

CP1

CP2

OUTB

GN

D

SLEEP

C4.1uF

LED1

R310K

C5.1uF

LED2

R413K

R55.6K

MT1MOTOR DC

P1

DB9 FEMALE

594837261

ICSP CONNECTOR

123

456

123

456

R1100

U3

SP233ACP

12

320

11151610

1217

518419

6

7

9

T2INT1IN

R1OUTR2OUT

C2+C2+C2-C2-

V-V-

T1OUTT2OUT

R1INR2IN

GND

VCC

GND

+

C6 10uF

+

C8 47uF

C12 .22uF

R2 1K

C11 .22uF

C7

.22uF

R74.7K

R8

.1

R651K

SCHEMATIC 1. The PIC18F4620 isunderutilized here and that’s a

good thing. That leaves you withlots of I/O and memory resources

for your motor application.

Eady.qxd 6/4/2008 9:53 AM Page 46

Page 47: servo2008 07

fOSC = 204 x 109 / ROSC

4 MHz = 204 x 109 / ROSC

ROSC = 204 x 109 / 4 MHz

ROSC = 51K

Applying our clock frequency to the BLANK pin logic

level results in the following:

When BLANK = 0 tblank = 6/fOSC

When BLANK = 1 tblank = 12/fOSC

I’ll let you do the BLANK math. Recall that I mentioned

earlier that the A3959 used internal fixed off-time PWM

current-control timing circuitry. Well, now that we know

what the internal oscillator is doing, we can compute the

fixed off-time interval. The A3959 is factory set for a fixed

off-time of 96 cycles of the internal oscillator. That comes to:

Fixed off-time = 96 x (1 / 4 MHz) = 24 μs

The PFDx pins control the function of the A3959’s

Internal Current-Control Mode. Those switching spikes we

just discussed are detected at the SENSE pin. The SENSE

input is responsible for monitoring the motor winding current

and feeding that information into the A3959’s internal current

sensing/control circuitry. When an overcurrent event is

detected at the A3959’s SENSE pin (pin 17), the selected

internal current-decay method is invoked. The internal current-

decay method is determined by the logic levels of pins 13 and

11, which are PFD1 and PFD2, respectively. We already know

what the internal current-decay modes are. So, applying

logical low levels to both of the PFDx pins selects slow decay

mode. Conversely, when both PFDx pins are driven logically

high, we have selected fast decay mode. In slow decay mode,

both of the A3959 H-bridge sink drivers are turned on for

the entire fixed off-time, which we computed as 24 μs.

A combination of logic inputs on the PFDx pins provides

us with two mixed decay mode selections. Driving PFD1

logically high and PFD2 logically low will invoke fast decay

mode for 15% of the fixed off-time with slow decay taking

up the rest of the fixed off-time interval. Driving PFD1

logically low while driving PFD2 logically high will produce

fast decay mode for 48% of the fixed off-time and slow

decay mode for the remaining 52% of the fixed off-time

interval.

If this all seems a bit too much on the theory side, don’t

worry. We’ll have total program control over all of the A3959’s

inputs. That way, we can experiment with the logic levels

until we find a combination that suits the BDPG-60-110.

If you had the opportunity to check out my SERVO A3979

article, you already know about the A3959’s VREG pin and the

A3959’s charge pump as their functionality across devices is

identical. We need only hang a 0.22 μF capacitor from the

VREG pin (pin 23) to ground. The voltage associated with VREG

is generated internally and is used to operate the A3959’s

H-bridge sink drivers. The charge pump pins, CP1 and CP2,

also require a 0.22 μF capacitor connected between them

to assist in the charge pump operation. The charge pump

generates a gate supply voltage that is greater than the VBB

motor winding supply voltage. The gate supply voltage

drives the A3959’s H-bridge source drivers. Another 0.22 μF

capacitor is tied from the CP pin to ground to act as a

reservoir for the H-bridge source drivers. CP1 and CP2 are

represented as pins 2 and 1, respectively, on the A3959 DIP

package. CP functionality can be found at pin 24. Access to

the motor winding voltage input (VBB) is at pin 20.

A3959 load current regulation is a function of the internal

fixed off-time PWM control circuit working in conjunction

with the external sense resistor, which hangs from the SENSE

pin. When the OUTA and OUTB outputs (pins 16 and 21,

respectively) are activated, current flows through the motor

winding. The motor winding current increases until it reaches

a predetermined trip value. The current trip value is a direct

product of the value of the external sense resistor and the

voltage applied to the VREF pin. The A3959’s sense comparator

resets the source-enable latch when the current trip point is

reached. As a result, the H-bridge source driver is deactivated.

Recall that we use blanking to prevent the source-enable latch

from being reset at the wrong time by a current spike. Once

the source driver is turned off, the motor winding current

recirculates for a time equal to the fixed off-time interval.

During the recirculation time, the logic levels at the PFDx pins

determine which internal current-decay mode (slow, fast, mixed)

is invoked. The current trip value is calculated as follows:

ITRIP = VREF / 10RSENSE

Let’s calculate the ITRIP value from the values you see in

Schematic 1:

Using good old Ohm’s Law against the VREF pin:

Where VDD = +5 VDC

I = E / R

I = 5 / 18.6K

I = 268.8 μA

Voltage at VREF = 268.8 μA x 5.6K = 1.505 Volts

ITRIP = 1.505 x (10 x 0.1) = 1.505 amperes

We can crank up ITRIP if we want to as our BDPG-60-

110 can eat 2.2 amperes of current. What we have is fine

for now. In the process of computing ITRIP, we covered the

only pin of the A3959 we have not yet addressed: VDD. Pin

9 needs to be sourced with +5 VDC.

The A3959 DIP package is 24 pins deep. So, that leaves

a total of six pins we haven’t covered thus far. We can end

our A3959 walk-around right here as the remaining six pins

are all GROUND pins. Any internal heat that is generated is

dissipated through pins 6,7,18, and 19, which should be

directly attached to a heatsink pad.

The circuit for the A3959 motor driver is already laid

SERVO 07.2008 47

Eady.qxd 6/4/2008 9:53 AM Page 47

Page 48: servo2008 07

48 SERVO 07.2008

down for us on the demonstration board. So, let’s build up

our A3959 controller.

PICing an A3959 Motor DriverController

I’ve chosen the PIC18F4620 to perform the A3959

controller duty. If you’ve ever designed with a PIC micro-

controller, there’s nothing new for you here. In fact, the PIC

controller hardware is so easy, I could simply tell you to look

the circuit over in Schematic 1 and be done with it. As you

can see in Photo 3, the PIC hardware is so simple, I

hand-wired the PIC A3959 controller circuit on a perfboard.

I elected to leave the SLEEP pin alone and tie it to an

inactive state. I also chose to use the lesser PWM Blank

time (6 / fOSC ) by tying the BLANK pin to ground.

There are plenty of I/O pins to spare. So, if you want to

experiment with the control lines I’ve chosen to logically tie

to a static state, don’t be afraid to hook up the SLEEP and

BLANK control lines to the PIC. If you use my existing

control line code as an example, you won’t have any

problems coding in the extra control lines.

The real work involved with building up an A3959

motor driver controller is in the firmware. With that, let’s

begin our firmware build by associating the A3959 control

pins with their PIC18F4620 counterparts:

//*******************************************************//* A3959 PIN DEFINITIONS//*******************************************************#define PFD1 LATB0#define PFD2 LATB1#define ENABLE LATB2#define PHASE LATB3#define MODE LATB4

The names I’ve assigned to the PIC18F4620 PORTB I/O

pins should be very familiar to you. It would be nice if we

reduced the complexity of the PFDx selections, as well:

#define decay_slow PFD1 = 0; \PFD2 = 0;

#define decay_mixed_15 PFD1 = 1; \PFD2 = 0;

#define decay_mixed_48 PFD1 = 0; \PFD2 = 1;

#define decay_fast PFD1 = 1; \PFD2 = 1;

Using C macros to put human-readable names on the

PFDx selections will make life a bit easier if you want to

experiment with the PDFx settings. The same holds true for

the EXT MODE selections as well:

#define ext_mode_fast MODE = 0#define ext_mode_slow MODE = 1

The reason we are here is to turn the BDPG-60-110

motor shaft. So, it would be fitting to put together some

motion macros:

#define CW 1#define CCW 0

#define motion_CW ENABLE = 1; \PHASE = CW;

#define motion_CCW ENABLE = 1; \PHASE = CCW;

#define motion_HALT ENABLE = 0;

Note the use of the A3959 ENABLE pin to start and stop

the BDPG-60-110-24V-3000-R326. When you run your motor,

remember that clockwise and counter-clockwise rotation is

determined depending on how you attached the motor leads

to the A3959 OUTx pins. These CW and CCW settings worked

for me. The PHASE logic swaps the polarity of the OUTx pins.

If your CW and CCW directions are opposite of mine

here, it’s much easier to simply swap the motor leads than

recompile and reload the PIC18F4620.

With all of our A3959-to-PIC18F4620 definitions and

associations complete, we can add this bit of code at the

end of our initialization routine:

//*******************************************************//* INITIALIZE A3959 MOTOR DRIVER HARDWARE//*******************************************************

decay_mixed_15; // PFD1 = 1 - PFD2 = 0ext_mode_fast; // MODE = 0motion_HALT; // ENABLE = 0

I promised that we would also write some PIC firmware

that would allow us to control the BDPG-60-110 through

the A3959 controller’s serial port. I have coded up all of the

necessary EUSART firmware for the PIC18F4620. You can

see what I’ve done with the PIC18F4620’s EUSART by

downloading the A3959 driver firmware from the SERVO

PHOTO 3. It doesn’t getmuch better than this.I’ve taken to poweringsmall PIC projects like

this from a PC USB port.

Eady.qxd 6/4/2008 9:54 AM Page 48

Page 49: servo2008 07

website at www.servomagazine.com. Here’s the code

that will put the menu up in a terminal emulator window:

void show_menu(void){

cls();cls();printf(“%c[2;4H SERVO A3959 MOTOR CONTROL

MENU”,esc);printf(“%c[5;7H F - ROTATE CW”,esc);printf(“%c[6;7H R - ROTATE CCW”,esc);printf(“%c[7;7H S - STOP”,esc);

}

Entering an F, an R, or an S invokes the main routine code,

which is looping continuously:

//*******************************************************//* MAIN SERVICE LOOP//*******************************************************

show_menu();do{if(CharInQueue())

{bytein = recvchar();switch(toupper(bytein))

{case ‘F’:

motion_HALT;mdelay1(100);motion_CW;

break;case ‘R’:

motion_HALT;mdelay1(100);motion_CCW;

break;case ‘S’:

motion_HALT;break;

}}

}while(1);

The CharInQueue() function informs the main routine

that a character is waiting in the EUSART’s external buffer.

When a character arrives from the personal computer, we

retrieve it from the external buffer and parse it. If the

character is an F, we stop the BDPG-60-110-24V-3000-R326,

wait for 100 ms and rotate the BDPG-60-110’s shaft in the

clockwise direction. An incoming “R” stops the motor, waits

for 100 ms, and forces the BDPG-60-110’s motor shaft to

rotate in the counterclockwise direction. To stop the motor

shaft, we simply drop the ENABLE line to a logical low.

That’s all there is to it!

Spinning OutMy version of the A3959 motor controller is shown

attached to its demonstration board in Photo 4. When

you’re ready to put the A3959 to work in a real-world

motor driver application, be sure to solder the A3959 directly

to the PCB. The A3959 tabs need to be soldered to a

copper heatsink area provided on the PCB. Give the

heatsink area as much of the PCB’s copper as you can.

The download package firmware was written using the

HI-TECH PICC-18 C compiler and contains lots of goodies

you can use in other projects, such as timer manipulation

routines, timer interrupt handlers, serial communication

routines, and serial communications interrupt handlers. The

A3959 is a really robust and easy to use part. I have no

doubt you’ll have your aluminum human doing some heavy

lifting in no time flat. See you next time! SV

Fred Eady can be reached via email at [email protected].

Allegro MicroSystems — www.allegromicro.comA3959

A3959 Demonstration Board

Microchip — www.microchip.comPIC18F4620

HI-TECH Software — www.htsoft.comHI-TECH PICC-18 C Compiler

Anaheim Automation — www.anaheimautomation.comBDPG-60-110-24V-3000-R326

SOURCES

PHOTO 4. You’ll want to build up an A3959 motor driver boardwithout the socket if you plan to run a motor for an extended

length of time. It is important to make sure that the A3959heatsink tabs are soldered to the copper heatsink area.

SERVO 07.2008 49

Eady.qxd 6/4/2008 9:55 AM Page 49

Page 50: servo2008 07

In Part 1, we studied Loki’s mechanical construction from

PCB (printed circuit board) material. The controller board

mounts on top of the body.

Part 1 also mentioned that I was inspired to build Loki

because of his antics in walking and posturing. Another

reason I had for building Loki was to investigate subsumption

and behaviors. Simply put, behaviors are the actions taken

by a bot with given inputs. Loki will avoid an obstacle in its

path. Another behavior would be to follow (or avoid) a light

source. Subsumption is the inhibiting of one behavior by

another. However, more in-depth discussions of behaviors

and subsumption are beyond the scope of this article. I do

intend to port these ideas as ‘C’ functions into my hexapod

(Shelob), as well.

Controller BoardAlmost any controller board and processor can be

used on a robot this size. I had several bare QwikFlash

boards on hand I had purchased from the PICbook website.

This website (www.picbook.com) supports the book

Embedded Design with the PIC18F452 Microcontroller

written by John Peatman. I’m currently using the 18F4620

PIC, although the 18F452 discussed in John’s book can be

used, and possibly even an old 16F877, as well (untested

and limited). See the CA1.PDF document on the PICbook

website for construction, bill of materials, block diagram,

and a schematic of this fine board. Note that no hex file or

code is planned for the ‘877 chip at present. A hex file is

currently available for the ‘4620 PIC implementation.

The BookJohn’s book on the ‘452 is an excellent tutorial for

learning the workings of the 18F452, as well as the

18F4620 I used. And having a board to try out code on is

very helpful. Although John’s book uses assembly language

to test out the inner workings of the PIC, It is still quite useful

for C language developers and experimenters. Microchip

thought enough of the book to give out copies of it as

prizes for their seminar classes at the recent Embedded

Systems Conference. Other prizes were the ICD2 in-circuit

debugger and PIC start boards. (Now I have an additional

copy to pass along to my oldest son, who is also a

hardware engineer and is interested in the PIC.)

The QwikFlash board with a ‘4620 PIC runs at 40 MHz,

has 64K of Flash, 3986 bytes of RAM, and 1,024 bytes of

EEPROM. Plenty of I/O bits, counters, and timers too for

our use! To control Loki — or any other small bot — I added

connectors for four R/C servos, two Sharp GP2D12 IR

In this second part of the Loki project, theQwikFlash controller board and its controlsoftwaRE will be examined. This is a very usefulboard for all kinds of robotic projects. I have two runningbots at this time and another one in the works!

Loki Crosses thePond — Part 2Loki Crosses thePond — Part 2

50 SERVO 07.2008

by Alan Marconett

QwikFlash board populated with LCD (on Shelob).

Marconett2.qxd 5/30/2008 2:14 PM Page 50

Page 51: servo2008 07

rangefinders, and a Devantech

SRF08 ultrasonic rangefinder in the

“prototype” area of this board.

The QwikFlash controller board has

an RS-232 level converter and a built-in

DB-9 connector for communications,

although I currently use just the TTL

lines for telemetry (via Bluetooth). With

it, I run a terminal interface program

called T2 on my PC to access Loki’s

small monitor program. I used the

monitor program to develop Loki’s

gaits and postures.

There is even an 8x2 character

LCD that can be added to the board,

although only the board on Shelob has

this part. The LCD is not currently used

on Loki. The Bluetooth (Blue SMiRF)

setup I’m using is from SparkFun, and

is great for freeing Loki from wires

(it doesn’t take much weight to off-

balance a small robot such as this).

Otherwise, a lightweight, three-

conductor cable can be used for

normal RS-232 communications.

The QwikFlash board requires 7 to

9 VDC, which I get from a 1,300 mAh

7.2V battery pack I salvaged. A 6V

battery pack would be sufficient if

you’d like to use a 9V battery for the

controller instead. I added three

1N4001 power diodes in

series to drop the voltage

from the battery pack closer

to 6V for the R/C servos I

used (servos don’t like too

much voltage). A modular

RJ11 connector to match

the Microchip MPLAB ICD2

in-circuit debugger cable is

also on the board. I used the

ICD2 to download and

develop the code for Loki.

MPLAB IDE v7.4 runs the

ICD2 and invokes the HI-TECH

Software compiler that I used.

Controller BoardConstruction

To build the QwikFlash

controller board, you can

follow the instructions in the

CA1.PDF document found on

the previously mentioned

PICbook web page. Some

comments are in order. If

you use a Bluetooth module,

SERVO 07.2008 51

Schematic 1. Drawingof Loki sensor, servo,and battery wiring.

Loki Crosses the Pond — Part 2

• Cheap walking robot, low cost parts, can be made at home• Loki is inspired by the efforts of David Buckley

http://davidbuckley.net/DB/Loki.htm.• Original construction was wood (I later found out)• My Loki is constructed of PCB material to a similar size• Currently using four Futaba S3004 R/C servos, need bigger knee servos• Battery is a salvaged six-cell Ni-MH 7.2V 1,300 mAh pack• Controller board is a $15 (bare) QwikFlash 18F4620 PIC board available from

www.picbook.com• 50 MHz, 64K Flash, 3K RAM, plus EEPROM• Bluetooth wireless for telemetry and monitor control• EEPROM gaits editable over wireless link• PIC programming via ICD2• Control program written in HI-TECH C, used to develop gaits• Two modes, autonomous and control via a small monitor program• Parser used to decode commands received by monitor• EEPROM commands save, view, and execute steps in sequences• Autonomous control currently consists of simple obstacle avoidance while doing

a simple walk• Sensors include two Sharp GP2D12 IR range finders and a SRF08 ultrasonic

rangefinder• Body and feet PCB material CAD designed and cut on my CNC’d Sherline mill• Loki’s gait is exaggerated due to the need to clear the toes of the overlapping feet• R/C servos are driven by two timers and interrupts in the PIC• Servo commands set new angle for servo and time to get to new position• Gaits are stored by strings of servo move commands, similar to those of the

Lynxmotion SSC32 servo controller• To walk, a simple array of six strings is repeated in an endless loop• More strings allow Loki to make turns• An FSM selects the strings to be used, and changes the string selection upon

recognition of an object by a sensor

LOKI Four-Servo Biped Robot Summary

Marconett2.qxd 5/30/2008 2:14 PM Page 51

Page 52: servo2008 07

you will not install the U1 MAX232 level converter IC.

Also not installed is U2, the MAX522 DAC, as we will be

using the I2C interface for our ultrasonic sensor. We don’t

need the connector on the bottom of the board, unless

you just want it.

Add Parts to the Prototype AreaTo interface to our four servos and two IR sensors, we

need to add some three-pin, single row, straight solder tail

headers. I used the same header stock used elsewhere on

the board. A six-position header is used for the Bluetooth

connections and a five-position header is used for the

ultrasonic rangefinder. These sensors are for the

autonomous operation, but you can run Loki without

them in the terminal mode.

Six resistors are needed. Four of the resistors are

in-line to the data pins of the servo connectors, while the

remaining two resistors are pull-ups for the I2C lines.

I used a three-position terminal block (optional) to

experiment with different batteries. You’ll want to provide

a direct path from the battery to the servos to minimize

52 SERVO 07.2008

Loki Crosses the Pond — Part 2

VDD

VDD

VDD

VDD

VDDPOT15 k�

potentiometerAlive LED

VDD

VDD

VDD

VDD

VDD

VDD

VDD

VDD

GND31

32

12

11

14

1

13

GND

OSC2

OSC1

MCLR

2526

1413

7

16

15

8

INT2INT1

(RB7)

(RB6)

(RC7)(RC6)

(RC5)

(RC3)

RC4

RC2

RC1

RC0

(RA5)

RA4

RA3

RA2

RA1

(RA0)

Unused

RB5RB4RB3

Unused

RB2RB1

RC1RC0

VDD

VDD

VDD

RE2RC3

GND 1

H2Expansion header

(See Appendix A2)

3579111315

246810121416

RC2RD2

RB0RB1RB2RB3RB4RB5

RC5RC4

B1/INT1GNDB0/INT0GND

GNDDACA

24

23

18 2

85

61

4 7 3

17

16

15

7

6

5

4

3

2

10

98

30292827

ERS 8 � 2 LCD

display

LCD1

"Nibble"interface

B7B6B5B4

SW3Pushbutton switch

Unused

RPG1Rotary pulse

generator(24 inc./rev.)

64

14131211

2

3

15

22

21

20

19

D8

D4

D5

D6

D7

GND

GNDC2/CCP1

GNDC1/CCP2

QwikFlashinstrument input

(bottom of board)

Protection circuitry

DACB

GNDE2/AN7

DIN

U2Dual 8-bit DAC

OutA

OutBSCLKCS

H3

H1Terminal

strip at topof board

RB0INT0

SDO

SDI

SPI

CC

PA

DC

SCK

CCP1

CCP2

AN4

AN0

AN7

Inte

rrup

ts

910

RTS*

CTS*

1112

3837363534

33

RD0

C1222 pF

C1322 pF

Yl10 MHz

SW1

D3

D1R2 � 1 k�

R447 k�

R3470 �

SW2RESET

*RTS & CTS can beconnected to unused

PIC18F452 pinsto support hardwareflow control of serial

data transfers.

R12 � 1 k�

Right LED

Center LED

Left LED

C8

C7

R11 � 47 k�

R1 � 470 �

R13 � 10 k�

R9 � 10 k�

R10 � 10 k�

R15470 �

R143.3 k�

R5 � 1 k�

R6 � 1 k�

R7 � 1 k�

R8 � 1 k�D2

CON3Power

connector

PowerLED

REG1

9 V in, 5 V out

� �

RD1

PO

RT

DP

OR

TC

PO

RT

BP

OR

TA

PO

RT

E

RD2

RD3

RD4RD5RD6RD7

RE2

RE1RE0

VDD

VDD

GND1

U3PIC18F452

40

39

J1Jumper forQwikBug

Forin-circuitdebugger

ForQwikBug

Deb

ugha

rdw

are

CON1Modular

connector

CON2DB9F

connector

U1MAX232A

UARTRXTX

C170.1 F�

C1 � 0.1 F�

C533 F�

C150.1 F�

C160.1 F�

C1433 F�

2

1

3C4 � 0.1 F�

C11 � 0.1 F�

C10 � 0.1 F�

4

5C2 � 0.1 F�

6

C3 � 0.1 F�

C6 � 0.1 F�

VDD

132456

32785

C9 0.1

F

MCLR

MCLR

VDDTMP1

Temperaturesensor

Schematic 2

Marconett2.qxd 5/30/2008 2:15 PM Page 52

Page 53: servo2008 07

noise. Install two or three 1N4001 diodes in series with the

battery if you intend to use the 7.2V higher voltage battery

pack. A bypass cap is sometimes needed on the servo

battery line. Another possible addition is a seven-pin,

double row, straight solder tail header for

the optional LCD display (follow

instructions in CA1). An external 16x2

LCD display could also be used. In

this case, you might want to put the

connector on the top of the PCB.

Current software does not utilize the

LCD display; and the RE0 and RE1

pins were usurped for use by the IR

sensors. These PIC pins will need to be

re-assigned if the LCD is used.

The above parts are all added to

the prototype area of the QwikFlash

board. Wire these per the “Servos and

Sensors” diagram in Schematic 1.

There are hole positions for four

miniature toggle switches on Loki’s

body. I’m currently using only one for

servo power. There is already a toggle

switch on the QwikFlash board for 5V

power, but it is wired after the 5V

regulator chip. Builders might want to

add a switch in the power line to the

QwikFlash board, or for a board that

does not have its own power switch.

CablesI used four 4” pre-made “jumper”

wires for the ultrasonic rangefinder

(cut two blue 8” lengths in half) and

six 6” yellow wires for the Bluetooth

transceiver. These are available from

SchmartBoard (the colors designate

the length) and have female pins for

.025” posts on either end. (These are

great for working on proto boards.)

The ultrasonic rangefinder cable will

need a CST-100 six-position connector

receptacle stuffed with six Crimp

CST-100s. A tool is available to crimp

the pins, or use a pair of needle-nose

pliers to crimp the pin on the wire

before inserting them into the

connector receptacles. You’ll also want

to solder in a five-position, single row,

straight solder tail header into the

backside of the ultrasonic rangefinder.

One of the other standard length

jumpers (red) would probably work for

the SMiRF, but I wanted a connector

body here. As an afterthought, I’d

have put one on the ultrasonic sensor

cable, as well.

ElectricalThe electrical system on Loki is simple. It consists of a

battery, switch, battery connector, and wiring. The free

ends of this wiring are to be terminated in the power

SERVO 07.2008 53

Loki Crosses the Pond — Part 2

ITEM/DESCRIPTION QTY SUPPLIER/PNQwikFlash board options• Blank PC board only 1 Micro Designs Inc./QF-QFPCB3.1• Parts kit for 452 demo board 1 Digi-Key/18F452-KIT-ND-OR-• Unassembled PC board and parts kit 1 Micro Designs Inc./QF-PARTS2• IC MCU Flash 32KX16 40 DIP 1 Digi-Key/PIC18F4620-I/P-ND

Available as programmed part from the author. (un-programmed)

Additional parts for prototype area of QwikFlash board• Rectifier GPP 50V 1A DO-41 3 Digi-Key/1N4001DICT• Conn Header .100” SINGL STR 36 POS 1 Digi-Key/S1011-36-ND• RES 2.7K ohm 1/4W 5% carbon film 2 Digi-Key/2.7KQBK-ND• RES 1.0K ohm 1/4W 5% carbon film 4 Digi-Key/1.0KQBK-ND• Qty. 10 5” jumpers and 20 headers 1 SchmartBoard/920-0006-01• Qty. 10 7” jumpers and 20 headers 1 SchmartBoard/920-0007-01• CST-100 six-position connector receptacle 1 Digi-Key/A19494-ND• Crimp CST-100 pins 6 Digi-Key/A19520-ND• Conn 2.1 mm female plug 5.5 mm OUT 1 Digi-Key/CP3-1000-ND

Sensors• Devantech SRF08 ultrasonic rangefinder 1 Super Droid Robots/TS-012-008• Sharp GP2D12 IR sensor 2 Lynxmotion/SIR-01

Servos and batteries• HS-475HB (76 oz in) standard servo 4 Lynxmotion/S475HB• 7.2 volt Ni-MH 1600 mAh battery pack 1 Lynxmotion/BAT-02• Wiring harness — battery connector 1 Lynxmotion/WH-01• 2.4 - 7.2 VDC Ni-CD and Ni-MH universal 1 Lynxmotion/USC-01

smart charger

Bluetooth• Bluetooth modem — BlueSMiRF RP-SMA SKU# 1 SparkFun/WRL-00158• Bluetooth USB module SKU# 1 SparkFun/WRL-00150• 2.4 GHz duck antenna RP-SMA SKU# 1 SparkFun/WRL-00145

Body parts• 0.25” dia. standoff RND 4-40 .625”L alum 8 Digi-Key/1839K-ND• 0.25” dia. standoff RND 4-40 .375”L alum 2 Digi-Key/2026K-ND• 4-40 x 1/4” Philips head screws 8• 4-40 x 5/8” Philips head screws 2• 4-40 nuts 10

• Approximately 150 sq in. 1/16” double-sided Digi-Key or surplusPCB board

• PCB copper clad 4.5” X 7” two-side 3 Digi-Key/PC41-C-ND• PCB copper clad 6 X 9” two-side 1 Digi-Key/PC53-ND

• Approximately 25 sq in 0.0625” 5052 (H32) Onlinemetals or surplusaluminum plate

• Servo angle brackets bend up from 2aluminum plate

• IR sensor mount 1/2” x 1/2” x 6” long 1aluminum angle bend up from aluminum plate

-OR-• IR sensor mount 1/2” x 1/2” x 6” long 1

aluminum angle

Parts List

Marconett2.qxd 6/4/2008 8:55 AM Page 53

Page 54: servo2008 07

connector. The red +V wire goes to the center connector;

the black -V wire goes to the shell. This connector allows

easy disconnect from the controller board. The battery

connector can be disconnected to allow connection of the

battery charger.

SoftwareNow down to the software issues. I’m an old hand at

the C language, and I naturally grabbed my trusty HI-TECH

compiler for the job. (Note that any one of several different

languages would work.) Although I’m not using one, a

boot loader would be a good choice for a ‘bot like this.

As mentioned, I use an ICD2 for programming, and have

to plug in a modular cable for this. Obviously with a boot

loader and wireless connection, no cables would be

needed! But don’t dismiss this simple umbilical cord; it is an

easy way to get started. In fact, I initially ran my Loki with a

battery pack lying on my desk. Having the weight of the

battery pack off-loaded allowed me to use some old Futaba

S3004 R/C servos I had laying around until I could

determine what size servos I needed. The S3004 servos at

the knees are too weak to lift up the body of Loki. You

could also use the Hitec RCD servos listed here:

Hitec HS-645MG 107 oz-in @ 4.8V, 133 oz-in @ 6.0V

Hitec HS-475HB 61 oz-in @ 4.8V, 76 oz-in @ 6.0V

Note: Futaba 3004 servos rotate the opposite direction

to Hitec HS-475HB servos! Be sure you account for this

if you change between the servo brands. I’m currently

making modifications to the code to accommodate both

rotations.

RTOSLoki’s controller program is basically a “baby RTOS”

(real time operating system), which means that there are

several tasks that run at the same time, managed by an ISR

(interrupt service routine).

The ISR is called at a regular

interval by a timer interrupt.

The ISR generates “system

ticks” that initiate various

background tasks. Also,

several peripherals are

supported by an ISR in the

background. The USART

and A/D converter are

examples of this, as are the

updates for the R/C servo

positions. The I2C FSM for

the ultrasonic rangefinder

relies on multiple calls from

the scheduler to avoid

“blocking” while waiting for I2C events. This RTOS is not

pre-emptive and only supports a fixed list of tasks; hence,

the baby moniker.

The current controller program (RTOS) is a bit eclectic

in that it has a monitor that accepts commands from a

console and also supervises an autonomous mode for

when the robot is on its own. I’ve mentioned the monitor

command to move the servos; there are also commands to

save/view/execute the servo positions stored in EEPROM,

and to read the sensors. The current autonomous mode

is in its infancy; it’s merely a simple obstacle avoidance

behavior for now. More is planned for it in the future.

ParserThe heart of the monitor is a simple hacked-together

parser to decode commands for Loki. Perhaps the most

important command is the R/C servo command which takes

position parameters for up to four servos (although I’ve

planned to allow up to eight servos) at a time. A servo

command is a simple string of ASCII characters (like

“#0P1200 #1P1500”) ending in a CR (carriage return) in a

format similar to that used by SSC (Serial Servo Controllers)

such as the Lynxmotion SSC32 servo controller. This is

convenient for me, as Shelob — my main hexapod — uses it.

Add to the command a parameter for the required time of

the move (“T1000”), and we have a means of commanding

1-4 servos to move in what’s called in CNC parlance a

“coordinated motion” (all axis motion starts and ends at the

same time). This is very convenient for moving the legs of

Loki, or any robot, for that matter.

Loki currently recognizes the following commands or

parameters:

• REV Loki revision # sign-on

• ESC Clear error

• #n Servo #

• + - Offset of servo position

• Tnn Time

• Pnn Servo position

54 SERVO 07.2008

Loki Crosses the Pond — Part 2

Top view of Loki (new legs). Sonar and IR sensors.

Front view of Loki (new legs).Sonar and IR sensors.

Marconett2.qxd 5/30/2008 2:16 PM Page 54

Page 55: servo2008 07

• POnn Servo offset

• Cnn Canned sequence #

• Knn Continuous canned sequence #

• R Reset (stop) sequence

• U Range request (sonar)

• Z.. Pot update of a servo

• I Range request (IR)

• X Execute step of stored EEPROM sequence

• Y Execute (back) step of EEPROM sequence

• V View stored EEPROM steps

• E Save current position into EEPROM step

• A Set address of execution step

Loki can execute either one of the canned sequences,

or the EEPROM sequence that’s been saved. I developed

the simple six-step gait and turn sequences used by the

autonomous mode (and the canned sequences) with the

EEPROM commands.

Either the ‘Z’ or ‘+/-’ offset commands can be used

to position a servo, and then store all servos with the ‘E’

save command.

Sequences and Autonomous ModeThe SW3 pushbutton is pressed to start up the

autonomous mode of Loki. Loki starts by walking forward,

and will take random turns at random intervals. Loki turns

away if the IR sensors encounter an obstacle. The forward

walk is accomplished by continuously looping through

canned sequence #1.

A full left turn is really three #3 sequences, and a full

right turn is three #5 sequences. Although not very efficient

on space, the sequences are “man readable,” and easily cut

and pasted into a program or manually sent via a terminal.

Wondering what sequences #2, #4, and #6 are? They

are backwards gaits of #1, #3, and #5, respectively.

Sequence #7 reads the pot to determine position (more on

that later), and #8 is a waving posture.

To control the transitions between the sequences, a

FSM (finite state machine) is used. This FSM is scheduled to

run periodically by the main ISR. The FSM can be called the

first “behavior” for Loki. I intend to add additional behaviors

such as following a light source. These too are implemented

as FSMs. All FSMs run in parallel and all are scheduled

from the main ISR via the system ticks. This parallel FSM

operation allows a new behavior to be easily programmed

(that’s the theory). The multiple FSMs will be controlled

by subsumption. Loki doesn’t have all that implemented

yet, however.

SensorsLoki has three sensors currently. The two IR distance

sensors (also called proximity sensors or rangefinders)

have analog outputs. The processor reads the IR sensors

with the A/D and is controlled by interrupts. The IR data is

conditioned and results in left and right range values in

inches. The ultrasonic sensor is interfaced by I2C and

controlled by another FSM. The ultrasonic sensor data read

is in inch range readings. The behavior FSM checks these

ranges for use in deciding when to make turns and when to

stop. If a terminal is connected (either by a direct RS-232

connection or by Bluetooth), the telemetry (actually, just a

lot of printf statements) will be available, and the ranges

seen by the sensors will be displayed, along with some

sequence information.

LEDsThe controller board has five LEDs. D1 is the power

on LED. D2 is the “heart beat” LED which flashes at a one

second rate to indicate that the program is still running. D4

is the message LED that indicates when a command is

being received. D5 is the ERROR LED, which gets set when

a received command is in error. D6 is the move LED that

indicates when a servo move is in progress.

SwitchesThere are three switches on the controller board.

SW1 is a miniature toggle switch for +5V. SW2 (small

pushbutton) is the reset switch and resets the processor.

SW3 (small pushbutton) is the data switch used to initiate

autonomous activity. There is also the miniature servo

power switch on the body.

Servo OperationThe main timer already generates interrupts for the

main ISR at the frame rate of the servos (2,500 μs). This

rate is also divided down to generate system ticks at a 1/10

second rate for other background tasks. A second timer

times the pulse width for each of the four (or eight) servos

sequentially. We don’t just suddenly “jump” from one servo

position to the next. What we do is “sweep” the servo(s) to

SERVO 07.2008 55

Loki Crosses the Pond — Part 2

Close-up front view of Loki (new legs). Sonar and IR sensors.

Marconett2.qxd 5/30/2008 2:16 PM Page 55

Page 56: servo2008 07

the new position over the time period allocated for the

move. An increment in position for each servo frame is

calculated for each servo to be moved. Each frame we

increment each servo position as required. The result is a

smooth transition of position for the servos. And it all runs

in the background! The new positions, of course, come

from the servo commands parsed. The code also reads and

parses the canned sequences. The action of turning on a

servo output line for the time determined by the second

timer results in a PWM (pulse width modulated) signal

suitable for controlling R/C servos.

CheckoutBefore powering up Loki, make sure his legs are

positioned left foot first and he is standing up. This is the

starting position, and all of the canned move sequences

both start and stop here.

Initially, both the servo and the controller board power

switches should be off and the battery disconnected.

Remove the PIC chip U3 if installed. It is recommended that

the servos and sensors be unplugged at this time.

You may now connect the battery and turn on the

controller power switch, and observe the LED power

indicator come on. Measure +5V on the output terminal

of the 5V regulator REG1.

Turn the power off and insert the PIC (the end with pin

1 and the little notch faces the three LEDs). When you turn

the power back on, you should again observe the LED power

indicator come on and still read +5V on the output of the

regulator. The “heart beat” LED D2 should be flashing once

a second, which indicates that the program is running.

Terminal TestsPower down again and connect either a checked-out

Bluetooth module (TTL) with a viable wireless link to the PC

or install a MAX232 level converter chip into U1 (any

Bluetooth module should be disconnected) and a 1:1 three-

wire DB9 cable to the PC. Run a suitable terminal emulator

program such as T2 or Docklight (even HyperTerminal). Loki

expects a 115K baud rate, no parity, and no handshake. Set

your terminal software (and Bluetooth if used) accordingly.

(Because of the variety of Bluetooth modules available, no

detailed description of using the Bluetooth or SmiRF will be

given here).

Assuming the terminal program is configured properly

and the Bluetooth (if used) is operational, then you should

observe the sign-on message “Loki 1.0 here!” when the

board power is turned on. Insure that you are familiar with

Bluetooth before attempting to use it! I suggest you try

RS-232 first (I did).

Loopback TestsIn case no sign-on message is seen, and assuming you

have the proper voltages and the chip(s) in right, you

should first check out communications. It is normally easier

to start off with a simple RS-232 serial cable known to

work. If no message is seen upon power-up of the board,

disconnect the RS-232 cable and plug in a loopback plug

into the end of the cable instead. You should see your

keystrokes echoed through the loopback plug. In the case

of Bluetooth, the Tx and Rx jumper leads (blue) can be

unplugged from the controller board and connected

together with a small piece of .025” header pin. This

“loops” the Rx out of the Bluetooth module and right back

in. This is a typical way of checking out a terminal program

and cabling, and also the Bluetooth. After verifying the

communications, standard troubleshooting techniques

apply. Check for shorts, grounds, damaged traces, and the

like. Pins are easy to bend over on the IC chips. Mind the

polarity of the electrolytic caps, LEDs, and diodes.

Loki Here!On your terminal, send the string REV<CR>. <CR> is a

RETURN keystroke. It is often represented as ‘\r,’ as well.

Loki should reply with “Loki 1.0 here!” This is the message

also seen on power-up, but it is a good fast test of a valid

two-way connection to the terminal. And with Bluetooth,

it’s nice to have a quick way to verify that you’ve still got

a connection.

You are now ready to send some initial servo

commands to Loki to test him out. Insure Loki’s legs are

positioned with the left foot first. (Loki always puts his left

foot forward!)

WARNING! Servos can rapidly jump when first turned

on. Positioning the feet as mentioned will minimize any

undesired jerking motion of the feet upon application of

servo power.

KEEP YOUR FINGERS CLEAR of Loki’s feet when

starting up!

I recommend connecting and testing one servo at a

Loki Crosses the Pond — Part 2

Loki in a posture.

56 SERVO 07.2008

Marconett2.qxd 5/30/2008 2:16 PM Page 56

Page 57: servo2008 07

time. Driving servos into their mechanical stops can damage

them. Proceed cautiously. Also be aware that if the battery

discharges too far, erratic servo operation can occur. Turn

off the power immediately!

Okay, we’ll now power-up Loki’s controller with ONLY

servo #0 connected. Next, turn on the servo power, being

careful to hold up Loki by the body, and WATCH YOUR

FINGERS!

Issue the command #0P1600<CR> from the terminal.

Servo #0 is the right knee; it should move a little. This is the

basic servo command. You should experiment with the

servo command to familiarize yourself with it and to check

out the other servos, as well. Try some other positions, such

as 1800 and 700. Add T1000 to the servo command, or

issue it by itself to set the move time at 1,000 ms (default).

Try other move times.

You’ll find out that the servos have limits assigned to

their travel. For example, 700 and 1779 are the limits for

servo #0. There are similar limits for the other servos. These

limits prevent Loki from kicking himself.

Servo CalibrationAs mentioned earlier, with the servo horns only

allowing rough squaring, we save a calibration value for

each centered servo position. The servos can be finely

adjusted from a terminal program by setting up your

terminal program to send the strings #nP+25<CR> and

#nP-25<CR> when buttons are pressed. These buttons can

then be used to jog the joint up or down to the required

position; ‘n’ is the servo number and the ‘25’ is the amount

to move. Change the amount to suit your taste. The goal

is to have the feet flat on the table, parallel, and about

1/2” apart. Record the location of all four servos (offsets

are 0 at this point).

After getting the servos where you want them, the

calibration values are sent to Loki’s controller via the

command #n PO nn <CR>. The servo number is n, and the

centered position is nn. All four servo offsets can be sent

in one command, if desired. The offset values will be

calculated and stored in EEPROM. The centered or “left foot

forward” position of Loki’s legs will be normalized to 1500

with the offsets. A position of 0 results in the servo going

to sleep (PWM pulses cease).

Loki’s First StepsNow that we’ve got the servos moving, we can take a

little walk! A C1<CR> command will command a single gait

cycle, and K1 will initiate a continuous walk. The walk can

be stopped by a R<CR> command. Note that Loki always

finishes out his gait cycle to the left foot forward posture.

This is to ensure that the feet are in a known position,

which minimizes the possibility of Loki getting his feet

tangled up.

A C3<CR> Partial Right Turn or C5<CR> Partial Left Turn

can also be executed. Three will be needed to complete a

full 90 degree turn.

Sensor TestsWith a terminal connected, the U (ultrasonic sensor)

and I (IR sensor) commands can be issued from a terminal

to conveniently test Loki’s sensors. Note that distances less

than about 4” are invalid for the IR sensors.

Issuing walk commands with the servo power turned

off can also be used to view the range values and various

walk sequence states on a continuous basis.

After Loki is successful in taking a few walks, the

autonomous mode can be tried. Press SW3 to start Loki.

Objects should cause Loki to turn. An object too close will

cause Loki to shut down.

Other Board UsesI found the QuikFlash board a very useful and

convenient board to use. It is also inexpensive and perfect

for other small robots. I’m already looking at it for another

robotic project.

Up to eight servos could easily be accommodated with

additional connectors. Although Loki is a legged bot, one

could also drive R/C servos modified for continuous rotation

and use them to build a small wheeled robot (I’m a leg

man, personally.). The navigation portion of the software

would be a little different, but the section of the code

driving the servos would probably be the same. And don’t

forget robotic arms! Just add software.

Loki’s FutureThis is only the beginning for the controller board and

Loki! A custom control board for Loki is envisioned, which

would eliminate the need for hand-wiring servo and sensor

connectors in the prototype area.

On the software side, it is anticipated that more

behaviors will be added, and improvements made over the

rudimentary “rules” that currently suffice for subsumption.

Sequence entry to the EEPROM is at its infancy, to say the

least, and currently no fast download of sequences from a

terminal is available. SV

Loki Crosses the Pond — Part 2

Loki and author Alan, KM6VV.

SERVO 07.2008 57

Marconett2.qxd 5/30/2008 2:17 PM Page 57

Page 58: servo2008 07

58 SERVO 07.2008

Humanoid shaped servo robots are

some of the coolest robot kits

around. They are generally simple

to build, and the finished product is

agile and undeniably entertaining.

Robots this cool, however, often come

with a hefty price tag. We’ve been

lucky enough to review two such kits

for SERVO so far. The surprising

nimble Robonova-1 from Hitec will run

you over $1,000, and the versatile

Bioloid kit from Robotis comes with a

price tag of about $900. These prices

likely put these bots out of the reach

of many casual hobbyists, which is a

shame because they have so much

to offer. The construction of these

robots is an excellent lesson in shrewd

engineering design, and there are

numerous competitions that cater to

this unique type of bot at events like

RoboGames.

This month, we have the pleasure

of introducing the Robophilo from

Robot Brothers, Inc. The Robophilo is

pitched as the most

affordable of the

humanoid servomotor

bots, and it certainly

makes good on that

claim with its scant

$400 price tag when

compared to its

competitors. But does

affordability sacrifice

quality, or is the

Robophilo agile enough

to hold its own in a

dance off, kung-fu, or soccer against

the Robonova and Bioloid? That’s

what we aim to discover.

Like The Six MillionDollar Man With a99.995% Discount

The second half of Robophilo’s

cryptic name stands for Programmable

Humanoid In Lifelike Operation. If the

other servo module humanoids that

we’ve gotten our hands on are any

indication, this moniker is certainly not

an exaggeration of its abilities. But for

us to check on that, we first need to

build the thing.

The Robophilo can be acquired as

the pre-built Ready-To-Walk form or in

kit form, and we were fortunate

enough to get the Robophilo in

pieces. The Robophilo kit comes with

a CD that contains all of the necessary

software and an electronic instruction

manual in pdf form. The kit also

comes with a rechargeable battery

pack and charger.

And, in case there was any doubt

about whether or not the Robophilo

was meant to be treated as a high

tech plaything, the instruction manual

THIS MONTH:There’s a New Humanoid

on the Block

ROBOPHILO KIT.

ROBOPHILO TEAM.

TwinTweaks.qxd 6/4/2008 4:16 PM Page 58

Page 59: servo2008 07

declares on its very first page that

“Robophilo is not a toy.” It just goes

to prove that intellectually intensive

and brain stimulating robot projects

can be so fun that there might be

some confusion, so we’re glad that

the distinction has been made.

The Robophilo instruction manual

gives the directions on how to build

the bot with clear text and helpful

3D illustrations of the step-by-step

assembly. The pictures are very nice,

but the detail on the page, the

background watermark, and the

length of the manual (78 pages!)

discouraged us from printing it out.

Following along on the computer,

however, proved to be easy enough.

The brackets for the arms and

legs of the Robophilo are certainly

reminiscent of those used on the

Robonova and Bioloid, and this tried

and true design works just as well on

the Robophilo. These parts are made

out of lightweight plastic instead of

metal as one of the money saving

measures on the kit, but the quality of

the parts do not appear to suffer for

the sake of economy.

One thing that the Robophilo has

that its competitors do not is its own

set of tools. This simply consists of a

crosshead and a hex head screwdriver,

but one hugely helpful detail about

the crosshead screwdriver is that it

is magnetized. This proves to be

invaluable when dealing with so

many tiny screws.

Other aspects of the Robophilo kit

that set it apart from it contemporaries

are the inclusions of silicone grease

and rubber o-rings — the robot’s

substitute for synovial fluid, if you will.

The Robophilo also uses some smaller

servomotors in conjunction with

some small metal push bars for the

movement of the head and waist. An

unfortunate distinction is that a very

small number of steps demand the

judicious use of some super glue,

which is not included in the kit. But by

planning ahead and having some super

glue at the ready, this minor detail

shouldn’t mess up your building flow.

One problem that we encoun-

tered with the Robophilo construction

was with the actual casings of the

servomotors. The casings, like most

others for various servos, have little

tabs on the side with holes for

mounting. We figured that the

Robophilo made use of these

tabs, but we were mistaken. The

illustrations in the instruction manual

and the pictures of completed

Robophilos on the box show servo

casings sans tabs, so we had to chop

them off. Perhaps this was a manufac-

turing oversight that will be corrected

for future kits, but the tabbed casings

are only a minor setback that we

easily corrected after some quick

surgery with a hacksaw.

Other than that, the Robophilo

went together relatively easily. All of

the plastic parts have part numbers

directly on them for reference, and all

screws and other bits are stored in

conveniently labeled bags (except for

the fact that some of our bags were

labeled in Chinese, the parts were

very easy to keep organized). At the

end of most steps, rough tuning is

PHILOMOTION CREATOR.

ROBOPHILO FINE TUNING.

SERVO 07.2008 59

There’s a New Humanoid on the Block

TwinTweaks.qxd 6/4/2008 4:16 PM Page 59

Page 60: servo2008 07

60 SERVO 07.2008

Twin TTweaks ....

done for the servomotors by hooking

them into the PCB (printed circuit

board). The kit does include a battery

pack, and the tuning is a nice way to

become familiar with the PCB before

the more daunting task of wiring up

the entire robot.

Final Touches andFine Tuning

Once the Robophilo is given all of

its limbs, there are only a few fine

touches before it is finished. One of

them is to

wire it up,

which is made

very straight-

forward by helpful diagrams in the

instruction manual. The mess of wires

can be cleaned up with some wire

sleeves included in the kit.

The penultimate step of building

the Robophilo is to do the fine tuning

for all of the servos, which is a

laborious and time-consuming process.

The major money-saving measure

employed in the design of the

Robophilo is in the servos, and the

tradeoff for achieving a low cost

becomes clear during the fine tuning

process. The Robophilo servos are

cheap analog servos that lack the

torque of the servos in the Robonova

and Bioloid, and are also more

difficult to tune. Thankfully, the tuning

process is more tedious than difficult

and the quality of your experience will

most likely depend on how perfect

you insist the tuning to be.

Tuning basically consists of

entering various positions for the

servos and then adjusting the offset

and range of motion in the

Robophilo’s fine tuning editor. With

20 servos to tune, this can turn into a

time-consuming affair. During the

tuning process is also when the

instructions recommend to connect

the pushbars for the left and right leg

movement and head turning into the

servos. The pushbar is easy to insert

into the large servo horn for the waist

movement, but the other servo horns

have holes that are simply too small

for the pushbars. After vigorously

pressing the pushbars into place, we

were able to attach everything, but

nonetheless it was a vexing setback.

During our fine tuning of the

Robophilo we witnessed something

disturbing and tragic. We were editing

the range of motion on the right leg,

and then the Robophilo’s arm began

to quiver. We checked to see that

nothing was blocking it, but the

quivering only got worse. Then, the

entire robot started to convulse as its

LED started to dim. It was a tragic

thing, watching the Robophilo run out

of batteries before our eyes. The good

news is that the battery pack is

rechargeable, and the kit comes with

a charger. A few hours later, we were

ready to press on.

Philo Goes West

After what seemed like hours of

fine tuning, we were finally ready to

finish the robot. The last steps include

cleaning up the wires and attaching

the final body panels. Unfortunately,

halfway through putting on the

Robophilo’s ill fitting shoes we ran out

of screws! Most robot kits like the

Robophilo come with ample numbers

of spare screws, and running out was

a disappointing surprise. We suppose

we could have seen it coming,

because several other sizes of screws

came in only the exact amount

necessary, with no extras left over.

Thankfully, we had enough screws to

keep the shoes on and the main body

panels on.

Unfortunately, the body casing for

the Robophilo was a big engineering

disappointment in that it seemed to

sorely underestimate the amount of

space needed for the wires to escape.

Also, the front panel doesn’t even

seem to consider that extra room is

required on one side for the small

servo that turns the head. The thin

plastic is easy to modify, but it is a bit

annoying that it has to come to that.

Putting the final pieces onto the robot

should be a triumphant experience,

not the most frustrating of the entire

build.

Despite the final frustrations, we

had finished the bot and there was no

denying that it scored high marks in

cool factor. As a final touch, the

ROBOPHILO MANUAL.

ROBOPHILO REMOTE.

ROBOPHILO PCB.

TwinTweaks.qxd 6/4/2008 4:17 PM Page 60

Page 61: servo2008 07

There’s a New Humanoid on the Block

Robophilo includes a

variety of decals to give

the bot some pizzazz,

and also as a way to tell

one Robophilo apart from

the other.

The Robophilo can be

controlled by an infrared

remote that bears a

stunning resemblance to

a TV remote. The rascally

robot was even seemingly

designed with team

sports in mind, because

the receiver can be adjusted in such a

way so as to operate four Robophilos

with four separate remotes and

without interference. The Robophilo

also has motion and pose editors so

users can create their own unique

actions. There is even an option to

assign the user created motions to

buttons on the remote.

The Robophilo also has an option

for a software upgrade that would

allow users to program their own

motions in C. We always like to see

this kind of versatility in robot kits, but

for our purposes we stuck with the

easy to use GUI.

After all of the frustration and

tedium, seeing the Robophilo move

around is a well deserved reward. The

weaker servos don’t give it quite the

agility of the Robonova or the Bioloid,

but it still gets around just fine. In a

dance-off between the Robophilo and

the Robonova the Robonova

would be more like the Korean

pop star and the Robophilo the

late night comedic pundit, but the

Robophilo certainly puts up a

valiant effort.

Rock’em Sock’emHuros

By now, we had accumulated

three different “androids” as they

seem to be referred to in the

competitive robotics community,

and three seems to be the magic

number for a number of events.

The classic team sport of

competitive robotics is soccer, and

a quick online search of humanoid

soccer will return numerous

pictures of servomotor androids

decked out in makeshift jerseys

kicking around tiny soccer balls.

Sometimes these events are referred

to as “Huro” events (RoboGames even

features a HuroCup), which we can

only guess is a playful portmanteau of

the words human and robot.

By the time of this printing,

RoboGames will have already taken

place in June, but it always seems like

a great way to analyze the versatility

and effectiveness of a robot is in the

context of a competition.

The Robophilo, Robonova, and

Bioloid all easily pass the height and

weight requirements for three-on-

three soccer and for the variety of

events that make up the HuroCup.

The main constraints on these events

are height, weight, and footprint

dimensions. The wide open HuroCup

allows robots that are up to 150 cm

tall and 30 kg, so our three androids

easily make the cut. Another three-on-

three soccer event, however, seems to

only cater to the smaller and lighter

Robonova with a height limit of a

mere 30 cm and a weight restriction

of 600 g.

The HuroCup still offers a

plethora of events for intrepid

roboticists. The mission of the

HuroCup is actually quite high

minded. According to the Laws of the

HuroCup, “The goal of the HuroCup

league is to encourage research in

practical, autonomous, highly mobile,

flexible, and versatile robotic

platforms.” That may sound like a lot

of work and a daunting task, but

the thrill of competition and exciting

variety of events are sure to make it

as much a pursuit of fun as one of

progress.

Track and field style events like

ROBOPHILO SERVO. ROBOPHILO TORSO (APART).

ROBOPHILO TORSO (TOGETHER). ROBOPHILO WORK.

SERVO 07.2008 61

TwinTweaks.qxd 6/4/2008 4:18 PM Page 61

Page 62: servo2008 07

62 SERVO 07.2008

the Forward-Backward Dash and the

Marathon test the limits of bipedal

mobility, and events like Weight Lifting

and the Lift and Carry stress balance

and strength. The Robonova seems

like a popular choice for these events,

but we think the hefty Bioloid could

also be a strong competitor. Without

modification, the Robophilo would

face an uphill climb (Stair Climbing is

actually another android event held at

RoboGames). The catch about all of

these events is that the Huros have to

be autonomous. In that case, the

Bioloid might look like a better option

because of the sophisticated sensors

that each and every Dynamixel servo

module is equipped with. But

one shouldn’t count out the

Robophilo either — its PCB has

numerous open ports for

additional servos and sensors,

and with the C upgrade it

proves to be a formidable

autonomous competitor.

The epic RoboGames also

include a number of remote

controlled humanoid robot

events. The remote control

events include Kung-Fu, Golf,

and even Taiko Drumming.

Our three humanoids fit the

bill as far as height and weight

restrictions for these events,

and at first glance the

Robophilo might seem like a better

contender for these events than the

Bioloid. The reason for this is that the

Bioloid is the only one of the three

that does not come with a remote

control, but an extra receiver module

can be added to make it controllable

by radio frequency. The impressive

sensor arrays on each of the

Dynamixel modules give it more than

enough autonomous capabilities to

compensate for this inconvenience,

but such upgrades would likely be a

burden on a lot of hobbyists that have

already grappled with the steep price

tag. The Robophilo, on the other

hand, comes with a remote and is

ready to go — it even comes with some

preprogrammed karate chops, and the

motion editor would be a great way to

add some more Kung-Fu moves.

Such physically demanding events

like Kung-Fu and Taiko Drumming

would necessitate robust robots, and

once again we think the Robophilo

would be up to scratch. The

Robophilo miraculously seems to be

free of one of the major concerns

we’ve had about the Bioloid and

especially the Robonova — loose

screws. Perhaps it’s due to the pitfalls

of mass production or loose

tolerances, but the screws that hold

the Robophilo together certainly seem

determined to stay put from our own

clumsy cross threads or some other

mystical mechanism. The fine metal

threads of the Robonova’s sleek metal

frame may have made the initial

construction a breeze, but the screws

seem to come out as easily as they go

in. It’s nothing a little Lock-Tite would-

n’t fix, but it’s also nice to know that

the Robophilo probably wouldn’t lose

an arm in the middle of a golf swing.

The Price of aLow Price

Overall, the Robophilo is a bit of a

Curate’s Egg — good in some parts

and bad in others. The troublesome

servo casings, the ill fitting servo

horns and body panels, the weak and

unruly servos, and the shortage of

screws are all quite irksome. Even the

seemingly neat addition of a hanger is

a mixed bag. Unlike our other two

androids, the Robophilo comes with

its own hanger for storage or display.

The hanger is a nice idea and

refreshingly simple to put together,

but it is not very stable and we had to

add our own extra base to it so it

wouldn’t topple over. The hanger

looks like a gallows, where an unruly

Robophilo could be justly put to death

for criminal frustration.

Actually, that would be hyperbolic,

because the Robophilo is not

significantly more tedious to build

than any other servomotor humanoid,

but these numerous small details

worked together to somewhat tarnish

our opinion of the robot. To make

sure we weren’t crazy, we searched

for other reviews of the Robophilo to

see if our sentiment was widespread

or a fluke. Searching for other

commentary on the Robophilo online

returned a number of glowing reviews

that seemed somewhat incongruent

with our experience. Then we noticed

that most of these reviews were for

the Ready-To-Walk version of the

Robophilo, which clocks in at $100

more than the kit version for a grand

total of $499. This is still significantly

less than other humanoid robot kits,

and for tinkerers that are short on

time or money it might be a decent

option. Even so, other reviewers also

noted the weak analog servos that

were the big money saving item.

They did, however, also tout the

expandability of the kit as a way to

ROBOPHILO FINISHED.

ROBOPHILO HANGER.

Twin TTweaks ....

TwinTweaks.qxd 6/4/2008 4:19 PM Page 62

Page 63: servo2008 07

overcome these problems. We couldn’t

agree more, and the Robophilo folks

are also hard at work at improving

their product.

We think that getting a humanoid

robot out there at such a low price is

an admirable accomplishment that

shouldn’t be overshadowed by a few

missing screws. The Robophilo still has

a number of great plusses in addition

to its affordability. The nice tools,

handy hanger (once stabilized), intu-

itive motion editor, stylish remote with

numerous channels, and expandability

all make for an impressive robot.

The HuroCup Laws even mention

how there is a drive to get more

competitors involved in Huro events,

and we think that the Robophilo will

certainly help in that department. It

may not be as stylish as the Robonova

or as versatile as the Bioloid, but the

Robophilo is accessible. The tradeoffs

made for affordability can easily be

overcome with later upgrades and

some ingenuity, but the Robophilo

and Robot Brothers should be

applauded for their sincere effort to

democratize humanoid robotics. SV

ROBOPHILO SOCCER.

Recommended WWebsitesFor more information, go to:

www.robophilo.comwww.robogames.net

SERVO 07.2008 63

There’s a New Humanoid on the Block

TwinTweaks.qxd 6/4/2008 4:20 PM Page 63

Page 64: servo2008 07

64 SERVO 07.2008

Just because one person doesn’t

want it doesn’t mean it isn’t

valuable. That’s the case with surplus.

Simply put, surplus is excess stock

for resale. Sometimes it’s used,

sometimes it’s new. Occasionally, it’s

worthless junk, but very often, surplus

has a beneficial use to someone,

somewhere. And just as importantly,

surplus means the item isn’t being

thrown away in the trash, so it’s not

clogging up a land fill.

Why bother with surplus? For

starters, it usually costs less, often a

lot less — there are exceptions, such

as rare or antique items, but we’re

not talking about that kind of stuff

here. The downside to surplus is

limited selection and quantity. You

may not find exactly what you’re

looking for, so you have to be

prepared to improvise. And don’t

expect unlimited supplies of an item.

Surplus is often one-of-a-kind, or at

least restricted quantity.

You can find just about anything

at surplus — cars, jet engines, elevator

parts, you name it. But the kind we’re

most interested in this time around is

surplus electronics and related gear —

ICs, resistors, capacitors, small motors,

jacks and plugs, and just about

everything else you might need for

the average robot.

Where to Go forSurplus

The Internet — and by extension,

mail order–is an ideal playground for

surplus shopping. We’ll get to mail

order buying in a moment, but before

logging into your PC, consider any

local surplus stores in your area. Don’t

have any? You’d be surprised at

what’s out there. Look in the Yellow

Pages under the heading of

Electronics. Sometimes you’ll find

what you’re looking for under a

Surplus heading, but these tend to be

military/camping surplus outfitters,

rather than electronics surplus.

Referrals are a great way to find

out-of-the-way businesses. If you

attend a local robotics or other user’s

group, ask members where they like

to shop. And when you find one

store, ask the sales clerks if they know

of others in the area that might be of

interest to you. Most are willing to

point you to the competition, since in

the surplus world, if one store doesn’t

have it, another one might. Customers

are gladly shared among the area

stores.

Local thrift outlets are another

good source for surplus. Many have

sections devoted to old electronics

such as TVs, VCRs, and radios. You’ll

need to do your own dismantling to

get at the parts, but for many, that’s

half the fun! Some thrift stores test

their electronic goods and charge

more if they are working; for

cannibalizing surplus parts you won’t

care if they’re working or not, so just

go for the cheapest you can find.

Odds are, even if your area

supports just a couple of nearby retail

surplus stores, you’ll probably rely

mostly on mail order to get what you

need. Many of the better online

stores are listed in the Sources section

that follows, but don’t forget to use

your favorite Internet search tool to

find more. Google, Yahoo!, MSN, or

other web search engines let you

find items of interest from among the

millions of websites throughout the

world. Add the keyword “surplus” to

the search terms to help narrow the

hits you get.

Keep in mind that the Internet –

and all mail order – is world wide.

You may find some retail stores that

are not located in your country. Many

businesses ship internationally, but not

all do so, and the added shipping

costs can all but negate the cost

savings of surplus. Read the fine print

of the website to determine if the

company will ship to your country,

and note any specific payment

requirements. If a check or money

order is accepted, the denomination

usually must be in the company’s

native currency.

Many surplus electronics outlets

sell a mixed bag of new and surplus

wares. In fact, it’s often difficult to

know what’s new or prime products,

and what is surplus. These stores

sell new products in order to keep

a stable inventory. What this means

is that the store may be able to

re-order some of the product, but

not others.

Remember that most surplus is a

“get it while you can” commodity.

Once it’s sold, it’s sold, and the stores

Stocking Up WithSurplus Electronics

Tune in each month for a heads-up onwhere to get all of your “roboticsresources” for the best prices!

RoboResources.qxd 6/3/2008 11:11 AM Page 64

Page 65: servo2008 07

move on to the next item. Should you

need a larger quantity of a particular

part, inquire to see if additional

quantities are available, and whether

it is a standard stocked item or limited

availability surplus.

What to Stock Up On

Because the availability of surplus

comes and goes, you will want to take

advantage of a product offering while

you still can. But that involves buying

things you may not need at the

moment — which could end up being

not needed ever! It’s prudent to

exercise caution in ordering surplus

merchandise that you have no

immediate plans for. I like to limit non-

essential purchases to a certain dollar

amount per month or per quarter. I

often use surplus to refill depleted

inventory. This includes basic items

such as wire and switches.

For project-specific purchases –

such as motors and gears – I will

refrain from buying these until I need

them. Yes, this does mean sometimes

losing out on a great opportunity, but

if you’re not careful it’s easy to

over-buy, and end up with a garage

full of components you may never

use. This has happened to me, and I

ended up donating several hundred

pounds of unused inventory to some

local robot user groups and schools.

As surplus electronics often

involves small parts, it is advantageous

to organize your inventory so that you

can find what you need quickly.

Plastic divider drawers sold at home

improvement stores are a good

option. For odd-size items, I use heavy

duty self-sealing plastic bags, and

write down the contents using a thick

felt marker. I then put the filled bags

in shoe boxes. It only takes a moment

to sift through the bags to find just

the part I need.

Of course, the real benefit of

shopping the electronics surplus

outlets is the savings on things you

need right now. When you start a

new project, get into the habit of

checking the surplus traders first. That

way, you’ll save money where you

can. Be realistic in your expectations

and be prepared to deviate from

your original project plans to suit the

materials on sale at the time. For

example, if your robot calls for 2-1/2”

diameter wheels, but you’ve found a

great deal on 2-3/4” ones that can

save you money, consider changing

the specifications to accommodate the

different wheel size.

Sources

Following are numerous online

outlets that offer electronics surplus,

either exclusively or as part of a

broader selection. Several have printed

catalogs for offline review, but bear in

mind that because surplus product

comes and goes, you’ll always want to

check the company’s website for the

latest deals.

Bear in mind that many other

types of online resellers such as

robotics specialty stores carry surplus

electronics. These aren’t listed for the

sake of space constraints. The moral:

It pays to study the Web catalogs of

your favorite online retailer to be sure

you’re finding all the best deals.

A-2-Z Solutions, Inc.www.a2z-solutions.com

A-2-Z Solutions carries new and

surplus electronics. Mostly computer

equipment (PCs, monitors, scanners,

and so forth). Online sales with Web

catalog.

AE Associates, Inc.www.ae4electronicparts.com

AE Associates carries new and

used electronics, including switches,

connectors, electronic components

(resistors, capacitors, diodes,

transistors, etc.), and test equipment.

Searchable database. Also sells a small

number of compact black and white

and color video cameras. Local store

in Van Nuys, CA; online sales with

Web catalog.

All Electronics Corp.www.allelectronics.com

All Electronics is one of the

primary sources in the United States

for new and used robotics compo-

nents. Prices and selection are good.

Walk-in stores in the Los Angeles area.

Product line includes motors, switches,

discrete components, semiconductors,

LEDs, infrared and CdS sensors,

batteries, LCDs, kits, and much more.

Specifications sheet for many

products are available on the website.

Online store, Web catalog, and

printed catalog.

Alltronicswww.alltronics.com

New and surplus merchandise.

Among their product line useful in

robotics are DC and stepper motors,

stepper motor controllers, power

MOSFETs, small CCD video cameras,

and tools. Online sales with Web

catalog.

American Science & Surpluswww.sciplus.com

AS&S sells surplus of all types,

including some you’d normally find in

an Army/Navy surplus store. But they

also carry motors, gears, batteries,

switches, and some electronics.

APEX Electronicswww.apexelectronic.com

Military and industrial surplus,

with a major emphasis on wire of all

types and sizes. Huge selection, but

the retail store is not well organized,

in my opinion. Limited online sales

(only some components listed on

the site).

Apex Jr.www.apexjr.com

Surplus electronics and

mechanicals. General electronics,

transformers, and “movie props.”

Online store with Web catalog.

Ax-Man Surpluswww.ax-man.com

Local (St. Paul, Fridley, and St.

Louis Park, MN) electronic and

mechanical surplus.

B.G. Microwww.bgmicro.com

B.G. Micro is a haven for the

SERVO 07.2008 65

RoboResources.qxd 6/3/2008 11:11 AM Page 65

Page 66: servo2008 07

66 SERVO 07.2008

electronics tinkerer and robotics

enthusiast. Much of the stock is

surplus, so it comes and goes, but

while it’s being offered, it has a good

price attached to it.

Online sales through Web

catalog; printed catalog available.

BMI Surpluswww.bmius.com

Electronic surplus, much of it

high-end industrial or scientific;

opticals, laser. Online sales with

Web catalog.

Brigar Electronicsbrigarelectronics.com

Handy selection of electronic

components, including unique

sensors, construction hardware, and

motors, along with the usual

transistors, resistors, etc. Online sales

with Web catalog.

CTR Surpluswww.ctrsurplus.com

Surplus electrical, including

motors, test equipment, and power

supplies. Online sales with Web

catalog.

Electro Mavinwww.mavin.com

Electro Mavin carries electronic

components, motors, batteries, optics,

and test equipment. Online sales with

Web catalog; retail store in Los

Angeles area.

Electronic Dimensionswww.el-dim.com

Electronic Dimensions carries

military and industrial surplus,

electronics, radio receivers,

transmitters and parts, electron tubes,

test equipment, and ham gear. Retail

store in Washington state, and online

sales with Web catalog.

Electronic Goldminewww.goldmine-elec.com

Electronics Goldmine carries new

and used electronic components

(LEDs, potentiometers, resistors,

heatsinks, transistors, etc.), robot

items, electronic project kits, and

more. Online sales with Web catalog.

Electronic Surplus, Inc.www.electronicsurplus.com

Electronic Surplus has a wide

selection of test equipment and

electronics parts.

Electronix Expresswww.elexp.com

New and surplus electronics,

including passive components, motors,

relays, and more. Online sales with

Web catalog.

Excess Solutionswww.excess-solutions.com

Surplus electronics. Local store

and online sales.

Fair Radio Saleswww.fairradio.com

Though specializing in surplus

for ham radio, Fair Radio also offers

plenty of general electronics and

test equipment. Online sales with

Web catalog. A printed catalog is

available.

Gateway Electronics, Inc.www.gatewayelex.com

Gateway Electronics is a general

electronics mail order and retailer.

Among their products are passive

and active components, motors,

electronic kits, gadgets, books, and

tools. Some of their goods are new;

others are surplus.

Hosfelt Electronicswww.hosfelt.com

General electronics. New and

surplus.

HSC Electronic Supplywww.halted.com

Online mail order sales, with

walk-in retail stores in northern CA.

Halted offers a mix of computer and

electronics surplus.

Marlin P. Jones & Assoc., Inc.www.mpja.com

MPJA sells both new and surplus

electronic and mechanical products.

Their assortment of items such as

motors is fairly small, but they make

up for it with a wide selection of

other common (and some not-so-

common) products.

MECI — Mendelson’sLiquidation Outletwww.meci.com

Surplus electronics, motors, and

even a special section for combat

robot parts — large motors, batteries,

that sort of thing. Online sales with

Web catalog.

Quickar Electronicswww.quickar.com

Quickar carries surplus electronics

and tools. Online sales with Web

catalog.

Skycraft Parts & Surplus, Inc.www.skycraftsurplus.com

Skycraft Parts & Surplus, Inc., is

a “surplus mall” offering power

supplies, transistors, relays, ICs, wire,

cable, heat shrink, transformers,

motors, fiber optics, test equipment,

resistors, diodes, and more. Local

store in Florida, plus online sales with

Web catalog.

Timeline, Inc.www.timeline-inc.com

Surplus of all kinds: electronic,

computer peripheral, laser, motors,

LCDs, and more. Online sales with

Web catalog.

Unicorn Electronicswww.unicornelectronics.com

Unicorn Electronics has a large

selection of electronic components,

including passives, transistors, logic

ICs, relays, and more. Online sales

with Web catalog.

Weird Stuff Warehousewww.weirdstuff.com

Weird Stuff Warehouse sells

surplus, including electronics. Retail

store in Sunnyvale, CA. SV

Gordon McComb can be reached viaemail at [email protected]

CONTACT THE AUTHOR

RoboResources.qxd 6/3/2008 11:12 AM Page 66

Page 67: servo2008 07

First, a little history. The concept of chance appears in

most ancient cultures, dating back at least as far as

the ancient Egyptians use of the “talus,” an early

predecessor to the die. Fashioned from the knuckle or heel

bone of a hoofed animal, the talus had four possible

outcomes. It has been found alongside tomb illustrations

and scoreboards in Egyptian sites lending support to the

idea that playing dice and gambling were popular pastimes.

In the words of Ian Hacking, a historian of probability,

“It is hard to find a place where people use no randomizers

yet theories of frequency, betting, randomness, and

probability appear only recently. No one knows why.”

An intriguing mystery! And indeed it is not until 1654

that what we know as probability today began to take

shape. French nobleman Chevalier de Mere had a gambling

problem. He wanted to know if it would be profitable to

bet that double-sixes would appear at least once in a set of

24 dice throws. Luckily for him, he was a friend of one of

the most brilliant mathematicians of his day, Blaise Pascal.

De Mere posed the problem to Pascal and the theory of

probability emerged from the ensuing correspondence

between Pascal and his good friend Pierre de Fermat,

another brilliant mathematician.

What Fermat and Pascal realized is what we all learned

in grammar school — that with each throw of the dice,

each possible outcome is equally likely. The possibility of

throwing a six is therefore 1/6. They further realized that

probabilities could be multiplied, and the probability of

throwing two sixes was 1/6 x 1/6 = 1/36. The probability,

therefore, of throwing two sixes in 24 throws is 1/36 x

1/36 x 1/36 … 24 times or 0.4914. So it was not advisable

for Chevaler de Mere to bet on throwing two sixes within

24 throws after all, and probability theory was born!

So what does any of this probability stuff have to do

with random number generation?

Games of chance are, as Hacking called them

“randomizers.” They are a way of abdicating responsibility

for decision-making to the world of probabilities. In turn,

results returned from such activities are random outcomes.

At any given moment of the game, you cannot predict with

certainty which number will appear next. And a set of ran-

dom outcomes produces a sequence of random numbers

containing no repeating patterns — a sequence which

Algorithmic Information Theory would call uncompressable.

AIT and CompressibilityAs Gregory Chaitin, founder of algorithmic information

theory describes it, compression occurs if data can be repro-

duced by a computer program with a smaller number of bits

than the original data contains. In other words, if I have a

data set of 500 one-byte measurements, the data contains

500 * 8 = 4,000 bits. If I can find a repeating pattern in that

data, I can simplify it by creating a simpler symbol to represent

each repeating subset of the sequence. I can then code an

algorithm to process the input string and replace the

symbols based on a key. In this way, I can shrink the size of

the data itself without losing any of the original information.

by Heather Dewey-Hagborg

Throughout this column, we have relied on the idea of randomness to seed all of our

unconventional computing experiments. In this month’s article, we will take a brief

detour from code and hardware to examine just what the concept of “random”

actually means, how our microcontroller is implementing it, how this differs from a

computer, and some schemes for creating “true” random number generators.

DIFFERENTBITS

DIFFERENTBITSRANDOM BITS

SERVO 07.2008 67

DifferentBits.qxd 6/4/2008 1:54 PM Page 67

Page 68: servo2008 07

68 SERVO 07.2008

DIFFERENT BITS

Example:

Original dataset

70, 15, 111, 32, 56, 70, 15, 70, 15, 7, 1, 3, 5, 20, 67, 54,

42, 29, 113, 7, 1, 3, 5

Compressed dataset

a, 111, 32, 56, a, a, b, 20, 67, 54, 42, 29, 113, b

Key

a = 70, 15

b = 7, 1, 3, 5

The more you can compress the data, the more

patterned or predictable it is, the less information it

contains, and the less random the sequence of numbers is.

By contrast, if the data cannot be compressed at all, “if the

smallest program for calculating it is just as large as it is ...

then the data is lawless, unstructured, patternless, not

amenable to scientific study, incomprehensible. In a word,

random, irreducible!” (Chaitin, p. 64)

So randomness is equivalent to information. The more

information a sequence contains, the more difficult it is to

compress, and the closer it is to randomness. In this light,

white noise becomes pure information and a perfect source

— in addition to games of chance — for generating random

sequences. Anywhere noise is present, for example, radio

waves and the atmosphere, we can tap into it to extract

random sets of numbers.

RadioactivitySomething that we thankfully have rare occasion to

contemplate, radiation is an excellent source of random

numbers. Radioactivity can be defined as “The spontaneous

emission of radiation from the nucleus of an unstable atom.

As a result of this emission, the radioactive atom is converted,

or decays, into an atom of a different element that might

or might not be radioactive.” (Defined by the Radiation

Emergency Assistance Center.) For our purposes, this means

that given an unstable atom, there is no way of predicting

when it will lose its extra nucleon resulting in the radioactive

decay. By proxy, if you have multiple radioactive atoms,

there is also no way of predicting the interval between

decays, and it is exactly this combination of random periods

that can be used to generate random strings of binary.

So, we know that randomness comes from dice

throws, card games, coin tosses, noise, and radioactive

decay, and I think we can safely bet that our computers are

not striking up a game of cards each time we request a

random number, so how do they do it?

rand() and srand()Most likely, if you are reading this magazine you

have also done at least a little programming and have

encountered some version of the rand() function or random

class. Almost every contemporary computer language and

platform has had some variant of this, from microcontroller

C to Java to Python. These functions generate what are

known as pseudo-random sequences of numbers. Why

pseudo-random? Well, for one thing, the random number

generator in your computer is actually just an equation.

Most computer languages (including C and Java) contain

a version of the classic algorithm, the linear congruential

generator, as the source behind rand(). A linear congruential

generator works by computing each successive random

number from the previous, starting with a seed, X0. The

seed is generally what you supply to the algorithm by calling

srand(seed_value) before requesting a number from rand().

Here is the formula:

Xn+1 = (aXn + c) mod m

where Xn is the output set of random numbers

m is the modulus value

a is the multiplier value

c is the increment value and X0 is the initial seed value

(ex. supplied by srand)

In Ansi C, for example, m = 232, a = 1103515245, and

c = 12345. The number returned by the rand function is

actually drawn from only bits 30:16 of the output result of

the function.

Similarly, Java uses the linear congruential generator

with an a value of 25,214,903,917 and a c value of 11.

ProblemsOne of the defining characteristics of pseudo-random

number generators is that given the same seed, they will

always produce exactly the same series of numbers as output.

This is very useful when you need a sequence of data that

appears random and is the same each time, for example, in

rendering computer graphics, but it is an annoyance for most

of the applications we have implemented in this column.

The other problem with linear congruential generators

is that they are not terribly random. The longest random

sequence it is possible to generate is the length of the

chosen modulus value (232 in C) before it begins to repeat

from the beginning; a characteristic referred to as the

period of the generator. Additionally, it has a characteristic

called serial correlation which means that there are

predictable patterns in the data. To return to our discussion

of algorithmic information theory above, this means that

the data could be compressed; it is not 100% random.

In comparison, the Python programming language uses

For more details on radioactive decay as a source of randomness, check out Hotbits, a company that supplies random number sequences sourced from radioactive behaviorvia the Internet; www.fourmilab.ch/hotbits/.

FOR YOUR INFO

DifferentBits.qxd 6/4/2008 1:55 PM Page 68

Page 69: servo2008 07

a different random number generating algorithm known as

the Mersenne Twister. This algorithm has been proven to

generate significantly more random data (the period is

219937 – 1), but it requires more memory for implementation

and is therefore not suitable for microcontroller or space

intensive implementations.

What About Microcontrollers?CCS (www.ccsinfo.com) reports their rand function to

be the following:

unsigned int16 rand(void){

_Randseed = _Randseed * 1103515245 + 12345;return ((unsigned int16)(_Randseed >> 16) %

RAND_MAX);}

This is clearly derived from the ANSI C example we looked

at above, as you will recognize the linear congruential

function, simply separated into two steps. Notice also that

the a and c values are identical to the ones above, and the

only difference between the two functions is that in the

CCS version, m is the user defined value RAND_MAX rather

than 232. Note that this makes explicit the relationship

between the maximum period of the random number

generator RAND_MAX and the modulus value m.

(Hitec did not respond to my query about their random

number generation technique, but it is probably safe to

assume it is similar.)

A Better rand()If you have read some of the examples from earlier

installments of this column (neural networks, genetic

algorithms), you have undoubtedly noticed plentiful use of

the rand() function. And if you have actually implemented

any of these examples, you have also noticed that the

methods used to seed the PIC random number generator

are less than satisfactorily random. I will conclude this

month’s column by briefly explaining some possible

methods for generating better random seeds on the PIC

and providing some links to more details.

CCS recommends measuring the time in microseconds

between power up and the first user keypress, and then

using the least significant bits of that measurement. In terms

of code, this involves using a hardware timer to generate

interrupts and counting the number of intervals between

device initialization and the user’s keypress. An example of

this is available on the CCS website at www.ccsinfo.com/

content.php?page=compexamples#seconds.

Their suggested workaround solution for when user

input is not possible is saving an initial seed in EEPROM and

then incrementing it each time the processor is reset, and

saving the new value in place of the old. CCS has read and

write EEPROM functions available for doing exactly this; see

their EX_EXTEE.C example for more details.

Other possible solutions for getting a good random

sequence on a microcontroller involve either developing

hardware specific to this task, or connecting to the Internet

and querying a site like Hotbits (mentioned previously) or

random.org.

If you do want to build your own dedicated random

number generating hardware, there are a few tried and

true methods. The first makes use of the principle that a

reverse-biased PN junction generates completely

unpredictable output known as “avalanche noise.” Lots of

details about making a random number generator using

this technique, as well as interfacing it to the PIC, are

available online from Rob Seward’s art project

‘Consciousness field generator’ at http://robseward.com/

itp/adv_tech/random_generator/.

The basic idea is to sample the weak avalanche noise

signal and amplify it dramatically. This value is then sampled

by a microcontroller either by sampling the time interval

between spikes or simply choosing a constant sampling rate

and accumulating 1s and 0s each iteration. Because

succeeding bits may be more correlated than is desirable,

different unbiasing techniques exist. One popular technique

called the Von Neumann method samples two bits at a

time, discards them if they are equal, and keeps the first

one if they are different. Another method known as the

XOR corrector samples two sets of pairs of bits and then

performs an XOR operation on them and uses the output.

More information on the PN junction technique is

available at www.cryogenius.com/hardware/rng/.

Another method for hardware random number

generation makes use of the radioactivity method described

earlier. The basic premise is to use a Geiger-Müeller tube

to count instances of individual atom’s decay in a given

isotope. Again, the time interval between decays can be

used, or a fixed sampling period can be established and the

number of decays per unit of time can be counted.

A detailed description of this idea is available on Bernd

Ulmann’s blog at www.vaxman.de/projects/rng/

rng.html.

Finally, if you can’t do the user keypress, EEPROM, or

external hardware techniques, you can try sampling a

floating pin on the analog-to-digital converter of your PIC,

and accumulating the least significant bit each sample. To

maximize your randomness on this technique, test out one

• Gregory Chaitin: Meta Math!

• Ian Hacking: The Emergence of Probability: APhilosophical Study of Early Ideas about Probability,Induction, and Statistical Inference

• Peter J. Bentley: The Book of Numbers: The Secret ofNumbers and How they Changed the World

SUGGESTIONS FOR FURTHER READING

SERVO 07.2008 69

DIFFERENT BITS

DifferentBits.qxd 6/4/2008 1:55 PM Page 69

Page 70: servo2008 07

of the unbiasing techniques just mentioned.

To close on a completely random note, I will leave you

with a fun example of a very early musical piece that took

advantage of true random number generation. In 1787,

Mozart composed a set of instructions for a ‘musical dice

game’ — a method of using consecutive dice throws to

generate a minuet! Lots more information about this and a

computer generated version are available online at

http://sunsite.univie.ac.at/Mozart/dice/. SV

Heather Dewey-Hagborg can be contacted via email [email protected]

CONTACT THE AUTHOR

DIFFERENT BITS

Electronic Parts & Supplies Since 1967

www.c-stamp.com

LOW

CO

ST!CONTROLLERS & ROBOT KITS – SENSORS – DISPLAYS

Free

Expert

Technical

Support

1 (800) 985-AWIT

Ea

sy t

o C

on

ne

ct

LOW

COST!LOW COST

Professional SW Dev. Tools

For the finest in robots,

parts, and services, go to

www.servomagazine.com

and click on Robo-Links.

70 SERVO 07.2008

DifferentBits.qxd 6/4/2008 1:56 PM Page 70

Page 71: servo2008 07

Robot Builder’s Cookbookby Owen Bishop

This is a book forfirst-time robotbuilders, advancedbuilders wanting toknow more aboutprogramming robots,and students in further and highereducation tacklingmicrocontroller-based practicalwork. They will all find this book a uniqueand exciting source of projects, ideas, andtechniques to be combined into a widerange of fascinating robots. $29.95

FIRST Robots: Rack 'N' RollBehind the Design

by Vince Wilczynski / StephanieSlezycki

The second annualbook highlighting the creativity and processbehind 30 winningrobot designs from the 18th annual international FIRSTRobotics Competition.The FIRST organization,founded by DeanKamen (inventor of the Segway), promotes education in the sciences, technology, andengineering in collaboration with sponsorsincluding Motorola, Xerox, NASA, Delphi,General Motors, and other companies invested in science education. $39.95

Build Your Own Humanoid Robots

by Karl WilliamsGREAT 'DROIDS, INDEED!

This unique guide tosophisticated roboticsprojects bringshumanoid robotconstruction home tothe hobbyist. Writtenby a well-known figurein the robotics community, Build Your OwnHumanoid Robots provides step-by-stepdirections for six exciting projects, each costing less than $300. Together, they formthe essential ingredients for making yourown humanoid robot. $24.95*

Mechanisms and MechanicalDevices Sourcebook

by Neil Sclater / Nicholas ChironisThe fourth edition of this invention-inspiring engineeringresource covers thepast, present, andfuture of mechanismsand mechanicaldevices. You’ll finddrawings anddescriptions of morethan 2,000 compo-nents that haveproven themselves over time and can be incorporated into the very latestmechanical, electromechanical, and mecha-tronic products and systems. Overviews ofrobotics, rapid prototyping, MEMS, andnanotechnology, along with tutorial chapterson the basics of mechanisms and motioncontrol, will bring you up-to-speed quicklyon these cutting-edge topics. $89.95

We accept VISA, MC, AMEX, and DISCOVERPrices do not include shipping and

may be subject to change.

The SERVO WebstoreAttention Subscribers ask about your discount on prices marked with an *

LookLookWWhathat’’ssNeNeww

Forbidden LEGO by Ulrik Pilegaard / Mike Dooley

Build the ModelsYour ParentsWarned You Against.

Forbidden LEGOintroduces you tothe type of free-style building thatLEGOs masterbuilders do for funin the back room. Using LEGO bricks in com-bination with common household materials(from rubber bands and glue to plasticspoons and ping-pong balls) along withsome very unorthodox building techniques,you’ll learn to create working models thatLEGO would never endorse. $24.95

SERVO 07.2008 71

SERVO MagazineBundles

Published by T & L Publications, Inc.

$57per bundle

Save $10off thenormalprice!!

Now you can get one year’s worth of allyour favorite articles from SERVO Magazine

in a convenient bundle of print copies.Available for years 04, 05, 06, and 07.

Robotics Demystifiedby Edwin Wise

YOU DON'T NEED ARTIFICIAL INTELLIGENCETO LEARN ROBOTICS!Now anyone with aninterest in robotics cangain a deeper under-standing — without for-mal training, unlimitedtime, or a genius IQ. InRobotics Demystified,expert robot builderand author Edwin Wiseprovides an effective and totally painlessway to learn about the technologies used to build robots! $19.95

WebstoreJuly08.qxd 6/3/2008 8:29 AM Page 71

Page 72: servo2008 07

Linux Roboticsby D. Jay Newman

If you want your robotto have more brains thanmicrocontrollers candeliver — if you wanta truly intelligent,high-capability robot —everything you needis right here. LinuxRobotics gives you step-by-step directions for“Zeppo,” a super-smart, single-board-powered robot that can be built by anyhobbyist. You also get complete instructions

for incorporating Linux single boards intoyour own unique robotic designs. No programming experience is required. Thisbook includes access to all the downloadable programs you need.$34.95

Get your very own limited-edition SERVO Magazine T-shirt. Shirts come in sizes S, M, L, and are available in either black or white.

All shirts are 100% preshrunk cotton. Limited time offer. Call 1-800-783-4624.

FREE!FREE!

with anywith any

purchase purchase

over $100over $100

From HomoSapien to RoboSapien Before R2D2 there was R1D1

RobotProgrammer's

Bonanza by

John Blankenship,Samuel Mishal

The first hands-onprogramming guidefor today's robot hobbyist!Get ready to reach into your programmingtoolbox and control a robot like never before!Robot Programmer's Bonanza is the one-stopguide for everyone from robot novices toadvanced hobbyists who are ready to gobeyond just building robots and start programming them to perform useful tasks.$29.95

Oil prices gettingto you, too?!Stay home,

read a book.The online storThe online store @e @

wwwwww.ser.ser vvomagazineomagazine .com.com

To order call 1-800-783-4624Robot Builder’s Sourcebook

by Gordon McCombFascinated by theworld of robotics butdon’t know how totap into the incredibleamount of informa-tion available on thesubject? Clueless asto locating specificinformation on robot-ics? Want the names,addresses, phonenumbers, and websites of companies thatcan supply the exact part, plan, kit, buildingmaterial, programming language, operatingsystem, computer system, or publicationyou’ve been searching for? Turn to RobotBuilder’s Sourcebook — a unique clearing-house of information that will open 2,500+new doors and spark almost as many newideas. $24.95

72 SERVO 07.2008

The Amateur Scientist 3.0 The Complete Collection

by Bright Science, LLCThere are 1,000 projects on this CD, notto mention the additional technicalinfo and bonus features. Itdoesn’t matter if you’rea complete novice looking to do their firstscience fair project or asuper tech-head gadgetfreak; there are enough projects on the single CD-ROM to keep you and 50 of yourfriends busy for a lifetime! $26.99

CNC Roboticsby Geoff Williams

CNC Robotics gives youstep-by-step, illustrateddirections for designing,constructing, and testinga fully functional CNCrobot that saves you 80percent of the price of anoff-the-shelf bot — andthat can be customizedto suit your purposes exactly, because youdesigned it. Written by an accomplishedworkshop bot designer/builder, this bookgives you everything you need. $34.95

Phone-in

orders only!

SERVOMagazineT-Shirts

For men and women

NNEEW!W!

WebstoreJuly08.qxd 6/3/2008 8:34 AM Page 72

Page 73: servo2008 07

PROJECTS

Recently named as one of the Best Inventions of 2006 by Time Magazine, the H-racer is nowthe best selling fuel cell product in the world. The H-racer is a micro-version of what engineersand scientists have been dreaming about for real cars: combining hydrogen with oxygen togenerate a DC current to power an electric motor. Unlike a gas-powered car engine, the only

byproducts of this electrochemical process are electricity, heat, and pure water. With the H-racer, you can witness the power of new energy technology in the palm of your hand.Horizon has created this unique, patented miniature fuel-cell car and hydrogen refueling station.All you need to do is add water. Only $115.00 plus S/H

BACK ROOM SPECIALS

With this kit, you now can see andfeel the future of energy generationin your own hands!

Bionics for the Evil Geniusby Newton C. Braga

THE EVIL GENIUS TACKLES BIONICS! Step into the future -- (orthe past, if you have atouch of Dr. Frankensteinin your soul) -- with these25 incredibly cool bionicexperiments!Demonstrating how lifeforms can be enhanced, combined, manipulated, and measured with electronicand mechanical components, these inexpensive projects from internationallyrenowned electronics guru Newton Bragaprovide hours of fun and learning. $24.95 Sale Price $ 22.95

Or order online www.servomagazine.com

SERVO 07.2008 73

Fuel Cell Projects for the Evil Geniusby Gavin D J Harper

FUEL YOUR EVILURGES WHILE YOUBUILD GREEN ENERGY PROJECTS!Go green as you amasspower! Fuel CellProjects for the Evil Genius broadensyour knowledge of thisimportant, rapidlydeveloping technology and shows you howto build practical, environmentally consciousprojects using the three most popular andwidely accessible fuel cells!$24.95 Sale Price $ 22.95

The Definitive Guide to Building Java Robots

by Scott PrestonThe Definitive Guide toBuilding Java Robots is for educators, students, hobbyists,and startups lookingfor Java/hardware interaction. This bookshows you how to useyour PC to buildrobots, and how youcan interface with amicrocontroller to do the basics. You’ll learnto design your robot to navigate, see, speak,recognize your face, listen to you, and buildmaps. $55.95 Sale Price $ 47.95

123 Robotics Experimentsfor the Evil Genius

by Myke PredkoIf you enjoy tinkering inyour workshop and havea fascination for robotics,you’ll have hours of funworking through the 123 experiments found in thisinnovative project book.More than just an enjoy-able way to spend time,these exciting experiments also provide asolid grounding in robotics, electronics, andprogramming. Each experiment builds on theskills acquired in those before it so youdevelop a hands-on, nuts-and-bolts understanding of robotics. Sale $22.95

The SERVO BUDDYKIT

An inexpensive circuit youcan build to control a servowithout a microcontroller!For more information,please check out your

May 2008 issueor go to our website @

www.servomagazine.comSubscriber’s Price $39.55

Non-Subscriber’s Price $43.95PCB includes article reprint.

H Racer video clips can be found in the on-line store product descriptions!!

NNEEW!W!

Buy both these bookstogether in the month

of July 2008

and

and save 10% off the list price. Plus get free shipping in the US!!

Call 800 783-4624 or order online @ www.servomagazine.com

List Price $29.95 Sale Price $ 26.95 List Price $39.95 Sale Price $35.95

The LEGO Mindstorms NXT Idea Book

Building Robots with LEGO Mindstorms NXT

SSAAVE 10% plusVE 10% plusGET FREEGET FREE USUS

SHIPPING!SHIPPING!

WebstoreJuly08.qxd 6/3/2008 8:38 AM Page 73

Page 74: servo2008 07

By the time I graduated high

school, I had already met the

love of my life, Vern, and was well on

my way to my career goal. We got

married in our early 20s and, although

I had a “day job,” I embraced my

home life in my free time. Fast-

forward 10 years and enter our first

child, Nic. Finally! The time to stay

home and hone my mothering skills

had arrived. I had picked up some

techie skills through my job, but didn’t

really anticipate ever needing them

again, except for working on our

home network or fixing my sister’s

computer. Then came reality.

A mere two months after our son

was born, Vern and I decided to open

a small ISP and network services

company. My marginal techie skills

took a quick ramp up to being a full-

fledged Novell CNA with a strong A+

skill set. My husband was (and is) an

excellent network engineer. As he

designed and installed networks, I

would assist and then go on to

administer, repair, and upgrade as

needed. Our son became accustomed

to a wide range of environments as

he traveled with me to customer sites

and enchanted everyone there. After

the business settled into more ISP and

less network services, child number

two was on her way and I once again

attempted the stay-at-home thing. But

my quiet Suzy Homemaker world was

not going to stay that way for long.

By then, my husband’s electronics

interests had branched out to include

the Halloween world.

Let me explain: My husband is a

prolific designer of devices. He has

developed the Robo Spin-Art machine,

the Ponginator, Therepings, Ping Pong

Printer, Sonar Station, a talking skull in

a coffin, a 20-foot wide “venomous”

spider, and so much more. The ideas

he has still on the drawing board have

the same potential for eye-catching

Dusting RobotsOne Woman’s View of Life

With an Electronics Hobbyistby Kym Graner

When you were five, 10, or even 15 years old, what did you want to be when you grew up?

I’m betting those career aspirations changed with your interests until you eventually became

whatever you are today. Maybe you wanted to be a fireman-superhero-doctor, or maybe

a veterinarian-cheerleader-cop. I wanted to be a mom. From the time I was about 12,

I knew that was the job for me. Nothing showy, nothing extremely technical or requiring

decades of schooling. I just loved kids, cooking, crafts, and the outdoors. I couldn’t think

of anything better than being a stay-at-home mom.

74 SERVO 07.2008

Nic as a baby (left). Nic now (right).

Appetizer.qxd 6/4/2008 3:46 PM Page 74

Page 75: servo2008 07

fun that the ones already living in the

outside world possess. He’s always

been like this — inventing things since

he was in grade school. He really

can't help it.

Many of these creations came

together in 2005 to make an awe-

some Halloween Haunt that the

neighborhood still talks about.

Unfortunately, it was made at the

expense of my one beautifully deco-

rated room — the dining room. My

vintage cherry Queen Anne dining

set, hutch, and my grandmother's

antique desk had to take shelter in

my bedroom. The stained glass

chandelier was removed, black

plastic sheeting was stapled onto

my gorgeous crimson walls, and

voilá! One scary spider’s lair was

created. Like I said, it was fab —

award-winning, even! But just last

weekend, I found another staple in

the ceiling, holding just a scrap of

spider webbing.

The accoutrement that

currently grace my dining room

include two human-sized robots/

sculptures, the coffin guy, Bob —

who, at roughly six feet in height

— is also human-sized, a Stargate

Defender machine, a trashcan

zombie, and an evil spider-con-

trolled robot. My living room set

includes a former motorized

wheelchair base, turned mobile

platform for an in-process “boogie

bot,” one of the Robo Spin-Art

machines, and a supply of ping

pong balls for the Ping Pong

Printer. Rather than reflecting my

daydreaming interest in a Better

Homes & Gardens living space, our

house now sports a look that was

once described by a friend as

looking like Godzilla swallowed a

RadioShack and then threw up.

There’s a part of me that wishes

my home could revert to the

“normal” decorator dream it started

to become. But then I look at all

the fun we’ve had making and

showing off these things, teaching

our children to design and build,

and getting to meet like-minded

people, and it makes the “clutter”

worth the sacrifice. SV

Order 24 hours a day, 7 days a week

www.Jameco.comOr call 800-831-4242 anytime

Exclusively at Jameco…The Lowest Prices…

Guaranteed!

3 Levels of Choice3 Levels of Savings

Save 3% to 5%Looking to save on thousands of Name Brandcomponents? Jamecooffers these popular products for 3% to 5%below market price, andwe guarantee it!

Save 15%-25% Save more when a specific manufacturer isnot required. Major Brandsemi’s are sourced from 5-6 specific major manufacturers, plus wealso offer Jameco Brandand Generic passives foreven greater savings.

Save 30% or more! Looking for killer deals?Jameco buyers often findFactory Overruns fromsome of the industry’sbiggest names. Thatmeans savings of 30%and more to you!

Other Jameco Advantages:

� We offer over 300 Major Manufacturers� 99% of catalog products ship the same day.� Lowest prices guaranteed, or we pay 10%.

SEMICONDUCTORS • PASSIVES • INTERCONNECTS • ELECTROMECHANICAL • POWER

SERVO 07.2008 75

Sami as a baby (left). Sami now (right).

Appetizer.qxd 6/4/2008 3:08 PM Page 75

Page 76: servo2008 07

76 SERVO 07.2008

Full Page.qxd 6/2/2008 10:40 AM Page 76

Page 77: servo2008 07

Over the years, I have written

about advances in all types of

robot designs, robot technology, and

various robotic subsystems in this

column. In each article, I have tried to

cover advances in the science of

robotics and have covered the history

of a part of robotics in a specific

way. I have never tried to examine

the way that we humans have

viewed these creations of ours as

they have slowly taken over many

parts of our lives. I have often

wondered just what mindset

developed in people’s thought

processes as the science of robotics

took a certain turn. We, as robot

experimenters and hobbyists, certainly

view robotics in a way different from

the average person. We don’t just sit

back and read about how they weld

and paint our cars in far away

factories. We build our own or buy

ready-built robots or robot kits so we

can see the technology at work, first

hand. As a society, robotics is now

changing our lives in ways we never

imagined.

The ‘20s to the ‘50s —The First Visions ofRobots in Our Society

The idea of a non-human

humanoid in our society has been

around for thousands of years. Most

of these mythical creatures were not

particularly nice to us. A hundred

years ago, the very word robot did

not exist as Czech playwright Karel

Capek had yet to write his 1920 play,

RUR, which stood for Rossum’s

Universal Robots. The Czech word,

robota meant ‘serf,’ ‘drudgery,’ or

‘laborer’ in Czech — a person who

does hard work. Karel attributes his

brother, Josef, as the inventor of the

word robot, though he first suggested

the word roboti. It was changed to

robot for the play. The term robotics

was later derived from a mix of robot

and electronics or mechanics (there

are those who steadfastly stand by

each of the two words that are

attached to robot).

Robots were always thought of

as anthropomorphic or ‘man formed’

in the plays and movies of a century

ago. The earliest robots of man’s

imagination were machines to be

feared. Maria from the film Metropolis

was anything but an agreeable

creature. The many stories of Isaac

Asimov (Figure 1) from the 1940s on

brought a semblance of ‘man-like’ to

these machines. They walked on two

legs as nobody had a clue in those

days just how difficult it was to have a

machine balance while walking.

Asimov had enough technical

knowledge to realize that the

electronics of his day were not

sufficient for a robot’s brain, so he

envisioned the ‘positronic brain’ in his

robot tales as the mystical power

behind his creations. There was no

way he could have imagined the

cheap Flash drives that we use today

that contain billions of transistors as

memory cells. Transistors were still

years in the future so electronics relied

on the lowly vacuum tube.

Asimov’s robots were also a

bit kinder to mankind. In later

years, his ‘Three Laws of Robotics’

have had a great impact on all

levels and types of robots including

the design and manufacturing of

industrial robots — the only robots

Then NOW an

d

ROBOTICS — A HISTORICALPERSPECTIVE

b y T o m C a r r o l l

SERVO 07.2008 77

First Law: A robot may not injure a human, or, through inaction, allow a human being to come to harm.

Second Law: A robot must obey theorders given it by human beingsexcept where such orders wouldconflict with the First Law.

Third Law: A robot must protect its own existence as long as such protection does not conflict with theFirst or Second Law.

THE THREE LAWSOF ROBOTICS

FIGURE 1. The Late Dr. Isaac Asimov.

Then&Now.qxd 6/4/2008 10:02 AM Page 77

Page 78: servo2008 07

78 SERVO 07.2008

of the ‘60s with sufficient power to

injure a human being.

The ‘60s and ‘70s —Robots Arise fromFiction to Reality

When George Devol received his

patent on universal automation for

‘programmable transfer of articles in

a factory’ and later met young Joe

Engelberger in 1954 (Figure 2),

Unimation was born and so was the

first industrial robot — nothing at all

like the walking creatures of film and

literature. This was the first pivotal

point in the history of robotics. Robots

were now real and useful tools to

humanity. These two men were

thinking only of ways to automate

manufacturing processes, not to

replace people in their jobs.

The original Unimate robot had a

single arm extending out of a turret,

much like a military tank gun (Figure

3). However, despite the lack of

human form, the robot was here to

stay as the first Unimate toiled away

in a General Motor’s plant in New

Jersey. ‘Robots’ became the new tools

that made American industry the envy

of the world.

Factory robots started out

handling parts and soon were spot

welding and spray painting cars on

assembly lines. Robots always seem

extremely powerful to the average

person but few realize that a typical

industrial robot can actually only

handle a small payload. What they are

capable of doing is moving this small

payload quickly and precisely and

many times; thus the need for a

massive structure. Humans quickly tire

when asked to

handle items many

times. The media

touted these times

as the ‘Robotics

Age’ and a

magazine was

actually published

in the ‘80s with

that same name.

“The ‘steel collar’

worker has

arrived!” touted the headlines.

Industries welcomed these

machines as workers who never tired,

never asked for a raise, and never got

sick. Human factory workers first

looked at these intruders with a jaded

eye, worried that their jobs were at

stake. Soon, they saw their dirty,

repetitive, and dangerous jobs being

replaced by the machines and their

job status being elevated to robot

operator or robot repairman. Workers

were happy and management even

happier. The robot tide rapidly spread

overseas, primarily to Japan. The

world was now accepting robots

in society.

The presence of ‘the Three Laws’

did not prevent Robert Williams, a

worker in a Ford Motor Company

plant in Flat Rock, MI, from being

killed by a robot in early 1979. He felt

that the robot was operating a bit too

slow and was retrieving a part from a

bin when the robot’s arm struck him

in the head, killing him instantly. A

massive structure moving at high

speed can be very dangerous. No, the

robot wasn’t acting in anger that a

human was taking his job back, but a

jury awarded Williams’ family $10

million from the robot’s manufacturer.

Two years later, a Japanese worker,

Kenji Urada, was killed in a Kawasaki

plant when a robot that he thought

he had turned off, pushed him into a

grinding machine.

Throughout the ‘60s, the vast

majority of the world’s robots were

the industrial variety. Talented

experimenters built some machines

in their garage workshops and

universities allowed a few grad stu-

dents to craft a robot or two for a

thesis project, but the word ‘robot’ to

most people meant the machines in

car factories. Newsreels and

magazines showed images of rows of

mechanical servants snaking their

lanky arms into car frames, sparks or

paint mist spewing onto the floor.

Robot ‘intelligence’ — if that word

applied at all — usually meant an

expensive mini-computer or maybe a

mainframe in another room, linked to

the robot by a bi-directional RF or

wired link. Sensors were almost

non-existent on industrial robots.

Expensive cameras and factory

automation devices served as sensors

for university experimental robots.

Large drum memories held crude

programs for the robots, but, hey,

they worked, and more and more

were being installed in factories

around the US and the world.

You could ask a kid on the street

in those years, “What is a robot?” He

might, at first, say it was Tobor The

Great from the movie of the same

name. You could then ask, “No, what

is a real robot?” He would then

describe the rows of robots in a car

factory, as would any adult of those

times. Others might mention the

unmanned Surveyor or Viking lunar

landers, or the space probes sent

across the solar system to explore our

planetary system. Some might even

recall the ‘hot cell’ teleoperators

at Oak Ridge, TN that handled

radioactive materials by remote

control. All will agree that robots are

now real creations of man.

The ‘80s — JapanBecomes the Leaderin Robotics

The US can take pride in many

innovations in robotics but it is Japan

that has taken the lead in implementa-

tion of robotic technology. In the

beginning, virtually all of the robot

manufacturers were based in the US

but today’s list of the top companies

are all Japanese based. There are still

a few innovative US, Canadian, and

European robot companies but most

of the original US companies were

either bought out by their Asian

competition or went out of business.

Japan also has the greatest

FIGURE 2. JoeEngelberger. Photo

courtesy of Industry Week.

FIGURE 3. Unimate Robot.

Then&Now.qxd 6/4/2008 10:03 AM Page 78

Page 79: servo2008 07

number of industrial robots installed in

their factories; a good reason they are

one of the world’s top manufacturing

powers. By the end of 2005, Japan

had over 373,000 industrial robots in

place in factories, with the US in a

distant second place with 131,000.

Sweden, Germany, Korea, Canada,

and other countries were soon

installing robots and even manufactur-

ing their own. The UP400RN robot in

Figure 4 is made by Motoman, the

North American name for the

Japanese parent company, Yaskawa.

This company has a line of over 250

different robots for all types of indus-

tries, not at all untypical for modern

robot manufacturers. The proverbial

‘yanking the rug from under North

American robot manufacturers’ was

the second pivotal point in the history

of robotics. Actually, the rug wasn’t

yanked; it was handed over.

The ‘RobotRevolution’ Beginsin the ‘80s

Applications soon spread from

just material handling, spot welding,

and painting to more sophisticated

operations such as vision-aided pick

and place systems. The SCARA

(selective compliance assembly robot

arm) soon became the most popular

robot configuration when it was first

used in 1978 in small assembly

operations such as electronic circuit

board ‘parts insertion.’ Gantry x-y-z

axis robots were developed to handle

large and small parts. AGVs (automat-

ed guided vehicle) took a departure

from fixed base robots and moved

about factory floors carrying parts,

guided by invisible paths on the floor

or by other means. Surveillance and

security robots silently guarded factory

and office floors.

Robot applications were

spreading outside of the typical

factory floor to many new uses. The

Robotic Industries Association (RIA)

and the Robotics International of the

Society of Manufacturing Engineers

(RI/SME) were in their heyday in

the mid-1980s with thousands of

members attending the many industry

shows around the country. The

world’s industries touted all these new

applications for robotic technology as

the Robot Revolution.

Service Robot — aNew Category

A new tide of interest in robotics

began to develop. With varieties of

robots spilling over into all aspects of

life in the early ‘80s, it was natural

for the large electronic kit maker,

Heath, to design a robot kit for the

experimenter and hobbyist (Figure 5).

The Hero 1 was an instant hit, and

a later Hero Jr. and the more

sophisticated Hero 2000 rounded out

the line. With Heath long since out of

business, for those who are interested,

Robert Doerr at www.robots

wanted.com has many Hero parts

and whole robots to sell. Bob also

handles the equally famous RB5X

robot that cost a whopping $2,295 in

1984 (Figure 6).

Nolan Bushnell of Atari fame

started a company called Androbot

and began selling his ready-built TOPO

and BOB robots in early 1983, or as

he stated — “the year 1 AB,” for the

first year of AndroBot, or After Bob,

as others have said. Universities and

community colleges began to offer

courses in robotics for the budding

roboticist — a new buzz word that

began to make the rounds in the late

‘80s. I’m assuming that the word was

derived from robotic and scientist. As

the science of robotics comprises so

many diverse technologies, robotics

students found their special interests

within mechanical engineering,

electrical engineering, computer

science, physics, computer

engineering, and other technical

fields such as chemistry and optics.

Once the dominate force in

robotics, industrial installations took

a back seat to newer applications.

Robot technology had now spread out

from the factory floor to teleoperators

for remote manipulation, mobile

military robots, and remotely-operated

vehicles for under the sea, on the

ground, and in the air. Medical

applications were replacing the

surgeon, floors were being cleaned by

robots, and medicines delivered by

robot couriers in hospitals. Robots

snaked their way through pipes for

inspection, crawled up the sides of

buildings to clean windows, delivered

food to tables in restaurants, and

entertained us in our homes.

SERVO 07.2008 79

FIGURE 6. RB5X.

FIGURE 5. Hero Robot.

FIGURE 4. MotomanUP400RN by Yaskawa.

Then&Now.qxd 6/4/2008 10:03 AM Page 79

Page 80: servo2008 07

Entrepreneurs searched for different

ways to use this new technology.

Interest in Roboticsfrom the ‘90s to thePresent is Phenomenal

Robot experimenters have long

been interested in robotics as a means

of using a machine to do something

physical, in that it either investigated

its environment by roving about or it

actually made changes to the environ-

ment. With the advent of affordable

microprocessors and microcontrollers,

robots can now operate on their own.

These autonomous robots do not

need “man” in the loop to

accomplish something intelligently.

It is this seemingly intelligent

appearance of robots that

appeals to a new breed of robot

enthusiasts — those with strictly

computer science or AI

backgrounds. Once called gear

heads for their mechanical bent,

the new generation of robot

experimenter now has at his

or her disposal all types of

sophisticated microcontrollers,

sensors, vision systems, and

navigation methods to create

some ‘killer’ robots.

SophisticatedRobots BecomeAvailable to Everyone

Gone are the old robot kit

companies as new hobby robot

manufacturers step up to the plate.

LEGO — the maker of the plastic block

sets for kids — develops some

amazingly unique and powerful robot

kits with their Mindstorms series.

Robot Sumo moves from Japan and

becomes popular in the US and the

world. Dean Kamen, inventor of the

Segway Personal Transporter of 2001,

had interests in robotics back in

1989 when he founded FIRST (For

Inspiration and Recognition of

Science and Technology), a robotics

competition that in 2008 had

over 37,000 high school students

in robotics teams across the

nation. A recent article in Electronic

Design magazine indicated that

students in the FIRST competition

were more likely to attend college

and were likely to be interested in

engineering fields, were more

community oriented, and aspired to

post-graduate studies. Does this

mean students who entered the

competitions were then inspired to

go into robotics and engineering, or

that FIRST naturally attracted the

type of student who would have

gone this route, anyway?

Robots have always appealed

to children, and the child in all of

us. Tiger Toys brought forth the

extremely popular Furby in 1998 — a

small, furry robot animal reminiscent

of the characters in the Gremlins

movie (Figure 7). This talking and

somewhat moving creature sold over

40 million units. Sony, the huge

electronics manufacturer first

produced its robot dog (and cat)

named Aibo in 1999. Many people

wondered just who would shell out

$1,500 to $2,000 for a plastic dog but

almost 200,000 did until Sony ceased

production in early 2006. It is

rumored that they will bring out a

new model this year called the Aibo

PS to be controlled by their latest

PlayStation (Figure 8).

History will show that these

introductions of sophisticated robot

toys were an important turning point

in robotics and its acceptance with

non-technical people. CrustCrawler,

Lynxmotion, Parallax, and many other

companies advertising in SERVO

now supply or make some amazing

robots or robot components for robot

experimenters.

The average person has no clue

how these creations of ours work,

so our various clubs have arranged

exhibitions for the public. Robothon

was one of the larger robotics

expositions developed and presented

by the Seattle Robotics Society at

the Seattle Center — home of the

Space Needle. For years, Robothon

introduced thousands to the exciting

science and hobby of robot building

and robot competition. This year, it

will not be held, not because there

is not interest for such events but

because leadership of the Robothon

has kept it alive for so many years that

burnout has occurred.

The same applies to the Portland

Robotics Society’s popular PDXBot and

other group’s events around the

country. However, others such as the

big San Francisco RoboGames and

the Dallas group’s contests are still

packing ‘em in. The leadership of

these events has seen a gradual

lessening in the attendance of these

exhibitions, unfortunately. Possibly the

downturn in our economy is making

money a bit tight for expensive

hobbies. Maybe the rest of society has

become so used to robots vacuuming

our floors and entertaining us that a

80 SERVO 07.2008

FIGURE 7. Furby.

FIGURE 8. Aibo.

Then&Now.qxd 6/4/2008 10:04 AM Page 80

Page 81: servo2008 07

demonstration of a championship

Robo-Magellan or a 20-servo

humanoid walker brings a bored “ho

hum” from the average bystander. Do

they really want a full-size Honda

Asimo as a servant in their homes?

Does this hiccup in interest signify

another turn in the history of robotics?

Possibly. Have we failed as robotics

enthusiasts? No way! The history of

any technology has always gone

through these cycles of interest and

acceptance. The steam engine was a

marvel until it drove trains, ships, and

factories everywhere. The common

light bulb that lit the world as the

marvel of a century ago, is so

commonplace that it is ignored today,

soon to be replaced by LED lamps.

The amazing $2,000 cell phone of

two decades ago is now given away

and is in the hands of most school

children.

The Robot Revolution

The recent April 21st edition of

U.S. News and World Report had an

article entitled ‘The Robot Revolution

May Finally be Here.’ I’m thinking,

“They’re saying this again, after 20

years?” The article went on to

mention that iRobot has sold almost

three million Roombas — the vast

majority of the new helper robot

category. “Personal robots emerged as

a mainstream product last Christmas,

with Sharper Image’s catalog

featuring a “Shop for Bots” section,

says Philip Solis of market tracker ABI

Research,” as written in U.S. News.

Yet, the March 27th edition of

Electronic Design had a picture of

Star Wars’ C-3PO on the cover with

the article title under it stating: “The

Droid War: Cost, Lack of Industry

Focus Clouds Robotics Future.” The

article actually paints a rosier picture

of the state of robotics in the actual

essay, with an emphasis of LEGO’s

Mindstorms NXT robotics kit and

National Instrument’s LabVIEW

software package.

So, you see, there are always

multiple sides to any historical subject,

whether a part of the Civil War or

the subject at hand we all love so

much. It just depends on your point

of view and what particular facet of

robotics interests you most. Outside

of the usual timelines, every “history

of robotics/robots” that I Google

always seems to have a different

slant on the subject. I would very

much appreciate some of you readers

of SERVO to email me with your

feelings about the future trends of

robotics, for it is you who will

ultimately change the directions of

experimental robotics with your

purchases, designs, exhibition

attendance, and comments at

meetings and on the web. SV

Tom Carroll can be reached via emailat [email protected].

SERVO 07.2008 81

All Electronics Corp. .........................25, 70

AP Circuits/e-pcb.com ............................10

AWIT ..........................................................70

Boca Bearings ....................................23, 70

CipherLinx Technologies .........................70

CrustCrawler .............................................82

Electronics123 ..........................................25

Endurance Robotics ................................70

Hitec ..........................................................15

Images Co. ................................................70

Jameco ......................................................75

Lorax Works ........................................25, 70

Lynxmotion, Inc. .......................................11

Maxbotix ...................................................70

Mini Robotics .....................................63, 70

Net Media .................................................83

Parallax, Inc. ...............................Back Cover

PCB Pool ..............................................21, 70

Pololu Robotics & Electronics ..........43, 70

Rabbit, A Digi International Brand ............3

RoadNarrows Robotics ...........................24

Robot Craft ...............................................70

Robot Power ............................................23

RobotShop, Inc. .................................70, 76

Skycraft Surplus ........................................25

Solarbotics/HVW .....................................14

solderbynumbers.com ............................25

Sparkfun Electronics ..................................2

Technological Arts ...................................70

Vantec .......................................................10

Weird Stuff Warehouse ...........................25

Advertiser Index

Looking for a GIFT or maybe just something special for yourself?

Check out our website and take a look atall our other robotic items for sale!

Then&Now.qxd 6/4/2008 10:04 AM Page 81

Page 82: servo2008 07

Full Page.qxd 6/2/2008 10:33 AM Page 82

Page 83: servo2008 07

Full Page.qxd 4/29/2008 4:05 PM Page 83

Page 84: servo2008 07

backcvr.qxd 6/2/2008 10:30 AM Page 84