servo2008 01

84
Vol. 6 No. 1 SERVO MAGAZINE ZENO SUPER STEPPER DRIVER SPACE ROBOTICS NEW LIFE FOR ARTI ONE January 2008

Upload: karina-cristina-parente

Post on 01-Dec-2015

36 views

Category:

Documents


0 download

TRANSCRIPT

Vol. 6 N

o. 1

SERV

OM

AG

AZIN

EZEN

O•

SUPER

STEPPER D

RIV

ER•

SPACE RO

BOTICS

•N

EW LIFE FO

R A

RTI ON

E January 2008

Cover.qxd 12/6/2007 8:50 AM Page 1

Full Page.qxd 12/5/2007 3:20 PM Page 2

Full Page.qxd 12/5/2007 2:19 PM Page 3

4 SERVO 01.2008

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

Departments06 Mind/Iron

21 Events Calendar

22 New Products

23 Robotics Showcase

66 Robo-Links

76 SERVO Webstore

82 Advertiser’s Index

Columns08 Robytes by Jeff Eckert

Stimulating Robot Tidbits

10 GeerHead by David Geer

Zeno — The First Complete Character Robot

14 Ask Mr. Roboto by Pete Miles

Your Problems Solved Here

61 Twin Tweaksby Bryce and Evan Woolley

More Than Meets the Eye — the Mighty Morphing V-Bot

67 Different Bits by Heather Dewey-Hagborg

Neural Networks for the PIC MicrocontrollerPart 4: Self-Organizing Maps

71 Robotics Resources by Gordon McComb

Small Brains for Your Bot

75 Appetizer by Gerard Fonte

Terms of Endearment

79 Then and Now by Tom Carroll

Robots Take to the Air

PAGE 24

TOC Jan08.qxd 12/5/2007 11:16 AM Page 4

01.2008VOL. 6 NO. 1

SERVO 01.2008 5

ENTER WITH CAUTION!24 The Combat Zone

MEET THE MIGHTY MORPHING V-BOT/pg 61

32 The Super Stepper Driverby Fred EadyBuild an intelligent stepper motor controller from scratch that’s based on the Allegro MicroSystems A3979.

38 Compute Square Roots Fastby Tim PatersonSquare roots have a number of possible applications in microcontroller systems.

42 GPSby Michael SimpsonPart 4: A closer look at the interfaceneeded for each of the GPS modules covered in this series.

49 Space Roboticsby Fulvio MastrogiovanniThis article focuses on the entire control loop that’s used to allow a rover to safely navigate on Mars using information from Earth.

54 C Programming for MicrocontrollersMade Easyby Sam ChristyThis new, no-cost online system can cut start-up time from hoursto minutes.

56 Reviving a Showbotby Robert DoerrGive ARTI ONE a new lease on life.

Features & Projects

TOC Jan08.qxd 12/5/2007 11:16 AM Page 5

Published Monthly By T & L Publications, Inc.

430 Princeland CourtCorona, CA 92879-1300

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

Product Order Line 1-800-783-4624www.servomagazine.com

SubscriptionsInside US 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 GeerPete Miles R. Steven RainwaterMichael Simpson Kevin BerryFred Eady Robert DoerrSam Christy Tim PatersonGerard Fonte James BakerChad New Don HebertBryce Woolley Evan Woolley

Heather Dewey-HagborgFulvio Mastrogiovanni

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.

INFRASTRUCTUREA fundamental aspect of robotics is

that the application domain can rangefrom ocean beds and table tops to thenooks and crannies of extraterrestrialdunes. It’s no coincidence that thetechniques and technologies described inthe article featured in this issue of SERVOcan be applied to virtually any applicationareas. However, if you have a particularinterest in space exploration, then you’llfind Fulvio Mastrogiovanni’s article,“Space Robotics,” of particular note.Fulvio, a PhD candidate from the MobileRobotics and Artificial Intelligence at theUniversity of Genova, Italy, offers afocused consideration of control theoryapplied to the practical challengespresented by the NASA Mars ExplorerRover mission. The article also hints at anoften ignored and poorly understoodaspect of robotics — that of infrastructure.

Space exploration and transport,together with development of moretraditional military gear, are responsible formany of the innovations in sensors,software, and platform designs that trickledown to civilian robot developers.However, even if you have access to the components and algorithms used byNASA engineers, you’d probably find itimpossible to develop a robot that evenapproximates the abilities of the impressiveMartian rovers. The missing ingredient isinfrastructure — the robots, conventionaltools, and processes used to develop thevehicles and robots destined for space.

Consider the array of advancedrobotics used in the construction andtesting of the shuttle’s external tank. Theshuttle’s external tank, which has a lengthof 55 feet and diameter of 28 feet, isfabricated at the Michoud AssemblyFacility, near New Orleans. When I touredthe facility, I was amazed at the robotsand other automated equipment requiredto achieve the tolerances necessary forspace flight. In particular, I witnessed afully assembled fuel tank mountedhorizontally on a motorized spindle in away that enabled robots to apply

insulating foam to the aluminum-lithiumtank. I tried to imagine the control systemsand motors necessary to rotate the58,000 lb tank and maintain a precisecoating depth. Although I haven’t seen itfirst hand, I assume that the roboticequipment used to create the multi-stageBoeing Delta II that transported theMartian rovers is just as impressive.

Sam Christy’s article on programmingfor FIRST controllers and Tim Paterson’sarticle on square roots illustrate a key‘invisible’ component of the infrastructurerequired to develop robots. If you’re likemany roboticists, you probably have a drillpress, soldering iron, a few boxes of spareparts, perhaps a library of reference texts,and a PC. To the uninitiated, the PC maybe simply another artifact in yourworkshop. However, if you’re involvedwith developing control loops, machinevision, wireless communications, or othercomputational tasks, then your PC may beyour primary development tool. In thisregard, traditional tools and componentsoften fail to capture the enormity ofeffort, planning, and time that goes intodeveloping a robot.

If you’re new to robotics, then you’rejust beginning to appreciate the depth andbreadth of your development infrastructure(or lack of it). Whether you’re primarilyinvolved in developing pneumatic weaponsfor battle bots or vision recognitionalgorithms for a commercial robotic platform,you’ll soon discover that a developmentinfrastructure is a prerequisite for efficient,unencumbered robot development.

At the start of my robotics career, Iinvested almost a year of effort developinga flexible infrastructure. The majorcomponents include:

• Drill Press and Bit Assortment• Vise• Work Bench• Dremel and Accessories• Dual-Trace Digital Oscilloscope• Multimeter• Regulated Power Supplies (3)• Lamp• Glue Gun• Heat Gun

Mind / Iron

by Bryan Bergeron, Editor

Mind/Iron Continued

6 SERVO 01.2008

Mind-Feed Jan08.qxd 12/4/2007 2:39 PM Page 6

• Air Compressor• Hand Tools• Glues and Adhesives• Nut and Bolt Library• Clamps• Cables, Wire, and Shrink Tubing• Connectors and Pins• Soldering/Desoldering Station• R/C Unit• Nibbler Tool• PC• Software (Schematic generation, simulation, compilers)• Sensors (US, IR, motion, etc.)• Microcontrollers (STAMP, PICs, ATMEL)• Storage Bins• Breadboard System• Multi-drawer Tool Chest

I’m still working on the infrastructure, but at a much lowerlevel. So, how do you go about building an infrastructure? Ifyou’re fortunate enough to be financially well positioned, thenthe anticipatory approach is a viable option. Assuming that youcan accurately anticipate your upcoming needs, then you canassemble an infrastructure within a few weeks. Even withequipment in hand, you’ll need several weeks to learn how tooperate and apply your new hardware and software.

At the other extreme is the as-needed approach, whichentails purchasing tools and test equipment on an as-neededbasis. While easy on the pocket, this approach often results in aloss of momentum. Stopping a project midway to await deliveryof a drill or torque wrench and then learning how to use thedevice can derail an otherwise focused project. There is also thedefocusing associated with taking time to identify the bestoscilloscope, drill press, or other item.

The two approaches aren’t mutually exclusive. For example,I use a hybrid approach in which a few major purchases — drillpress, multimeter, hand tools, and oscilloscope — are added to asneeded. I’ve learned the hard way that when you build aninfrastructure, buy the best that you can afford. Don’t be lured byan inexpensive hand tool or soldering iron that will satisfy yourcurrent project. Instead, try to anticipate what you’ll need overthe next five years. It costs more to buy a cheap tool and then amore expensive tool a few months later, than to buy the right toolto begin with. I’m a big fan of eBay where — if you’re patientenough — you can find good deals on equipment that mightotherwise be out of your reach.

Another option is to outsource your infrastructure by joininga well-stocked robotics club. For modest dues, you can haveaccess to a supportive infrastructure that may prove invaluableto your success in robotics. A related approach isto extend your infrastructure with external services, such aslaser cutting. I use Pololu Robotics and Electronics(www.Pololu.com) for laser cutting on large projects.Outsourcing can be expensive, but it allows you to focus on whatyou do best.

As a word of warning, as you construct your infrastructure,remember that it’s tempting to use robotics as an excuse toamass a huge collection of fantastic tools and equipment. This isfine if your intent is to collect tools. However, if your goal is toproduce functional robots, then do your best to avoid theseduction of gear. SV

Advanced Course 3 Days $1995Program and Control:

GPS ReceiversRS232, 485 Serial Communications

Wireless CommunicationsIEEE Zig Bee, Bluetooth

Distance SensorsRFID Readers and Tags

Motor Control W/Feedback

Minneapolis, MN, Jul. 21-23Los Angeles, CA, Aug. 18-20

Newark, NJ, Sep. 22-24San Diego, CA, Oct. 6-8

Check the web for more dates

Intro Course 3 Days $1995Program and Control:

LED and LCD DisplaysDC, Servo, and Stepper Motors Temperature and Light sensorsRS232 Serial Communications

ADCs and EEPROMsTimers, Interrupts, & Clocks

Visual Basic Interfaces

Columbus, OH, Jan. 21-23Los Angeles, CA, Feb. 4-6Huntsville, AL, Feb. 18-20

Newark, NJ, Mar. 3-5

Check the web for more dates

WoW!Finally,

Hands-on Training for

PIC® Microcontrollersand PIC BASICPRO™!

RCG Research

Innovative Ideas in Electronics Design

www.RCGResearch.comPhone (800) 442-8272PIC and PIC BASICPRO are trademarks or registered trademarks of Microchip Technologies, Inc.

RCG Research, Inc. is not affiliated with Microchip Technologies, Inc.

Extreme Robot Speed Control!

OSMC6

6

6

6

Monster power!14-50V3.15 x4.5”x1.5”3 wire interface

160A!”

www.robotpower.comPhone: 253-843-2504 [email protected]

Scorpion HX6

6

6

6

Dual (6A pk) H-bridgesfwd-only channel

5V - 18V1.6“ x 1.6” x 0.5”

2.5A12APlus

$79.99

Scorpion Mini6

6

6

2.5A (6A pk) H-bridge5V - 18V1.25“ x 0.5” x 0.25”

$119.99

Scorpion XL6

6

6

Dual H-bridge5V - 24V2.7“ x 1.6” x 0.5”

13A 45A Peak!

6

6

6

6

6

6

6

14V - 50V - Dual H-bridges - 150Adjustable current limitingTemperature limitingThree R/C inputs - serial optionMany mixing options - Flipped Bot InputRugged extruded Aluminum case4.25" x 3.23" x 1.1”

80A A+ Peak!

$29.99

$399

Introducing Dalf6

6

6

6

6

6

6

Closed-loop control of two motorsFull PID position/velocity loopTrapezoidal path generator

PIC18F6722 CPUC source for routines providedSee

Giant Servo Mode!

www.embeddedelectronics.net

$250

MADE IN

THE USA

H-bridges: Use with Dalf or with your Micro/Stamp

Simple-H6

6

6

6

6-28V 252.25 x2.5 x0.5”3 wire interfacecurrent & temp

protection

A!” ”

$79

SERVO 01.2008 7

In re-reading my December 2007 Robotics Resources column, I spotteda small error regarding the light wavelength of the laser diodes used inDVD players. Most commercial DVD players use 650 nanometer (deepred) laser diodes, rather than the 780 nanometer (infrared) laser diodescommon in CD players.

Gordon McCombRobotics Resources

Mind-Feed Jan08.qxd 12/4/2007 2:40 PM Page 7

8 SERVO 01.2008

Goodbye E-Harmony, HelloBot-Harmony

You may have noticed (or tried notto notice) that some robots are becom-ing a lot more lifelike and even alluring.One example is Dion, a Chinese babewho is said to mimic all sorts of humanfeatures, including facial expressions,skin temperature and elasticity, breath,and heartbeat. According to the manu-facturer, she can even be built to resem-ble the specific person of your choice.

Another deliberately seductivemechanism is Actroid DER2, developedat the University of Osaka and manufac-tured by Kokoro Co. This one isdesigned “to play an active part formany occasions as a chairperson withfluent narrations and booth bunny.” Youcan even rent her for a five-day outingfor $400,000 yen (about $3,500 US).

I didn’t locate any specific infor-mation about how intimate these yum-bots are designed to be, but if you arepresently settling for a partner whohas to be inflated for each romanticencounter, you might be interested ina recent book by AI expert David Levy.The good news is that it someday willbe common for people to marry andhave sex with robots. The bad news isthat Levy doesn’t expect it to be legaland acceptable until about 2050. He

also predicted that Massachusetts willbe the first to legalize it.

If you want to follow that line oflogic, pick up a copy of Love and Sex with Robots: The Evolution of Human-Robot Relationships, publishedlate last year by HarperCollins (www.harpercollins.com). The hardcoveredition will cost you $24.95, or youcan get the e-book for $19.95.

Arm Inspired by theReal Thing

Ever since the Barrett Hand —a three-fingered manipulator used extensively by NASA — was introduced in1997, mechanical arms have grown moredexterous and complex, but still haven’tlooked or operated that much like thehuman counterpart. But an eerily lifelikeone, even without any skin covering, hasbeen brought to us by Germany’s FestoCorp. (www.festo.com).

The company is known primarily forits pneumatic and electromechanical systems, components, and industrial controls. But perhaps its most interestingaccomplishment is the creation of Airic’sArm. Based on the real thing, it even hasmetal versions of the radius and ulna, themetacarpals, and the shoulder and shoulder blade. One big difference, how-ever, is that it is powered by 30 of Festo’s“Fluidic Muscles,” which are tubes ofelastomer reinforced with aramide fibers.

When you fill one with compressed air, its diameter increasesand its length shortens, thus creatingmovement. This actually gives Airic an advantage over the rest of us: When the arm contracts, it doesn’trequire any additional power to staycontracted; that is, it can lift some-thing and hold it in place indefinitely.

Festo intends to further developthe system by adding vision and tacticsensors and maybe even giving it aneck, a back, and a hip. A short videoof the thing in action is presently atwww.youtube.com/watch?v=tVg6xKHJKY4.

Feeding Robot for theDisabled

On a more specialized level is theMy Spoon feeding robot manufacturedin Tokyo by SECOM Co., Ltd. Designedto allow victims of spinal cord injuries,muscular dystrophy, and other disabili-ties to feed themselves without a care-giver’s assistance, it offers interchange-able controllers and utensils, and aselection of operating modes to accom-modate different disability levels. It’s notquite up to the flexibility of a humanoidhand in that foods must be served fromspecific divisions of a meal tray, and theymust be in bite-sized pieces.

Both users and therapists seem tobe praising its effectiveness, and it waseven nominated as a finisher in the Top10 Robots listed by Japan’s Ministry of

Dion, from Beijing Yuanda SuperRobot Technology Co., Ltd., andActroid, from Kokoro Co., Ltd.

Airic’s Arm, perhaps the mostrealistic robotic arm yet.

Photo courtesy of Festo Corp.

The My Spoon™ feeding apparatus.Photo courtesy of SECOM Co.

by Jeff EckertRobytes

Robytes.qxd 11/30/2007 11:19 AM Page 8

Economy, Trade, and Industry. No priceis given on the company’s website(www.secom.co.jp/english/index.html), which probably indicates that it willrun you a pretty nice chunk of change.

But the main idea is to give the usera greater sense of independence, whichis not a bad thing. And it could probablybe fitted with a nice demitasse spoon,making it useful for a fair number ofHollywood actors and pop stars ...

Creeper Checks StructuralIntegrity

Quite often, even creepy littlerobots on tracks can cost an amazingamount of money. For example, it wasreported that the US Army recentlyordered 40 PackBots from iRobot(www.irobot.com) at a cost of $8.8million, or $220,000 each. It is thereforeinteresting that Sanyo appears ready tointroduce a model that is rumored to bepriced at a paltry one million yen (about$8,900). Sure, the military machines aremore heavily equipped and hardenedfor rough duty and, sure, we’re comparing horses to ponies. But still, atabout 1/25th of the cost ...

In any event, details are spotty, butSanyo's new machine — so far, rathergenerically named the UnderfloorRobot — is designed to scamper aroundunderneath potentially crumbling officebuildings, apartments, and other placesthat may be suffering from structuraldamage. It runs about two hours on acharge, performing visual inspectionsand beaming back video of whatever itfinds. It is equipped with a zoom lensfor getting down to details and willautomatically create reports and measure the distance between objects.

Other specs include dimensions(L, W, H) of 420 x 260 x 200 mm (16.5x 10.2 x 7.9 in), base weight of 9.6 kg(21 lb), and the ability to traversebumps up to 85 mm (3.4 in) in height.Power comes from a lithium-ion

battery pack, as usual. More detaileddata should be appearing at www.sanyo.com by the time you read this.

Watch for Floating ObjectsOkay, they’re not the most complex

self-operating devices you’ve ever seen,and all they basically do is bob up anddown; measure tempera-ture, salinity, and velocity;and relay the informationback home. But theamazing thing is that theInternational Argo Project(www.argo.net), withsupport from more than40 countries, haslaunched more than3,000 of the things since2000, and they are scat-tered all over the globe.

In the operationalcycle, each float spends10 hours at the surface,descends to its driftingdepth of 1,000 m (3,281ft), and stays there foreight to 10 days, dropsto the profiling depth of2,000 m (6,562 ft), thenmakes its measurementsduring a 10 hour ascent.

The objective is toallow the world, for thefirst time, to take thepulse of the oceans on a

continuous basis and relay the information to whoever needs it within hours of its collection. And“whoever” includes you.

For the beginner’s guide toaccessing Argo data, log onto www.argo.ucsd.edu/Frbeginnersguide.html. You’ll be giving speeches on climatology in no time. SV

Robytes

Diagram of an Argo Active Float.Photo courtesy of the Argo Information Centre.

iRobot’s PackBot Explorer and Sanyo’s upcoming underfloor robot.Photos courtesy of iRobot and Sanyo Electric Co. Ltd.

SERVO 01.2008 9

Robytes.qxd 11/30/2007 11:19 AM Page 9

10 SERVO 01.2008

Zeno — due on the market as a toyin 2009 — is the closest thing tohuman that a robot has become.

Its facial expressions are a story all to themselves, enabling the most complete robot personality andhuman-to-robot emotive interactivity todate. Want some proof? Read on!

Zeno is a 16-inch, six-pound, interactive robot boy developed byHanson Robotics with help from anumber of vendors includingRoboGarage and roboticist TomotakaTakahashi, of Japan, who is responsiblefor creating Zeno’s body.

The body prototype uses 18 servos, enabling the robot to walk, run,balance on one foot, lie down and get up, and gesture, as in non-verbalcommunication, according to Dr. DavidHanson, PhD, who worked withTakahashi to produce the combinedrobot, Zeno.

Zeno is BornOnly recently completed (September

2007), Zeno, the boy robot, offers everyhuman facial response. Zeno (animationsoftware from Massive Software andMaya software) is the world’s first “complete character robot,” according toDr. Hanson.

Complete character means Zenohas facial expressions, walking and ges-turing expressions, and conversationalcapabilities like a complete humanbeing would have.

Zeno smiles, frowns, and getsangry. He looks sad, surprised, andafraid. He can present confusion or concentration as well, according to Dr.Hanson. The mouth moves when Zeno isspeaking, the eyelids each work inde-pendent of the other, and the eyeballsturn side-to-side, and look up and down.

“In the toy, we intend for the ears

to wriggle,” says Dr. Hanson. Zeno cannod, turn, and tilt its head. “Thesemotions can be used expressively, aswell as to affect eye contact with people and otherwise look around therobot’s environment,” Dr. Hanson says.

Zeno — like other Hanson characterrobots — interacts with people with a fullrange of robotically orchestrated facialexpressions and conversation enabled byHanson’s Artificial Intelligence softwareand carried out by Hanson’s patentedrobot mechanics and materials.

Thanks to a company calledSensory, Zeno recognizes and understands human speech, accordingto Dr. Hanson. Zeno can respond withsubstantial verbal exchanges.

Not short on words, Zeno’s vocabu-lary is what scientists like Dr. Hanson call“arbitrarily large” in size, meaning it ismore than big enough for the job athand. “As people talk with the robot, the

robot listens especially for words andphrases most pertinent to the recentconversation,” says Dr. Hanson.

Zeno analyzes human speech toget the intent of the conversation.While the robot makes errors inspeech recognition 10-20 percent ofthe time, it can still respond tohuman commentary, staying ontopic, according to Dr. Hanson. Thismirrors human exchanges, in whichpeople generally stay on topic butallow conversation to flow and take

Contact the author at [email protected] David Geer

Zeno — The First CompleteCharacter Robot

Human interaction is its main attraction ...

Photos are courtesy of ThomasRiccio unless otherwise noted.

Even from the start, Zeno’s head was morethan a hat rack. Here is a shell of Zeno’shead with notes and numbers; a part of

the design process.

A clay mock-up of Zeno fromthe design phase.

Geerhead.qxd 11/30/2007 11:29 AM Page 10

GEERHEAD

on new directions, Dr. Hanson explains.

Frubber — It’s Allin the Skin!

Hanson’s patented Frubber syn-thetic materials technology makes itpossible to give Zeno and other robotsa wide range of life-like, emotive facialresponses. Frubber enables Hansonrobots to form near-real human expres-sions with what is the closest to realskin that robotics materials have comeso far, while requiring a fraction of thepower needed by other solutions.

Hanson’s “structured porosity elas-tomer” (SPEM) uses a hierarchy of poresthat can pack into other pores down tosmaller and smaller scales — even to themolecular level — resulting in very skin-like foam. The robot skin stretches likehuman skin and packs like skin to enablemore realistic human expressions.

Frubber stretches to greater thaneight times its original size or compress-es to fractions of its original form whileusing less than .045 percent of thepower required for other robot faceexpression solutions. The power reduc-tion makes it possible to use replaceablebatteries for the facial operations which,in turn, helps make it possible to createhuman-like bipedal robots that run with-out being tethered to power supplies.

ElectronicsHanson’s electrical and computing

technologies include the patent-pending Character Engine AI frame-work, which works in conjunction withanimation software.

The AI framework and softwareenable robotic movement includinghuman-like qualities that were not previously transferable from computeranimation to robotic actuation. The AIand machine intelligence can run on asingle, standard PC, which can controlthe robot wirelessly, explains Dr. Hanson.

“In our first prototype, we areusing Bluetooth wireless for the motioncontrol and the sensor data, and ana-log composite RF for video transmis-sion. In the final product, we intend touse Wi-Fi (802.11g),” says Dr. Hanson.

According to Dr. Hanson, theCharacter Engine framework is a modu-lar and extensible software architecturefor developing extremely intelligentcharacters. This generally means thesoftware is well designed so it’s easy toexpand on the programming that exists,to code other things to go with it.

The modular approach to codingthe software makes it easy to interfacethe Character Engine with other AI androbotics software like MS RoboticsStudio, Intel Open CV, and a variety ofcognitive architectures.

The Character Engine provides agood framework (programming structure) for writing personalities intothe individual robot’s characters. TheCharacter Engine enables code/personality authors to quickly createnew personalities with software toolsjust for that purpose.

The Character Engine uses Mayasoftware, as well as Massive software,which will be familiar to games and animations programmers, tocontrol the animated behav-ior of the robot, so it canexpress its personality. So,what games and feature filmanimation language writersand program developers havebeen doing is not simplybringing characters to life onscreen, but paving the way tobring them to life in 4D!

The Massive Softwareprogramming serves as themotor cortex — the interac-tive animation brain forHanson’s robots. “Massive is

the right tool for the job, deliveringextremely lifelike character behavior inresponse to sensory stimuli, a capacitywell demonstrated in numerous films,including the Academy Award winningcrowd effects in the “Lord of theRings” movies,” comments Dr. Hanson.

The Character Engine softwarealso combines state-of-the-art comput-er vision, face tracking, and motiontracking with other sensory input, soZeno’s personality knows who andwhat it is interacting with and respond-ing to. Zeno uses motion detection andcomputer vision to recognize facial

SERVO 01.2008 11

Zeno at WIRED’s Nextfest.Photo courtesy of Kevin Carpenter.

Full-length Zeno. His body is mobile, too.

Zeno complete with depth of character.Just look into those eyes!

Geerhead.qxd 11/30/2007 11:30 AM Page 11

12 SERVO 01.2008

expressions, human gestures, and common objects, explains Dr. Hanson.

ModularProgramming Provesits Worth Again

The flexibility that modular pro-gramming offers is imperative toenable researchers and developers tocombine the complex elements of AIthat make it possible to simulate theequally complex brains in humanbeings, according to Dr. Hanson.

“We hope this focus on intelligentcharacters will foster rapid progress insociable AI, helping to give rise tofriendly AI — the sort of AI that feelscompassion towards us, and can help

to prevent the nightmarish future ofunfriendly AI so common in sci-fi.”

“We have authors who constructthe personalities for our robots both asworks of literary art and state-of-the-artAI,” says Hanson. These authors definethe robot’s motives in doing things,their intentions, and their will.Hanson’s Character Engine pursues theobjectives of the robot’s will while itinteracts with the world.

Zeno is a social robot. So, it willrespond positively to socially positivepeople and back away from rude people. “If a person is kind to therobot, for example, Zeno will seek tospend more time with them. If a person is rude, on the other hand,Zeno will be cold and distant, and seekother people to interact with or will

play alone, ignoring that person.”In order to tell the kind people

from those who are rude, Zeno uses aunique data structure to rememberpeople; a data structure Hanson callsPeople Objects. The People Objectscontain photos of people, their names,memories of interactions with thosepeople, facts about them, topics of discussion and how the robot “felt”when interacting with each person.“This way, the robot builds emotionalmemories which guide his interactionsand motives,” says Hanson.

Zeno’s UnveilingHanson Robotics unveiled Zeno to

the public in September. As a result, anAssociated Press article covering thefantastic new robot appeared in morethan 200 newspapers with circulationsin the millions.

Zeno has since appeared on GoodMorning America, which has five million viewers. Zeno has also been onCNN and NBC and in the pages of PCMagazine and any number of otherpublications. Tens of thousands sawZeno at WIRED’s Nextfest — the WIREDmagazine technology fair. Zeno’s estimated exposure as of this writing ismore than 45 million Americans,according to Hanson.

Zeno has his own storyboard withother characters of Hanson’s design sohe’s ready to star in his own sci-fi filmproduction. Plans for Zeno includemass production at a retail price under$300 per unit. SV

GEERHEAD

Zeno is a 100 percent artificial telligence robot running from a PC. “ThePC sends motor control signals wirelesslyto Zeno, and Zeno sends sensor dataincluding streaming video wirelessly tothe PC,” says Dr. David Hanson. The PCprocesses the video data comprising he faces of people around Zeno and the audio data from people talkingaround him.

Zeno can do everything that pastHanson robots can do and more.Previous efforts include the Philip K. Dickandroid — a technological portrait of thefamous author — which won theAmerican Association for ArtificialIntelligence first place award in 2005.

“Our current Character Engine ismuch more powerful than the Philip K.

Dick android software or the softwarerunning our Jules, Joey, and Einsteinrobots,” says Dr. Hanson.

Hanson’s robots are fullyautonomous, interactive robots thatrelate in a human-like manner. They makeeye contact, recognize people, and holdconversations.

“When the $250 Zeno is available in2009, it will perform most of these functions even without a PC, using anembedded version of our CharacterEngine. With the wireless connection tothe PC, though, it will be even smarter,and with the extended AI on our serverbank, across the network, little Zeno willbe one of the smartest robots in theworld, almost frighteningly smart,” Dr.Hanson says.

ALL AI, ALL THE TIME!

Hanson Roboticswww.hansonrobotics.com

Working with Zeno livewww.youtube.com/watch?v=

q88FK37Q8jU

Other Hanson robotshttp://youtube.com/results?search_query=hanson+robots&search=Search

RoboGaragewww.robo-garage.com/english/

index.html

RESOURCES Is Zeno portraying a sense ofwonder, of curiosity?

Zeno face close-up, side view.

Geerhead.qxd 11/30/2007 11:30 AM Page 12

Full Page.qxd 12/5/2007 3:08 PM Page 13

14 SERVO 01.2008

Q. It is my understanding thatthe HSR-8498HB servos thatare used in the RoboNova

humanoid robot have position feed-back capabilities, so I bought a coupleof them from Tower Hobbies. I havebeen trying for several days now to figure out how to get position datafrom these servos. From what I haveseen on the Internet, all I have to do issend the servo a 50 μs pulse, and it willreturn a position signal that is similar tothe regular pulse width to move theservo. I am missing something here,can you help me?

— Pete Senganni

A. Last November, I showedhow position feedback for theHSR-8498HB servo (see Figure 1)

can be measured by sending a 50μs pulse and then measuring thepulse width of the signal that isreturned from the servo on the samesignal line. Since this was on the samedata line, a pullup resistor was neededon the signal line.

At that time, I was planningon talking about the HMI SerialCommunication Protocol and howto interface it with a microcontroller.I had all sorts of problems trying toget this to work, which is probablywhy there is almost no informationto be found on the Internet on howto do this. So this month, I will talkabout the problems I had trying toget this to work, and to get all of theHSR servos from Hitec (www.hitecrcd.com) to work with a computer and

a microcontroller.Table 1 shows

a list of several

different specifications for the roboticservos that are currently available atHitec. These servos are programmableand provide data feedback, such astheir current position, voltage draw,and current draw. Each servo can beassigned an ID number and they canbe daisy-changed together; up to 128different servos can be controlled witha single data line.

Programming features includevelocity, start/stop, min/max positionlimits, center position, dead band, proportional and derivative gains, andforward/reverse direction control. Allof these features are available throughthe Hitec Multi-protocol Interface(HMI). The HMI protocol allows the servos to be controlled with traditionalposition control using the 1 to 2 mspulse width, position feedback usingthe pulse width method, and via serialdata communications which will be

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?

byPete Miles

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

[email protected]

Figure 1. HSR-8498HB demonstratingtwo reconfigurable housings.

Figure 2. HMI Servo Programmer user interface.

MrRoboto.qxd 11/30/2007 11:25 AM Page 14

discussed here.These four servos

currently cannot be pro-grammed with the HFP-10digital servo programmerthat is used to program theother digital servos fromHitec. These four servoscan only be programmedvia a PC computer or a microcontroller. The software for programmingthese servos is available fordownloading at the HitecRobotics website (www.robonova.com).

Go to the downloadssection, and the softwaresubsection. Download andinstall the program“HMI_Servo_Programer-V1.0.2.zip.” The currentversion of the software atthe time of this writing wasV1.0.2. The version num-ber may be different by thetime you download thesoftware, so the program title might bea little different. Figure 2 shows animage of the software user interface.

To connect the PC to the servo, aspecial cable is needed. Hitec is planning on selling this cable within thenext few months, but you can buildyour own. Pressing the “Help” menuitem on the HMI Servo Programmerwindow will show you a schematicdrawing for the interface cable. I haveredrawn this schematic in Figure 3 andadded some details. Note pins 7 and 8are wired together.

Here is where my problems began.Before writing code to get a microcon-troller to control the servo, I needed toknow if I could control the servo withthe programmer. The reason for this isso that I could monitor the serial databack and forth between the servo andthe computer to help me understandhow to control the servo.

With this cable, I was never able toget the software to control the servo. Ithen tried using a RS-232 to TTL converter that was on the ParallaxProfessional Development Board(www.parallax.com), and I still couldn’t get it to work. For a long time,I thought it was the servo firmware

version on my HSR-8498 servos. Theones I had were version 1.08, and theprogrammer manual stated that itrequired firmware version 1.10.

After a while, it occurred to methat these servos were designed to

receive true RS-232 logic levels (i.e., alogic level 1 occurs with a zero or negative input voltage, and a logic level0 occurs with a high input positive voltage). The RS-232 to TTL voltageconverter that is used on the Parallax

SERVO 01.2008 15

1 2 3 54

76 8 9

3.3 KΩ

DB-9 FEMALE(WIRING SIDE)

+4.8 - 7.4 V (SERVO POWER)

1

SIGNAL

POWER

GROUND

SERVOCONNECTOR

DATA CARRIER DETECT (DCD)2 RECEIVE DATA (RD)3 TRANSMIT DATA (TD)

54

SIGNAL GROUND (SG)DATA TERMINAL READY (DTR)

RING INDICATOR (RI)9876

REQUEST TO SEND (RTS)CLEAR TO SEND (CTS)

DATA SET READY (DSR)

PIN RS-232 FUNCTIONS

Figure 3. Serial interface cable for the HMI Servo Programmer.

HSR-8498HB HSR-5498SG HSR-5980SG HSR-5990TG

Operating Voltage 4.8-7.4V 6.0-7.4V 6.0-7.4V 6.0-7.4V

No-load Speed@ 6.0V 0.20 sec/60° 0.22 sec/60° 0.17 sec/60° 0.17 sec/60°

No-load Speed@ 7.4V 0.18 sec/60° 0.19 sec/60° 0.14 sec/60° 0.14 sec/60°

Stall Torque(6.0V)

102.8 oz-in.(7.4 kg-cm)

152.8 oz-in.(11.0 kg-cm)

333.3 oz-in.(24.0 kg-cm)

333.3 oz-in.(24.0 kg-cm)

Stall Torque(7.4V)

125.0 oz-in.(9.0 kg-cm)

187.5 oz-in.(13.5 kg-cm)

416.6 oz-in.(30.0 kg-cm)

416.6 oz-in.(30.0 kg-cm)

Idle Current Draw(6.0 & 7.4V) 8 & 8 mA 8 & 10 mA 8 & 10 mA 8 & 10 mA

No-load CurrentDraw, running

(6.0 & 7.4V)200 & 240 mA 200 & 240 mA 300 & 380 mA 300 & 380 mA

Stall Current Draw(6.0 & 7.4V) 1.20 & 1.48 A 1.20 & 1.48 A 4.20 & 5.20 A 4.20 & 5.20 A

Pulse Range(~180°) 600-2350 μs 600-2400 μs 1100-1900 μs 1100-1900 μs

Centering Pulse 1500 μs 1500 μs 1500 μs 1500 μs

Dimensions 1.57” x .78” x 1.45”(40 x 20 x 37 mm)

1.57” x .78” x 1.45”(40 x 20 x 37 mm)

1.57” x .78” x 1.45”(40 x 20 x 37 mm)

1.57” x .78” x 1.45”(40 x 20 x 37 mm)

Weight 1.92 oz (54.7 g) 2.10 oz (59.8 g) 2.46 oz (70.0 g) 2.39 oz (68.0 g)

Table 1. Hitec robotic servo specifications.

MrRoboto.qxd 11/30/2007 11:25 AM Page 15

Professional Development board usesthe MAX232E chip. The MAX232Eactually inverts the signal, so that alogic level 1 on the output will have a+5V signal and logic level 0 will be at 0V. In essence, the servos werereceiving an inverted signal.

When I inverted the signal with a4011 NAND gate, the Servo

Programmer was now able to controland program the servo. Figure 4 showsthe circuit that I was able to use tocommunicate with the servos using theHMI Servo Programmer.

It took a long time to eventuallyfigure out why the original circuitshown in Figure 3 would not workwith my computer. It turns out that it

was my USB to RS-232 adapter. Thetechnical gurus at Hitec couldn’tunderstand why this wasn’t workingon my computer since they weresuccessfully using USB to RS-232adapters with their setups. For somereason, my adapter would not work.With my adapter, the 3.3K resistorcaused the signal line to always be

16 SERVO 01.2008

1 2 3 54

76 8 9

DB-9 FEMALE(WIRING SIDE)

+4.8 - 7.4 V (SERVO POWER)

1

SIGNAL

POWER

GROUND

SERVOCONNECTOR

DATA CARRIER DETECT (DCD)2 RECEIVE DATA (RD)3 TRANSMIT DATA (TD)

54

SIGNAL GROUND (SG)DATA TERMINAL READY (DTR)

RING INDICATOR (RI)9876

REQUEST TO SEND (RTS)CLEAR TO SEND (CTS)

DATA SET READY (DSR)

PIN RS-232 FUNCTIONS

1

2

3

4

5

6

7

11

8

9

10

12

13

14

4011

+5 V

T1OUT R2OUT

R2IN

T2OUT

R1IN

T1IN

R1OUT

T2IN

C1+

C1-

Vcc

C2+

C2-

+V

-VGND

0.1 μF 0.1 μF

0.1 μF

0.1 μF

MA

X23

2E

+5 V

Figure 4. Alternate serial interface circuit for the HMI Servo Programmer.

HIG

HS

PE

EDM

ICR

OC

ON

TRO

LLER

VSS

I/O

VDD

4.7 KΩ

+5V

SIGNAL

GND4.8-7.4V

+4.8 - 7.4V SERVO POWER

HSR CLASS SERVO AND CABLE

SERVO

Figure 5. Wiring an HSR class servo to a microcontroller.

MrRoboto.qxd 11/30/2007 11:25 AM Page 16

at zero volts. But if I replaced the3.3K resistor with a simple wire (i.e.,pins 2 and 3 on the DB-9 connectorare connected/shorted together), Iwould get the proper signal and theservo responded to the HMI ServoProgrammer.

This little trick happens to workwith my computer and my oldgeneration USB adapter. I would notrecommend that anyone do thiswith a regular RS-232 signal since thepurpose of the resistor is to cut theregular ±15V signals from a properRS-232 line down to a safe levelthat will not damage the servo (i.e.,current limiting). If the circuit in Figure3 does not work with your computer,then I would recommend you usea circuit similar to the one shownin Figure 4.

At this point, you can use the HMIServo Programmer to test and programthe servo. The first thing you do isselect the COM port your serial cable isconnected to, and press the Connectbutton. If the program connects to theservo, you will get a message at thebottom of the user interface “ConnectOK! - HMI Servo Motor Ver- 110.” The110 means the servo has the 1.10firmware version.

It turns out that the programmerwill connect to servos that have theolder versions of the firmware, just notall of the features will work with theolder servos.

Once connected, select the servofrom the menu list, then press the“Read Servo” button. This will read allof the parameters that are currentlystored in the servo. Now you canchange the various parameters onthe servo based on what is availableon the HMI Servo Programmersoftware, such as setting a servo ID.Now, this program does not readin the current position, voltage, orcurrent draw from the servo, andcannot set specific user selectedproportional/derivative gains, or setthe speed of the software.

In the ZIP file that the HMI ServoProgrammer came from is a VisualBasic example program that will showyou how to change velocity and readposition, voltage, and current. The restof this discussion will be based on

using a microcontroller to control theservos via serial communications.

Figure 5 shows a simple schematicfor connecting one of the HSR class ofservos as identified in Table 1, to a highspeed microcontroller. The serial I/Oline is bi-directional, and the 4.7K resistor is required for this to work. The serial communication protocol isshown below. Note that the communi-cation protocol uses two stop bits.

19200 BaudTwo stop bits

No Parity

The serial communication proto-col transmits seven bytes of data. Fivebytes are transmitted to the servo,and the servo transmits two bytes ofdata back to the microcontroller.Figure 6 illustrates the data stream.The header is one byte and always0x80 (128 decimal). The checksum isthe 256 minus the sum of the first four bytes of data transmitted tothe servo.

The key to getting a microcon-troller to work with these servos isthe timing between the CHECKSUMbyte transmitted to the servo and thefirst RETURN1 byte received from theservo. The servo will start transmittingthe data almost immediately afterthe last stop bit from the CHECKSUMbyte. Thus, the microcontrollerneeds to be able to change the datasignal line state from an output toan input and start looking for thestart bit of the RETURN1 byte. Ifthe microcontroller takes too long tomake this change, the servo will eithernot return the two bytes of data ortiming will be off and the data willbe corrupted.

When it is time for the servo totransmit the data to the microcon-troller, it may not transmit any data ifthe microcontroller hasn’t changed thesignal line to an input. This is why ahigh speed microcontroller is needed.

My testing has indicated that thefive bytes of data sent to the servocan be successfully transmitted usingonly one stop bit instead of the specified two stop bits with no timingproblem. And receiving the two databytes from the servo using one stopbit also works since the microcon-troller will wait until it gets the firststart bit for each byte of data. Theadvantage of sending and receivingthe data to and from the servo usingone stop bit instead of two stop bitswill give the microcontroller a smallamount of time to change the state ofthe signal line from an output to aninput. And it gives the microcontrollersome time to start the serial inputprocess to receive the data. At 19200baud, each data bit takes 52 ms totransmit. Thus, the microcontrollerhas only 52 ms to transition fromtransmitting data to receiving data.Also, since the data line is connectedto a pullup resistor, the microcon-troller must pull the data line lowbefore the first byte of data is trans-mitted to the servo, and immediatelyafter the CHECKSUM byte of data istransmitted to the servo. This needsto be done so the start bits can be properly distinguished from the normally pulled high signal line.

I was not able to get any of theBASIC Stamps (www.parallax.com)or the Basic Atom28 (www.basicmicro.com) to bi-directionally commu-nicate with the servos. I was able toget the SX28 microcontroller to workwith the servos when I used a 20 MHzresonator. The 52 ms time limit toswitch from serial output to serial inputmay be the limiting factor for thechoice of microcontroller used withthese servos.

Table 2 shows a list of the differentcommands that works with the HSRservos with firmware version 1.10. Forthe most part, the commands 0x(#ID),0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,0xEB, 0xEF, and 0xF6 are the ones used

COMMAND PARAM1 PARAM2 RETURN2CHECKSUM RETURN1HEADER0x80 BYTE BYTE BYTEBYTE BYTE BYTE

CHECKSUM = (256 - (0x80 + COMMAND + PARAM1 + PARAM2) MOD 256)

Figure 6. Serial communication data package.

SERVO 01.2008 17

MrRoboto.qxd 11/30/2007 11:26 AM Page 17

to control the servos and obtain feedback information.

One of the first things that youshould do to test to see if you have bi-directional serial communicationsestablished with the servo is to readthe servo firmware and ID numberusing command 0xE7. To do this, sendthe following five bytes of data to theservo: 0x80, 0xE7, 0x00, 0x00, 0x99.You should receive the following twobytes of data back: 0x6E and 0x00. Thedecimal equivalent of 0x6E is 110which is firmware version 1.10. 0x00 isthe default servo ID number. Unless ithas been previously changed, it shouldbe zero.

To command a servo to move to aspecific target position, the servo IDnumber serves as the move command.The target position is in milliseconds,much like the regular pulse width commands. Since the position range istypically between 600 and 2,400 ms, itis always greater than 256 ms, thus thetarget position becomes a 16 bit word.This needs to be broken down into two separate bytes of data to be transmitted to the servo. The following

two equations show how to break thetarget position down into the twobytes of data:

High_Byte = INT(Target_Position/256)

Low_Byte = (Target_Position) MOD 256

For example, to tell the servo tomove to the 1,500 ms neutral position,the following set of data is sent to theservo: 0x80, 0x00, 0x05, 0xDC, 0x9F.The 0x80 is the header, 0x00 is theservo ID number, 0x05 and 0xDC arethe high and low bytes of the 1,500 mstarget position, and the 0x9F is theChecksum. Once this command is sent,the servo will immediately begin tomove to that position.

To change the speed of the servo,the 0xE9 command is used. The firstparameter sent to the servo is the servoID number, and the second parameteris the speed. The speed commandappears to be more like a percentagebetween 0 and 100%. The servo’sspeed doesn’t get any faster for num-bers greater than 100. This commandwill also return the current position of

the servo. Again, the position is brokendown into two bytes of data that canbe recombined into a single value withthe following formula:

Position = (High_Byte * 256) +Low_Byte

The HSR servos can be daisy-chained together so that one serialdata communication line can be usedto control all of the servos connectedto that line. If the servos are wired thisway, then the above two commands(setting the position, velocity, and position feedback) are the only commands that will address a specificservo, by its ID number. The rest of thecommands address all of the servos atthe same time.

Thus, if you want to address all ofthe features of the servos, they willneed to be individually wired to themicrocontroller. This is true for servofirmware version 1.10. New firmwareversions may change this.

Another command for setting theservo’s target position is 0xE6. If theservo’s motion has been stopped using

18 SERVO 01.2008

Command Param1 Param2 Return1 Return2 Description

ID Position High_Byte Position Low_Byte 0x00 0x00 Position command for servo #ID

0xE1 Address 0x00 Data 0x03 Read EEPROM

0xE2 Address 0x00 0x03 0x03 Write EEPROM

0xE3 Address 0x00 Data 0x03 Read memory

0xE4 Address 0x00 0x03 0x03 Write memory

0xE5 0x00 0x00 Position High_Byte Position Low_Byte Read position

0xE6 Position High_Byte Position Low_Byte 0x00 0x00 Position command

0xE7 0x00 0x00 Version ID Read firmware versionand servo #ID

0xE8 0x00 0x00 Current Voltage Read current draw and voltage

0xE9 ID Speed Position High_Byte Position Low_Byte Set the speed of servo #IDand read position

0xEA 0x00 1, 2, or 3 0x03 0x06 Select servo performancegroup number

0xEB 0x00 0 or 1 0x03 0x06 Stop or restart servo motion

0xEF 0x00 0x00 0x03 0x06 Release servo from serial control

0xF6 Position High_Byte Position Low_Byte 0x33 or 0x63 0xFB or 0xFF Position command for all servos

ID (Servo ID number) Valid Range: 0x00 to 0x7F, Default: 0x00

Table 2. Servo command set.

MrRoboto.qxd 11/30/2007 11:26 AM Page 18

the 0xEB command, the target positioncan be changed, and when the servohas been re-enabled it will move to thenew target position. Command 0xF6will also do this.

Command 0xE5 will read the current position of the servo in a similar manner as command 0xE9. Thedifference here is that any servo’s position can be read with the 0xE5command and the 0xE9 commandreads the position of a specific servo ID number.

Command 0xE8 will read the current draw and the voltage draw of aservo. The value ranges from 0 to 255.When the servo is unloaded and notmoving, the current draw value is typically 0 and the voltage value is 127.When I try to force the servo horn tomove by hand, the current draw valueincreases and the voltage valuedecreases. I don’t have any informationabout correlating these values to actual current draw and voltage draw.At the very least, this information can be used to help determine optimalreaction load performance and todetermine if the servos are being overloaded.

Command 0xEA can be used tochange the proportional and derivativegains for the servo to make theirmotion “softer” or “stiffer.” I have notpersonally experimented with thesenumbers, but I have heard that changing them could make the servosrespond faster to sudden directionchanges, and it could help reduceservo jitter under certain loaded conditions.

An interesting command is 0xEB,the servo Stop/Start command. Whenthe servo is commanded to stop(Param2 = 0), the servo will stop moving where it is. The rotor will belocked like it was commanded to moveto this position, and will not let youforcibly change it. What is interesting isthat once the servo is stopped, its current position can be read, the velocity can be changed, the currentdraw can be read, and other parameters can be changed.

When the servo is restarted(Param2 = 1), the servo will movefrom where it is currently located toits new commanded position. This

command can be easily demonstrat-ed when the servo velocity is set tonear zero, and commanding theservo to move from one extreme toanother. Shortly after the servo hasstarted to move, you command theservo to stop, then change the endposition or servo speed, then restartthe servo, and you will notice that itwill move to the new position at thenew velocity.

The last motion command is 0xEF.This command will stop all motion control of the servo. Unlike the 0xEBcommand which locks the servo position, the 0xEF command will allowthe servo to be moved by hand. Servopositions can still be read after the execution of this command. This feature enables the ability to manuallymove servos to specific positions, andthen records these locations so thatthey can be played back later. This is a feature that will simplify the programming efforts for animatronicand walking robot routines.

In addition to the basic motioncommands described previously, theservos can be reprogrammed with amicrocontroller. The key is to knowwhich memory locations contain whichparameter. This is where the 0xE1,0xE2, 0xE3, and 0xE4 commands comein handy. These commands can beused to read and write to differentmemory and EEPROM locations.

Unfortunately, the memory locations/addresses and their functions are not published. But hasthis ever stopped anyone from gettingthe information they wanted? With

the help of a serial port monitor (I liketo use the Free Serial Port Monitor program from www.serial-port-monitor.com) and the HMI ServoProgrammer, I was able to determineseveral of the EEPROM addresses forseveral different parameters. Withthese two software packages, I canmonitor the data transmitted to andfrom the servo, determine whichmemory locations/addresses arechanged, and how they are changedwhen I change a parameter in the HMIServo Programmer software package.

For example, I was able to determine that the servo ID is stored atthe EEPROM address 0x29. This can beread using the 0xE1 command, and anew value can be used to change theID number using the 0xE2 command.By making a set of systematic changesin the HMI Servo Programmer, I wasable to determine that every singlechange to the EEPROM also changedthe EEPROM address of 0x2C.

The value at 0x2C always seems tochange by the same numerical value asI changed the other values. This givesan indication that this memory locationis some sort of a Checksum. The best Ican tell from monitoring the data usingthe servo reset function (covered next)is that the checksum is computed usingthe same method for individual com-mand packets. Thus, the checksum isequal to 256 minus the mod 256 of thesum of all of the bytes written to EEPROM addresses from 0x00 to 0x2B (Param2 using the 0xE2 command or read by Return1 using the0xE1 command).

SERVO 01.2008 19

Header Command Param1 Param2 Checksum Return1 Return2

0x80 0xE1 0x29 0x00 0x76 0x00 0x03

0x80 0xE1 0x2C 0x00 0x73 0xB3 0x03

tmp = 0x0A - 0x00 = 0x0A (tmp = 10 - 0 = 10)checksum = 0xB3 - tmp = 0xB3 - 0x0A = 0xA3 (checksum = 179 - 10 = 169)

Table 3

Header Command Param1 Param2 Checksum Return1 Return2

0x80 0xE2 0x29 0x0A 0x6B 0x03 0x03

0x80 0xE2 0x2C 0xA3 0xCF 0x03 0x03

Table 4

MrRoboto.qxd 11/30/2007 11:26 AM Page 19

To make a change to an individualparameter, read both of the valuesstored at the checksum and theparameter EEPROM locations.Calculate the difference between thenew parameter value minus the oldparameter value, then subtract thisvalue from the checksum value. Writethese two new values to the EEPROM.Remember, if the checksum valuebecomes negative, it needs to roll overto 255 again.

For example, if I wanted to changethe Servo ID from its default value of0x00 to 0x0A (10 decimal), then I canwrite a program to read the two EEPROM locations as shown here usingthe 0xE1 command. (Note the valuesshown are from the HSR-5980SGservo). Then I make the overall checksum change calculation, alsoshown in Table 3.

These two new values are thenprogrammed back to the sameEEPROM addresses using the 0xE2command as shown. Remember,the checksum value calculated above

is the overall EEPROM checksumvalue, which is sent as Param2, and isnot the same checksum value that iscomputed for each command packetsent to the servo as described earlier(see Table 4).

In order for these parameterchanges to take effect, the servo mustbe powered down and restarted. Ifthere was an error in calculating thechecksum, the servo will still work butthe motor will be disabled until theproblem is corrected.

If for some reason the servo stopsfunctioning properly due to program-ming problems, the HMI ServoProgrammer software has a servo resetfeature that will reset the servo back tothe factory defaults. All you need to dois start the program, select the servotype, and select “Servo Reset” underthe File menu item. Then press the Yesbutton, and the servo will be reset backto its original condition.

At this point, you should have allthe information needed to controlthese servos using serial communica-

tions. By monitoring the data beingtransmitted between the servo and thecomputer (using a program like theFree-Serial-Port-Monitor), the specificparameters and their functions can bedetermined. This information can thenbe modified to change your servo performance characteristics.

At some point, someone will takethe time and, using the steps present-ed here, compile a complete list of allof the parameters and their functionsfor the different HSR servos and publish them to make our lives easier.

At 19200 baud, it will take about 4ms of time to send the seven byte datapackage. This takes about twice aslong to command a servo than usingthe traditional pulse width method. Butthe command only needs to be sentonce, the 20 ms servo update is nolonger needed, velocity is now a control parameter, and with the feedback information from the servos,true closed loop positional and velocitycontrol of these servos can easily be achieved. SV

20 SERVO 01.2008

MrRoboto.qxd 11/30/2007 11:26 AM Page 20

Know of any robot competitions I’ve missed? Is yourlocal school or robot group planning a contest? Send anemail to [email protected] and tell me about it. Be sure toinclude the date and location of your contest. If you have awebsite with contest info, send along the URL as well, so wecan tell everyone else about it.

For last-minute updates and changes, you can alwaysfind the most recent version of the Robot Competition FAQat Robots.net: http://robots.net/rcfaq.html

— R. Steven Rainwater

JJaannuuaarr yy 220000888-10 Singapore Robotic Games

Singapore Science Center, Republic of SingaporeA plethora of events including Micromouse,autonomous Sumo, RC Sumo, robot soccer, wallclimbing, pole balancing, underwater robots,legged robot marathon, legged robot obstaclerace, and a robot colony contest.http://guppy.mpe.nus.edu/sg/srg

25-27 TechFestIndian Institute of Technology, Bombay, IndiaLots of events for autonomous and remote controlled robots including standard Micromouseand several events unique to TechFest: Pixel, acontest for vision-equipped bipeds; Full Throttle:Grand Prix, remote-controlled, internal combustionpowered cars race on a concrete track; Vertigo, aremote-controlled robot and an autonomousrobot must work together to move blocks around;Prison Break, remote-controlled robot mustclimb out of a pit and survive a fall to escaperobot-jail; U-571, an obstacle avoidance contestfor underwater robots.http://techfest.org/competitions/department

FFeebbrruuaarr yy24-28 APEC Micromouse Contest

Austin Convention Center, Austin, TXAmazingly fast little autonomous robot crittersrace to solve a maze in this competition. If

you’ve never seen one of these events, go seethis one. You won’t believe how fast thesethings are.www.apec-conf.org

MMaarrcchh15-16 Manitoba Robot Games

Tec Voc High School, Winnipeg, Manitoba, CanadaIncluded in this competition are a mix of eventsfor autonomous and remote-controlled robotsincluding Japanese style mini-Sumo, Western styleSumo, a robot Mini-Tractor Pull, Super Scramble,line following, and the Robo-Critters contestfor kids.www.scmb.mb.ca

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

SERVO 01.2008 21

Events.qxd 12/5/2007 11:07 AM Page 21

EZPZ23-HR1 Piezo Motor ServoController + Driver

The EZ Piezo Servo fromAllMotion is designed

to allow the rapid implementation of positioncontrol using the NanomotionHR1-1-S3 or similar motor.

The fully intelligent controllers,measure just 2.25 “ x 2.25“. The Nanomotion HR1 motor,nine pin DSUB connector plugs directly into the controller.A single four wire bus, containing two power wires andtwo communications wires, links up to 16 such piezomotor controllers in a daisy chain. Commands can beissued from any serial terminal program (such asHyperTerminal) or from the EZ Servo/Stepper Windowsapplication.

The commands are intuitive and simple. For example,the command A10000 will move the servo motor to theabsolute position 10000. (This communications protocol is compatible with devices that use the Cavro DT or OEM protocol.)

The EZ Servo is also capable of stand-alone operationwith no connection to a PC. It can be set to execute a preset string of commands upon power-up (i.e., onlypower is required in this mode). The commands includenested loops and execution halt pending a switch closure,which is useful in stand-alone applications.

Using AllMotion Starter Kits, a first-time user is able tomake the HR1 piezo motor servo in less than half an hour.Features include:

• Single four wire bus linking up to 16 stepper/servo motors.

• HR1 motor plugs directly into the driver controller.• 12V 2A supply voltage.• RS-232, RS-485, or USB based communications.• Four quadrant operation.• On-board EEPROM for user program storage.• Stand-alone operation with no connection to a PC.• Execution Halt/Branch pending switch closure.• Pre-wired for OptoSwitch inputs.• Position velocity and torque modes.• Industry standard communications protocol.• Homes to an opto or encoder index with a single command.

• Fully programmable ramps and speeds.• Quadrature encoder based feedback for position mode.• Velocity mode possible with only Hall sensors for

feedback.• Switch selectable device address.• Software selectable max currents.• 4 MHz max encoder frequency.• Two one amp on/off drivers included.• Optional step and direction mode; 4 MHz step frequency.• Four ADC inputs; Halt/Branch on ADC value.

For further information, please contact:

TReX Jr Dual-MotorController

Pololu introducesits new TReX Jr

Dual-Motor Controller, aversatile DC motor controllersuited for mixed autonomous andradio control of small- and medium-sized robots. Three independent interfaces are offered:radio control (RC) servo pulse interface, analog voltage,and asynchronous serial. The serial interface can switchinstantly with one of the other two interfaces, allowingmixed autonomous and remote control. For example, arobot could be configured to run autonomously most ofthe time, but a human operator could override theautonomous function if the robot gets stuck or into a dangerous situation. If the serial mode is selected as theprimary interface, high-resolution measurements of all fiveRC inputs are made available to the autonomous robotcontroller, allowing for complex and unlimited mixing ofoperator control and sensor input.

The TReX Jr motor controller operates from 5 to 24 V,and the two primary outputs provide bi-directional controlwith peak currents of 5 A and continuous currents of 2.5A while a unidirectional auxiliary output delivers over 10 A(continuous). A fourth control channel for invertible robotsallows improved control if the robot does get turnedupside-down, and the fifth control channel determineswhich interface controls the motors. The unit measuresapproximately 1.75” x 1.75” x 0.5”, and it is available fullyassembled or in kit form.

New Products

MOTOR CONTROLLER

510•471•4000 Fax: 510•471•4003Email: [email protected]

Website: www.allmotion.com

AllMotion

NNEEWW PPRROODDUUCCTTSS

22 SERVO 01.2008

JAN08NewProd.qxd 12/5/2007 11:10 AM Page 22

For further information, pleasecontact:

Advanced Featuresfor Robot RemoteControl

InRob Ltd. a leader in advancedwireless control systems for

unmanned ground vehicles (UGV),has announced advanced and innovative features for its remotecontrol units for military robots and UGVs.

These features include:

• Secure, clear, and uninterruptedwireless transmissions in most operating environments.

• Intuitive touch screen for moreefficient operations in the field.

• Graphic screen display showingcritical data of the robot, includingfuel level, engine RPM, status oftools in action, such as cameras, etc.

• Networking technology withoption for a single operator tosimultaneously control and coordi-nate multiple robots.

• Advanced safety features forweapon platforms. This feature is particularly important for law enforcement and HomelandSecurity use, where the robots maybe used near crowds.

For further information, pleasecontact:

REMOTE CONTROL

6000 S. Eastern Ave.Suite 12-D

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

Fax: 702•262•6894Email:

[email protected]:

www.pololu.com

PololuCorporation

ThePower SchmartModule™

will power up yourcircuits with your choiceof -9, -12, +2.5, +3.3,+5, +9, and +12 volts.

$15Very Schmart!

www.schmartboard.com

$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 01.2008 23

Web: www.inrobtech.comInRob Ltd.

JAN08NewProd.qxd 12/5/2007 11:13 AM Page 23

Featured This Month:Technical Knowledge24 Crushers

by James Baker

Feature26 So You Think You’re Ready

for a Sponsor? by Chad New

Product Review27 Eagle Tree Systems Micro

Power V2 E-Logger andPower Panel LCD Displayby Don Hebert

ROBOT PROFILE – TopRanked Robot This Month:29 G.I.R. by Kevin Berry

Events30 Results and Upcoming

24 SERVO 01.2008

Many people think that theopposite of a robot with a

kinetic energy spinner is anarmored push-bot. I disagree. TheKE spinner puts energy into arotating mass as it spins up over aperiod of time. Once the energy isthere, delivering it is a very crudeaffair. Our friend Isaac Newtontells us that when this spinningweapon hits the opponent, theopponent hits back with equaland opposite force. The classic“immovable object” push-botmeeting our “unstoppable force”spinner, thus delivers equal energyto both machines.

Once impact occurs, it isout of the driver’s control as toexactly where on the opponentthe energy goes, and how muchenergy is used up. In my opinion,this makes spinners and armoredbots the same. Neither can besure of where impact occurs,neither decides how much energy

is imparted, and both suffer thesame violent, chaotic energytransfer.

An opposite to this would bea robot that can choose where onthe opponent it attacks, and cancontrol the amount of energy ittransfers to that chosen area over a period of time selected bythe driver. This perfectly describesthe crusher.

Physics

For pure destructive power,nothing can match the potentialof a crusher. Whether hydraulic orelectric motor based, it is possibleto generate huge forces. A superheavyweight could easily makeover 100 tons of crushing powerand put it onto a point, whichvery few robots — if any — wouldsurvive. The difficulty comes increating a chassis capable of taking such high forces over a

TECHNICALKN WLEDGE

● by James Baker

Crushers

CombatZone.qxd 12/3/2007 3:19 PM Page 24

SERVO 01.2008 25

usable range of motionwithin the weight limit; 100tons over one inch is easilypossible, but that is of nouse in combat. In all weightclasses, it is the robot chassis that sets the limitsfor crushers.

Return of theCrusher

The UK has a long love affairwith crushers. We have had manyheavyweight machines successfullyuse crushing weapons. The feather-weight class however, rarely sawthe type, as effective crushingweapons are heavy. Circumstancesin the UK at the moment are suchthat high kinetic energy spinnershave very few opportunities tofight. Combined with the extra 1.6kg now allowed in the featherweightclass, it has opened the floodgatesfor robots that could never affordweight for crushing weapons tomake their entrance. There areseveral crushers being built rightnow, and Dragons Claw is the firstof many.

Dragons Claw

Tony Booth, a good friend ofmine, decided to build a high powercrusher after winning an eBayauction for a Linak LA34 linearactuator. This particular item candeliver a reliable 10,000 newtonsof force at 24 volts, so it’s perfectfor featherweight combat robots.Tony did the right thing when designing an unfamiliar type of robot. He asked everyone he could foradvice, listened to theadvice, and used thatadvice when designingthe robot. It’s amazinghow many peoplerefuse to do this.

Based on a weldedaluminium chassis,Tony never underesti-mated the forces

involved in crushing your opponent.He conducted many tests with atemporary chassis and claw,before deciding on the currentconfiguration.

Supplying the actuator withthe (quite modest) current itneeds are two packs of 12V NiMHbatteries (in series giving 24V),through a simple servo-operatedDPDT switch and failsafe. Thesebatteries also supply the RobotPower Scorpion XL speed controllerwhich, in turn, runs the 18V drillmotor based drive system.

This mix of components isproving to be very effective. Therobot is fast, turns quickly, and(more importantly) rotates aroundits weapon due to having the driveright at the front. The electron-ics are small, light, and overspecification for their currentuse. Dragons Claw has beentested and proven itself to be avery effective combat robot. Ithas successfully pierced 10mm plastics, 2 mm titanium,and 6 mm aluminium, to name but a few examples. In fun events, it has provenitself capable of catching its

opponent and bringing the weapondown to pin or crush. (Catching theopponent was initially a concern asthe actuator has a speed of just 5mm per second.)

Dragons Claw is able to controlits opponent once it captures them.A light squeeze holds the opponentin place so it can be taken to arenahazards or for other robots to attack.Increasing the power to crush theopponent puts a full 1,000 kg intothe Hardox claw, and onto the targetrobot through an interchangeabletitanium tip. In testing this process,Tony bent the 10 mm steel pivotpins, so they are now 0.5 inchtitanium.

So, the robot is ready then? Not quite.

CAD of Dragons Claw.

CAD of claw mechanism.

Dragons Claw’s frame.

Prototype claw.

Making weightequals drilling holes.

CombatZone.qxd 12/3/2007 3:20 PM Page 25

26 SERVO 01.2008

So you think that you areready to get some sponsors,

do you? Have you typed outyour letter and arranged somenice pictures thinking that youare ready to rake in the sponsors?Think again; getting a sponsor,

keeping a sponsor, and mostimportantly making that sponsorhappy with you is much moreinvolved than an email and a fewnice shots!

In this article, I will giveyou some basic guidelines which

may help increase your chances forsuccessfully getting yourself asponsor. This will hopefully helpoffset the cost of this sport andalso give you equipment that maybe able to take your robots to thenext level.

Too Heavy

The curse of the crusher is that itneeds to be very strong. In this case,

it meant Dragons Claw was a littleoverweight and it had no armor yet!There are many ways this surplusweight could be removed. Lighterbatteries, smaller actuator, or expensive alloys being some options.The cheapest option is to drill holes, which is what Tony did. A fullkilogram (2.2 lb.) was lost by takingaluminium away, but you have to becareful not to weaken the chassis somuch that it cannot handle those bignumbers when you hit the “squashhim” button.

Thankfully at the same time Tony was drilling holes, the UK robot

combat governing body (theFighting Robot Association)was changing the rules. Theextra 1.6 kg now allowed,combined with the manyholes drilled, meant DragonsClaw was now underweight,and ready for its titaniumarmor. This was bolted inplace to nylon pillars, allowingflex and deformation. A beautiful paint job later and

Dragons Claw was ready to enter itsfirst competition. I have foughtagainst this robot with my fun-bots, and as you can see in thephotos, Dragons Claw is a seriouslycompetitive machine.

Robots are never finished. Theywill evolve and change to suit theenvironment and their predators orprey. This assisted evolution meansthat Dragons Claw may well havechanged again by the time you readthis article, so you can get updatesand further information about it onTony Booth’s website at www.teamdragon.org.uk. SV

SO YOU THINK YOU’REREADY FOR A SP NSOR?

● by Chad New

Weapon control.

Lifting works, too.

Paint matters!

Leverage also matters.

Finished Dragons Claw. Crushing the opponent.

CombatZone.qxd 12/3/2007 3:22 PM Page 26

SERVO 01.2008 27

The WhenAs a newbie robot builder, you

have a very low chance at landinghimself a sponsor. You are unproven,your name is not known, and chancesare that your robots are not yet up topar with your competition. It is not animpossible task, however, yourchances are much greater once yougain some experience. The appropri-ate time to seek sponsorship is whenyou can prove that you know whatyou are doing. Can you build a robot?Talk about it; tell a person what all theparts are, what they do, and howthey are going to work better nexttime. Have you been to several eventsand come home with a robot that youcan still drive, or better yet, a win?

If you can answer “yes” to thesequestions, then you might be able torealistically consider getting yourself asponsor. You have built up some cred-ibility that you must now project tothe companies which you would liketo attempt to gain sponsorship from.

The Why

Why would anybody sponsoryou? Companies will sponsor who iswilling to work for them. They arenot going to shower you with partsand money for free, no matter howgood your emails are. Companiesneed testers, feedback, good com-munication, pictures, and marketingtools. What they need is a personcommitted to help sell their product.When a new product comes out,

they need people that know whatthey are doing to test it and givethem feedback, telling them how itcan be made better and the weakpoints of the item. When setting upa booth, they need robots to displayand pictures for their website.Combat robots are great for market-ing! If Product X can take the abusefrom a combat robot, then inside anR/C car it should last forever! If youmake it clear that you are willing towork for your sponsorship and arenot just looking to be handed some-thing, then you have a chance.

The How

It all starts with one email or aphone call. First impressions are themost important, so you better make ita good one. If you are going to call,have a list of facts ready to talk about;list the points that you want to makeand most importantly how you canhelp them. If you choose to send anemail, make it short and to the point.You do not want the reader to loseinterest and shoot your mail to thetrash bin. Again, list the points thatyou really want to emphasize andwhat you have accomplished. Youmay also include some pictures ofyour robots. However, do not attach avideo because that may take a longtime to download. Also, don’t forgetto list what you can do for them!

Ready?

Take all of these tips and

combine them into one great emailor phone call. If you are able to scoresome free parts, make sure you putthem to good use! Do not take themand run. Give your sponsors updates,feedback, and check to see if theyneed your help with anything. With alittle effort and some luck, you toocan have parts for the cost of a littlecomputer work! SV

Iwas always very thorough aboutmonitoring current draw and amp

hours in my robots. Current and voltage tests can determine the

compatibility of a motor/batterycombination. Studying the results ledme to my favorite voltage/amphour/motor combination.

At first, an AstroFlight wattmeter would go for a ride, securedon top of the robot. Reading the display while the robot was moving

Quick Tips1) DO use spell check! You don’twant to sound incompetent.

2) Don’t say: “Hi, I would like to builda robot. Please give me parts.”

3) DO follow-up on your emails andcalls. Just a simple “hey, just checkingto see if you got my message” works fine.

4) Don’t send long random emailsthat have no point.

5) DO be polite, even if the answer isno. Next time they need a tester, theymight email you!

6) Don’t be a pest! Do not send people dozens of emails. That is anassured no!

7) DO be patient. Just because youdon’t get an immediate responsedoesn’t mean the answer is no.

8) Don’t give up. Work harder at it! Build better robots, take better pictures, and refine your sponsor-ship pitch.

PR DUCT REVIEWEagle Tree Systems Micro Power V2 E-Logger and

Power Panel LCD Display● by Don Hebert

CombatZone.qxd 12/3/2007 3:22 PM Page 27

28 SERVO 01.2008

was difficult. It would move too fast,so most of my measurements weredone with the wheels up or against awall, wheels spinning. Wheels-uptesting detected gearbox problemseffectively. Bad mechanical conditions showed higher that normal amps.

This worked okay for most of myneeds. But as my lifter got morepowerful, I found the need for fastermeasurement. Some events, like the1/2 second of the lift, were not visible in the display of the wattmeter. A data collection device withsufficient samples per second wasneeded. The Micro data logger fromEagle Tree Systems fit the bill.

The Micro Power E-Logger fromEagle Tree Systems (www.eagletreesystems.com) can measure±100 amps and 4.5–45 volts. It calculates amp hours and watts. All

this is recorded in memory forlater retrieval. Sampling rate is10 per second. Data retrieval isvia a supplied USB cable. ThePC software is also provided(see Figures 1 and 2).

Real-time amps, volts, watts, andamp hours can be displayed with theoptional Power Panel LCD. Think of itas a dashboard for the robot (seeFigure 3).

The entire combination is halfthe size of the Astro watt meter. Figure 4 shows installation ina 12 lb robot.

Preliminary setup prior to firstuse is required. The data logger hasmany add-on devices. What isinstalled — like the LCD display —must be declared for them to work.For my tests, the LCD was the onlyextra device. The current and voltagedetectors on the data logger arealways available.

The instructions for what data tocollect is also required. I displayedvolts, current, amp hours, andwattage. Volts and amps are directfrom the on-board sensors. Wattageis calculated from volts and amps.

Amp hours are calculatedfrom amps and time.

With the LCD panel,you may conduct realtime monitoring such as awheels-up test. You donot have to retrieve thecollected data. If thebuffer gets full data, collection simply stops.The real-time display ofdisplayed volts, current,amp hours, and wattagewill continue. (Just this is

pretty cool.) The unit is small and willfit anywhere. I usually use maskingtape to hold everything in place.

A new recording session is start-ed each time the logger is turned on.Plug it in to the battery circuit afterthe power switch. I find it helpful toscript the sequence of events aheadof time. Once the data is extracted,current draw will be your only indica-tion to tie the section of the trace tothe test event. A wheels-up test atfull power may be indistinguishablefrom full speed reversals on theground or from wheel spin againstthe wall. So noting which test wasdone first allows you to link the firstpeak in current draw with that test.

After the tests are done, turn offthe power. Remove the data loggerfrom the robot and bring it to your computer. Start the software.Connect to your PC with the providedUSB cable. The connection will power-up the data logger and connectionwill be established. We now have toexplicitly request data from the device.

Until the memory is full, you mayplug the logger again and again tocollect more data. Each power-on iseasily distinguished as a new sessionin the graph. For example, I couldsave five separate test sessions in thedata logger before I had to clear dataand start over. I saved the data to thesame file name and each time I didanother test, all of the data from theprevious test was still in there. Noproblem! The saved file just got larg-er each time I saved to the hard drive(see the sample graph in Figure 5).

I encountered one problem afterclearing data memory and running afew more data collections. I retrieved

FIGURE 1. Micro Power Data Logger.

FIGURE 3. Power panel.

FIGURE 4. Installationin a robot. This is small!

FIGURE 2.Main screen.

CombatZone.qxd 12/3/2007 3:23 PM Page 28

SERVO 01.2008 29

the data and saved it to the previous-ly named file. I expected a concate-nation of the data already saved andthe new data just retrieved. But thenew data completely overwrote all ofthe previous data; the original datawas gone. This was a mistake on mypart, I now know better. But thereare no warnings that you are aboutto overwrite data.

There is a live mode that usesthe main screen of the PC as a real-time display. There are also additional sensor modules to monitorRPM and temperature.

In conclusion, I heartily endorsethis product. The MicroPower V2 E-Logger retails for $69.95, and thePower Panel LCD Display for $39.95.

It records data accurately and meetsmy needs. Even if you do not use the

data collection, it is still a handy little display. SV

ROBOT PR FILE● by Kevin Berry

FIGURE 5.Graph screen.

Contact the AuthorDon can be reached via email at

[email protected]

TOP RANKED ROBOT THIS MONTH

Historical Ranking: #1Weight Class: 6 lb "Mantis"Team: Chaos RoboticsBuilder: Dirk StonehouseLocation: Saskatoon, Saskatchewan, Canada

BotRank Data Total Fights Wins LossesLifetime History 16 14 2Current Record 13 11 2Events 6

G.I.R. — Currently Ranked #1

NewSection!

CombatZone.qxd 12/3/2007 3:24 PM Page 29

G.I.R. has competed in WBX II,WBX III, WBX IV, Kilobots IX,Kilobots X, and Kilobots XI. Moredetails are listed below:

• Frame: 1-1/2” x 3/4” aluminum channel, milled to reduce weightand welded

• Base plate: 1/16” Garolight

• Drive train: Four B62 gearhead motors

• Voltage: 14.8

• Wheels: 2 inch 1/10 scale pan car foam tires

• Configuration: Invertible box with

thresher and hinged titanium wedge

• Drive ESC: Two Traxxas EVX

• Drive batteries: Two 2.1 Ah, 7.4V Thunder Power lithium packs

• Weapon: 1-3/4” inch drum thresherwith six two-tooth blades driven atthe center with a dual “O” ring beltconfiguration

• Weapon battery: One 2.1 Ah, 7.4V Thunder Power lithium pack

• Weapon motor: 27 turn stock 540

• Weapon ESC: Tekin Titan

• Armor: Titanium in the front

• Future plans: Upgrade from the 540 weapon motor to a Hacker A30-10XL

Design Philosophy

“I designed G.I.R. to be a powerful pusher with the ability towithstand shell and bar spinners.Also, to inflict some damage withthe drum and be invertible. So far, ithas proven to be a fairly good designto be ranked #1.” SV

Photo and information are courtesy of Dirk Stonehouse. All fight statistics are courtesy of BotRank (www.botrank.com)as of November 13, 2007. Event attendancedata is courtesy of The Builder’s Database (www.buildersdb.com) as ofNovember 13, 2007.

30 SERVO 01.2008

Results from Oct. 14through Nov. 11, 2007

2007 Halloween Robot Terror waspresented by California Insect

Bots in Gilroy, CA on 10/27/2007.Go to www.calbugs.com for moreinformation. Results are as follows:

● 150 Gram Flea Weights — 1st:“Crisp,” Team Misfit, driven by OrionBeach; 2nd: “Atom Bomb,” TeamMisfit, driven by Daniel Chatterton.

● 1 Pound Ant Weights — 1st:“Baron Underbheit,” Team Misfit,driven by Kevin French; 2nd: “Pooky,” Team ICE, driven by DavidLiaw; 3rd: “Mash Potato,” Team ICE,

driven by Pui Shan Wong.

● 3 Pound Beetle Weights — 1st:“Unknown Avenger,” Team ICE, driven by David Liaw; 2nd: “Impact,”Team Target Practice, driven by DonHebert; 3rd: “Queen of Kings,” TeamMisfit, driven by Shannon Muha.

Franklin Institute Robot Conflictwas presented by North East

Robotics Club, Inc., in Philadelphia,PA on 10/20/2007. Go to www.nerc.us for more information.Results are as follows:

● Beetleweight (3 lb) — 1st: “Yeti,”Team Mad Scientist; 2nd: “Pure DeadBrilliant,” Team Rolling Thunder; 3rd:“Destructive Crab,” Team GreenMachines.

● Hobbyweight (12 lb) — 1st:

“Ntertainment,” Team Demolition;2nd: “Ingor,” Eater of Souls, Ministryof Bad Ideas; 3rd: “Not a VD,” TeamAnarchy Robotics.

● Featherweight (30 lb) — 1st: “BillyBob,” Robotic Hobbies; 2nd:“TriPolar,” Team Brain Damage; 3rd:“The Interloper,” Team Interloper.

● Sportsmans (30 lb) — 1st: “BountyHunter,” Team Hammertime; 2nd:“Upheaval,” Team Mad Scientist;3rd: “Mangi,” Team HFA.

HORD Fall 2007 was presented bythe Ohio

Robot Club inBrecksville, OHon 11/3/2007.Results are asfollows:

● Flea Weights — 1st: “Little Buzz,”Richard Kelley, Team Kelley; 2nd:“0–2,” Even Gandola, Team Probotics.

● Ants — 1st: “Dusty, the Evil Dust

EVENTSResults and Upcoming Events

CombatZone.qxd 12/3/2007 3:24 PM Page 30

Pan,” Jeff Gier, Team MechanicalAdvantage; 2nd: “Heman I,” EvanGandola, Team Probotics; 3rd:“Rumble,” Heman I, Evan Gandola,Team Probotics.

● Beetles — 1st: “D2,” David Timothy,Team D2; 2nd: “The Box,” RichardKelley, Team Kelley; 3rd: “Rumble,”Sweaver, Greg Shay, Team Fishneck.

Robots Live presented a show inLondon for the MCM Expo,

10/20-21/2007. Go to www.robotslive.co.uk for more information.

Mecha Mayhem 2007 was presented by Chicago Robotic

Combat Association in Rosemont, ILon 10/19-21/2007. Go to www.thecrca.org for more information.

Robowars Metro was presentedby RoboWars in Oakleigh, South

Victoria, Australia on 11/06/07. Goto http://robowars.org for moreinformation.

Upcoming Events forJanuary and February2008

WAR NW Model Hobby Expo2008 will be presented by

Western AlliedRobotics inSeattle, WA on2/9/2008. Go towww.westernalliedrobotics.com for more information.

The event will be held at theMonroe County Fairgrounds (nearSeattle; www.nwmodelhobbyexpo.com/Directions.html). Theevent will be held from 11:30am-6:00pm and safety inspection from9:00am-11:00am. If a lot of robotsregister, they may start safety andfights earlier. Class: 1, 3, 12, and 30*pound robots (30 lb spinning-weapons not allowed). Format:Double Elimination or Round Robin(RFL Rules), no ICE or open flames.Entry Fee: $40 for first 30 lb or 12 lbrobot. $25 for first 3 lb or 1 lb robot.Additional robots are half price.Special entry fee considerations forbuilders who are under 18. Arena:12 x 12 with 18” x 18” pit in one corner surrounded by a 2” high wall making it very difficult to accidentally drive into it.

Motorama 2008 will be present-ed by North East Robotics

Club, Inc., in Harrisburg, PA, from2/15-17/2008. Go to www.nerc.usfor more information.

This will be a 150 g to 30 lb combat event. Fairies and Ants fightin 8’ box on Friday; Beetles throughFeatherweights fight in 16 x 16 boxon Saturday and Sunday. All complet-ed forms and entry fees must bereceived by 1/2/07. This is going tobe another awesome event at theFarm Show Complex!

Robots Live will present an eventat the Hermitage Leisure Centre,

Whitwick, Leicestershire on 2/2-3/2008. Go to www.robotslive.co.uk for more information.

For the first event of the year,Robots Live heads back to their hometown of Whitwick in Leicestershire.Not only is this their hometown but also their birthday! Come andcelebrate two years of Robots Live!

Robowars has tentatively sched-uled their national title event in

Oakleigh, South Victoria, Australiaon 1/12-13/2008. Go to http://robowars.org for more information. SV

Tormach PCNC 1100 Features:Table size 34" x 9.5"

R8 Spindle 1.5 hp variable speed to 4500 RPM

Computer controlled spindle speed and direction

Precision ground ballscrews

Digitizing and tool sensing support

4th axis and high speed spindle options

3 Axis Mill

$6800plus shipping

When you’re serious about hardware, you need serious tools. Whether milling 0.020” traces on prototype PCBs or cutting ½” steel battle armor, this CNC mill can do it all. Weighing in at more than 1100 lbs, the PCNC can deliver the hardware end of your combined hardware & software projects.

Precision CNC Machining

Mill includes Control, CAD and CAM software. Optional stand, coolant system, computer and accessories are extra.

Product information and online ordering at www.tormach.com

SERVO 01.2008 31

CombatZone.qxd 12/3/2007 3:25 PM Page 31

32 SERVO 01.2008

Because I get to put together allkinds of neat stuff. And, whenI’m done playing with my new

garage-brewed toys, I get to showthem to you and tell you all aboutthem. So, get your soldering irons hot and stuff your face into that illumi-nated desktop magnifier. We are going to build an intelligent stepper motorcontroller from scratch that is based onthe Allegro MicroSystems A3979.

So What??YIPEE. Another stepper controller.

NOT! This stepper controller is compactand when properly heatsinked, handlestwo ampere motor loads. The AllegroA3979 is an upgraded version of thevenerable A3977. All of the easy to use

motor control knobs and dials youwere used to on the A3977 are alsopresent on the A3979 DMOS driver.We can even use the same externalcomponents in an A3979 design thatwe would use in an A3977 design. Thebig difference in the two DMOS driversis the addition of 16th stepping capability to the A3979. If you thinkyou’re about to read about a rehashedversion of the A3977 circuits you canget from various Internet points, sitdown, shut up, and read on.

Getting SmallIf you have ever worked with the

A3977, you probably used the 44-pinPLCC version of the part. The PLCC is bigand relatively easy to put down on a

printed circuit board (PCB). You can’tget the A3979 in a 44-pin PLCC package; it only comes in a 28-pinTSSOP package. Instead of dissipatingheat though pins as the PLCC-packagedA3977 does, the A3979 has an exposedheatsink pad on its belly. A woodpeckerwould see that pad on the underside ofthe A3979 in the perspective of Photo 1.

The A3979 can be crammed into a very tiny space if you’re not driving stepper motors the size ofwatermelons. The only design pointthat increases the size of the A3979

by Fred Eady

The SuperSTEPPER DRIVER

PHOTO 1. Don’t think that you can’t access thisheatsink pad without special soldering equipment.A few holes in the printed circuit board under thebelly of the A3979 provides access.

PHOTO 2. This was a challenging build as Ihad to be extra careful not to short theSMT 0805 components on the groundplane extensions under some of the SMTparts. A fine tipped soldering iron and anilluminated magnifier are must-have toolsfor this project.

Eady.qxd 12/4/2007 3:42 PM Page 32

PCB is heatsinking. Thus, as you can see in Photo 2,I’ve gone all out on the heatsinking of the A3979 bylaying out a ground/heatsink plane onto the entiretop side of the A3979 stepper driver PCB.

To keep things simple, I also spread out all of theA3979’s supporting components in my design. If youtrash the serial port and squeeze the PIC18F2620 intowards the A3979, you can push this stepperdriver/controller into a very small form factor.

Let’s Get StartedThe very first thing we must do is design and lay

out a suitable PCB to support the A3979 and its subor-dinate components. I want you to be able to build thisstepper controller in your shop. I used ExpressPCB andtheir tool suite for the PCB fabrication. To make parts-gathering easier for you, I’ve sourced all of the A3979motor driver board’s components from Mouser andDigi-Key. The A3979 motor driver board ExpressPCB layoutsans ground plane can be seen in Screenshot 1.

In that the A3979 has a built-in translator, the computingsupport requirements are low. Let’s stop here and define“translator.” Without a built-in translator, we would have towrite every little bit of code required to interpret commandinputs and convert them to motor movements. That includeswriting code to correctly phase and drive the A3979’s H-bridges. We would also find ourselves constructing phase

tables for use in the microstepping process. The phase tableswould be used to modulate a PWM signal that is fed into aDAC (Digital-to-Analog Converter). The DAC would generatevoltage levels relative to the modulated PWM signal. (Trustme. We want to use a translator if at all possible.) Thus, atranslator is — in this context — a combined package of special-ized hardware and firmware that resides in the A3979 silicon.

The purpose of the translator is to convert incoming motorcommands into motor actions or A3979 control actions. A

REFPFD

RS-232 CONNECTOR

OUT1B

OU

T2B

OUT1A

OU

T2A

TXDRXD

HOME

DIR

MS2

MS1

SLEEP

STEP

RESET

RXIN

TXOUT

RX

RXIN

TXOUT

TX

VBB

+5VDC

+5VDC

+5VDC

+5VDC

+5VDC

+5VDC

+5VDC

+

C7220uF

C16.1uF

C14

.1uF

C10

.22uF

R5

.2

C17.1uF

C8

.1uF

U1

A3979SLP

7 21 44

1

23

4

5689

10

11

1312

14

152816

17

18

19

20

22 23 24

25

26

27

AGN

DPG

ND

GN

D

SENSE1

HOMEDIR

OUT1A

PFDRC1REFRC2

VDD

OUT2A

MS1MS2

SENSE2

VBB2

VBB1

SR

RESET

OUT2B

STEP

VREGVCP

CP1

CP2

OUT1B

ENAB

LE

SLEEP

C2

.001uF

C15

.1uF

R150K

R910K

U3

ST3232

138

1011

1

34

5

26

129

147

15

16R1INR2IN

T2INT1IN

C1+

C1-C2+

C2-

V+V-

R1OUTR2OUT

T1OUTT2OUT

VSS

VDD

C18.1uF

R250K

OPTIONAL

ACTIVITY LED

OPTIONAL330

ICSP CONNECTOR

123

456

123

456

R7100

C13

.1uF

+

C4 10uF

+

C6 220uF

U2

PIC18F2620

2345

212223242526

27

28

1112131415161718

109

1

67

819

20

RA0RA1RA2RA3

RB0RB1RB2RB3RB4RB5

RB6/PGC

RB7/PGD

RC0RC1/CCP2RC2/CCP1

RC3RC4RC5

RC6/TXRC7/RX

OSC2/RA6OSC1/RA7

MCLR

RA4/T0CKIRA5

GNDGND

VDD

C19

.047uF

BIPOLAR STEPPER MOTOR

C12 .22uF

C3

.001uF

C22

.33uF

R8 1K

C20

.33uF

C21

.33uF

R330K

C11 .22uF

C5

.1uF

C9

.1uF

DB9 FEMALE

12

34

56

78

9

12

34

56

78

9

R430K

C1.1uF

R6

.2

SCREENSHOT 1. This is art. However, my wife won’t let me put anythinglike this up in a frame in the living room. It looks better on a computerdisplay, anyhow.

SCHEMATIC 1. The A3979’s translatoris fully serviced by the PIC18F2620 andthere are still plenty of spare I/O linesfor your use. I added an RS-232 port toallow you to control motor movementfrom a laptop or desktop PC.

SERVO 01.2008 33

Eady.qxd 12/4/2007 3:43 PM Page 33

34 SERVO 01.2008

motor action is the instigation of motor movement such asclockwise rotation, counter-clockwise rotation, and halting themotor. The A3979 command inputs STEP and DIRECTION areused to invoke motor action. A3979 control actions include putting the A3979 silicon to sleep, resetting the A3979’s inter-nal systems, or enabling or disabling the A3979’s internal H-bridges. Control actions are also spawned by A3979 commandinputs, which are logic levels applied to the translator commandinput subsystem. The A3979 translator also provides some use-ful output in the form of a HOME signal. HOME is defined inA3979 terms as the initial state of the translator. The translatorwill put the step sequence in the HOME position at power-up.

Picking up on the idea that the A3979 doesn’t need anIBM mainframe to operate efficiently, all we really need tocontrol the stepper motor by way of the A3979 is a smallmicrocontroller, such as the PIC18F2620. The PIC18F2620hookup details can be seen in Schematic 1. As you can see, it has more than enough I/O to support the A3979. Theability of the PIC to clock itself internally leaves two more I/Olines (RA6-RA7) at our disposal.

There are only eight A3979 translator I/O lines we needto deal with. The A3979 ENABLE line is optional here and isput into a permanent enabled state. That leaves us with onlyseven translator lines to tie to the PIC. Since the plan is tocover the top side of the A3979 PCB with a ground plane, allof the communication lines between the PIC and the A3979are routed on the bottom side of the A3979 PCB. Note alsothat the translator I/O lines are routed as far away from thepower circuitry as possible.

The largest current carrying trace needs to be 0.025 inches wide, which will transfer two amperes. As you can seein Screenshot 1, that is a tall order in terms of the A3979 pins.So, we do the best we can and attach the widest trace possi-ble as close as possible to the A3979 motor output pins. It isimportant to keep the thin traces as short as possible to keepthe trace resistance to a minimum. Once we have attached atrace to the A3979 motor driver pins, we can increase the copper area to accommodate the higher currents we mayencounter at the A3979 motor output terminations. I usedlarge copper planes instead of traces on the bottom side of thePCB to connect the A3979’s motor output pins to the four-pinmotor terminal block. Copper planes are one of my favorite fea-tures of the ExpressPCB printed circuit board layout program.

The final critical design point is to place the current senseresistors as close to the A3979’s current sense pins as possible.We also need to consider routing the current sense resistors’ground return paths. The ground return paths to the A3979from the current sense resistors need to be electrically unhin-dered. I placed the current sense resistors as close as possibleto their respective A3979 current sense pins and used the vastness of the ground plane as the sense resistors’ groundreturn path. The A3979 datasheet says to provide a separateground path for each sense resistor. However, from experienceI’ve found the ground plane method to have no adverseeffects on the operation of the A3979 H-bridge circuitry.

Again, I could have saved some board space by installing fixed resistor voltage dividers for the PFD and REF

potentiometers. Having the pots here allows you to adjustthe symmetry of the stepper motor current waveform (PFD)and select the amount of current you want to supply to thestepper motor (REF) with the twist of a screwdriver.

No project of mine would be complete without an RS-232port and a standard issue Microchip ICSP programming/debugging portal. Note that I’ve used the ST3232 in a five-voltconfiguration in this project. The ST3232 can be used in 3.0volt and 5.0 volt environments by simply changing the chargecapacitor values. Normally, 0.1 μF charge capacitors would besurrounding the ST3232 in a 3.3 volt project. As you can seein Schematic 1, the 0.1 μF charge capacitors are replaced with0.33 μF charge capacitors and a 0.047 μF charge capacitorbetween the ST3232’s pins 1 and 3.

I used a reflow oven to reflow-solder the A3979 motordriver board’s SMT components. If you don’t have access toa reflow oven, you can assemble the A3979 board with a finetipped soldering iron. If the reflow process intrigues you, youmay want to investigate the Stencils Unlimited site(www.stencilsunlimited.com). There you will find all kindsof SMT soldering aids. The A3979’s pins are fine and requirea stencil setup for reflow soldering. Because I want you to beable to build the A3979 motor driver board without havingto procure specialized tools, I didn’t go the stencil route thistime and used my Metcal soldering system to manually connect the A3979 pins to the PCB.

The Metcal (www.metcal.com) soldering system is aquick heating precision solder station. If you don’t haveaccess to hot air soldering equipment, you’ll need to addsome holes to your PCB layout under the belly of your A3979.The additional holes will allow you to flow solder throughfrom the bottom of the board onto the A3979’s exposedheatsink pad, which must be thermally connected to theground plane. I’ve included the A3979 motor driver boardExpressPCB file in the SERVO A3979 project download package at www.servomagazine.com so you can use it as a base for your custom A3979 project. The A3979ExpressPCB file will reveal the presence of the ground planepassing underneath the A3979 providing a soldering pointfor the A3979’s exposed heatsink pad.

Coding the A3979 MotorDriver Firmware

Everything depends on the PIC18F2620 clock. At power-up, the PIC will default to a 1 MHz internal RC clock as wehave specified that it use its internal clocking subsystem.Ultimately, we want to run the PIC at its maximum clockspeed of 32 MHz. To do this, we must first load the OSCCONregister with 0x70. This will change the PIC’s internal clockspeed to 8 MHz. Then, we enable the 4x PLL to boost theclock speed to 32 MHz. This is done by writing a 1 to thePLLEN bit. Once the clocking has been taken care of, we canassign the PIC’s port I/O to input or output according to theport pin’s required usage. For the PIC18F2620, a 1 identifiesan I/O pin as an input while a 0 is used to define an I/O pinas an output. Here’s the clock and port I/O TRIS code:

Eady.qxd 12/4/2007 3:43 PM Page 34

//*******************************************************//* INITIALIZE CLOCK AND IO PORTS//*******************************************************OSCCON = 0x70; //run at 8MHz

PLLEN = 1; //enable 4x PLLTRISA = 0b01010111;TRISB = 0b11111111;TRISC = 0b10001010;

For now, we won’t be employing the services of the PIC‘s analog-to-digital converter (ADC) subsystem. So, we’ll justturn it off. If you want to use the ADC in your version of thisproject, you can do so as portions of the PIC18F2620’sPORTA and PORTB I/O subsystem can become ADC inputs.Since we’re not using the ADC, here’s the ADC “OFF” code:

//*******************************************************//* CONFIGURE A2D AND COMPARATORS//*******************************************************ADCON1 = 0b00001111; //all port I/O is digitalADON = 0; //ADC offCMCON = 0x07; //comparators off

The ADC OFF code also turns off the PIC18F2620 comparators with a write to the CMCON register.

The PIC is endowed with a multitude of timers/counters.So, why not use them? I’ve coded up timer routines forTIMER1 and TIMER3. Each of the aforementioned timers willtrigger an interrupt every millisecond. I’ve set up TIMER1 asa general-purpose timer that can resolve milliseconds, seconds, and minutes. TIMER3 leans towards being a real-time clock and if you add an LED to RA7, TIMER3 willdrive the LED at one blink per second. The timer setup codeis pretty simple and looks like this for TIMER1:

//************************************************//* CONFIGURE AND START TIMER1//* SET TO OVERFLOW EVERY 1mS//************************************************

TIMER1OFF;T1CON = 0b00000000;TMR1H = 0xE0;TMR1L = 0xC1;TIMER1ON;

And, like this for TIMER3:

//************************************************//* CONFIGURE AND START TIMER3//* SET TO OVERFLOW EVERY 1mS//************************************************

ihours3 = 12;imins3 = 0;isecs3 = 0;imsecs3 = 0;T3CON = 0x00;TMR3H = 0xE0;TMR3L = 0xC1;TMR3ON = 1;

Screenshot 3 is a CleverScope capture of theTIMER3 1 ms clock driving I/O pin RA7. In the TIMER3interrupt code, I count 1,000 of these to mark seconds,which clocks the RA7 LED if it is present in your design.

I’ve provided the full code package for the A3979 motordriver board via the SERVO website. If you’re interested in theway the timers interact during an interrupt, you can perusethe download package source code to study the timer interrupt service routines in detail.

The final steps of the A3979 motor driver board initialization process include activating the interrupts and setting up the stepper motor:

//*******************************************************//* CONFIGURE EXTERNAL INTERRUPTS//*******************************************************

enable_TMR1int;enable_TMR3int;enable_GLOBALint;

//*******************************************************//* INITIALIZE STEPPER MOTOR DRIVER HARDWARE//*******************************************************

quarter_step; //quarter-step modestep_HALT; //stop the motorrst_step = 0; //reset the A3979mdelay1(100); //delay 100mSrst_step = 1; //bring A3979 out of resetslp_step = 1; //put A3979 to sleepstep_HALT; //make sure motor is stopped

The millisecond delay routine (mdelay1()) is actually a Cmacro and its source code can also be found in the downloadcode package. The same can be said of the interrupt enablemacros. There are a couple of additional macros (quarter_stepand step_HALT) in the stepper motor initialization code thatneed to be defined for you at this time. Check this set ofA3979 translator input definitions against Schematic 1:

#define rst_step LATC5#define slp_step LATC4#define dir_step LATC0#define ms1 LATA3#define ms2 LATA5

Let’s see, there’s a RESET translator input, a SLEEP trans-lator input, a DIRection translator input, and the step resolu-tion selection (ms1-ms2) translator inputs. Now you can go

SCREENSHOT 2. To get this shot, I simply toggled the RA7 line every timea TIMER3 interrupt occurred. Using the 1 mS interrupt clock as a timebase, I can count the 1 mS pulses to create timings for seconds, minutes,hours, and days.

SERVO 01.2008 35

Eady.qxd 12/4/2007 3:43 PM Page 35

36 SERVO 01.2008

back to the stepper motor initialization code and resolve theusage of rst_step and slp_step. However, you still don’t haveenough information to decipher quarter_step. In fact, youcan’t decrypt any of the ms1 or ms2 logic combinations untilyou fix your eyes on the following truth table macro code:

#define full_step ms1 = 0; \ms2 = 0;

#define half_step ms1 = 1; \ms2 = 0;

#define quarter_step ms1 = 0; \ms2 = 1;

#define sixteenth_step ms1 = 1; \ms2 = 1;

The step resolution definitions you’ve just seen are actuallyC macros, which assign logic levels to the ms1-ms2 translatorinputs. The macro quarter_step should make sense to you now.If you’re still a bit foggy on the concepts, I suggest getting a copyof the A3979 datasheet and referencing it as you study thesource code I’m presenting. The A3979 logic is very simple and Iguarantee that if you relate what you’re reading here to whatyou see in the A3979 datasheet, it will all come together for you.

We could write some bit-bang code to feed the A3979translator’s STEP input. However, why do that when we canconjure up a set of never-ending step pulses from thePIC18F2620’s PWM generator? And, using the PIC18F2620’sPWM is easier than writing step code. The first step in gettinga string of step pulses out to the A3979 involves setting upyet another one of the PIC18F2620’s timers for PWM duty:

//*******************************************************//* CONFIGURE PWM//*******************************************************//decrease CCPR1L to shorten step pulse width

TIMER2OFF;CCP1CON = 0x1F;CCPR1L = 50;T2CON = 0x07;PR2 = 180;TIMER2ON;

The values I have loaded into the TIMER2 and PWM registers worked fine to spin my LIN Engineering (www.linengineering.com) 5718 series stepper motor. You may haveto juggle the PR2 and CCPR1L values for your particular motor.The A3979 will accept step pulses as narrow as 1 μs. Iobtained a 1.6 μs step pulse like the one you see in Screenshot3 by loading CCP1CON with 0x1F and CCPR1L with 0x00.CCPR1L and the two least significant bits of CCP1CON’s uppernibble hold the 10-bit PWM duty cycle value. I obtained the1.6 μs step pulse with the PWM duty cycle binary value of0b0000000001. The PWM duty value you see in the codeexample translates to binary 0b0101000001. The lower nibbleof CCP1CON is used to enable or disable the PIC18F2620’sPWM engine as shown in the code snippet that follows:

#define pwm_ON CCP1CON = 0x3F#define pwm_OFF CCP1CON = 0x00

#define step_CW slp_step = 1; \dir_step = CW; \mdelay1(10); \pwm_ON;

#define step_CCW slp_step = 1; \dir_step = CCW; \mdelay1(10); \pwm_ON;

#define step_HALT slp_step = 0; \pwm_OFF

If you need to use all 10 bits of PWM resolution, you’ll needto alter the two least significant bits of the upper nibble of thedefault 0x3F value I’ve posted in my example code. I’ve alsogiven the A3979 ten times (10 ms) more wakeup-from-sleeptime (mdelay1(10)) than the 1 ms the datasheet demands.

The A3979 download code package also contains an inter-rupt driven EUSART driver for the PIC18F2620. A menu systemis incorporated that will allow you to connect the A3979 motordriver board to a laptop or desktop PC and control the move-ment of the stepper motor. We don’t have the page space hereto talk about the EUSART driver in detail. However, I describethe EUSART driver down to the bit level in the RS-232 chapter

in my book Networking and Internetworking withMicrocontrollers. The neat thing about the EUSARTdriver is that you can easily drop it into any PIC appli-cation that needs robust RS-232 communications.

Firing Up the A3979 MotorDriver Board

It is important that you don’t adjust the REF potto get a voltage above four volts on the REF pin. So,before you fire up your A3979 motor driver board,be sure to adjust the REF pot’s wiper to be nearer tothe grounded pot pin. It’s a good idea to simply center both of the pots as they will produce around2.5 volts on the PFD and REF pins upon power-up.

Once you’ve powered up successfully, adjustthe REF pot to put 1.6 volts on the REF pin. This willlimit the stepper motor current to one ampere. The

SCREENSHOT 3. This shot was taken with my CleverScope. This is as tight apulse as I could get with the circuitry we are using.

Eady.qxd 12/4/2007 3:44 PM Page 36

stepper motor current formula to determine the REF voltagefor a desired stepper motor current limit value is:

REF voltage = 1.6 * Maximum Current Limit Value

The A3979 is rated to handle a maximum motor currentof 2.5 amperes. Plugging that into our formula gives us:

REF voltage = 1.6 * 2.5 = 4 volts

Now you know why you don’t want to exceed four voltsat the A3979’s REF pin.

You can experiment with the PFD pot setting as the voltage on the PFD pin determines the symmetry of the motorcurrent waveform. Ideally, you want your motor current waveform to look like the sinusoidal motor current waveformsin the A3979 datasheet. A trick I’ve picked up is to listen to themotor as you adjust the PFD pot. If the motor sounds like it’strying to kill itself, your motor current waveform is not right.Adjust the PFD pot to get the smoothest and quietest soundfrom your motor at the desired REF voltage. Plug this code intoyour main service loop to adjust the PFD and REF voltages:

void main(void){//*******************************************************//* INITIALIZE//*******************************************************

init();//*******************************************************//* MAIN SERVICE LOOP//*******************************************************

do{step_HALT;sdelay1(2);step_CW;sdelay1(2);step_HALT;sdelay1(2);step_CCW;sdelay1(2);

}while(1);}

The adjustment code will spin the motor in a clockwisedirection for two seconds, stop the motor for two seconds,and spin the motor in the opposite direction for two seconds.This sequence of events will go on until you remove power orreprogram the PIC18F2620.

Spinning OutThat’s all there is to it. I’ll include a BOM (Bill of

Materials) file with the A3979 firmware download soyou can scrounge up the parts you’ll need to buildyour own A3979 motor driver board. Who knows, theA3979 just may be the answer you’ve been looking forto complete those small robotic motor control jobs. Asalways, if you have any questions about the A3979 orthe A3979 motor driver board, fire off an email to me.Have fun! SV

SERVO 01.2008 37

For further reading,check out this book,

available on theSERVO website:

www.servomagazine.com

$67.95

Allegro MicroSystemswww.allegromicro.com

A3977 and A3979

Microchipwww.microchip.com

PIC18F2620

STMicroelectronicswww.stmicro.com

ST3232

Saelig Corporationwww.saelig.com

CleverScope

The A3979 motor driver board code was written with the HI-TECH PICC-18 C compiler.

Resources

Fred Eady can be reached via email at [email protected].

Contact the Author

Eady.qxd 12/4/2007 3:45 PM Page 37

My particular application — aswe discuss here — is in filteringinput data used to calibrate

the odometer in a road rally computer.After computing a best-fit line using alinear regression on a set of datapoints, square roots are needed tocompute the distance of each datapoint from the line. If a data point istoo far off the line, it is discarded onthe assumption of human error and theline is recalculated.

Square Root on a PIC in theNovember ‘06 issue of Nuts & Volts(www.nutsvolts.com) demonstrateda simple algorithm for computingsquare roots. While the implementa-tion was very compact, the algorithmhas a significant performance issue — itgets extremely slow as the argument tothe square root function gets large.This is because the algorithm sequen-tially computes each square starting at 1 until it finds the one closest to the argument.

Let’s look at an alternative methodof computing square roots. It has theadvantage of taking nearly constanttime, regardless of argument — about150 microseconds for a 32-bit input ona 20 MHz PIC18. This makes it practicalto compute square roots in a robotcontrol loop running 100 times per second, for example. Code size is

about 35% larger, but still well under200 bytes.

√ AlgorithmThis algorithm for computing

square roots determines one result bitat a time, in a manner very similar tobinary long division. Infact, it is so similarthat a review of longdivision — decimal andbinary — will be help-ful to set the stage.

Figure 1 shows asample long divisionproblem. The basicsteps for each digitare:

• Make a guess of the digit.• Multiply the trial digit by the divisor.• Try to subtract that product from the

current remainder.– If the product is larger than theremainder, make a new guess witha smaller digit.– If the subtraction produces aresult larger than the divisor, makea new guess with a larger digit.

In the case of Figure 1, the guessfor the first digit (estimated from 62÷8)initially turned out to be too large. The

first trial digit and product are crossedout and a new set was tried.

The description for binary long division is the same, but the only twochoices for the trial digit are 0 and 1.This makes it very easy to make the rightguess, and also very easy to computethe trial * divisorproduct that is tobe subtracted fromthe remainder.Figure 2 shows a sample binarydivision problem.

By definitionof square root, ifthe divisor equalsthe quotient, thenwe have thesquare root of thedividend. The algorithm for square roottakes the form of binary division wherethe divisor is continually changed tomatch the quotient.

The square root of an N-bit number has N/2 bits; in our example,we’ll be taking the four-bit square rootof an eight-bit number. From our binary division viewpoint, we’ll be looking for the square root of the dividend. We start with a divisor at themidpoint of the possible result range: a1 followed by N/2 – one zero; in ourcase, a 1 followed by three zeros.

Square roots have a number of possibleapplications in microcontroller systems ...Square roots have a number of possibleapplications in microcontroller systems ...

38 SERVO 01.2008

√ by Tim Paterson

679

897)625186279

-53828698

-8073625

11011001)1111001

-10011100

-10010110

-00001101

-1001100Figure 1.

Decimal longdivision

example.

Figure 2. Binarylong division

example.

Paterson.qxd 12/4/2007 2:42 PM Page 38

The first halfof Figure 3 showsan example withthe first bit calcu-lated. Notice inthe figure howwe don’t know

the divisor yet, so I’ve substituted “xxx.”The binary division procedure requiresmultiplying the guess by the divisor, so“0” is used for each “x” for now.

The second half of Figure 3 showsthe partially-completed calculation ofthe second bit. We make a guess of 1,multiply the trial bit by the divisor(which is 11xx now to stay equal to ourquotient), and subtract from theremainder. We must also account forwhat we should have subtracted whenwe computed the previous bit. Backthen, we only subtracted 1000. Nowwe have a divisor of 11xx, so we shouldhave subtracted 1100 before. I’ve putthis make-up value to be subtracted onan additional line. Because we’re shift-ed right one bit, it’s written as 1000,but you can follow the “1” bit up thecolumn and see it’s in the right place.

So at this point, we have two valuesto subtract — 1100 and 1000 — whosebinary total is 10100. This total amountto subtract is larger than our currentremainder of 1110, so we must con-clude the trial was too big — instead of1, it must be 0.

The first halfof Figure 4 showsthe second bit setback to 0, andthe calculation ofthe third bit.Everything isdone the same:We subtract theproduct of thetrial bit and thedivisor, and alsoinclude a lineto subtract the

value of the trial bit had it been setback when we computed the first bit.This time, the total of the two values tosubtract (1010 and 1000) is 10010,while the current remainder is 11100.The remainder is big enough, so thetrial bit is correct.

The second half of Figure 4 showsthe calculation of the final bit. Notehow that extra value we subtract (tocorrect for previously subtracting thewrong value) has more “1” bits in it.Each of the 1 bits corresponds to a subtraction for a previous quotient bitwhere we didn’t subtract the bit we’reworking on now. So, for each 1 bit inthe quotient (not counting the trial bit),there will be a corresponding 1 bit inthe extra value to subtract to accountfor not subtracting it originally.

Once more: For each 1 bit in thequotient, there will be a 1 bit in theextra value to subtract. This is the sameas saying the extra value to subtractequals the quotient (and divisor) before

setting our trial bit. So, we subtract thedivisor with the trial bit, and we subtractthe divisor without the trial bit. Addingthat up, we subtract 2 * divisor + trial.

That’s it. Since the divisor and quotient are always equal, I’m going tostart calling them the root. To calculateeach bit of the root, try to subtract twotimes the root plus the trial bit from thecurrent remainder. If it fits, the trial bitis part of the root; if not, that bit is zero.

√ ProgrammingSquare RootsListing 1 represents this algorithm

as a function in C. You don’t need toknow C to understand it if you look inthe sidebar for the explanation of theoperators. This algorithm also includesthe extra step of rounding the resultbased on whether the next bit wouldbe 0 or 1. This function has been compiled and tested for both Windowsand the AVR microcontroller.

SERVO 01.2008 39

101101x)01111001

-10001110

-000011100

- 1010- 1000

1010

10111011)01111001

-10001110

-000011100

- 1010- 1000

10101- 1011- 1010

Figure 4. Thirdand fourth bits ofsquare root being

calculated.

11xxx)01111001

-1000111

1111xx)01111001

-10001110

-1100-1000

Figure 3. First andsecond bits ofsquare root arebeing calculated.

typedef unsigned long UINT;#define INT_BITS ((sizeof(UINT)) * 8)

UINT SquareRoot(UINT arg){

UINT trial;UINT root;

trial = 1 << (INT_BITS - 1); // set up 100000... binaryroot = 0; // Inside loop, really root * 2

do{

trial >>= 1; // move trial to next position in rootroot |= trial; // combine trial bit into root

if (arg < root) // does trial root bit fit?root ^= trial; // no, remove trial bit

else{

arg -= root; // root fits, remove it from argroot += trial; // double the trial bit

}

root >>= 1; // move both root & trial to nexttrial >>= 1; // position within arg

} while (trial != 0);

// Compute rounding// See if next bit computed would be 1; round up if so.if (arg > root)

root++;

return root;}

LISTING 1. Fast square root algorithm in C.

Paterson.qxd 12/4/2007 2:45 PM Page 39

The function starts by initializingthe variable trial which contains thecurrent trial bit. The function isdesigned to be easily targeted for 16-bit or for 32-bit integers (or anyother size), which explains the some-what complicated-looking expressionthat initializes trial. I’ll assume we’reusing 32-bit integers, in which case trialgets initialized to 0x80000000 — a 1 inthe MSB and the rest 0. Note that thefirst thing that happens inside the loopis that trial is shifted right one bit, sothe first trial bit value is 0x40000000.

In the main loop, the variablenamed root actually keeps the value oftwo times the current root. Combiningtrial into root gives us the amount tosubtract from the current remainder(called arg) if it fits. If it doesn’t fit, theexclusive-OR operation is used to clearthe trial bit in root. If it does fit, we needto double the trial bit so that, as part ofthe new root, it will be root times two.

At the bottom of the loop, rootand trial are each shifted right one bit.This moves them to the next bit position for which we’ll be computingthe root. Looking back at Figure 4, youcan see how the subtraction for eachbit is shifted right compared to the previous bit. Conveniently, when it’stime to end the loop, this right shift of

I have never seen any description ofthis algorithm published before. I don’tmean that it’s original with me — in fact, Ibelieve this algorithm is widely used infloating-point hardware. I became awareof the algorithm many years ago whenreading about a particular computerarchitecture that included hardwaresquare root.

I have an old Pentium manual thatlists the time to perform a floating-pointdivide as 39 clock cycles, and the time toperform square root as 70 clock cycles –less than twice as long. The only way thatcould be happening is if the floating-point unit implements this algorithm inhardware.

For a processor that has hardwaredivide but no hardware square root, themost common way to compute squareroot is with Newton-Raphson iteration.This algorithm is very simple:

1) Make a guess at the root.

2) Divide the guess into the argument.3) Average the quotient with the guess tomake the next guess.

This method converges very fast;every iteration doubles the number ofdigits (or bits) of accuracy. The trick isto come up with a good initial guess. This is difficult for integer or fixed-point arithmetic, where it may take oneiteration to get one bit correct. Then thesubsequent iterations give you 2, 4, 8,and 16 bits of accuracy — typically fivetotal iterations for a 16-bit root of a 32-bitnumber.

When using floating point arithmetic,it’s easy to get an accurate initial guessbecause of the “normalized” format ofthe numbers. With an eight-bit multiplyand addition, you can come up with aguess accurate to almost five bits. Thenonly three iterations are needed toachieve single-precision accuracy.

I used this technique when I wrote

the x87 emulator for Microsoft in 1991.This program provided floating-pointarithmetic back in the days before it wasbuilt into every processor; it hasn’t beenneeded since the 486SX. It is still widelydistributed, included as WIN87EM.DLLwith every 32-bit operating systemMicrosoft has shipped.

While researching for this article, Ifound another square root algorithm on the Microchip website posted inApplication Note TB040 for PICs thathave hardware multiply. The generalidea is to set a trial bit in the root,square the root, and see if it was toobig. The algorithm calculates the resultbit by bit, with one square (multiply)operation per bit. According to theapp note, with a 32-bit input thismethod would take 200 microsecondsat 20 MHz, and the code size appearedto be over 200 bytes. So it is bothbigger and slower than the algorithm Ipresent.

Square Root Algorithms

40 SERVO 01.2008

SquareRoot:clrf32 root ; root = 0clrf16 trial ; trial = 0x80000000clrf trial+2 ; "movlw 0x80 ; "movwf trial+3 ; "bcf STATUS,C; Clear C flag for following rotate

RootBit:rrf32 trial ; trial >>= 1ior32 root,trial ; root != trialcmp32 root,arg; if (arg < root) - C flag set if arg < rootbnc RootFits; "

; Didn't fit, remove trial bitxor32 root,trial ; root ^= trialbra ShiftRight

RootFits:sub32 arg,root; arg -= rootadd32 root,trial ; root += trial

ShiftRight:bcf STATUS,C; Clear C flag for following rotaterrf32 root ; root >>= 1 - Always leaves C flag clearrrf32 trial ; trial >>= 1bnc RootBit ; if trial bit shifted out, we're done

#if ROUND; Compute rounding. Note that root always fits in 16 bits here,; but it could round up to 17 bits.

movf arg+2,f ; see if bits 17-23 are non-zerobnz IncResult ; if non-zero, arg is big, always > rootcmp16 arg,root; if (arg > root) - C flag set if root < argbnc Done ; "

IncResult:inc24 root ; root++

Done:#endif ;ROUND

retlw 0

LISTING 2. PIC version of fast square root,built on macros for 32-bit operations.

Paterson.qxd 12/4/2007 2:45 PM Page 40

root is effectively the divide-by-two neededto convert the root * 2 that has actuallybeen in root to the true root value.

I hand-compiled this function into PICassembly language, partially shown in Listing2. Following the lead of the previous article onsquare roots, I used macros extensively toencapsulate the 32-bit operations. For example, the ior32 macro actually requireseight instructions to perform a logical-OR ontwo 32-bit operands. This approach allows youto see the close relationship between the C andassembler versions of the program without getting caught up in the details of 32-bit arith-metic. The complete program listing with themacro definitions can be downloaded from theSERVO website (www.servomagazine.com).

There is one optimization worth noting that is possible inassembly language but not in C. In C, the loop exits when thebit in trial has been shifted out and trial is now zero. Inassembler, we can use the fact that the trial bit was shiftedout into the carry flag. This saves us from testing the fourbytes of trial to see if they’re all zero.

In the PIC version, I have put the rounding code in a conditional block marked with #if ROUND. I wanted to makeclear the optional nature of this section so it could be omitted if not appropriate for a given application. It addsvery little execution time because it is out of the main loop,but it does add almost 20% more code. It also has the effectof allowing the result to exceed 16 bits, rounding it to0x10000 if the input is big enough, so this must be taken intoconsideration if a purely 16-bit result is expected.

Another option you’ll find in the full source code listing isto choose to assemble the program for the PIC16 or for thePIC18. This doesn’t show up in Listing 2 because it only affectsthe macros. The PIC18 code is typically around 20% faster.

√ Performance ResultsI compared the performance of this square root routine

with the original one described in the November ‘06 issue. Inboth cases, I used PIC18-optimized code. I switched off therounding code in my routine since the original didn’t round. Iused the Microchip MPLAB simulator with its stopwatch func-tion to compute execution time, assuming a 20 MHz clock.

The execution time of my program ranges from 136 to159 microseconds, for an average of about 150 microsec-onds. The variation is due to the different code paths insidethe main loop on whether the trial bit fits or not. Code sizeis 134 bytes (22 bytes more when rounding is included).

The performance of the original square root program istotally dependent on the size of the argument. With an inputof 500, it takes 155 microseconds; about the same as myprogram. For smaller arguments, it would be faster — as littleas 12 microseconds — for an argument of 1. At the otherend, it can take as long as 445 milliseconds (close to a 1/2second!). Code size is 100 bytes.

I also compiled the C version of my routine for the AVRusing the free WinAVR compiler package. Assuming a 16MHz clock, execution ranged from 34 to 37 microseconds.Code size was 108 bytes.

In conclusion, this algorithm makes computing squareroots entirely practical in microcontroller-based robotic projects, even in moderately fast service loops. No otherapproach comes close to the performance and code size ofthis algorithm. SV

Here is an explanation of the operators used in Listing 1:

1 << (INT_BITS - 1) With INT_BITS set to 32, this shifts a “1” bit left 31 bits, producing the value 0x80000000.

trial >>= 1 Shift trial right one bit.

root |= trial root = root OR trial (logical OR).

root ^= trial root = root XOR trial (exclusive OR). Reverses the effect of root |= trial, clearing the trial bit from root.

arg -= root arg = arg - root

root += trial root = root + trial

root++ root = root + 1

C Operators

SERVO 01.2008 41

Paterson.qxd 12/6/2007 12:57 PM Page 41

42 SERVO 01.2008

EM-406A

The actual connections to theDios Workboard are shown in Figure2. The module comes with a smallconnector that is used to connect theEM-406 to an evaluation board. Weneed to modify this cable as shown inFigure 3 so that we can plug it into abreadboard or prototype board.

Figure 4 shows the actual pin-outon the connector from the EM-406

module’s point of view. I placed asmall piece of double-sided tapeon the module to hold it in placeon the breadboard as shown inFigure 5. I then made the followingconnections:

EM-406, Pin 1 (GND) – DiosPro VssEM-406, Pin 2 (VCC) – DiosPro Vcc(5V)EM-406, Pin 3 (TX) – DiosPro Port 8(UART RX)

by Michael Simpson

FIGURE 1.Positional datadecoded anddisplayed.

FIGURE 2

FIGURE 3

GPSPART 4

Simpson4.qxd 11/30/2007 11:32 AM Page 42

On the cable that I made, I tiedboth pin 1 and pin 5 together. At this point, you don’t need to connect the PPS or RX pins.

EM-406A Observations

Of all the modules tested, Ifound the EM-406 to be the mostsensitive and easiest to use. Iwas able to lock on to four orfive satellites in my basementworkshop. At times, even theWAAS receiver kicked in whenin the basement. In normaloperation outside, I found theEM-406 to be very accurateonce the WAAS receiver connected. The only downsidewas the lack of an externalantenna connector. There is noneed to send commands to setup the module, so only the TXlead is needed for the interface.I also liked the fact that themodule could be operated atfive volts. This makes theinterface to both the PC andmicrocontroller very easy.

Etek EB-85A

I covered the connectormodification in Part 2 of this series.Connect the pins on the connecter asshown in Figure 6. Unlike the EM-406,we need to connect the RX lead as we will need to send some setup commands to the EB-85.

Etek EB-85A Observations

The EB-85 operates with five voltsas well, so it is one of my favorites.While it does support more channelsthan the EM-406, I was only able tolock on to seven or eight satellites ata time so I did not see any advantageover the EM-406. The EB-85 doesneed some setup to turn off some ofthe messages that are not neededand to turn on the WAAS receiver.The EB-85 sports a much fasterdefault baud rate so more data canbe received in a shorter period of

time. This can be a double-edgedsword since you have to service theUART more often in order to keepfrom dropping data.

Holux GPSlim236

The GPSSlim236 micro-controller interface is sim-pler than one would think.The mini USB connectoron the unit is actually aTTL interface. With thisconnector, you can bothpower/charge the unit andpull data from the receiver. Ipurchased a $3 mini USBcable from www.cyberguys.com (part #131 0995)for the interface.

Cut off the largeconnector and strip the

leads. Attach the red and blackwires to a two-pin header and thegreen and white leads to a two-pinheader as shown in Figure 7. Theconnection to the Workboard isshown in Figure 8.

FIGURE 4 FIGURE 5

FIGURE 6

FIGURE 7

SERVO 01.2008 43

Simpson4.qxd 11/30/2007 11:33 AM Page 43

44 SERVO 01.2008

GPSlim236Observations

While I like this receiverfor its versatility, it does notsupport WAAS as indicatedby the manufacturer. Eventhe GPS Viewer supplied bythe manufacturer failed toturn on this feature. That beingsaid, I used the Bluetoothinterface with my pocket PCfor the last couple years withgreat success.

EM-408

The EM-408 modulerequires a bit more to interfaceto a microcontroller. Theactual connecter configurationwas shown in Part 1 of theseries, but since the moduleoperates at 3.3 volts, you willneed to add a 3.3V regulatoras shown in Figure 9. Sincethe module does not needto be set up in order tooperate, you can forgo theRX lead connection and thetwo resistors shown.

EM-408 Observations

Of the 3.3V units tested,I prefer the EM-408. In fact,if you decide to use a 3.3Vmicrocontroller, you may wantto use this module. The EM-408also supports an externalantenna, so it can be located ina different location than theelectronics.

Copernicus

Like the EM-408, the Copernicusmodule needs a 3.3 volt interface asshown in Figure 10. The Copernicusmodule I used came with a headerboard that will mount — with a bitof effort — on a breadboard asshown in Figure 11. Several of theleads on the module need to beconnected to VCC. The actual pinout

FIGURE 8

FIGURE 9

Program Name Description

DiosGPSEM406.txt For use with the EM-406A module

DiosGPSEtek.txt For use with the Etek EB-85A module

DiosGPSHolux.txt For use with the Holux GPSlim236 receiver

DiosGPSEM408.txt For use with the EM-408 module

DiosGPSCopernicus.txt For use with the Copernicus module

TABLE 1

Simpson4.qxd 11/30/2007 11:33 AM Page 44

for the module is shown inFigure 12.

CopernicusObservations

The Copernicus moduledoes not have a built-inantenna so you must connect one. The headerscan make hookup easier.The main disadvantage ofusing this module is the lackof WAAS support. Unlikethe EM-408, the RX leadsand interface resistors mustbe used since you have toset up the module.

Software Interface

I have included five programs listed in Table 1.All the programs are identical except for the baud rate andthe use of a setup function for theEtek and Copernicus modules.

SERVO 01.2008 45

FIGURE 10

FIGURE 11

FIGURE 12

Variable Description

NEMAhour UTC Hours (Integer) 0-23

NEMAmin UTC Minutes (Integer) 0-59

NEMAsec UTC Seconds (Integer) 0-59

NEMAday UTC Day in Month (Integer) 1-31

NEMAmonth UTC Month in Year (Integer) 1-12

NEMAyear UTC Year (Integer) 1-99 = 2001-2099

NEMAlongdeg Longitude Degrees (Integer)

NEMAlatdeg Latitude Degrees (Integer)

NEMAlatmin Latitude in Minutes * 10000 (Float)

NEMAlongmin Longitude in Minutes * 10000 (Float)

NEMAspeed Speed in MPH (Float)

NEMAdir Heading in Degrees (Float)

NEMAlatdir N/S Indicator for Latitude (Integer) 78=N 83=S

NEMAlongdir E/W Indicator for Longitude (Integer) 69=N 87=S

NEMAfix Fix Mode (Integer) 0=No Fix 1=SPS Fix 2=DGPS/WAAS Fix

NEMAaltitude Altitude in Meters (Float)

NEMAsats Satellites Used in Fix Calculation (Integer)

NEMAcmd Command Received (Integer) 0=None 2=RMC 3=GGA

NEMAstrdat 95 Byte Character String Holding Received Line of Data (String)

NEMAstrtest 80 Byte Character String Used by Library (String)

NEMAstrtemp 80 Byte Character String Used by Library (String)

TABLE 2

Simpson4.qxd 11/30/2007 11:34 AM Page 45

46 SERVO 01.2008

Wire the module according tothe previous section and program the

appropriate program into the DiosProusing the Dios compiler. Once the GPS

module locks on to threesatellites, the programwill start to display thepositional data shown inFigure 13.

DiosNEMALibrary

The Dios Compiler hasa NEMA library built incalled DiosNEMA. Thislibrary processes both theGGA and RMC commands

and populates the global variablesshown in Table 2 when the appropri-ate command is received.

When a command is received, thevariable NEMAcmd will be set to 1, 2,or 3, depending on the commandreceived as shown next.

• 0: No command received• 1: Non RMC or GGA command

received• 2: RMC command received• 3: GGA command received

In most cases, I don’t do any processing unless the NEMAcmd is setto a value of 3 (GGA). Once I have avalid NEMA command, I then checkthe NEMAfix variable to see if themodule has a valid fix on at least threesatellites. If it does not, then all theremaining variables are invalid.

There are a few other consider-ations you need to keep in mindwhen using the library. First, youmust set up the UART using thehsersetup command shown inProgram 1. In the case of the EM-406, we have set the baud rateto 4800. The UART handler builtinto the DiosPro is interrupt drivenso data is automatically placed intoa 256 byte buffer for you. It isimportant that you call theprocNEMA() frequently, enough tokeep this buffer from filling up.

The Dios NEMA library also has acommand called printNEMA. Thiscommand will allow you to send thecurrent NEMA text to the debug window. You pass a single argument

to the function withthe following results:

• 0: Display current value for NEMA text string

• 1: Display all processed NEMAcommands

• 2: Display RMC and GGA NEMA commands only

• 3: Display GGA NEMA command only

‘Dios NEMA Proccessorfunc main()

clearhsersetup baud,HBAUD4800,start,txon,clear

print “Mode Lat Long Alt Speed Dir”print “—— ——- ——— ——- ——- ——-”

loop:procNEMA()printNEMA(9)

if NEMAcmd = 3 then ‘GGAif NEMAfix > 0 then

print NEMAfix,”:”,NEMAsats,” “,{-6.0} NEMAlatmin,” “,NEMAlongmin;print “ “,{6.1} NEMAaltitude,” “,{4.1} NEMAspeed,” “,NEMAdir

elseprint “No Fix “,NEMAfix,”:”,NEMAsats

endifendif

goto loop

endfunc

include \lib\DiosNEMA.lib

Program 1

FIGURE 13

FIGURE 14 FIGURE 15

Simpson4.qxd 11/30/2007 11:35 AM Page 46

• 9: Display nothing

NEMAlatmin andNEMAlongminValues

The NEMAlatminand NEMAlongmin val-ues are actually wholenumbers. The minutevalue is multiplied by10,000. This is done tomake processing easierand faster. You can alsotake the N/S and E/Wdirection indicators andset the minute values tonegative or positive,accordingly. However, Ihave found this is notneeded for most robotprojects unless you arenear the equator orMeridian. If you need toprocess the actualdegrees, you can usethe NEMAlatdeg andNEMAlongdeg variablesfor your calculations.

In most robot appli-cations, you will recordor store waypoints in aset of variables or tables,then make calculationsbased on the currentminute values and make course changes, asnecessary.

LCD DisplayProgram

The Dios WorkboardDeluxe supports a two-line or four-line character LCD. I havecreated a series of programs todisplay GPS data on a two-line LCDshown in Figure 14. The folksat Sparkfun have the perfect LCDfor this project. They even havethe four-line LCDs if you want moredisplay area.

Attach a 16-pin male headerto the LCD and plug it into theLCD header as shown in Figure 14.

SERVO 01.2008 47

DiosProfunc main()

clear

‘Start back lightoutput 13low 13

‘LCD init stringlcdinit 23,25,24,29,28,27,26 ‘RS, E, RW, D0,D1,D2,D3lcdcontrol 1 ‘cls

hsersetup baud,HBAUD4800,start,txon,clear ‘EM406

print “Mode Lat Long Alt Speed Dir”print “—— ——- ——— ——- ——- ——-”

loop:procNEMA()printNEMA(9) ‘— Change to 1 to display all Messages

if NEMAcmd = 3 then ‘GGA

if NEMAfix > 0 thenlcdgoto 1,1if NEMAspeed < 10 then

lcdwrite {-2.1} dec NEMAspeed,” “,{-3.0} dec NEMAdir,” “,{-5.1} dec NEMAaltitudeelse

lcdwrite {-3.0} dec NEMAspeed,” “,{-3.0} dec NEMAdir,” “,{-5.1} dec NEMAaltitudeendiflcdgoto 2,1lcdwrite {1} dec NEMAfix,”: “, {-5.0} dec NEMAlatmin,” “,{-6.0} dec NEMAlongmin_print NEMAfix,”:”,NEMAsats,” “,{-6.0} NEMAlatmin,” “,NEMAlongmin,” “; print {6.1} NEMAaltitude,” “,{4.1} NEMAspeed,” “,NEMAdir

elselcdgoto 1,1lcdwrite “ No Fix “lcdgoto 2,1lcdwrite “ “

endifendif

goto loop

endfunc

include \lib\DiosNEMA.lib

Program 2

Program Name Description

DiosLCDEM406.txt For use with the EM-406A module

DiosLCDEtek.txt For use with the Etek EB-85A module

DiosLCDHolux.txt For use with the Holux GPSlim236 receiver

DiosLCDEM408.txt For use with the EM-408 module

DiosLCDCopernicus.txt For use with the Copernicus module

TABLE 3

Simpson4.qxd 11/30/2007 11:35 AM Page 47

Load up the appropriate program as indicated in Table3. The LCD will display the positional data as shown inFigure 15.

The program works much the same way as theDiosGPSxxx programs in the previous example. The only difference is that I have added a couple of LCD commandsas shown in Program 2. In addition to displaying the LCDdata, the program displays the positional data in the debugwindow when connected to the PC. By connecting a 9Vbattery to the coax connector, you can take the GPS intothe field for further tests.

Going Further

We covered quite a bit of information in this series.I hope that I have inspired you to take it to the nextlevel. Several breadboard components are includedwith the Dios Workboard Deluxe, including buttonsand LEDs. Try connecting a couple of buttons to create the ability to set a waypoint. Then use the LCD display or a set of LEDs to indicate the direction towardthe waypoint.

I am currently working on a project using the smallerDiosPro 18 chip and a SD memory card to create a verysmall GPS data logger. I hope to create an article featuringthis project in the near future.

Be sure to check for updates and downloads forthis article at www.kronosrobotics.com/Projects/GPS.shtml. SV

The following is a breakdown of sourcesfor all the components needed forParts 1 through 4 of this project.

SPARK FUN ELECTRONICSEM-406A GPS Modulewww.sparkfun.com/commerce/product_info.php?products_id=465

EM-406 Evaluation Boardwww.sparkfun.com/commerce/product_info.php?products_id=653

EM-408 GPS Modulewww.sparkfun.com/commerce/product_info.php?products_id=8234

Copernicus Evaluation Boardwww.sparkfun.com/commerce/product_info.php?products_id=8145

Nine-Pin Serial Cablewww.sparkfun.com/commerce/prod

uct_info.php?products_id=656V AC Adapterwww.sparkfun.com/commerce/product_info.php?products_id=737

External Antenna with SMA Connectorwww.sparkfun.com/commerce/product_info.php?products_id=464

SMA to MMCX Adapter Cablewww.sparkfun.com/commerce/product_info.php?products_id=285

2 Line Character LCD Bluewww.sparkfun.com/commerce/product_info.php?products_id=709

2 Line Character LCD Greenwww.sparkfun.com/commerce/product_info.php?products_id=255

4 Line Character LCDwww.sparkfun.com/commerce/prod

uct_info.php?products_id=256KRMICROSZeusProwww.krmicros.com/Development/ZeusPro/ZeusPro.htm

KRONOS ROBOTICSEZRS232www.kronosrobotics.com/xcart/product.php?productid=16167

DiosPro Chipwww.kronosrobotics.com/xcart/product.php?productid=16428

Dios WorkBoard Deluxewww.kronosrobotics.com/xcart/product.php?productid=16452

CYBERGUYSMini USB cablewww.cyberguys.com/templates/SearchDetail.asp?productID=3312

Parts List

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

48 SERVO 01.2008

Simpson4.qxd 11/30/2007 11:36 AM Page 48

SERVO 01.2008 49

In January 2004, two twin rovers —Spirit and Opportunity — landed ondifferent sites on Mars. Newspapers

and TVs showed beautiful close-upimages of the Martian surface takenfrom the rovers (see Figure 1).

Biologists around the Earth havebeen amazed by the discovery of geolog-ical evidence of water in Mars’ past, thusconfirming the intuition that the RedPlanet can sustain future life. As a matterof fact, MER has been the most success-ful mission ever: Spirit and Opportunityoperated for three Earth years, each oneexploring over eight miles of Martian terrain. This means an unprecedentedmobile surface exploration.

Nonetheless, Spirit and Opportunitywere not the first to navigate on Mars:Pathfinder and Sojourner were there in1996, even if they were only an engineering test-bed mission to vali-date technology for surface mobility.However, both Spirit and Opportunityhave greatly exceeded most of their initial requirements.

Among the major MER objectives,we can identify: (1) looking for past lifethrough the study of the planet soiland the discovery of the presence ofwater; (2) understanding the climate ofthe planet which is supposed to havebeen a “green heaven” in the past; and(3) performing experiments both in the

field of geology and in studies of the atmosphere in order to prepare for future human exploration and settlements (see Figure 2). In otherwords, planetary astrobiology.

These objectives require that tensof kilometers must be traversed inorder to measure and study biodiversi-ty. From a rover’s perspective, this turnsout to be a daunting task: long distance mobility and autonomy are thetwo major issues in mobile robotics.

Rovers cannot be tele-operated.From Earth to Mars, there are over 300million miles and the response timeswould cause rover ungovernabilitycaused by the extremely limited band-width. Despite that, the MER’s mission

assessed a number of key points andtechniques which paved the way for allfuture planetary exploration researchagendas: remote planning, commandsequencing and validation on Earth,data gathering, and reduced independ-ence on Mars.

This article focuses on the entirecontrol loop which is used to allow arover to safely navigate on Mars using information processed on Earth,ranging from data acquisition to lowlevel command actuation.

A Typical Control Loop

A mission on Mars is limited by thefact that rover work cycles are tied to the

FIGURE 1

Since 2000, the NASA Mars Exploration Rover mission (MER) hasbeen the main objective of hundreds of scientists and engineers;

their life being completely dedicated to the mission for years.

Mastrogiovanni.qxd 11/30/2007 11:06 AM Page 49

50 SERVO 01.2008

Martian day (which is called “sol”), astheir power supply is the sun. However,there are many contingent and econom-ic issues which must be addressed:

• Activities must occur every sol inorder to maximize scientific return.

• The current technology in cognitivesystems does not allow completeautonomy for rovers on remote planets.

• The distance between Earth and Marsprecludes direct tele-operation becauseof limited bandwidth and temporal lag.Therefore, plans must be submittedfrom Earth and executed on Mars without direct supervision from Earth.

• Rovers are semi-autonomous betweencommunication windows, thus requiringat least self-localization and hazard avoid-

ance capabilities to reacha given goal position.

• When the rover reaches a new area, thefinal pose is subject todead reckoning errors.This requires a datauplink to Earth to analyze the state and toplan future operations.

These issues lead to awell-defined sequence of

activities which must be coordinatedbetween Earth and Mars: Earth-side pro-cessing and filtering of data downlinkedfrom Mars; analyzing the current roverstate and its surrounding terrain for pos-sible hazards; locating traversable areasand features of interests; and finally,uplinking new commands every sol.

From the rover’s side, this impliesthe execution of the received planschedule (i.e., a sequence of navigationand scientific activities), the recordingof the relevant information, and thenthe communication with Earth. Thoseactivities are outlined next:

• Data analysis (Earth). Images androver data are received from Mars. Thisstep involves browsing images takenfrom the various cameras on board therover (i.e., to examine the surroundingterrain and to detect hazards and areas

of interest) and analyzing numericalvalues originating from sensors.

Images are first displayed andmerged together, thus producing envi-ronment panoramas (see Figure 1again). These images are used to integrate scientific activity plans, whichact as guidelines for planningapproaches to targets of interest.

In practice, scientists ask roveroperators to move the vehicle accord-ing to what they see in image panora-mas. In order to execute a plan, roversmust be fully operational and operatorsneed to visualize the rover within theterrain and analyze interactions with it.

First, the rover status is checked:telemetry provided by such data channels as the suspension and the steering angles and internally computed quantities (i.e., the robotpose) are visualized and possible dangerous situations are inferred.

Second, a 3D model of the roverenvironment is built from cameraimages (see Figure 3). This is usuallyachieved using stereo vision. Stereoimage pairs are processed separately,and then the left and the right imagesare correlated to find matching pixels.Next, the disparity of each matched pairis computed, thus retrieving an estimat-ed distance of the feature pixel from thestereo camera axis. As a result, a full 3Dmodel of the rover surroundings is built.

• Plan generation (Earth). Once a clearmodel of the rover environment isknown, it is possible to specify command sequences for future activities. Between communicationwindows, rovers are autonomous inthat they operate while out of contactwith ground controllers. Roughlyspeaking, a mission is composed by acollection of actions to be performedin sequence. In general, there is aninterleaved sequence of navigation andscience activity actions.

• Driving the rover (Earth). Using aninteractive 3D visualization software, itis possible to specify desired rover posi-tions in various ways. In general, thiscan be achieved using point-and-click

FIGURE 2

FIGURE 3

Mastrogiovanni.qxd 11/30/2007 11:06 AM Page 50

techniques or by dragging a cursorover the 3D terrain using the mouse.

A basic route can be created bydragging a 3D rover model to each suc-cessive waypoint in the terrain model.The operator’s experience is necessaryto select reasonable routes and to plandrives with the tight operational com-munication windows. The operatorsmust select the appropriate traverseand localization methodologies.

Once a sequence of desired loca-tions relative to the terrain is decided,motion commands can be generatedfor path planning using a grid-basedestimation of surface traversabilityapplied to local terrain. Motion commands are then stored and packedto be sent to Mars.

• Rover perception (Mars). Reliable perception is mandatory when therobot is navigating, because dead reck-oning information is clearly unreliable,especially in rocky terrain. Cameras areused because they provide a lot of infor-mation if compared to other sensors.

In particular, Visual Odometry isused when navigating. This algorithmcomputes the rover displacementbetween two successive camera images.Specifically, an image is taken before arover’s movement. After the movement,another image is taken mostly of thesame terrain area. Features present inboth images are then associated, andthe corresponding displacement is computed. As a result, an estimate ofthe current rover motion is computed.

• Rover locomotion (Mars). Given therough nature of the Martian surface,cutting-edge state estimation tech-niques must be used to precisely allowa rover to reach a given target position.In general, reaching a target is a three-step process: terrain traverse, homing,and fine positioning. Once a given areais reached with a sufficient precision,scientific operations can be arranged,and the results sent back to Earth.

Planetary Rovers

Nowadays, there is a widespread

agreement in the robotics communityabout the morphology and the designprinciples of rovers for space explo-ration. These are necessarily application-driven. Rovers must adhere to the con-cept of “Robotic Field Geologist,” i.e., asemi-autonomous rover is considered asa replacement for a team on Earth, able“to do in one day what a field geologistcan do in about 45 seconds.”

In other words, the goal is to create a cyber astrobiologist, deployingscientific instruments (i.e., the scientificpayload) over wide areas. The mechanical design and the cognitivearchitecture of planetary rovers arearranged to guarantee the traversal ofuneven and rocky terrain according tospecific requirements.

From the mechanical point of view,typical key requirements are: (1) therover must traverse over obstacles of25 cm in maximum dimension; (2) therover must traverse over slopes of anominal tilt of 16 degrees; (3) moreover, it should cope with hard,high traction terrains and softdeformable soils; (4) and with a tem-perature between -100 and 20 Celsius,in order to carry the scientific payload;and (5) each vehicle is approximately1.4 m long and 1.2 m wide.

Furthermore, lithium-ion batteriesare used for saving mass and volume.

From a mechanical perspective, the current state-of-the-art locomotion tech-niques assume that rovers are six-wheeldrive, four-wheel steered vehicles with aspecifically designed suspension system.

In particular, the rover suspensionsystem is a mechanical assembly calledrocker-bogie that connects the six wheelsto the body of the rover itself (see Figure4). In order to increase robustness to possible hardware faults, all six wheelsare independently driven by DC motors.Moreover, in order to increase the mobility capabilities, front and rearwheels are independently steered, allowing the rover to turn in place, aswell as to execute more complex turns.

The two front and rear wheels aresteered by identical DC motors. A differential connects the two rocker-bogie systems to the main rover body.

The rocker-bogie design is charac-terized by a number of interestingproperties: (1) safe traversal of obsta-cles whose dimensions are in the sameorder of magnitude of the diameter ofthe wheels (about 30 cm); (2) withstanding a tilt of 45 degrees in anydirection without overturning; (3)absorbing the most of the impact loadduring terrain traversal, which is partic-ularly important for the scientific payload carried around during missionexecution; and (4) passively keeping all

SERVO 01.2008 51FIGURE 4

Mastrogiovanni.qxd 11/30/2007 11:07 AM Page 51

52 SERVO 01.2008

six wheels in contact with the surface,even when driving over uneven terrain;this allows a maximum speed on “flat”ground of about 5 cm/s.

Cognitive algorithms guiding rover operations must be scheduled on resource-constrained devices, inorder to maintain high standards of robustness and reliability. Therefore, anextremely modular system architecturemust be implemented, which allowsthe distribution of the computationsbetween on-board machinery andworkstations on Earth. Needless to say,this implies that a communication linkbetween Mars and the Earth must beestablished, on the basis of temporalcommunication windows. Theserequirements necessarily lead to amulti-agent design choice, where dif-ferent modules perform different tasks.

Low level tasks include sensor dataacquisition and actuator commandissues. In particular, sensing devicesinclude stereo NAVCAMS (cameras fornavigation) and PANCAMS (camerasfor taking panoramic images), used byground teams for path planning, IMUs(inertial measurement units) for atti-tude determination during motion, andwide FOV (field-of-view) stereo HAZ-CAMS (for detecting hazards both infront of and at the back of the rover).

Actuating devices include the six-wheel rocker-bogie mobility system androbotic arms for manipulation and fieldoperations. State values associated with

devices are recorded in log files andthen used for investigating the overallrover’s behavior in case of either acci-dents or system faults. In a sense, this isa sort of “parallel” telemetry which canbe uplinked to the Earth for furtherinvestigation and mission planning.

High level tasks include activitiesfor the rover perception, mobility, sci-entific research, and communication.During operations, the rover must con-currently perform a number of tasks:

• Accurate position estimation usingvarious techniques (i.e., dead reckon-ing, visual odometry, or sun sensing).

• Internal state estimation for failuredetection.

• Environment perception (i.e., eleva-tion maps, stereo vision).

• Control (i.e., low level navigationcontrol, adaptive route planning).

In particular, perception, mobility,and adaptivity deserve special attention for semi-autonomous rovers.

Rover’s Perception

Visual odometry is a technique tomanage rover motion estimation byfeature tracking with stereo imagery.When integrated with wheel odome-try, general estimation error is less than2% of the distance traveled, regardlessof terrain and soil types. In principle,the overall algorithm is fairly simple.

First, adjacent pairs of stereoimages are processed for image filter-ing and noise removal. Next, candidatefeatures are selected and matchedautomatically from one image to theother; misleading or poorly associatedfeatures are not considered further. A3D motion estimate is generated fromdozens of pairs of matched features.Finally, the motion estimate is integrat-ed with an initial guess (odometry).

In practice, there are a number ofcritical issues to be addressed: (1) theapplication of the technique is limitedto images where distinctive features

can be detected; (2) the algorithmrobustness largely depends on the kindof features being considered; (3) cor-rect data association is fundamental;wrong mappings can lead to unrecover-able failures; and (4) from the computa-tional perspective, the real-time applica-bility is limited due to the high load.

Despite these issues, visual odome-try is the de facto standard in rover perception. Furthermore, it has beensuccessfully used with good results onOpportunity without ground-basedsupervision. Nowadays, a boosting inrelated research is provided by theintroduction of the so-called SIFT features, which allow for a fast globalmatching process.

Rover’s Mobility

Rover’s motion is achieved by instan-tiating a sequence of motion primitives,specified on Earth according to the mission’s goal and the scientific activityplanners. Commands are arranged intosequences which resemble subroutinesin a computer program. Among themost commonly used primitives, weidentify basic and advanced ones.

Basic primitives include Go_Straight,Move_on_Arc (the rover moves along acircumference arc of a specified radius),or Turn (to turn on place, or wih respectto a given landmark or position).Advanced primitives are various forms ofGo_to_Waypoint (the rover tries to reacha given cartesian position specified withrespect to the robot-centered frame),usually with an integrated approach to hazard avoidance. This command generates a trajectory to be safely followed by the rover on the basis of theterrain knowledge on the ground.

In order to precisely track rover’sposition, closed-loop techniques mustbe necessarily used. In particular,wheel odometry (computing the robotpose by integrating orientation andwheel rotation) is acceptable on a rela-tively flat terrain. However, when therover is into a region of high slip, deadreckoning is not appropriate anymore,and it is usually fused with informationprovided by IMUs and visual odometry.

Maestro software: A demo version ofthe mission planner used by NASA

http://mars.telascience.org

CLARAty software: Open sourceversion of the software framework

running on current rovershttp://claraty.jpl.nasa.gov/man/

overview/index.php

Proceedings of ASTRA,the official conference of the

European Space Agencywww.esa.int/TEC/Robotics/

SEMABJC4VUE_0.html

Resources

Mastrogiovanni.qxd 11/30/2007 11:08 AM Page 52

Navigation can be divided intothree distinctive phases:

(1) Long traversals: less than 40 m persol are navigated.

(2) Target approaching: less than 10 m,used for approaching interesting areas.

(3) Fine positioning: less than 2 m,used for establishing a workspace formanipulation purposes.

In general, the localization processcan dynamically adapt to the terrain. Inareas characterized by small rocks, sim-ple dead reckoning can be used for tra-versal; where excessive slippage wouldbe problematic, visual odometry isused to reduce dead reckoning errors.

Contingency Planning

When executing a navigation mis-

sion, it is often the case that the roverhas to modify the original path provided by Earth operators. This canbe done when detecting hazards, forexample. Usually, rovers are designedto support two hazard detection levels:Reactive (e.g., tilt check, motor faults);and Predictive (e.g., stereo vision used to track potential risks, traversalanalysis, terrain roughness).

Contingency planning consists ininterleaving planning and execution.Therefore, an initial plan is established.During the execution, possible planfaults are identified, in which case, anovel sub-plan is generated and thenintegrated within the initial one.

Future Research

Rovers for space exploration pushthe current limits in mobile robotics, telecommunications, planning technologies, and mechanical designs.

Fortunately, the techniques supportiveof remote planetary exploration can beapplied on Earth, as well. Antarctic andvolcano exploration are only two of thepossible scenarios. In the coming years,we will witness fully autonomousrovers, able to build maps of their environments and able to decidewhere to go and what to see on Mars. In a sense, they’ll range fromgeologists to tourists. SV

Fulvio Mastrogiovanni is a PhD studentin Mobile Robotics and ArtificialIntelligence at the University of Genova,Italy. In the past few years, he gainedexperience in planning techniques,knowledge representation, and reliableand efficient software architectures formobile robots. Currently, he is workinghard to provide planetary rovers withan increased autonomy and robustdeliberative capabilities.

About the Author

SERVO 01.2008 53

Mastrogiovanni.qxd 11/30/2007 11:08 AM Page 53

120100011110102110001

0011201011

54 SERVO 01.2008

Many aspiring roboticists take theirfirst steps in programming embed-ded controllers with interpreted

languages, such as LOGO and Basic.These languages are fine entry points forbeginners, but after a short time, theirlimitations can become frustrating. Totackle more sophisticated projects, sooner or later you will have to move upto writing code for microcontrollers in C.

With C, your code will run fasterand you will gain access to advancedchip features, like interrupts and univer-sal asynchronous receiver/transmitter(UART) capabilities. C is also designedto be portable, unlike Basic, whose myriad varieties can be incompatiblewith one another. Moreover, since mostprofessional developers programembedded controllers in C, there is awealth of C code available on-line to helpget you started on your next project.

Bootstrapping the Old Way

For the novice, making the

transition to writing C code for microcon-trollers can be daunting. Not only do youhave to learn a new programming lan-guage, you also have to install a range of new software tools: a text editor or integrated development environment(IDE) for writing and editing your code, aC compiler that works with your chip,and a utility for downloading the compiled code to your embedded device.

Finding all of the necessary softwaretools and getting them to work togetherproperly is a major challenge, even forexperienced developers. Most compilersprovide little or no user interface. Theywork mysteriously in the background,waiting for instructions and files fromthe IDE. Within the IDE, command lineoptions must be set, telling the compilerwhich chip is being used and what typeof output file is expected. Likewise, thedownloading software has to be config-ured with the correct oscillator settings,or else the code will not run correctly.

Even after the IDE, compiler, anddownloader have been installed andconfigured, there is the issue of libraryand header files. At this stage, thenovice programmer may have only rawC — about 30 recognized words — towork with. Some C compilers comewith built-in code libraries, but othersdo not. So if you are trying to get start-ed inexpensively, there may be a fairamount of legwork left to do in orderto establish basic coding functionality,like delay routines and text output.

All of this just to get to “HelloWorld,” or more likely, in the case of anembedded controller, a blinking LED!

A Different ApproachMachine Science, Inc., of

Cambridge, MA, has developed a newon-line system that radically simplifiesthe process of developing C code formicrocontrollers. This unique, patentedsystem enables users to write and com-pile code using an on-line interface,rather than a locally installed IDE. Thecompiler is installed on a server, anddownloading is accomplished with aJava applet, so there is no software forthe user to install or configure locally.

To access the system, users simplylog in to the Machine Science websiteand write their code in a text window,which provides useful features such asediting tools, line numbering, andcolor-coded C syntax highlighting(Figure 1). Users can then compile theircode and send the compiled hex file toa microcontroller in real time, with asingle mouse click. Since all of the soft-ware is server-based, the system workson both PCs and Macintosh computers.

In addition to cutting set-up time,there are other advantages to using anon-line development environment formicrocontroller projects. Code files areautomatically stored on the server andcan be accessed from any Internet con-nected computer. This is particularlyhandy if you want to work on the sameproject at the office and at home, or atdifferent terminals in a high school oruniversity computer lab. As a resourcefor users, Machine Science also pro-vides a suite of code libraries, coveringeverything from pulse width modula-tion (PWM) to controls for liquid crystaldisplays and other external devices.

C PROGRAMMINGfor Microcontrollers Made EasyC PROGRAMMINGNew, no-cost online system cuts start-up timefrom hours to minutes by Sam Christy

FIGURE 1. Machine Science onlineprogramming environment.

Christy.qxd 12/5/2007 11:17 AM Page 54

12010

11

As an additional resource, MachineScience has developed a series ofdetailed project guides, featuring step-by-step programming instructions for noviceC coders. Several activities are included,ranging from simple breadboard-basedprojects to more advanced robotics pplications. Companion activity kits —including off-the-shelf hardware, such as breadboards, microcontrollers, input and output devices, and robot-buildingcomponents — are also available.

The on-line programming systemwas originally developed for Microchip’sPIC16F877, but Machine Science issteadily extending the system to workwith additional microcontroller plat-forms. Atmel’s Atmega8 and Atmega32chips are supported, as is the FIRSTRobotics Competition controller. Userscan simply choose which hardware platform they are using from within the on-line interface and instantly startcompiling for any supported chip.

In order to streamline the user expe-rience, certain parameters — such as chipprocessing speed — are pre-set in the on-

line system. With time, users may findthat they are ready to take advantageof the greater control and flexibilityafforded by locally installed program-ming software. All of the compilersintegrated with the on-line system areavailable at no cost, either as open-source software or as demo versions.

While the system is designed forease of use, it is also very powerful.Freed from the constraints of inter-preted programming languages,Machine Science users have built anarray of embedded controller projects.These include a computer-controlledEtch-a-Sketch, mating stepper motors tothe toy controls to create line drawingsof famous figures, as well as a full-scale,Segway-style portable transportationdevice (Figure 2), which was created byundergraduates at the MassachusettsInstitute of Technology and studentsfrom Boston-area high schools.

To test drive the on-line C program-ming system, sign up for a free useraccount on the Machine Science web-site. With the barriers to getting started

removed, there’s no reason not to makethe move to C today. First-time micro-controller programmers may even wantto consider starting with C, rather thandevoting time and effort to learninganother programming language, only tohave to make the switch later. SV

FIGURE 2.Segway

electronics.

Machine Science, Inc.:www.machinescience.org

DIY Segway: web.mit.edu/first/Segway

Resources

SERVO 01.2008 55

We’re Semi Nuts!

Order 24 hours a day, 7 days a weekwww.Jameco.com

Or call 800-831-4242 anytime

©Jameco Electronics. *According to their web sites on August 28,2007. Trademarks are the property of their respective owners.

Jameco offers more major brands of semiconductors than anyone — almost twice as many as these catalog distributors.* It’s another Jameco advantage.

OTHER JAMECO ADVANTAGES:

• More major passive, interconnect and electromechanical brands than other distributors.

• 99% of catalog products ship the same day.

• Lowest prices guaranteed, or we pay 10%.

• Major brand names and generic equivalents for even greater cost savings.

Christy.qxd 12/5/2007 11:17 AM Page 55

56 SERVO 01.2008

Checking EEverything OOut

The first thing to do was checkeverything out to become familiar withthe robot. I took some time to seewhat was there and — more important-ly — what was missing. His name isARTI ONE and he is a custom builtrobot made by Promotional Systems inthe late ‘80s. I can no longer find anyinformation on this company andassume they may have closed up shop.(If anyone reading this has any historyon them please, email me.) The only

thing I had heard about this particularrobot is that the original owner used to work at NASA. With no official documents to the robot, the next stepswere to examine all the different components used and reverse-engineerenough to figure out how he was supposed to work.

I could see that the robot used astandard Futaba FP-R4F four channel 75MHz AM R/C receiver which connectsto a custom driver board for controllingthe robot. That driver board was dated10/2/87 and was made by Promotional

Systems for their robots. Thecustom driver board has thelogic for decoding the R/Csignals that drive a pair of H-bridges for the main drivemotors. It also controls thelights on the robot (eyes andmouth) and the operation ofa tape deck.

The tape deck appearedto be an add-on version for

an automobile. It is used to play music,sound effects, or prerecorded messages.One other gadget onboard is an OHRAwireless communicator which canreceive voice from the operator and actas a wireless microphone so the operatorcan hear people talk to the robot. Thissetup is ideal if the operator isn’t nearthe robot to hear what people say to it.

A unique feature of this particularrobot is that the charging transformerwas on board with the cord so it waseasy to keep track of and would alwaysbe available.

The robot itself is constructed fromthermoformed plastic similar to theway the old Androbot robots weremade, but with all the panels gluedtogether. The arms are made from aluminum dryer vents which have anextra support inside. They can be man-ually moved into the desired position.The hands have a spring loaded thumbwhich could hold a sign or small items.

A neat feature is that the head is

One cool aspect of the robotics hobby isthat there are so many different areasto explore. This keeps it really interesting!Recently, I was fortunate enough to pickup an old promotional showbot whichmade a nice addition to my robot collection.The robot itself seemed to be in pretty goodshape overall. However, it was missing all the extras like the remote control unit, wireless headset communicator and, of course, there were no docs ...

Original FutabaRX and harness.

Reviving aSHOWBOT

by Robert Doerr

Doerr1.qxd 11/30/2007 11:10 AM Page 56

easily removable and can be changed, if needed. Anexample is an extra head(McGruff, the crime dog) thatcame with the robot. I’ll justneed to pick up a trench coatif we use that extra head.

One of the first things todo after taking an inventoryof the major componentsused is to get an idea of howeverything was connected.This entails making a sketch of the connectors on the controller board andtracing out where the wires go.

The controller board had a 10-pinconnector for the radio receiver, a large3 x 5 connector near the top, andanother large 3 x 4 connector near thebottom. A rough schematic was madeof the charging and power sectionssince that was one of the first sectionsto deal with. Then, the rest of the connections were mapped out.

If you can’t follow the wires directlyor they are hard to see, an ohmmeter isyour friend and can help verify you havethe correct wire. It helps if you canunplug any connectors so that you’ll justbe mapping out the wiring itself and nothave to worry about any feedback froma board or device it may be plugged into.

The 3 x 5 connector provided thepower to the OHRA communicator, thecharge LEDs, cassette power, cassetteaudio, headset out, and a coupleunused pins. The 3 x 4 connector hasthe main power, charger, left and rightdrive motors, and the body lights.Having at least the basic wiring of the robot documented helps beforegetting into the project.

The power switch has three positions. If the switch is in the rightposition, the robot will be on. Whenthe switch is in the left position, thebattery will be connected to the charging circuit. The center is every-thing off, which keeps the main battery completely isolated. This centerposition would normally be used ifARTI was going to be stored for a whileor being transported to a show.

We NNeed MMore PPower

When examining the robot, I could

tell that the battery shipped with it wasthe wrong one. It was a 12V batterywith some handmade extensions toconnect it. The battery was much small-er than the compartment and as aresult, it would slide around. (It is not agood thing to have a battery freelymoving around and banging into stuff!)

After measuring the battery com-partment, I found that it was perfectlysized to accommodate a 12V 17AHbattery. I ordered a new one and it fitperfectly! When the original one died,I’m sure that someone just picked up a12V battery and didn’t really care if itwas the correct one or not. This largerbattery has the extra capacity neededfor longer performances.

After installing new ring terminalson the wiring and bolting them to thebattery, that portion was now all set.An important note of caution here!Before attempting to power up astrange robot for the first time, makesure that the wheels are lifted off theground! This way, it won’t run over youor wreak other havoc in your workshopif it decides to do something unexpect-ed. Be safe and be smart whenworking with mechanical and electrical gadgets! With the new battery, the robot would power up, theeyes and mouth would light, but thatwas about it.

Getting AARTI tto MMove

The original remote was probablya standard dual stick Futaba four chan-nel remote. It may have been a hackedversion customized to fit in a bag orotherwise concealed for the operator.That way, no one would notice it if theoperator was hanging out with thecrowd around the robot. At first, I was

going to find an old Futaba transmitteron the surface 75 MHz band and thenswap crystals (if needed) for the cor-rect channel/frequency. However, afterlooking into it a bit more, I discoveredthat the original R/C gear was an olderwide band AM unit which probablyshouldn’t be used these days, anyway.

Instead, I decided to use an extraAirtronics VG600 75 MHz FM six channel radio set that was leftoverfrom my old Battlebot. This new R/Cgear should prove to be more reliableand more immune to interference thanthe original gear. My radio set also hastwo extra channels that could be put touse later to control other features.

However, it ended up requiringmore than just plugging in the newreceiver into the robot. (Things arenever that easy!) The connectors weredifferent on the early Futaba receiverthan on the current crop of radioreceivers. Each had male connectors

REVIVING AA SSHOWBOT

ARTI 1 robot.

New AirtronicsRX and harness.

Close-up of connectoron new RX cable.

SERVO 01.2008 57

Doerr1.qxd 11/30/2007 11:11 AM Page 57

58 SERVO 01.2008

with an odd spacing. I didn’t want tohack off the end of the cable andinstall new ends in case the originaltransmitter for ARTI was ever found.Instead, I purchased a set of five 12”servo extension cables. On each one, Ijust cut off the male end, crimped onnew female pins, and inserted the pinsinto a 10-pin housing that was just likethe original harness. I made sure theground, 5V, and signal lines matchedthose of the Futaba receiver.

The channels were named on theFutaba receiver instead of numberedlike the newer receivers. It had (AILE,

ELEV, THRO, and RUDD) which thenhad to be converted to the channelnumbers. The only difference was thelocation of two channels on the earlyFutaba receiver. When plugging inchannels 1 and 2 (Elevator andAileron), the two plugs just had to be swapped on the new Airtronicsreceiver to compensate.

Before attempting to power it up,everything was double/triple checkedto avoid a mistake that could damageany of the electronics. Doing it right ismuch more important than doing itfast (in my opinion, anyway!).

Getting AARTI tto MMovethe WWay WWe WWant

The first adjustments performedon the transmitter were to the endpoint adjustments for each channel.This can set a limit on the signal thatwould normally drive the servos which, in turn, limit their travel. On anelectronic speed controller, this canalso act like a governor to prevent therobot from reaching top speed. Ilearned this lesson the hard way.

The first R/C electronic speed controller I used was a Vantec unit onmy Battlebot ‘Crash Test Dummy.’ Therobot seemed really fast but hadn’tbeen going full speed when it wascompeting. I was unaware that justturning those little end point adjust-ments could make a huge difference.(Arggh!!) When I figured that outafterwards, the robot seemed to gotwice as fast! Since then, I check andrecheck every adjustment I can makewhen using radio gear like this.

With the new radio gear connect-

ed, it was time to see if and how ARTIwould work. (Again, I want to notethat the wheels were propped up sothey wouldn’t touch the ground!) It is aconvention that the transmitter is thefirst thing on and the last thing off. This prevents the receiver frompotentially picking up a stray signal.The radio was powered on first, thenthe robot. ARTI immediately startedmaking a loud siren sound and thewheels started to move. If I moved thejoysticks on the transmitter, I could getthe siren to silence and change the speed of the motors. The controlsdidn’t respond as you would expect,but I anticipated there would be someissues to deal with.

Adjusting the trim tabs on theradio helped. The siren sound finallysubsided and was quiet, and thewheels almost stopped with the joysticks centered. Next was to deter-mine if ARTI was meant to drive withconventional tank style steering (dualsticks) or if the controller would handlethe mixing of the drive and steeringchannels for single stick operation.

Since the drive motors onlyseemed to respond to the right stick, itappeared that the controller did handlethe channel mixing for driving with asingle stick. I suppose that made senseso that an operator could drive withone hand on the controller, if needed.With the motors moving, the next step was to get them calibrated andunder control.

When moving the stick up anddown, the direction the wheels wereturning appeared to be reversed. Thispart was easily corrected by flipping thechannel reverse switch on the front ofthe transmitter. Some radios have thesereversing switches on the back or hid-den under a cover. The steering controlacted a bit differently than I was usedto as it only worked with the stick at theextreme range of the joystick. Had I notchanged the end point adjustment onthe transmitter, I may not have beenable to steer the robot at all.

When the joystick was full right,the left motor was off and only theright motor would go forward andback. With the joystick at the full leftposition, the right motor would be off

REVIVING AA SSHOWBOT

This shows thecorrect battery

and the old one.

Robotcontroller.

Robot base.

Doerr1.qxd 11/30/2007 11:11 AM Page 58

and the left motor would respond toforward and back on the joystick.

Although ARTI can’t rotate inplace with this steering setup, he iseasy to control.

No matter how the trim tabs onthe transmitter were adjusted, therewasn’t enough range of travel to centerthe signal. To fix it, the radio was goingto need some work. (I always seem tofind a reason to take things apart!)

After pulling the back off thetransmitter, I saw that there was anextra hidden adjustment on each trimtab (see the photo). These must havebeen used by the factory to help centerthe signal for their system. By adjustingthese, I was then able to set the correctcenter via the trim tabs on the front ofthe radio.

Once this was done, the drivemotors were off with the right stickcentered and the steering respondedwell at each edge. That took care ofthe motion part. Now we just need tofigure out what the other channelscontrol and how they work.

What EElse CCan AARTI DDo?

Since the robot started makingthat siren sound when first poweredup, I knew that moving the left joystickside to side turned on the siren. It didthat without having to move the sticktoo far, but it did nothing when movingit in the other direction. I thought itmight do something more, so again Ihad to adjust the extra trim tab insidethe radio to help center the signal. Thismoved the center of the signal and allof a sudden, the robot would makeanother different warbling siren soundwith the stick in the other direction. Italso required the stick be moved a bitmore to enable the original sirensound, so that it wouldn’t be turned onby mistake. Things were definitelystarting to shape up!

The last channel is controlled bythe up and down movement of the leftjoystick and would turn on/off theonboard tape player. This one didn’tneed much adjustment and since theleft stick is normally for a throttle, it

has a detent to stay in place. This wasperfect since you could turn on thetape deck and wouldn’t have to holdthe stick to keep it going.

When the robot was reassembledand the body screwed back on, I turnedon ARTI and absolutely nothing hap-pened. If I tapped on the circuit break-er, he would power on for a second ortwo. Since it seemed like it was bad, Ipicked up a replacement at the localelectronics shop (Abel Electronics.) Thebody was pulled back off the robot andthen the circuit breaker was replaced.

ARTI was turned on again butnothing happened. Upon closer inspec-tion, I found there was a bad connec-tion where the terminal was crimpedon the wire going to the breaker. Thewires had been tinned and thencrimped to the terminals. The crimpedconnection loosened up a bit and, as aresult, oxidized between the connectorand the wire which caused an intermittent connection at that spot.

It would have been better if theconnector had just been crimped to thewire itself (without tinning it first) orsoldered after crimping. I’ve heardarguments both for and against soldering crimped terminals so just use

what works best for you wheneverencountering a similar problem.Replacing that connector and reassembling the robot took care ofthe last issue with the robot itself.

Whenever the robot is poweredon, the eyes will light up in a blue colorand the mouth lights up red. If thetape player is enabled or the operatoris speaking, the light for the mouth willflash in time with whatever sound ARTIis making. This is a great visual aidwhen the robot is speaking. Kids havefound it very appealing when we play abook on tape.

The remaining gadget to tacklewas the wireless communicator usedfor the operator. The unit on the robotwas made by OHRA and would bothreceive and transmit sound. The one inthe robot was customized a bit to integrate it into the robot. I wouldeither have to find the correct matchfor it or replace the whole thing to getthat portion to work. It was just astroke of good luck that one of the few(very few) links that turned up was fora set of OHRA Walkphone full duplexcommunicator (OR-200) units still inthe original boxes.

Less than $25 and a week later,

REVIVING AA SSHOWBOT

Chargingtransformer.

OHRAWalkphone

for operator.Transmitter (with cover removed).

Extra (hidden)trim adjustment.

SERVO 01.2008 59

Doerr1.qxd 11/30/2007 11:12 AM Page 59

they showed up at my door. Theywere supposed to come as matchedpairs Model A with Model B or ModelD with Model E. It was a pleasantsurprise that the pair which arrivedjust happened to be on the same

frequency as the one in the robot.According to the manual, these

are supposed to have a range of up to1/4 mile which would work fine for therobot. Just adding a new 9V battery forthe one I was going to use did it! Icould talk through ARTI and hear whatpeople were saying to the robot. ARTIonly projects the operator’s voice as-is.I suspect that they may have customized the transmitter portion ofthe original unit so that it could soundlike a real person or (by flipping aswitch sound) more like a robot. That isa project I may tackle down the roadafter using the robot a bit more.

The FFuture ffor AARTI

Reviving ARTI and getting therobot fully functional again was a real-ly rewarding and worthwhile project. Itwas all done without having to hack upor modify the original robot. There area few upgrades that could be done tothe robot without any major changes.

One is to check out the twounused pins on the larger 3 x 5 connec-tor. I have a feeling they may turn on adevice whenever the stick for the throt-tle is all the way down instead of up forthe tape. This could enable the originalcontroller to drive one more device.

Another option may be to use theextra two channels on the new radiogear to control other features. Theaddition of either a large servo or DCgear motor could allow the head toturn back and forth. There are a lot ofoptions for improvements.

Down the road, I plan to use ARTIto do several interesting things. He isgoing to make an appearance at thelocal kindergarten class to talk aboutrobots. ARTI may also help out with thecandy duties for different holidays.

In the meantime, he has been ahuge hit with the kids just readingsome books on tape. In particular, theread-along Star Wars tape and booksets have been entertaining and helpsteach kids to read. SV

RobotWorkshop — Author’s websitewww.robotworkshop.com

Airtronics — Manufacturer of newradio used for ARTI revival project

www.airtronics.net

Vantec — Supplier of dual R/CH-bridge driverswww.vantec.com

Abel Electronicswww.abelelectronics.com

Tower Hobbies — Supplier of R/Cgear (Airtronics radio)

www.towerhobbies.com

Web RReferences

REVIVING AA SSHOWBOT

60 SERVO 01.2008

Doerr1.qxd 12/4/2007 10:37 AM Page 60

Last time, we had the honor to present two robots — theRoboquad and Robopanda — that

approached the line between toy androbot from the robot side of the equation. This month, the V-Bot showsthat a toy can also approach that fineline between electronic plaything andseemingly sentient automaton.

Mighty MorphingV-Bot

After the first trial of any cool toy— getting it out of the box and equipping it with batteries — the V-Botis ready for action. The V-Bot comes

with a two joystick controller that alsohosts a number of buttons that promptthe V-Bot to do everything from karatechops to transforming between a carand a humanoid robot.

The V-Bot is no Optimus Prime (itscar form looks something like a crossbetween an Xb and a Suburban), but itcertainly sports plenty of attitude. Inaddition to the inherent coolness of atransforming robot/RC car, the V-Bot isnothing short of a one bot show withits generous supply of flashing lightsand thumping techno beats. The V-botcan cruise around at a good speed in its car form that comes completewith working headlights, and it’s also

completely driveable in humanoidform, where it will karate chop anything in its way.

The V-Bot would even give theRobosapien or washed up celebrities arun for their money in a dance-off — itperforms its own dance to its ownmusic. And if you tire of the V-Botdancing to the same old soundtrack, ithas the super cool feature of having anaudio port capable of hooking up to aniPod. It comes with the necessary cableand a Velcro strap to keep your belovediPod safe, so you could have the V-Botdancing or driving around to Muse orBjörk in no time.

The humanoid form does not real-

THIS MONTH:

More ThanMeets the Eye

V-BOT CAR. V-BOT — GOOD AS NEW.V-BOT BOX.

SERVO 01.2008 61

TwinTweaks.qxd 12/3/2007 3:26 PM Page 61

62 SERVO 01.2008

Twin TTweaks ....ly compare with the agility and sophis-tication of bots like the Robonova-1 orthe Bioloid, but the V-Bot puts forth avaliant effort. The spectacle of its transformation certainly makes up formost of the shortcomings in itshumanoid form — the V-Bot spins on itswaist, folds up its wings, and lies downflat in a fairly fluid motion, and all tothe fanfare of flashing lights and music.With such inherent coolness, we werealmost reluctant to crack it open, butwe quickly got over that.

Modular ArtThe humanoid form of the V-Bot

brought back fond memories of thehumanoid robots we worked with inthe past like the Robonova-1 and theBioloid. Of course, these robots weremuch more sophisticated (and, by thesame token, much more expensive)than the V-Bot (which will run youabout $160), and that got us thinkingabout what it was exactly that createdsuch classy bots.

We think one of the major designelements that is conspicuously presentin the Bioloid and to a lesser extent inthe Robonova-1 that allows for suchsophistication is their modularity. Thehumanoid form demands a high number of degrees of freedom to create a passable reconstruction, and a modular design seems to be an effective tool in achieving that end.

The Bioloid was so modular that itwas able to become a host of otherthings in addition to the humanoid —everything from a spider to a cat witha flair for impressionism. With just a bit

of programming, the Bioloid was also effectively able to become a transformer of sorts.

That got us to thinking — if themodular Bioloid could be turned into atransformer, could the transforming V-Bot be turned into a modular robot?We thought it could, or at least wethought it stood a much better chancethan any run-of-the-mill RC car.

The V-Bot does give a rudimentaryemulation of the human form — it hasa head, two arms, two legs, and itmoves about in the upright position.Being a humble RC car, it does take afew shortcuts to achieve bipedal mobil-ity. Firstly, the V-Bot doesn’t actuallywalk — the bottoms of its feet areequipped with wheels, so this bot simply scoots around on a permanentset of Heelies. Secondly, the V-Bot onlystands upright with some assistance inthe form of braces with wheels thatprotrude from the back of its legs. Wedon’t begrudge it the crutches though— in our mission to make the Joinmaxrobot dog into a bipedal walker, wealso relied on some extra support inthe form of a long tail.

Despite these forgivable simplifica-tions, we still think the essence of thehumanoid form captured by the V-Botlends itself to being modularized.A remote controlled humanoid, nomatter how simplified, is bound tohave more degrees of freedom thana run-of-the-mill RC car. The transform-ing ability of the V-Bot also bodeswell for its list of moving parts. Ourhope was that a lot of moving jointswould mean a lot of parts that couldpotentially be split into modules —an arm module here, a leg modulethere, perhaps even a hand module ora foot module.

But it’s no use counting our modules before they detach, so it wastime for some demolition.

The Modern RoboticPrometheus

Our last experience of trying topop open a bot (the Robopanda) didn’tprove to be fruitful, but we were confident that we would be able to dissect the V-Bot. With the right

screwdriver in hand (a small Phillips),we were ready to commence surgery.

The V-Bot is held together by acopious amount of screws, but we didappreciate the fact that the vast majority were all the same size so thatwe didn’t have to go about carefullydocumenting where each screw went.

As we dissected the V-Bot, wewere repeatedly impressed with itssophistication. Our standard for sophis-tication in RC cars was based on ourexperience with cheap ones that wewould outfit with makeshift aluminumweapons for “rumbles.” The V-Bot wascertainly more impressive than any ofthose, and much of the elegance in itsdesign reminded us of the polish andefficiency of the Robosapien clan.Reflexive motion in the arms and abusy circuit board equipped with seemingly color coded sockets was certainly a cut above your regular RCcar, but we guess we should haveexpected it from something that canplay music from iPods.

Our hope with the V-Bot wasthat its humanoid form would help tocreate distinct appendages that couldeasily be detached to form modules.Things are never quite as simpleas they seem, though, and we soondiscovered that the V-Bot complicatedmatters by keeping its brain in its chestand its stomach in its feet. The pooranatomical analogy aside, the V-Botcreated problems for us by havingthe main circuit board stored in thechest of the robot and the batteries(six C cells) stored in the feet. Wecan appreciate how the weightdistribution kept the center of gravitylow, but it made modularity more difficult to realize. We could potential-ly section off the feet, but then therobot would need both of its feetto function at all. In that case, legmodules seemed hardly feasible.

Thankfully, the arms of the V-Botproved to be another story. They didn’thouse any critical electronics or powersources, but they did, in fact, housetheir own motors, which made themmore of a meaningful unit. They werealso only connected by a few screwsand could be easily attached and reattached — much more so than the

V-BOT BOARD.

TwinTweaks.qxd 12/3/2007 3:27 PM Page 62

More Than Meets the Eye

bot’s other appendages. They didn’thave their own power source and werenot independent modules in thatsense, but our lives were made easierby only having to deal with two wiresrunning from the arm motor to thebody. It would have been four, but the wires to the headlights were anunfortunate and unintentional victimof the dissection.

The RobotConnection

For our modules to easily reattachand detach from the V-Bot, we needed some connectors. It mightseem like any old plug should do, butchoosing the right connector is animportant design decision that canhave far reaching ramifications foroverall effectiveness and quality. Whilea hack on a fancy RC robot might notseem like the highest class of projects,we couldn’t resist using some classyconnectors.

How classy, you ask? We wereable to get our lucky hands on someDeutsch Micro AutoSport Connectors,which are five position connectorsderived from standard mil-spec (military specifications) connectors anddesigned specifically for the motorsports industry.

The AS connectors are lightweightand constructed of anodized alu-minum, and if that coolness wasn’tenough, they have plenty of otherdesign benefits. These connectors addstrain relief with a longer than usualtail and an integral knurled area for

ease in use with heat shrink boots, andthey have environmental sealing foruse in real harness applications.

By environmental sealing, wemean that the connector is completelysealed and won’t allow any moistureinside. While moisture in the connec-tors would be the least of our problemsif we left the robot out in the rain, itwas reassuring nonetheless.

A handy tip for using connectors ingeneral is to make sure that the socketend is always on the side with power. Ifthe pins were on the powered side andsomething conductive fell betweenthose pins, you would have a short circuit on your hands. In our case, thepowered side was the one going to themain body of the V-Bot, so we plannedto outfit its shoulder socket with asocket.

Adding modules would takemore than just connectors, so we alsohad to consider wiring. An importantthing to note about wires is that inaddition to their obvious electricalcharacteristics, they always add a

mechanical component to the design.In Evan’s circuits classes, the wires incircuit diagrams can be stretched andshrunk without having any effect onthe circuit. While there are obviouseffects on the electrical characteristicslike resistance when using longer orshorter wires, one cannot forget theconsequences for the mechanics ofthe circuit.

The flexibility of the wire and thesize of the wire (both length andgauge) are important things to consid-er. Often, electronics are not given a lotof real estate in a project, so you needwires that are easy to physically fitsomewhere around your board.

Or maybe the wires need to jumpthrough some holes or take a corneraround a bit of the frame, so you’llneed wire flexible enough to make the journey.

Or perhaps for some reason youwant to add connectors to the wiresfor some harebrained application —

AUTO SPORT CONNECTORS AND CRIMP TOOL.

V-BOT ARM. V-BOT CONNECTORS.

V-BOT CONNECTIONS.

SERVO 01.2008 63

TwinTweaks.qxd 12/3/2007 3:28 PM Page 63

64 SERVO 01.2008

then the gauge becomes an issue.Our Micro AS connectors could handlea maximum wire gauge of 22, sowe thought we would be fine withwhatever wires the V-Bot might throwat us.

To our mild surprise, the V-Bothad very fine gauge wires, probablyabout 26 or even 28. Thankfully ourplan was to extend the wires anyway,

but the small gauge just ensuredthat soldering them would be allthe more fun.

Robot CubismNow that we had the neces-

sary tools, connectors, and wires,we were ready to start the realsurgery. The first order of businesswas to completely separate theV-Bot’s arm from its body, whichwas achieved by simply cuttingthe wires. We cut the wires inthe middle to make the next stepas easy as possible — extendingthe wires.

We extended the arm wireswith 22 gauge wire. First, we carefully tinned both tips and thensoldered them together. The smallgauge of the V-Bot’s wiresdemanded caution while soldering

— if we weren’t careful, the insulationmight creep back irretrievably.Thankfully the insulation decided totough it out, and we were ready toattach the AS connectors.

As most good robot buildingbits, our connectors were scavenged.Scavenged connectors are likely toalready be outfitted with pins andsockets, so we busted out anextraction tool to take care of thestragglers. In many situations, you might actually want to leave extra pins and sockets because only when all five holes are filled will the connector truly be environmentally sealed, but we

wanted to conserve pins and sockets.To use the extraction tool, all

you have to do is dip it in somelubricant and then pull the offendingpin or socket. The other end of theextraction tool is actually an insertiontool, but inserting the pins andsockets is usually easy enough to dowithout any help. Just press in untilyou hear the click and presto — youhave a connector eager for somethingto connect to.

There is actually one more piece ofbusiness to be taken care of before theconnection can be made — crimping.The pins and sockets must be crimped onto the wires, and mil-specconnectors require a mil-spec crimper.Our fancy crimper precisely crimps the barrel in eight places — when donecorrectly, those pins and sockets aren’tgoing anywhere.

Once the extended wires were outfitted with the connectors, all thatwas left to do to give the V-Bot back itsarm was to connect them. That beingdone, we turned on the bot to see thatour surgery didn’t have any unexpect-edly fatal side effects, and we wererelieved to find that the V-Bot woke upwith just a little bit of soreness.

The real test, though, was to see ifthe arm would function when it wasreconnected. We had to notch theshoulder a bit to give the extendedwires room to escape, but other thanthat the V-Bot emerged relativelyunscathed (with the exception of theaforementioned headlights).

We turned the bot on for themoment of truth, and we were excitedto see that the arm was working justfine. The V-Bot may not have been better, faster, or stronger, but it was atleast somewhat modularized.

Meaningful ModulesWhile the modified V-Bot may not

have been the best example of a modular robot, real modular robots areout there doing great things (or atleast they’re in the lab getting ready todo great things). In the summer of2004, we had the opportunity to be apart of an apprenticeship program atthe Palo Alto Research Center, and we

V-BOT SURGERY.

FUN WITH V-BOT.

V-BOT CONTROLLER.

Twin TTweaks ....

TwinTweaks.qxd 12/3/2007 3:28 PM Page 64

were able to see some modular robots firsthand.

Modular robots can be used foreverything from search and rescueoperations in piles of rubble to mainte-nance in pipelines. But what is it thatmakes modular robots so useful?

Modular robots have an edge inrobustness, scalability, and adaptability.Many modular robots are made of regular modules, more like the Bioloidthan the modified V-Bot. That meansthey can be rearranged and recon-structed to create a variety of differentshapes capable of tackling differenttasks. Perhaps a modular bot can startout as a wheel blazing across flat terrain and turn into a slithering snaketo deal with uneven surfaces. Our modified V-Bot couldn’t really do that— perhaps after modularizing a fewmore appendages it could give a pass-able impression of a Picasso painting,but not too much else (maybe Dalí).

Fancy modular robots are alsoable to attach and reattach modulesdynamically. Sometimes this is accom-plished using shape memory alloys atthe interface between modules, or perhaps even just mechanical latches.The V-Bot couldn’t ditch its arm in aheartbeat, because screws have to beundone and the connector disconnect-ed. But if the V-Bot was to break anarm by performing a karate chop onthe wrong robot, it would be quick toamputate the damaged limb and,assuming we had another module atthe ready, outfit it with a new one.That gets to the heart of one of thegreat advantages of modular robotdesign — robustness. A modular robotcan simply leave behind damagedmodules, and though that might seema bit coldly utilitarian, it’s certainly amuch more favorable outcome thanhaving one faulty bit take out theentire bot.

Another major advantage of modular robots is in scalability.Regular modules can basically be interchangeable parts, so such botswould be easy to mass produce. It canalso be a great way to prototype —make a smaller version of a final botthat’s smaller in the sense that it justuses less modules. By the same token,

modular bots are also easy to expandand modify. To add a sensor, all youwould have to do is add another module instead of cracking the wholething open and wondering how tomake it all fit together.

For all of these advantages, itwould seem like every robot shouldbe modular, but there are somedesign hurdles that also make themas intimidating as they are appealing.For one, to make truly independentmodules, they all need to have theirown power sources. When you’redealing with a lot of modules, thatcan start to get a bit hairy. Also, trulyindependent modules would all needtheir own processors, and if you wantthem to be equipped with sensors orsome other sort of mechanicaldevice, it’s starting to look like a lot ofthings to include in a single module.The modular unit might be very difficult to design, but the potentialrewards are certainly enough to havea lot of very smart people trying tosolve the problem.

So, in the end our modified V-Botmight not have been a great exampleof a modular robot, but that doesn’tdetract from its overall coolness, even ifit might be more of a toy than a robot.The V-Bot does not have any externalsensors, so in that sense it doesn’t even

skirt the formal definition of a robot. Itdoes, however, look like what manypeople expect a robot to look like, andit acts like what many people expect arobot to act like.

However inaccurate this concept ofrobots propagated by children’s toys and summer blockbusters may be, wethink the V-Bot does a good job of capturing the essence of that popularconception. We were also veryimpressed by the V-Bot’s sophisticationand apparent hackability, so we would-n’t be too surprised to see it rear itshead in the magazine in the future (tothumping techno beats, of course). SV

V-BOT KARATE!!

SERVO 01.2008 65

More Than Meets the Eye

TwinTweaks.qxd 12/3/2007 3:29 PM Page 65

66 SERVO 01.2008

Electronic Parts & Supplies Since 1967

www.c-stamp.com

LOW C

OST!CONTROLLERS & ROBOT KITS – SENSORS – DISPLAYS

FreeExpert

TechnicalSupport

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, andservices, go to www.servomagazine.com

and click on Robo-Links.

RobolinksJAN08.qxd 12/6/2007 3:09 PM Page 66

Artificial Intelligence literature calls this characterizationability “clustering” and it is often used for data-miningand analyzing very complex data sets where a human

cannot easily determine a pattern in the data by simply looking at a graph. This is a fascinating topic of its own, but for this month’s article we are going to look at how aparticular clustering technique called a Self-Organizing Map can enable a simple microcontroller circuit to learn todynamically categorize the data it senses over time.

A Self-Organizing Map is a form of unsupervised learning which means that there is no “teacher” presenttelling the program whether its answer is right or wrong.Instead, this neural network model is concerned with findingpatterns in sensory data and classifying them. There is no correct or incorrect answer in this case, however there is aninductive bias or embedded prejudice in the network towardsanalyzing the data in the specific manner you set up. Butmore on inductive bias in a bit.

Self-Organizing Maps are a particular form of competitive learning referred to as winner take all.Competitive learning is a class of neural network learning inwhich neurons in a given network compete for activation.“Winner take all” means that neurons are arranged in a single layer and only one can fire at a time; hence they“compete” for activation.

A two-dimensional Self-Organizing Map can be visual-ized easily as a graph. Data points show the relationshipbetween data collected from two sensors, in this case temperature and light. They are plotted together and, as youcan see, certain patterns or clusters are visible in the data.

A Self-Organizing Map is initialized by creating randomprototype vectors, or points on the graph. Over time as the

learning rule is applied, these prototype vectors movetowards different clusters in the data and come to representthe general properties of the region. This eventually createsan emergent data topography which extracts features from the data and — more interesting for our purposes —allows a program to classify new input data in light of past experience.

The learning method for a Self-Organizing Map is actually quite simple and intuitive. Once a data set isacquired, the programmer needs to decide how many prototype vectors should represent the data space. This iswhere the inductive bias I mentioned earlier comes in,because here you are telling the program how many categories to look for in the data. If you want the program tothink like you do, this isn’t a problem, but if you want to learnsomething new from seeing how the program categorizesmessy data, I suggest using more prototype vectors than youthink you might need; extra prototypes will just be redundantbut missing prototypes are harder to spot.

by Heather Dewey-Hagborg

Imagine if your robot could learn to characterize its sensations. Could it evolve its

own language to describe its “feelings?” They might be literal sensations derived

from sensors rather than self-reflection, but it is still a provocative idea ...

DIFFERENTBITS

DIFFERENTBITS

NEURAL NETWORKS FOR THE PIC MICROCONTROLLERPART 4: SELF-ORGANIZING MAPS

FIGURE 1. A winner take all neural network layout with twoinputs and one prototype vector. Only the winner is activated.

SERVO 01.2008 67

DifferentBits.qxd 12/3/2007 3:34 PM Page 67

DIFFERENT BITS

68 SERVO 01.2008

In our example, I collected light and temperature datafrom 30 minute increments over a 24 hour period of time in a window in my apartment. They are saved to the PIC’sinternal EEPROM which has plenty of space for this amountof data. I initialized my Self-Organizing Map with four prototypes to start, imagining it could discover the basicboundaries of hot and cold, light and dark. I find the average sample value for both sensors and then I restrict therandom values chosen for the prototypes to reflect the actual data collected.

In CCS PIC C code, it looks like this:

// specify the range of random integers// to generate (0–50)#define RAND_MAX 50

//now we have 96 addresses in eeprom//representing 48 2-d datapoints

//calculate the mean for both sensorsmeanX = 0;for (location=0;location<(samples*2);location+=2){

x = read_eeprom(location);meanX+= x;delay_ms(10);

}meanX /= (float) samples;meanY = 0;for (location=1;location<(samples*2);location+=2){

y = read_eeprom(location);meanY+= y;delay_ms(10);

}meanY /= (float) samples;

for (i=0;i<proto_num;i++){ prototypes[i][0] = rand()+round((meanX-25)); prototypes[i][1] = rand()+round((meanY-25));

}

The next step is to iterate through the training data, inthis case, the collected light and temperature readings, and

to begin to update the prototype vector values.For each data point, we begin by finding the prototype

vector that has the closest value. In the graph in Figure 2, you can see how for any given data point one prototype isclearly the closest. We measure this using the standard distance formula:

In CCS PIC C code, the following two functions calculatedistance between two points:

#include <MATH.H>

float sqr(float x){return x * x;

}

float distance(int x1, int y1, int x2, int y2){return sqrt( sqr((float)x1-(float)x2) +

sqr((float)y1-(float)y2));}

If we had higher dimensional data, for example usingthree different sensors, we would just scale up the distanceformula accordingly.

We compare each prototype vector to the currentdata point and the one with the smallest distance is our“winner.”

The next step is to reinforce this relationship bybringing the target prototype vector closer to the datapoint. To do this, we first need to specify a learning rate;the amount to change the winning prototype after eachiteration. In our example, I chose a static learning rate of.025. It is also possible to change the learning rate overtime, allowing you to gradually narrow in more closely onthe ideal position for each prototype vector. To do this, we

FIGURE 2. A graph of thedata set sample values.

FIGURE 3. Agraph of the Self-Organizing Mapsample valuesand the initialprototype values.

DifferentBits.qxd 12/3/2007 3:34 PM Page 68

would simply subtract a small amount from the learningrate after each iteration through the data set. In otherwords, if we start with a learning rate of .05 and we have48 data points which we iterate through 30 times, wemight subtract .001 from the learning rate after eachiteration, leaving us with a final learning rate of .02. We don’t subtract after each data point, only after eachrun-through the entire set.

Once we have a learning rate specified, we determinehow much to change the prototype vector by multiplying thelearning rate by the difference between both components ofthe two vectors. For example, if the learning rate is .05, ourdata point is (122, 180) and our prototype is (84, 203), wewould adjust it as follows:

Delta = learning rate * (point 1 x – point 2 x)

Delta = .05 * (122 – 84)Delta = 1.9New prototype x value = 84 + 1.9 = 85.9

Delta = .05 * (180 - 203)Delta = -1.15New prototype y value = 203 -1.15 = 201.85

Then we round the floating point value off to the nearest integer to keep our memory consumption limited.The new values for our prototypes would be (86, 202). Asyou can see, the prototype vector has moved a little bit closer to the data point.

In code, it looks like this:

– a function for rounding

long round(float x){long x2;

if (x>=0){x2 = (long)(x+0.5);

}else {

x2 = (long)(x-0.5);}

return x2;}

– updating both coordinates of the winning prototype

temp1 = (long)x - (long)prototypes[winner][0];temp2 = c*temp1;prototypes[winner][0] = round( prototypes[winner][0]+temp2);

temp1 = (long)y - (long)prototypes[winner][1];temp2 = c*temp1;prototypes[winner][1] = round( prototypes[winner][1]+temp2);

We repeat this update process for each data point a set

number of iterations. In my example, 10 iterations was more than enough. Now the prototype vectors have movedto positions representing clusters of data.

If we feed a new input vector into the program, itwill recognize it as one of the four categories. I set mycircuit up to output to one of four LEDs, depending onwhich category it was sensing. At this point, you can decideif you want to halt learning, or allow the program tocontinue the learning process in a more restricted fashion.In my code, I chose to halt learning, but the code tocontinue learning with a limited learning rate of .005 isincluded in the comments.

You might be wondering how it is possible to mapspecific physical outputs to outputs of the Self-OrganizingMap when we don’t know ahead of time how it is goingto shape up. This question is resolved by a different typeof neural network called an Oustar which combines a

competitive layer like our Self-Organizing Map with a supervised output layer like the feedforward neural networks we looked at in the September issue. By adding ateacher, we are able to decide which clusters of data will berepresented by which output. This is useful in situationswhere you know what relationships you want the networkto learn in advance.

One of the things I find fascinating about theSelf-Organizing Map is the idea that the program canhave a kind of emergent knowledge all its own; something

FIGURE 4.Graph of the Self-Organizing Mapsample valuesand the finalprototype values.

• Source code for the CCS PIC C, a hex file, and the Processingapplication are available from the SERVO website at www.servomagazine.com.

• Processing IDE and compiler available for free online atprocessing.org

RESOURCES

SERVO 01.2008 69

DIFFERENT BITS

DifferentBits.qxd 12/3/2007 3:34 PM Page 69

I framed but never really specified and could neverpredict. One example I like is the idea I mentioned at thebeginning of this article of an emergent language: Overtime, a robot could map different sensations to differentprototypes. These prototypes would then be assignedrandom combinations of phonemes as names, graduallydeveloping into a very primitive vocabulary. A processorlike the Parallax Propeller with an established vocal tractlibrary makes this project a bit easier to tackle. Imagine,your robot telling you all about its feelings in its owninvented language! Well, maybe that is a project for afuture article ...

The CCS PIC C microcontroller code and a coordinatingapplet from this article are available on the SERVOMagazine website. The microcontroller code implements a simple Self-Organizing Map which uses an analog temperature sensor and an analog light sensor as input.This should work with any two analog sensors you choose.The circuit collects data from the sensors every 30 minutesfor 24 hours and outputs the samples in a distinct formatout the serial port. If you want to speed up the data collection process, just change the timing loop. Once thedata collection period is over, the circuit goes through alearning phase and then moves into an infinite loop whereit outputs its categorization of new input to one of four

LEDs and prints the sensor data.The applet is written in Processing, an easy to use

front end for Java. The applet has two modes: first, it justcollects data from the microcontroller (over the serial port)and displays a time vs. sensed values graph of the data.It saves an image of this graph as ‘data.png.’ Then theapplication switches into a different mode and displaysa plot of the accumulating input data and the prototypevectors dynamically updating over time. Press the ‘e’ keyto exit the application and save an image file of thegraph (‘SOM.png’), as well as a text file (‘capture.png’) ofall the data.

You will need to tweak the Processing code to use theright serial port for your computer if you aren’t using COM1.Also, if you change the number of prototypes in the PICcode, you will need to update the coordinating variable in theProcessing code.

Please drop me a line and let me know if you use theseideas or code for any of your own projects. I would love tohear about them! SV

Heather Dewey-Hagborg can be contacted via email [email protected].

CONTACT THE AUTHOR

70 SERVO 01.2008

DIFFERENT BITS

DifferentBits.qxd 12/3/2007 3:35 PM Page 70

As a child, I imagined robots beinggoverned by tubes and relays — not

an unusual image given the science fiction movies of the time, like Robbiethe Robot in Forbidden Planet. Today,fictional robots are depicted with minia-ture microelectronic brains, with “emo-tion chips” the size of a fingertip. Andno wonder, because these things actual-ly exist! Far from science fiction, withtoday’s technology you can build a robotwith a brain no larger than a caterpillar.

What’s more, these brains aredesigned to interface with the outsideworld. These so-called microcontrollers arepart computer, part input/output. In onechip-sized package is an affordable programmable computer with a multitudeof I/O for connecting to a robot’s variousmotors and sensors. The best news is thatthese microcontrollers are inexpensive.Some are as cheap as a dollar each; ver-sions that come with a complete develop-ment kit are $50 to $150. In all, a bargain.

This month, we’ll explore a varietyof options for inexpensive microcon-trollers suited for small robotics. Thoughthe microcontroller is basically a generic, universal device, some of theseproducts are expressly designed for usein amateur robots. And those thataren’t are still very capable of the job, asthey have the core ingredients neededto control most any real-world device.

Under the HoodMicrocontrollers are single-chip

computers, capable of running user-defined programs, accepting input fromswitches and other devices, and control-

ling the state of one or more outputs.Microcontrollers are expressly designedto be used in so-called embedded appli-cations, where control of some externaldevice is the main goal. Typical uses forembedded chips include the on-boardcomputer in your car, the “smarts” in amodern-day television, even the controlcircuitry in a coffee maker.

For the typical robot application,the microcontroller uses previously prepared custom programming to readone or more sensors. Based on the condition of those sensors, the controller then activates or deactivatesoutputs connected to motor drivers.

For example, suppose you’ve built arobot that senses the brightest light inthe room. The robot is “trained” to go tothat light. You’ve built your bot with twolight sensors, both of which pointstraight ahead like headlamps on a car.These light sensors are connected to twoanalog inputs of the microcontroller (notall microcontrollers have analog inputs;this is just for illustration purposes). Theprogram — which you’ve written andwhich constantly runs in the microcon-troller — reads the intensity of the sen-sors. The controller will activate either ofthe robot’s two motors in order to steerthe vehicle into the direction of the light.

The brains on board your bot knowthe light is straight ahead when thereading of the two sensors is the same.At that point, the controller activatesboth motors at the same time, causingthe vehicle to move toward the light.

This is just one of many possibleapplications for microcontrollers in robot-ics. As you work with microcontrollers and

various types of sensors — be they optical,ultrasonic, or whatever — new and creative uses for your robot emerge. Forinstance, if you can interface an electron-ic compass to your robot, you can write aroutine for the microcontroller that tellsthe robot which direction it’s facing.

A tilt sensor could be used on aself-balancing robot (two wheels, like aSegway); a GPS could inform the robotwhere it is on the Earth down to thenearest few feet; an optical distancesensor could tell the bot how far awayit is from the nearest object, and so on.

Variations in Designand Features

Not all microcontrollers are thesame. Sure, they all contain some kind ofcomputational unit, some place to holdyour program (microcontrollers retaintheir programming when switched off ordisconnected from power), and someworking RAM to run everything. But theydo vary in things like the number and typeof inputs and outputs, internal timers,and the amount of space for programs.

The most basic microcontroller has asmall handful (four or five) of connectingpins that can be used as either inputs oroutputs. These I/O pins — or lines — arepurely digital. That is, as inputs, the linescan be low or high (0 or five volts, respec-tively). Same if the pins are acting as outputs. This means you can read on/offtype sensors such as switches, and controlon/off devices such as LEDs and motors.

Many types of sensors are analog;that is, they don’t just provide on or offstates. A good example is the light

Small Brains for Your Bot

Tune in each month for a heads-up onwhere to get all of your “roboticsresources” for the best prices!

SERVO 01.2008 71

RoboResources.qxd 11/30/2007 11:22 AM Page 71

72 SERVO 01.2008

sensor described in the previous section. Its output varies from nearlyzero volts, to perhaps the full five voltsof the robot’s power supply. The instan-taneous reading of the sensor indicatesthe amount of light falling on it. Thoughdigital inputs can be used to read analog values (this requires additionalcircuitry), the best method is to use amicrocontroller with analog inputs.

Many controllers come with at leasta few analog input pins. In some, thepins are to an analog comparator; youcan compare the voltage to one pinagainst a control voltage. In others, thepin is connected to an analog-to-digitalconverter inside the controller. Your pro-gram reads the pin, and a digital valuerepresenting the voltage level is returned.

So far, we’ve mentioned connectingthe microcontroller to a motor, LED, orother output. The ability of a microcon-troller to directly interface to a devicedepends on how much current it can sup-ply from its output pins. Most controllerscan be connected to an LED — through acurrent-limiting resistor, of course. TypicalLEDs don’t require more than 10-14 mAof current to light up, and most controllers can supply this on a single pin.

This is not often the case withmotors and other devices that requirehigh currents. If the microcontroller doesnot have its own high-current outputs —and most do not — then in these cases,you need to use a driver circuit of sometype. The most common driver circuit formotors for use in robots is the H-bridge,so called because it uses four transistorsconnected in a kind of H-shaped pattern.Two outputs of the microcontroller turnthe motor on and off, and determine itsdirection. With more elaborate program-ming, you can pulse the control pin tocontrol the speed of the motor. Thisinvolves a technique known as pulsewidth modulation, or PWM. You can doan Internet search to learn more about it.

There are other features that differfrom one microcontroller to another,such as the number and type of internaltimers. You use these timers to do thingslike create wait delays, generate complexsignal forms (like PWM), even generatemusic. Then there’s the amount of mem-ory reserved for your programs, the max-imum operating speed of the controller,

the package style (whether DIP or something else), and much, much more.The feature set of a microcontroller isdescribed in its specification sheet.That’s where you can read up on whatthe chip does, and how you might use it.

The large microcontroller compa-nies (such as Microchip and Atmel) provide comparison charts that list thedifferences. If you’re just starting outwith microcontrollers, all these differ-ences can be mind-boggling. Ratherthan guess as to which one is best, goby the example of others. What areother robo-builders using? Find out, getthe same chip, and start experimentingwith it. Learn by their example.

Interpreted Languageor Compiled Language

One last major difference betweenmicrocontrollers is how they are pro-grammed. The two principal methodsare either using an interpreted lan-guage built into the chip or compilingyour program to a form for direct use inthe controller. In both cases, you deviseyour program on a PC, then downloadthe result to the microcontroller itself.

Let’s start with the interpreted language approach first. These microcon-trollers are inherently easier for mostbeginners. The chip itself contains aninterpreter that accepts programminginstructions — typically modeled after theBasic programming language — and converts these instructions in real time tosomething that the chip can use. The ven-erable BASIC Stamp is a good example ofan interpreted language microcontroller.

In order to use the BASIC Stamp,you need only a programming environ-ment for your PC and a cable to connectfrom your PC to the microcontroller.Parallax — the makers of the BASICStamp — offers a development kit withall the pieces necessary to get started.

With the compiled approach, themicrocontroller starts out with a blankcanvas. You write a program on yourPC, then compile it to a form that thecontroller can use. Once compiled, theprogram is downloaded to the microcontroller via a cable. The form ofthe program is most often a series ofhexadecimal (base 16) numbers. If you

were to open one of these programfiles in a text editor, it would appear asgibberish. But to a microcontroller, thenumbers represent specific program-ming steps and actions.

By and large, interpreted languagecontrollers tend to be a little more expen-sive, but they don’t require the investmentof a programming language and compiler,as these are already built into the chip.You’re given the software that lets youprogram the chip for free. The interpretedlanguage controllers are often easier touse because the programming environ-ment is more consistent. Because the lan-guage is built into the chip, it doesn’tchange as much; this leads to more exam-ples from both the makers of the micro-controller, and the existing user base ofthose sharing their ideas on the Internet.

Your choice of whether to use amicrocontroller that’s programmedwith an interpreted language versus acompiled language is largely a matterof personal needs and requirements.

SourcesFollowing is just a small selection

of low-cost microcontrollers suitable for use in amateur robotics. There areliterally hundreds and hundreds tochoose from, and there simply is notspace to list them all.

Active Robotswww.active-robots.com

Selection of robots and roboticconstruction products, including microcontroller boards designed withamateur robots in mind.

Atmel Corp.www.atmel.com

Makers of several lines of microcontrollers, including AVR — avery popular eight-bit controller usedextensively in amateur robotics.

Axiom Manufacturing, Inc.www.axman.com

Specializes in single board comput-ers, embedded controllers, customdesign, and manufacturing solutions.Products include single board comput-ers based on the Motorola 68HC1xmicrocontrollers, as well as others.

RoboResources.qxd 11/30/2007 11:23 AM Page 72

Basic Micro, Inc.www.basicmicro.com

Basic Micro produces the MBasicline of compilers for PIC microcon-trollers. Among their products are:development boards, getting startedkits, programmers, BasicAtom micro-controllers, and prototyping boards.

BasicXwww.basicx.com

The BasicX is a general-purposemicrocontroller with a built-in program-ming language. You write programs onthe PC using a Basic-like syntax, thendownload them via a cable to theBasicX, including the BasicX-24 — anall-in-one module that is pin-compatiblewith the Parallax BASIC Stamp.

BD Microwww.bdmicro.com

Developers and sellers of theMAVRIC line of Atmel AVR-basedmicrocontrollers, designed principallyfor use in robots.

BittyBotwww.bittybot.com

Makers and sellers of the MEGAbittyminiature microcontroller board. TheMEGAbitty is based on the Atmel MEGAAVR microcontroller. Though small —literally postage stamp sized — theseboards offer full function. They are perfectly suited for mini Sumo and othersize-restricted robot competitions.

Blue Bell Design, Inc.www.bluebelldesign.com

Blue Bell offers a unique co-proces-sor dedicated to robotics control. Theco-processor adds servo control, A-Dinputs, switch debouncing, and otherfeatures, and connects to your robot’smain microcontroller.

Chuck Hellebuyck Electronicswww.beginnerelectronics.com

Chuck resells the Basic Atom fromBasic Micro, as well as his own customboards. His BasicBoard is a general-purpose microcontroller board withLCD panel, speaker, LEDs, and othercomponents built in. It’s designed as aget-it-working-quick solution for a variety of embedded tasks. Various

single function module boards helpspeed the development of commontypes of circuits. Modules include switchI/O, light sensor, and relay control.

Dontronics, Inc.www.dontronics.com

Dontronics specializes in microcon-trollers, as well as the SimmStick proto-typing development board system.Based in Australia, he ships worldwide.

EMAC, Inc.www.emacinc.com

Single-board computers and microcontrollers in a range of sizes and types. A line of their single-boardcomputers are PC compatible, and canrun DOS, Windows, or Linux.

Gleason Researchwww.gleasonresearch.com

Gleason Research sells the MITHandy Board and Handy Cricket single-board computers. The HandyBoard (see the end of this article) is afavorite at MIT, and many universityand college robotics courses.

Hobby Boardswww.hobbyboards.com

Offers microcontrollers designedfor simple one-wire connectivity.Applications include home automation,home and garden, and weather. Ofcourse, robotics encompasses many ofthese aspects, as well.

Kanda Systems Ltd.www.kanda.com

Offers programmers for microcon-trollers for the following microcon-trollers and sub-systems; the 8051,Atmel AVR, CAN, Internet/Ethernet,Scenix, ST7, and Xicor.

Support for the Atmel AVR line is a specialty. Also sells starter kits, microcontroller chips and developmentboards, project boards, compilers andprogramming software (for both Basicand C), books, and PC interfaces.Additional offices in the United States.

Kevin Rosswww.kevinro.com

Kevin Ross offers the BotBoard Plusmicrocontroller boards, and BotBoard

interface products. Many of the boardsare available in kit or assembled form.The BotBoard Plus uses a Motorola68HC11-based microcontroller and pro-vides various connectors to attach robot-ic parts to it. According to Kevin, “TheBotBoard Plus is widely used by universi-ties and hobbyists for learning andexperimentation. The members of theSeattle Robotics Society have been usingthe BotBoard design for several years.”

Kronos Roboticswww.kronosrobotics.com

Kronos has developed a line of micro-controllers in various lines (Dios, Athena,Perseus, and Nemesis) where speed andlow cost are key features. The chips support code libraries of functions, whichallow you to readily program the chipwithout having to re-invent the wheel.Additional products include various co-processor boards and adapter modules.

Lorax Workswww.loraxworks.com

Sells a unique microcontroller usingthe FORTH programming language.

Maximum Roboticswww.maximumrobotics.com

Controller boards and developmenttools for microcontroller-based robotics.

microEngineering Labswww.melabs.com

microEngineering Labs makes andsells development tools for theMicrochip PIC microcontrollers, thePICBASIC Compiler, and other products.

Microchip Technologywww.microchip.com

Microchip makes a broad line ofsemiconductors, including the venerable PIC microcontrollers. Theirwebsite contains many datasheets andapplication notes on using these controllers; you should be sure todownload and save them for study.

MicroMint, Inc.www.micromint.com

MicroMint offers single-chip con-trollers with built-in Basic interpreters,stackable controller boards, PicStic micromodules, miniature modems, and more.

SERVO 01.2008 73

RoboResources.qxd 11/30/2007 11:23 AM Page 73

74 SERVO 01.2008

National Control Deviceswww.controlanything.com

NCD offers microcontroller-enabledproducts useful in robotics. Theseinclude: A/D converters, character displays, graphic displays, input/outputdevices, I/O expansion modules, microcontrollers, motor controllers,relay controllers, and serial interface.

NetBurnerwww.netburner.com

Ethernet controllers for embeddedapplications. They offer a completedevelopment package, or modules fornet-enhancing control electronics.

New Micros, Inc.www.newmicros.com

New Micros, Inc., is a leading manu-facturer of microcontrollers, single boardcomputers (SBC), peripherals, and sup-port electronics. Robotics is singled outas an ideal application for the company’sline of DSP-based microcontrollers.

Oricom Technologieswww.oricomtech.com

Oricom develops PIC and OOPic-based robot controllers, as well asextension modules, such as Zigbeewireless. The website includes experi-mental project info, links, and articles.

Parallax, Inc.www.parallax.com

The BASIC Stamp revolutionizedamateur robotics, yet the concept issimple: Take an eight-bit microcontrollernormally intended to be programmed inassembly language, then instead ofrequiring folks to learn assembly, embeda language interpreter within the micro-controller so that it can be programmedin a simpler language, namely Basic.Additional microcontroller offeringsinclude the new Propeller chip — aninventive device containing multiplecontrollers in one package.

PICAXEwww.picaxe.co.uk

Small and affordable interpretedlanguage microcontrollers. Available inseveral versions, with different I/O pinsand capabilities. Check the Distributorspage for online retailers.

Pololuwww.pololu.com

The Orangutan is a specialty controller made for controlling smallrobots. Offered in several versionsincluding a compact and inexpensive“baby” format.

Rabbit Semiconductorwww.rabbitsemiconductor.com

Rabbit makes a popular eight-bitmicrocontroller and associated developer kits; the Rabbit system isknown for its speed, hence its name. In addition to bare controllers, thecompany also sells “core modules”such as Ethernet connectivity built in.

Renesas Technology Corpwww.america.renesas.com

Manufacturer of a large line of microcontrollers and support electronics. Check out their web pagefor product availability, app notes, andspecifications sheets.

Reynolds Electronicswww.rentron.com

Rentron offers kits and ready-made products for the electronicsenthusiast and robotmeister, includingPICBASIC and PICBASIC PRO compilers,BASIC Stamp, Microchip PICs, Intel8051 microcontrollers, remote controls, tutorials, projects, RF components, RF remote control kits,and infrared kits and components.

Savage Innovations/OOPicwww.oopic.com

Manufacturer of the OOPic micro-controller line, offering multi-taskingand built-in “objects” that simplify programming. Many of the objects are directly suitable for robotics. Soldby distributors.

Southern Oregon Roboticswww.1sorc.com

Specializes in microcontrollers forSumo robots. Ready-made or blankboards available.

SparkFunwww.sparkfun.com

Offers a wide assortment of microcontroller development boards

and modules. Check out their line of “breakout boards” which are smallcircuit boards for attaching to the restof your robot electronics.

Systronixwww.systronix.com

Embedded control hardware, soft-ware, enclosures, components, etc. Javaand non-Java systems (such as JStamp).

TECELwww.tecel.com

Microcontroller boards using80C251, 80C552, 8051, and 68HC11controllers. Compiler, assembler, andloader software included upon purchas-ing any of the microcontroller boards.

Technological Artswww.technologicalarts.com

Technological Arts producespostage stamp sized single board computers using the Motorola 68HC1xmicrocontrollers. A number of special-purpose application boards are alsooffered, and many are suitable forrobotics.

The Handy Boardwww.handyboard.com

The Handy Board uses a Motorola68HC11 microcontroller to build asophisticated robotics central brain.The Handy Board is used in many college and university robotics courses(it was originally developed at MIT) andis suitable for education, hobby, andindustrial purposes. As the websitesays, “People use the Handy Board torun robot design courses and competi-tions at the university and high schoollevel, build robots for fun, and controlindustrial devices.”

A great deal of documentation,user-supplied programs, and othermaterial exists to support the HandyBoard. But one of the best is a book bythe Handy Board’s creator, Fred Martin.Check out Robotic Explorations: AHands-on Introduction to Engineering(ISBN 0130895687). SV

Gordon McComb can be reached viaemail at [email protected]

CONTACT THE AUTHOR

RoboResources.qxd 11/30/2007 11:23 AM Page 74

Direct Memory Access — Final examsSocket — What to do when the TV doesn’t workBank Switching — Looking for the best interest rateCellular Communications — Nerve impulsesCitizens Band — A block watch groupFax — The only thing Joe Friday wantsOversampled — When there isn’t enough fudge for the guestsEqualizer — A .44 magnumRAM — A male sheepDynamic RAM — A male sheep in mating seasonRAM Chips — What’s left in the field after the male sheep leavesTerminator — Arnold SchwartzenegerHex Inverter — Counteracting a spellEdge Connector — Holding hands Wow and Flutter — Your first kissC+ — A passing gradeAutomatic Gain Control — Nutri-System dietNoise Control — CandyDebouncing — Sneaking back into the night clubHertz — A bruiseMegahertz — A broken legGigihertz — Hitting your funny boneTerahertz — Strip miningELF — A small mythical humanList Processing — Grocery shoppingObject Oriented Language — Grounds for a sexual harass-ment suitSatellite Dish — An attractive groupieFine Thread — Nice clothesFloppy Disk — The cause of many back painsCosine — Helping your kids get a loanPriority Interrupt — A TV commercialExternal Storage — A refrigeratorInternal Storage — FatDischarge Rate — Credit card limitCharge Transfer — Automatic teller machineNon-coherent Radiation — A political speechDegreasing — Low cholesterol cookingSoft Error — Finding out she’s marriedHard Error — Meeting her husbandTwo-part Continuous-roll Forms — Toilet paperLine Error — A football official’s mistake

Direct Address — When she gives it to youIndirect Address — When you have to use the phone bookHard Copy — Your wife’s imitation of your mother’s cookiesInductor — An Army recruiterDIP — A strange personDual-in-Line — When you split up to find the fastest check-outFlip-flop — Missing the pancake and it lands on the floorHardware — A suit of armorASCII — The usual position for novice skiersStack-pointer — Someone who indicates pretty girlsAccumulator — A junk collector or your kidsProgram — A show on TVLoad Immediate — Drinking on the jobListing — Posture after immediate loadingRun time — How long it takes to get to the bathroomTerminal Message — The dying man’s last wordsKeypunch — The knock-out blowDropping a bit — A small decrease in energy (The tempera-ture is dropping a bit.)Head Crash — A sleeping hippyParity — What the cage smells like after the bird is removedParity Error — A bird that says the wrong thingsParity Test — Polly want a cracker?Interface — The resting place for a thrown cream pieReverse Polish Notation — Telling a joke backwardsComputer Card — A funny person who works in ITLogical Decision — Deciding not to visit the in-lawsBus Design — Making a vehicle to take kids to schoolBidirectional Bus — A bus that services two schoolsOhm — Where you go after workResistor — At one time you couldn’t do this to your wifeCPU — The smell of the oceanSource Program — A live TV showObject Program — Charlie’s AngelsAnti-Alias — Face recognition softwareFlow Chart — Insurance documentation of basement floodingLong Wave — Signaling good-bye from a slow shipSky Wave — Signaling good-bye from an airplaneDamping Factor — Amount of water needed for ironingLimiter — A parent e.g., “One more cookie and then it’s bed-time.”Julian date — A fig-like treat made by Julie SV

Terms of EndearmentWhat those familiar terms really mean

by Gerard Fonte

SERVO 01.2008 75

Appetizer.qxd 12/4/2007 2:38 PM Page 75

Robot Builder’s Sourcebookby Gordon McComb

Fascinated 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

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 allfind this book a unique and exciting sourceof projects, ideas, and techniques to becombined into a wide range of fascinatingrobots. $29.95

123 Robotics Experimentsfor the Evil Genius

by Myke PredkoIf you enjoy tinkeringin your workshop andhave a fascination forrobotics, you’ll havehours of fun workingthrough the 123experiments found inthis innovative projectbook. More than justan enjoyable way tospend time, theseexciting experiments also provide a solidgrounding in robotics, electronics, andprogramming. Each experiment builds onthe skills acquired in those before it so you develop a hands-on, nuts-and-boltsunderstanding of robotics — from theground up. $24.95

FIRST Robots: Aim Highby Vince Wilczynski / Stephanie

SlezyckiThis book looks at30 different robotdesigns all based onthe same chassis,and provides in-depth informationon the inspirationand the technologythat went into build-ing each of them.Each robot is fea-tured in 6-8 pages providing readers with asolid understanding of how the robot wasconceived and built. There are sketches,interim drawings, and process shots for eachrobot. $39.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.

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 purposesexactly, because you designed it. Written by an accomplished workshop bot designer/builder, this book gives you everything you need. $34.95

The SERVO WebstoreThe Amateur Scientist 3.0 The Complete Collection

by Bright Science, LLCThere are 1,000 projectson this CD, not tomention the additionaltechnical info andbonus features. Itdoesn’t matter if you’rea complete novice looking to do their firstscience fair project or asuper tech-head gadgetfreak; there are enoughprojects on the single CD-ROM to keep youand 50 of your friends busy for a lifetime!$25.99

Attention Subscribers ask about your discount on prices marked with an *

NNEEW!W!

76 SERVO 01.2008

WebstoreJan08.qxd 12/4/2007 3:40 PM Page 76

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.

SERVOMagazineT-Shirts

For men and women

NeNew Yw Yearear ’’ss

SpecialSpecial

$9.95!$9.95!

From HomoSapien to RoboSapien Before R2D2 there was R1D1

Take This Stuff and Hack It!by Dave Prochnow

Transform common household items into really cool stuff. Youdon't need to be an electronics genius to getstarted turning everydayitems into high-performingwonders. With how-toguru Dave Prochnow'sstep-by-step directionsand fully illustrated plans,even beginners can hack their way to a high-tech home, cooler toys, and less yard work.Certain to fire your imagination and start youplotting new, original, and even more creativewonders you can make from ordinary house-hold items, Take This Stuff and Hack It! is theperfect gift for your inner inventor. $27.95

Building Robots with LEGOMindstorms NXT

by Mario Ferrari, Guilio Ferrari

The Ultimate Tool forMINDSTORMS®Maniacs, the newMINDSTORMS kit hasbeen updated toinclude a programming brick,USB cable, RJ11-likecables, motors, andsensors. This bookupdates the robotics information to be compatible with the new set and to showhow sound, sight, touch, and distance issuesare now dealt with. $39.95

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

NNEEW!W!NEED MORE

INFO?

Go whereSERVE’ goes!

The online storThe online store @e @wwwwww.ser.ser vvomagazineomagazine .com.com

Robot Builder’s BonanzaThird Edition

by Gordon McComb / Myke Predko

Everybody’s favoriteamateur robotics bookis bolder and betterthan ever — and nowfeatures the field’s“grand master” MykePredko as the newauthor! Author duoMcComb and Predkobring their expertise to this fully-illustrated robotics “bible” toenhance the already incomparable contenton how to build — and have a universe offun — with robots. $27.95

SERVO MagazineBundles

Published by T & L Publications, Inc.

To order call 1-800-783-4624

SERVO 01.2008 77

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.

$57per bundle

Save $10

off the

normal

price!!

WebstoreJan08.qxd 12/5/2007 1:47 PM Page 77

BACK ROOM SPECIALS

The Official RobosapienHacker's Guideby Dave Prochnow

The Robosapien robotwas one of the mostpopular hobbyist giftsof the 2004 holidayseason, selling approxi-mately 1.5 million unitsat major retail outlets.The brief manual accom-panying the robot cov-ered only basic move-ments and maneuvers — the robot’s realpower and potential remain undiscoveredby most owners. This timely book covers allthe possible design additions, programmingpossibilities, and “hacks” not found anyplace else. $24.95 Sale Price $14.95Pub date: August 17, 2005

SERVO'S CUSTOMEMBROIDERED HAT

This is one good looking hat, with its stonewashed blue cap and bright yellow/goldstitching. There's no better way to showeveryone that you're well endowed with abigger - than - average brain then by proudlydisplaying your affiliation with SERVOMagazine. $ 14.95*

Hydrogen Powered Racer and Hydrogen Station

Recently named as one of the Best Inventions of 2006 by Time Magazine, the H-racer is now thebest selling fuel cell product in the world. The H-racer is a micro-version of what engineers andscientists have been dreaming about for real cars: combining hydrogen with oxygen to generatea DC current to power an electric motor. Unlike a gas-powered car engine, the only byproductsof this electrochemical process are electricity, heat, and pure water. With the H-racer, you canwitness the power of new energy technology in the palm of your hand. Horizon has createdthis unique, patented miniature fuel-cell car and hydrogen refueling station. All you need to dois add water. Only $115.00 plus S/H

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 Sale Price $13.95Pub Date October 20, 2004

The Day the EarthStood Still

An alien (Klaatu) with hismighty robot (Gort) landtheir spacecraft on ColdWar-era Earth just afterthe end of World War II.They bring an importantmessage to the planetthat Klaatu wishes to tellto representatives of allnations. Directed by: Robert WiseActors: Michael Rennie, Patricia NealRun Time: 92 minutes $14.95

Forbidden Planet:50th Anniversary Edition

A starship crew goes toinvestigate the silence of aplanet’s colony only tofind two survivors and adeadly secret that one ofthem has. Dr. Morbius andhis daughter Altaira havesomehow survived ahideous monster whichroams the planet. Directed by: Fred M. WilcoxRun Time: 98 minutes $26.95

Blade Runner(The Director’s Cut) (1982)

In a cyberpunk vision ofthe future, man has devel-oped the technology tocreate replicants, humanclones used to serve in thecolonies outside Earth butwith fixed lifespans. In LosAngeles, 2019, Deckard is aBlade Runner, a cop whospecializes in terminating replicants.Directed by: Ridley ScottRated: R — Violence $19.95

CLASSIC SCIENCE FICTION DVDS!

With this kit, you now can see andfeel the future of energy generationin your own hands!

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,” asuper-smart, single-board-powered robotthat can be built by any hobbyist. You alsoget complete instructions for incorporatingLinux single boards into your own uniquerobotic designs. No programming experi-ence is required. This book includes accessto all the downloadable programs you need,plus complete training in doing originalprogramming. $34.95 Sale Price $ 29.95

Or order online www.servomagazine.com

78 SERVO 01.2008

WebstoreJan08.qxd 12/4/2007 3:41 PM Page 78

Back in December ’05, I wroteabout robots that go to war. These

were about robots that are on theground, remotely operated from a distance. In my research, I have foundso many acronyms that are tied tothese types of robotic vehicles.

ROV for ‘remotely-operated vehicle’which is often tied to the underwater vari-ety, though it has been used to describeany remotely-operated land, sea, or evenaerial vehicle. AGV for ‘automated guidedvehicle’ which often describes the auto-mated vehicles in factories that follow linesin the floor or other command techniques.

UAV usually means ‘unmanned aerial vehicle’ though some have said itmeans ‘unmanned autonomous vehicle’for any type of autonomous vehicle withno human aboard (which seems redun-dant to me). Some have even calledthem RPVs or ‘remotely piloted vehicles.’

Typical of the military, some of thebranches have now changed the term,UAV to ‘unmanned aircraft system,’ orUAS, but most still refer to these types of flying robots as UAVs. It hasbeen the autonomous and teleoperat-ed aerial UAVs that have made thenews as of late. Unmanned robotplanes are actually not new; they’vebeen around for over 90 years.

Early AUVsDr. Archibald Low, who was born

in London, England and grew up inLondon and Australia, was much likeNikola Tesla — absolutely great at every-thing technical. He had inventions fortelevision fed through ‘phone’ wires,

rocket guidance systems, audiometry, adraftsman’s curve, and even all typesof race cars. One of his earliest projectsduring World War I was called ‘AerialTarget,’ really a misnomer as it wasactually a guided bomb.

The British wanted the Germans tothink that they were working on a targetdrone to test anti-aircraft gunnery accura-cy. The Royal Flying Corps wanted therobot plane in a hurry and Low had hispick of all types of craftsmen to do the job.In March 1917, the first plane waslaunched from the back of a truck by acompressed air catapult. He was success-ful in controlling the plane before it finallycrashed due to engine failure. The ‘UAV’was later upgraded with another first — anelectrically-driven gyro navigation system.

After the war, the project wasscrapped — typical of many ingenuousmilitary projects when funding dropsoff. A similar early autonomous aircraft— the Kettering Aerial Bomb — alsocalled the ‘Bug,’ is shown in Figure 1.This is an American entry into the earlyWWI development of the cruise missilethat would mature many years laterinto very effective weapon systems.

The German V-1Fiesler FZG-76Cruise Missile

Though the German V-1was one of the most devastatingweapons of World War II, someof their designs were based onthe work of Low and others.However, it is this vengeance

weapon that struck fear into the hearts ofBritish citizens during the darkest days ofthe war. The Fieseler FZG-76 with its 900kg warhead delivered much havoc to ter-rified Londoners between June 1944 andthe end of March 1945 (see Figure 2).

This unmanned robot “buzzbomb” — so named because of thepulse jet propulsion system — wassophisticated, even by today’s stan-dards. Unlike the ramjet that requiredhigher speeds to operate, the V-1’spulse jet used a set of venetian blindtype shutters that opened and closed45 times a second to allow a series of small explosions to power theunmanned plane along. The pulseengine was up to full thrust before theplane was launched. These rapid open-

Then NOWan

d

ROBOTS TAKE TO THE AIR

b y T o m C a r r o l l

FIGURE 2. V-1 on Display in Greencastle, IN.

FIGURE 1. Kettering Bug atUSAF Museum.

SERVO 01.2008 79

Then&Now.qxd 12/3/2007 3:31 PM Page 79

80 SERVO 01.2008

ings and closings, along with the seriesof explosions, caused the feared ‘buzz.’

I’ve heard model airplane pulse jetsoperate and can see why they have beenbanned in most populated areas; theysound a lot like a blaring horn. Much likethe landing of a mosquito in a tent atnight; the worry came when the V-1’sbuzz stopped. It proved to be the world’sfirst operational cruise missile with it veryunique guidance system (Figure 3).

The V-1 was launched from a steamcatapult (much the same as today’s Navyplanes launch from an aircraft carrier)and could reach speeds of over 580 kmper hour. The V-1 was equipped with anautomatic pilot that utilized a magneticcompass. Three compressed air-drivengyrocompasses were also used in the system. A master gyro controlled thepitch and roll through rudder and eleva-tor surfaces by an air-driven servo systemwith corrections fed into the system bythe magnetic compass. A weighted pen-dulum interconnected with the magneticcompass acted as a fore and aft attitudesensor, as well as an accelerometer. Thisingenuous arrangement allowed simpleturns to be accomplished by using onlyrudder control and no ailerons wererequired for banking.

The other two gyros damped out

errors and oscillations in theflight. Prior to launch, the V-1crew would pre-set controlsfor the required height anddirection of flight, as well asdistance to their target. A vaneanemometer (in reality, a smallpropeller in the nose of the V-1) turned so many revolutionsaccording to speed and dis-tance traveled and acted likean odometer to tell the systemhow far the missile had traveled towards its target.These turns unwound a preset

mechanical counter that would throwthe V-1 into a steep dive at the targetarea by causing the elevator to depress.

Would you believe that they actuallyused a tiny guillotine triggered by thecounter to sever the air hose feeding theelevator, causing it to depress? I wouldhave thought that a small valve wouldhave done a better job. This abrupt diveangle caused the fuel to stop flowing tothe engine in the early models, thus stop-ping the buzz, and the British knew a V-1 was soon to strike. Later models pow-ered themselves all the way to the tar-get. Almost 12,000 V-1s were launchedagainst Britain, though only about 25%actually hit significant targets.

The Unmanned AerialVehicles of Today

There is as much difference in theUAVs of today compared to Low’s andthe Nazi’s creations as to the WrightBrother’s plane and the Boeing 787.Endurance, range, speed, sophistica-tion of sensors, autonomy and, ofcourse, cost have all spiraled upward.

There are two basic classes ofunmanned aerial vehicles. The first is theclassic combat weapon — the cruise mis-sile. One example is the Tomahawk, theworkhorse of the Navy. This sophisticatedcruise missile proved itself in the Gulf Warof 1991 when it was programmed to findits way from the submerged submarinethat launched it, all the way to downtownBaghdad. News reporters were amazedto see it fly down a street and make aright turn to head to its final target. Theseweapons are like flying torpedoes; theirpurpose is to explode and destroy anintended target and never return home.

Some people may even include theunpowered smart bombs in this catego-ry. They are dropped from a plane, milesfrom a target, and guide themselvesthrough varying control surfaces to a tar-get that is illuminated by a laser beam.This beam can be from an overheadplane or from a soldier on the ground.

Another part of the combat category is the target and decoy missilethat provides ground and aerial gunnery a target that simulates a realenemy aircraft or missile.

The second type of UAV includes theaerial scout such as the Predator, an AUVthat returns to its home base. These vehicles can be autonomous or remotely controlled. The control can be from some-thing as simple as a suitcase-sized consoleused by a single ground soldier or as com-plex as a trailer with several controllers.

These AUVs are not weapons inthemselves, but can be loaded with smallmissiles or bombs and be fired ordropped by remote command. Most ofthis category, however, is relegated topassive spying or surveillance tasks. Thesecan be reconnaissance AUVs that providebattlefield intelligence. There are alsoUAVs specifically designed for cargo andlogistics operation. Government agenciesuse UAVs for research and developmentto further develop UAV technology.

There are so many variants of UAVstoday that they can range from tiny vehi-cles under one ounce in weight to vehi-cles weighing many tons. Figure 4 showsa tiny AUV not much larger than a drag-onfly, and there are operational vehicleseven smaller. Figure 5 shows a memberof the military hand-launching a vehiclethat contains a video feedback systemthat it about the size of a typical R/Cmodel airplane. It is known as the SmallUnmanned Aerial Vehicles AdvancedConcept Technology Demonstration(SUAV ACTD). These small AUVs bringbattlefield awareness to small unit commanders. AUVs such as this cancover many miles in distance, and moreimportantly, send back images of manysquare miles of terrain without riskingmilitary personnel to hostile action.

The Navy’s CruiseMissile Programs

Governments around the world

FIGURE 3. V-1 Drawing.

FIGURE 4. Micro UAV.

Then&Now.qxd 12/3/2007 3:32 PM Page 80

develop weapons of war with the hopesthat they never will be used in battle. TheUS has developed a long series of cruisemissiles and the Regulus is an example ofone of the first operational nucleartipped cruise missiles that began develop-ment back in 1947 for the Navy. Figure 6shows a Regulus prepping for launchfrom the deck of the U.S.S. Toledo, aNavy cruiser. The almost seven ton, tur-bofan jet powered Regulus could delivera 1-2 megaton W27 thermonuclear warhead up to a range of 500 nauticalmiles from a submarine or surface ship.

Unlike today’s submarine launchedTrident ballistic missiles that can belaunched while the sub is submerged,the Regulus was launched from the deckof the vessels. A later version — theRegulus II — was developed and testedthat could hit a target 1,200 nauticalmiles away at a speed of Mach 2, but thePolaris program of submerged-launchedballistic missiles superseded furtherdevelopment. The Regulus had a majorshortcoming for an unmanned missile; itrequired radio control guidance to its target. The missile inertial guidance andterrain-following technology was not yetfully developed in the mid ‘50s.

The TomahawkCruise Missile

The BGM-109 (Boosted GuidedMissile) Tomahawk Land Attack Missile(TLAM) is one of the few battle-testedlong-range missiles, having seen exten-sive use in the first Gulf War and morerecently in Afghanistan when US war-ships launched over 60 of them in thehunt for Osama bin Laden (Figure 7).

Iraq has also seen its share ofthese intelligent robot planes sail downthe streets of cities and make severalquick turns into their targets. They canbe nuclear tipped with a 200 kilotonwarhead, but all of the Tomahawksfired in war have carried 1,000 poundsof high explosives (TLAM-C) or submu-nitions called bomblets (TLAM-D). Theyall have a range of 1,400 miles.

Powered by a Williams International600 pound thrust turbo fan jet engine,the subsonic (550 mph) missile weighs2,650 pounds and is 18’3” long. Theweapons are delivered to the variousships and subs as an ‘all-up-round’

containing the missile, the 550 poundsolid state booster, and a capsule forsubs or a canister for ships that servesas the launch tube. Full production wasinitiated in 1981 (Figure 8).

What makes these things intelli-gent? The first Block II Tomahawk usedterrain contour matching (TERCOM), aradar altimeter, and a digital scenematching correlation (DSMAC) computerterminal guidance system. The missilerequired previous extensive knowledge ofthe terrain of the enemy’s target areas,not always possible in time of war. Thesecond generation or Block III systemsadded GPS and inertial navigation to sup-plement the terrain and scene computernavigation systems, much the same asthe DARPA Grand Challenge vehicles thatrecently navigated the simulated urbanenvironment. Block IV and V variationshave vastly improved the system. Thenew Tomahawk Baseline ImprovementProgram (TBIP) provides UHF SATCOMand a ‘man-in-the-loop’ data link toenable the missile to receive in-flight targeting updates, to transfer health andstatus messages, and to broadcast battledamage reports back to base.

The RQ-1 Predator UAVIt was early one Tuesday morning

in April 2006 when a teleoperatedrobot plane was scanning the groundat the Mexican border in southernArizona. Suddenly, the plane’s enginequit and it made a crash dive into a hill-side near some homes. This Customsand Border Patrol UAV Predator B hadaccidentally had its fuel supply cut offby an erroneous command from theremote control console (see Figure 9).

The biggest loss was not the crashor the loss of a multi-million dollar plane,but the loss of confidence that the USgovernment and society might have inunmanned planes sailing our skies. Aninvestigative panel revealed that theoperator said that the control console“froze up and he didn’t realizethat it was set to shut off theUAV’s fuel supply.” Figure 10shows the Pilot and Payload control console for the Predator;only a part of the typical 30 footlong control trailer that also con-tains two synthetic aperture radar

consoles, a mission planning console,and several satellite ground stations.

I’m highlighting the Predator overthe thousands of other varieties as it isone of the most visible UAVs, with its dis-tinctive bulbous nose and inverted “V”tail. The Predator contract was awardedto General Atomics Aeronautical Systemsin January 1994 by the US Air Force. ThePredator system first flew in that yearand entered production in August 1997.Over 125 Predators have been deliveredto the USAF. The Predators have beenoperational in Bosnia since 1995 forNATO and US operations. In 2002, aPredator UAV actually released a Hellfiremissile in Yemen that destroyed a civilianvehicle carrying suspected terrorists.

Thousands of UAVs fly above warzones in Iraq and Afghanistan, accumulating well over 300,000 flighthours. Powered by a 101 HP Rotaxengine (similar to a snowmobileengine), the Predator is 27 feet long

SERVO 01.2008 81

FIGURE 5. A Hand Launched UAV.

FIGURE 7. Tomahawk Block IV Cruise Missile.

FIGURE 6. Regulus Cruise MissilePrepped for Launch.

Then&Now.qxd 12/3/2007 3:32 PM Page 81

with a wingspan of 49 feet. Variousversions have an altitude capability of25,000 to over 50,000 feet and rangesfrom 400 nautical miles to well above1,000 miles in classified ranges.

The RQ-1 Predator variation is along-endurance (40 hours plus) medium-altitude UAV designed for surveillance and reconnaissance missions. Imagery gained from synthet-ic aperture radar, video cameras, and aForward Looking Infrared (FLIR) camera can be sent to the front line sol-dier and his commanders or by satellitecommunication links around the globe.

The MQ-1 variation armed withHellfire missiles is the multi-role versionthat is used for surveillance and armedreconnaissance. The newer MQ-9Predator B Reaper Hunter/Killer allowsa much longer time over an area ofinterest without continual monitoring

from the ground,secure air traffic control voice relay, andan Air Force Mission Support Systemautonomy. It was a Department ofHomeland Security version of thePredator B version that crashed inArizona. Two Predator C versions withturbo-fan jet engines are expected tobe test flown by the Air Force in 2009.

Sensors for thePredator

An unmanned aerial vehicle is of nouse if it has no sensors to take the placeof a pilot. The large Global Hawk andother totally autonomous UAVs must uti-lize a host of sensors to provide real-timefeedback to an onboard processor. ThePredator, though mostly controlled from aremote location with people in the loop,must also have real-time sensors to givethe controlling humans a total grasp onthe environment around the robot vehicle.

The synthetic aperture radar isused for all-weather surveillance viewing of both aerial and ground envi-ronments and has a resolution of onefoot objects. A multi-spectral targeting

system and a moving targetindicator are used on somemodels and provide night IRand daytime zoom TV feed-back, as well as laser designa-tion (illuminating) capability.Countermeasures are availableto protect the vehicle, as well.

Flight SummaryI have centered this article on the

military versions of various UAVs as mostfunding has gone to improve and updatethese very versatile robot vehicles. Asyou can see, not all are used for wartimepurposes. Most of the Predator UAVs arenot fitted with offensive weapon sys-tems. Civilian and peace-time uses pro-vide companies and local governmentswith extremely valuable data, impossibleto obtain without far more expensiveand hazardous flights by manned planes.

These sophisticated vehicles havemany uses beyond those of the military.Aerial mapping, high altitude air sampling, traffic monitoring, geologicaland water surveys, and urban planningare just a few. Autonomous AUVs suchas the Global Hawk can be given a mis-sion; the AUV can take off and fly to itstarget area, upload (and download) vastamounts of information, and fly homeand land, all without people in the loop.

In my research on AUVs, I hadamassed over 47,000 words of datafrom the Internet covering 42 differentvehicles. Most had some amazing feature that would make an experi-menter’s mobile robot quite a bit morecapable or useful. I was astounded byjust how unique and multi-tasking thesethings are. If anything can be viewed asa truly intelligent and autonomousrobot vehicle, it is today’s AUVs. SV

Tom Carroll can be reached via emailat [email protected].

CONTACT THE AUTHOR

All Electronics Corp. .........................23, 66AP Circuits/e-pcb.com ............................21AWIT ..........................................................66Boca Bearings .....................................41, 66CrustCrawler .............................................13Electronics123 ..........................................23Futurlec .....................................................66Hitec ..........................................................20Images Co. ................................................66

Jameco ......................................................55Lorax Works ........................................23, 66Lynxmotion, Inc. .........................................3Maxbotix ...................................................66Net Media .................................................83Parallax, Inc. ...............................Back CoverPCB Pool .............................................65, 66Pololu Robotics & Electronics ..........60, 66Rabbit, A Digi International Brand ............2

RCG Research .............................................7Robotis Co. Ltd. .......................................53Robot Power ...............................................7RobotShop, Inc. .................................70, 66Schmartboard ...........................................23Solarbotics/HVW .....................................37Technological Arts ...................................66TORMACH .................................................31Vantec .......................................................48

Advertiser Index

82 SERVO 01.2008

FIGURE 8. Cutaway Drawing of Tomahawk.FIGURE 9. Predator UAV.

FIGURE 10. Predator Control Console.

Then&Now.qxd 12/5/2007 1:38 PM Page 82

Full Page.qxd 12/5/2007 3:28 PM Page 83

backcvr.qxd 12/5/2007 2:05 PM Page 84