servo magazine 02 2005

84

Upload: dangtq84

Post on 10-Jun-2015

1.988 views

Category:

Documents


15 download

TRANSCRIPT

Page 1: Servo Magazine 02 2005

Circle #106 on the Reader Service Card.

Vol. 3 N

o. 2

SERV

OM

AG

AZIN

ER

ECYCLABLE RO

BOT SO

FTWA

RE

February 2005

Cover.qxd 1/5/2005 4:20 PM Page 84

Page 2: Servo Magazine 02 2005

Remember when...

Be sure to visit our new website atwww.Jameco.com/nvb

Jameco@Home—where electronics is still fun!

Remember when......electronics stores were stocked to the rafters

with every component imaginable and there was ALWAYS

a knowledgeable person there to help you?

Think those days are gone?

Well they’re not!

You just need a little Jameco@Home.

Call for a FREE catalog today.

We have the electronic components and knowledgeable

Technical Support people who can help bring back the fun

in your electronics hobbies, inventions, and DIY projects.

®

1-800-455-6119

Circle #32 on the Reader Service Card.

Circle #60 on the Reader Service Card.

CoverInside.qxd 1/4/2005 9:42 PM Page 2

Page 3: Servo Magazine 02 2005

Circle #81 onthe Reader Service Card.

Full Page.qxd 12/9/2004 3:22 PM Page 3

Page 4: Servo Magazine 02 2005

6 Mind/Iron

8 Rubberbands

12 Robotics Resources

17 Assembly Line

24 Brain Matrix

43 Menagerie

64 Robytes

66 Ask Mr. Roboto

72 Lessons From the Lab

78 GeerHead

81 Appetizer

Thanks tto SSozbots(www.sozbots.com)

for tthe pphoto oof RRoboOne on tthe ccover!

6 Publisher’s Info

7 Bio-Feedback

44 New Products

50 Robo-Links

62 Events Calendar

63 Robotics Showcase

70 SERVO Bookstore

82 Advertiser’s Index

ColumnsDepar tments

Take a Sneak Peek!

Coming 3.2005

WWalk This Walk This Waayy, Ey!, Ey!

SERVO Magazine (ISSN 1546-0592/CDNPub Agree#40702530) is published monthlyfor $24.95 per year by T & L Publications, Inc.,430 Princeland Court, Corona, CA 92879.APPLICATION TO MAIL AT PERIODICALSPOSTAGE RATE IS PENDING AT CORONA,CA AND AT ADDITIONAL ENTRY MAILINGOFFICES. POSTMASTER: Send address changesto SERVO Magazine, 430 PrincelandCourt, Corona, CA 92879-1300 orStation A, P.O. Box 54,Windsor ON N9A [email protected]

4 SERVO 2.2005

TOC.qxd 1/4/2005 4:46 PM Page 4

Page 5: Servo Magazine 02 2005

Features & Projects

1199 Recycle Your Robot’s Codeby Steven Grau

2266 Step Up and Get Motorvated!by Peter Best

3377 A Cut Aboveby Michael Simpson

4466 PIC Your Speedby Dennis Volrath

5511 The Core of the Atom, Part 2by Kerry Barlow

5577 Hats Off to RoboSapienby Henry Pfister

2.2005VOL. 3 NO. 2SERVO

SERVO 2.2005 5

TOC.qxd 1/4/2005 8:13 AM Page 5

Page 6: Servo Magazine 02 2005

Published Monthly By The TechTrax Group — A Division Of

T & L Publications, Inc.430 Princeland Court

Corona, CA 92879-1300(951) 371-8497

FAX (951) 371-3052www.servomagazine.com

Subscription Order ONLY Line1-800-783-4624

PUBLISHERLarry Lemieux

[email protected]

ASSOCIATE PUBLISHER/VP OF SALES/MARKETING

Robin [email protected]

MANAGING EDITORAlexandra Lindstrom

[email protected]

CIRCULATION DIRECTORMary Descaro

[email protected]

WEB CONTENT/STOREMichael Kaudze

[email protected]

PRODUCTION/GRAPHICSShannon Lemieux

COVER ARTMichele Durant

STAFFKristin Rutz

Dawn Saladino

OUR PET ROBOTSGuidoMifune

Copyright 2005 by T & L Publications, Inc.

All Rights Reserved

All 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 allsubscription orders, correspondence, UPS,overnight mail, and artwork to: 430 PrincelandCourt, Corona, CA 92879.

I’ve seen creative writers refuse todiscuss their new work until it’s safely inprint. At races and car shows, I havewitnessed people acting as if their hoodswere hermetically sealed. Academicsoften neglect to teach about a newthought until they have safeguardedtheir intellectual property. Yet, robotbuilders will practically gut theircreations in order to show someone howto replicate their builds. They publishtheir code and parts lists online and inthe pages of this magazine.

This trait, at first, seems at oddswith the sentiments Dave Calkins writesabout in this month’s “Appetizer.” Davediscusses the competitive programmingof the human race and, therefore,robot builders. As I read Dave’s article,I agreed with him wholeheartedly;robotic events offer the best means tolearn, be inspired, and meet like-minded individuals. I began to wonderwhy — in such a competitive hobby asrobotics — the community remains soopen about the methods used to createthe prize-winning bots seen at theseevents.

When you think about it, iscompetition really at odds with theopen exchange of ideas? I don’t believeit is. A true competitor will tell you thatwinning only counts when thechallengers are evenly matched. Still, itcan’t be that simple; even in a relativelyyoung field — like robotics — skilledcompetitors can be found.

Upon reflection, I believe that thisopenness in the robotic communitystems from a common goal to furtherthe field. We all know that robotics will,one day, revolutionize the world as weknow it and we want to be a part ofthat wave of social and cultural

transformation. In order to accomplishsuch a goal, the minds of thecommunity have to share theirinspirations, failures, and successes. Toparaphrase Marleen Barr, the notedcritic of science fiction literature, onlyby questioning the establishedknowledge and practices of acommunity can we ever hope to movebeyond the present knowledge baseand advance to the goals we all claimto support and work toward.

That sentiment finds its validationin the upcoming robotic generation.Almost any given issue of SERVOhighlights the successes of those whoaren’t even old enough to vote, yet findnew ways to push the boundaries ofthe field. In addition, the people behindHigh Tech High saw a need to open anew campus in Los Angeles, CA, thatcaters to lower-income students whowould, otherwise, not be able to accesssuch an intensive eduction in roboticsand technology.

As a community, we see thatyoung minds which haven’t yet learnedwhat we say can’t be done are, in fact,the basis of our future. As we share ourtrade secrets, they will take us up onthe challenge of moving forward, usingthe knowledge and information thatfound its root in others.

When that day comes where therobotics revolution has firmly takenhold, it may be those who now lookforward to being old enough tocompete in FIRST who lead the way,but their inspiration and education willbe founded on what others sharedopenly in an effort to create a well-rounded community of equallymatched and like-minded individualswho are at the robot events today. SV

6 SERVO 02.2005

Mind / Iron

by Alexandra Lindstrom

JanPages6&7.qxd 1/5/2005 8:41 AM Page 6

Page 7: Servo Magazine 02 2005

Dear SERVO,From what I have read, I think I like

SERVO Magazine better than Nuts &Volts. I have never subscribed to N&V,but I have purchased it from time totime from a local Border’s bookstore.SERVO Magazine seems moreappealing to me.

While I am not an active roboticsenthusiast, I do like controlling thingswith embedded microcontrollers. Thatis the reason for my main interest inSERVO Magazine.

I am not particularly a BASIC Stampfan. I prefer the MC68HC11 and theAtmel AVR breeds of microcontrollersbut, what information SERVO provides isdirectly applicable to those other kindsof microcontrollers, too.

Carl W. Livingston, via Internet

Dear SERVO,Great magazine and excellent

articles! I’m looking forward to someRoomba hacks. I just hope you don't go"tango uniform" like the othermagazines I used to receive.

Steven Canningvia Internet

Dear SERVO,I enjoyed Jack Buffington's

“Rubberbands and Bailing Wire” articleregarding the addition of an LCD to arobot (January 2005). It was wellwritten and had some good tips.

My biggest comment is simply thatthese displays (parallel) are a pain inthe butt! Yes, they have a few goodpoints, which were mentioned in thearticle. However, for the novice builderusing a display for the first time, Iwould highly recommend starting outwith a serial display.

Granted, they are a little moreexpensive, but they are much easier touse and only take up one pin on thePIC (or STAMP or whatever). If youdon't have an "official" serial port onthe processor, you can always do somebit banging.

Keep up the good work.

Paul Kafigvia Internet

Dear SERVO,I must say that I am a bit

disappointed in your coverage of yourmuch promoted and anticipated Tetsujincompetition. As an avid reader, I mustadmit I was expecting a bit more than

two pages of captioned pictures and avague promise of more to come (ofwhich I see nothing in the January issue).

The electrical engineering journalwe subscribe to at work covered theevent almost as well as you have (theygave it a whole two sentences). I'm notsure what else I expected from thecoverage of this event, but it wasdefinitely more than I've gotten fromyour last two issues.

Thanks for your time.

Jason Urbanvia Internet

Dear Jason,In our goal to provide interesting

and informative reading for our diverseaudience, we decided to spread thecoverage of Tetsujin over several issuesrather than one. Future issues willfeature articles by or interviews withthe Tetsujin competitors. These articleswill contain details about their buildsand the successes and trials they foundalong the road to Tetsujin. TheDecember issue of SERVO featured an“Appetizer” column by Tetsujin winnerAlex Sulkowski as a forerunner of thecontent to come.

— Editor

SERVO 02.2005 7Circle #70 on the Reader Service Card.

JanPages6&7.qxd 1/5/2005 11:19 AM Page 7

Page 8: Servo Magazine 02 2005

8 SERVO 02.2005

This month’s column is a bit of a mixed bag. The first partexpands on last month’s column, which described how to

communicate with an alphanumeric LCD display. This month,you’ll learn how to create custom characters. Using thesecharacters, you’ll learn how to draw bar graphs. The secondpart of this column will use one of the bar graphs and a little extra circuitry connected to your microprocessor toallow you to monitor the battery voltage of your robot.

Let’s dive right in and start with custom characters. Acustom character is any character you might create that isnot part of the standard character set. As you can see inFigure 1, there are plenty of different characters to choosefrom, but — if you can’t find the character that you want —then the HD44780 can let you create up to eight special char-acters of your own design to be displayed. These charactersare mapped into the spots on the left side of the chart inFigure 1. Some potential uses for custom characters wouldbe to display things such as a square, diagonal arrow, Greekletters, a moving clock icon, or bar graphs.

To create a special character, you will need to issue acommand to set the character generator RAM address.There are 64 bytes of character generator RAM. Each char-acter is built by using eight of those bytes, which representthe pixel rows in the characters. Only the lowest five bitsare used. If you set a bit high, its corresponding pixel will turn black when that character is displayed. To build acharacter, you will specify the first character generatorRAM address that you want to write to and then you will send data corresponding to the pixel rows for that character. Each byte sent will represent a lower row of pixels in the character.

Figure 2 shows a character and the data that you wouldsend to define it. If you sent a character generator address of zero and then wrote eight bytes of data, then you willhave completely defined the first character. If you send anadditional byte, then you will have written to the top row of the second character. You can change the character generator address at any time, so you could choose to write

to the first character andthen skip to the third char-acter, if you wanted to.

Our first example willbe to create special charac-ters that will let you createvertical bar graphs of anyheight. To make this easy to integrate into a program,the bar graph code is imple-mented in two subroutinesand one look-up table. The

look-up table holdsthe bytes of dataused to initializethe characters, thefirst subroutinewrites those bytesto the charactergenerator RAM,and the secondsubroutine draws

by Jack Buffingtonby Jack Buffington

Bars and Batteries:Displaying Your Robot’s Battery

Level on an LCD Display

Figure 1. The standard characters of theHD44780 and their character codes.

Figure 2. A smiley face and the bytes that youcan use to create it.

const int8 vGraphBytes[] = 0,0,0,0,0,0,0,31,0,0,0,0,0,0,31,31,0,0,0,0,0,31,31,31,0,0,0,0,31,31,31,31,0,0,0,31,31,31,31,31,0,0,31,31,31,31,31,31,0,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31;

Figure 3. A look-up table for a vertical bar graph.

Rubberbands.qxd 1/3/2005 4:14 PM Page 8

Page 9: Servo Magazine 02 2005

a bar graph for you.The vertical bar graph routine will draw a bar graph up

to four characters high on the column that you specify. Thisroutine accepts an eight-bit value for its magnitude, which itscales for you to the appropriate value that it needs. It makesreference to a subroutine called lcdMoveTo(). You can finddetails about this routine in last month’s column.

You can pack a lot of vertical bar graphs into an LCDscreen, but you can only display 32 different values this way, so you may want to use a horizontal bar graph. With ahorizontal bar graph, you can display 200 different values.This can give you a clearer indication of an eight-bit value.Here are the look-up table and subroutine that draw a horizontal bar graph.

So far, you have been shown how to draw bar graphs,but nothing has been said about how you could go aboutusing them. Some ways that you could make use of a bargraph could be as a sound level meter, a speedometer, agraph of how many times something has happened over acertain duration, or as a progress indicator for lengthy calculations. If you used multiple vertical bar graphs, you could build a strip chart to show the value of some variable over time. The example shown here will be how touse a bar graph to display the current level of your robot’sbatteries.

You might think that having your robot measure thestate of its own batteries would be a tricky process, but it isactually quite simple. All that it requires is that you have onefree analog to digital (A/D) input pin and two resistors! Theexample here shows how to measure the state of a 9 voltbattery, but other voltages can be measured using simplechanges to the circuit and program.

To create the circuit, you will take two resistors and connect them together to create a voltage divider, as shownin Figure 7. The PIC in the example is running at 5 volts. ThePIC can use its input voltage as the reference voltage for its A/D converter, so — in this set-up — it will be able to measure from 0 to 5 volts. In this example, the voltage levelof a 9 volt battery is being measured, so a voltage dividerthat has two equal value resistors is being used. This will

result in the voltage of the battery being divided in two,which shifts the voltage into a range that the PIC’s A/D converter can read. If you are using the circuit in Figure 7,then you will start to lose accuracy as the battery voltagedrops near 5 volts. At this point, the voltage regulator willstart to output a voltage less than 5 volts, which throws offthe calculation. Still, if the voltage has dropped to 5 volts,then the battery is very close to dead anyway.

Let’s look at how you can calculate and display the battery’s voltage on your LCD display. The A/D value that isread is an eight-bit value. Since the processor is running at 5 volts and the circuit is using a voltage divider that dividesthe input voltage by two, the maximum voltage that can be

Rubberbands and Bailing Wire

Do you keep burning your table or workbenchwith your soldering iron? Here’s an easy-to-make holderthat you can build that works just like the ones inexpensive soldering stations. Go to your local craft or hobby store and ask for aluminum armature wire. Youcan get it in several diameters,but 1/4” seems to work the best.Wrap the armature wire arounda broomstick or dowel rod tocreate the spiral and then bendthe base by hand.

TECH TIDBIT

SERVO 02.2005 9

void vBarGraph(int8 magnitude, int8 column) //draws a vertical bar graph. Magnitude is 0-255

int16 temp16;int8 temp8;temp16 = magnitude;temp16 *= 32;temp16 /= 255; // temp16 now contains 0-32

for(temp8 = 4; temp8 != 0; temp8—)lcdMoveTo(temp8,column);if(temp16 > 7)

lcdPutChar(7); // solid blocktemp16 -= 8;

else if (temp16 > 0)lcdPutChar(temp16 - 1); // partial blocktemp16 = 0;

elselcdPutChar(32); // space character

Figure 5. A subroutine that draws a vertical bar graph.

void lcdMakeVbarGraphCharacters() // vertical bar graphint8 temp8;

output_low(RS);output_low(RW);output_high(E);portB = 0b01000000;delay_us(20);output_low(E);lcdBusy();

for(temp8 = 0; temp8 < 64; temp8++)lcdPutChar(vGraphBytes[temp8]);

Figure 4. A subroutine that sets up the characters for the vertical bar graph.

Rubberbands.qxd 1/3/2005 4:16 PM Page 9

Page 10: Servo Magazine 02 2005

read is 10 volts. If you divide 10 volts into 256 equal parts,then you will be able to resolve the battery’s voltage to within.039 volts. That is sufficient for most things, but you couldalso set up the PIC to read analog voltages with 10-bit precision, which would let you resolve your battery voltage to within .009 volts. That is overkill for this application, soeight-bit resolution will be used.

There are three ways that you can calculate your battery’svoltage. There is no right or wrong way to do it, but there arebetter and worse methods. Let’s look at the obvious firstchoice, which is to use floating-point math. This makes

writing the C code easy, since floating point automatically figures out the decimal point for you and you can simply usea printf() statement to get your result. To find the voltage,you could simply use the following equation: read voltage =(reading/255) * the maximum readable voltage. In this case,the maximum readable voltage would be 10 volts.

The BIG downside of using floating-point math is that itcompiles into a gargantuan amount of machine code.Floating-point may be perfectly fine on a desktop computer,but — on a PIC with very limited resources — you will find thatusing floating-point math is an option of last resort, since it

will run slowly and will take upmuch of the ROM space thatyou could otherwise use for therest of your program.

A much faster and morecompact method of arriving atthe battery’s voltage is to useinteger math. Figure 8 showshow you would convertbetween your A/D value and avalue of 0 to 1,000, which repre-sents 10.00 volts. This method ofcalculating the voltage is simple,compiles to a small amount ofcode, and runs quickly. There isone problem with it, though.The variable ‘volts’ needs to be a32-bit variable. This is becauseyou will get overflow errors inthe ‘volts’ variable as temp8agoes higher than 65. Using a 32-bit variable may not be aproblem if you have lots of RAMavailable, but — if you don’t —there is a third method that only requires a 16-bit variable tocalculate the battery voltage.

Figure 9 calculates the voltage without the need toworry about overflow errors. Inthis case, the code is multiplyingby the fraction 125/32, which isreally a simplified version of the first equation, where thenumerator and denominatorwere both divided by eight. Thisversion will not overflow pastthe limits of a 16-bit variable.

You may still have a fewquestions about why the A/Dreading was multiplied anddivided by the numbers that weused. Let’s look at what thesenumbers are doing. Since Figure8 is the unsimplified version of

Rubberbands and Bailing Wire

10 SERVO 02.2005

const int8 hGraphBytes[] = 16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,28,28,28,28,28,28,28,28,30,30,30,30,30,30,30,30,31,31,31,31,31,31,31,31;

void hBarGraph(int8 magnitude, int8 line)int8 temp8a;int16 temp16a;// draws a horizontal bar graph the width of the screen on the specified line// pass 0-255 in magnitudelcdMoveTo(line,0);

temp16a = magnitude;temp16a *= 100;temp16a /= 255; // scale it to the range of 0-85

temp8a = 0;while(temp16a >= 5) // draw in the solid bars first

lcdPutChar(4);temp16a -= 5;temp8a++;

switch(temp16a) // make the last character be the right number of vertical barscase 0:

lcdPutChar(32); // spacebreak;

case 1:lcdPutChar(0);break;

case 2:lcdPutChar(1);break;

case 3:lcdPutChar(2);break;

case 4:lcdPutChar(3);break;

temp8a++;

while(temp8a < 20) // overwrite remaining characters in the row with spaceslcdPutChar(32);temp8a++;

Figure 6. The look-up table and subroutine to draw a horizontal bar graph.

Rubberbands.qxd 1/3/2005 4:16 PM Page 10

Page 11: Servo Magazine 02 2005

the fraction, we’ll use it for this example. It might be simplerto think of the order of operations as dividing the reading by 256 and then using that value to multiply by a numberrepresenting the maximum voltage.

Let’s first look at how the value is divided by 256. This isbecause the A/D reading divided by 256 will result in a valuefrom 0 to 1 (actually .996 because the maximum A/D valueis 255). If you multiply this value with another value that represents your maximum measurable voltage, then you willarrive at your answer. For example, in Figure 8, if 2,250 wasused instead of 1,000 on the second line, then that wouldrepresent 22.50 volts. You would need to adjust the valuesof your voltage divider to output 5 volts when the input was22.5 volts, as well, in order to measure up to 22.5 volts. Thereason that the multiplication happens first is because — ifyou divide your A/D value by 256 — you will always have aresult of 0, since you are working in integer math.

You now are able to have your microcontroller figure out its battery voltage. If you are simply using this figure forinternal calculations, then you could stop here. If you want to be able to display it on your LCD screen, then you willprobably want to add a decimal point to the value so that itis more easily understood.

Figure 10 shows a chunk of code that lets you figure outan integer portion and a decimal portion of the value andthen print it out on the screen. It also prints out a horizontalbar graph above the reading as a quick way that you can visually read the battery voltage.

As a final wrap-up on this topic, here are two other waysof measuring battery voltages. If you are looking to measurethe voltage of a battery that does not power the processor,you just need to tie its ground to the processor’s ground. Thiswill allow you to measure its voltage. If you are trying tomeasure the voltage of a battery that is powering yourprocessor directly without a voltage regulator between thebattery and the processor, then you will need to use a circuitlike the one shown in Figure 12.

This circuit uses a fixed voltage reference as the inputto the A/D converter. A voltage reference of 1 volt or someother low voltage will work fine. As your battery voltagedrops, the A/D reading will increase. Let’s say that you were using a voltage reference of 1 voltand your A/D reading was 57. If you divide 256

by 57, you get 4.49, which is the voltage of your battery. A 1 volt reference makes the calculation easy, but the math isn’t too much harder if you use a different voltagereference.

This month’s column showed you how to draw bar graphsand how to measure your robot’s battery’s voltages. Now, youcan build robots that have an actual user interface and thatcan know when their batteries are getting low so that theycan seek out a way to recharge or at least shut down grace-fully. This should give you quite a bit to play around with untilnext month’s column, where we’ll show you how to give yourrobot speech output sothat it can talk to you! SV

Rubberbands and Bailing Wire

SERVO 02.2005 11

Figure 7. The wiring needed tomeasure your battery’s voltage.

volts = temp8a;volts *= 1000;volts /= 256;

Figure 8. Calculatingthe battery voltageusing integer math.

volts = temp8a;volts *= 125;volts /= 32;

Figure 9. Calculatingthe battery voltage

using a 16-bit variable.

integer = 0;while(volts > 99)

volts -= 100;integer++;

decimal = volts;

hBarGraph(temp8a,1);lcdMoveTo(2,0);printf(lcdPutChar,”%u.%02u volts”, integer,decimal);

Figure 10. How to display the battery voltage.

Figure 11. The final result.

Figure 12. Measuring thevoltage when the battery

powers the processor directly.

www.ccsinfo.comSource of the C compiler for PIC processors

used in this column.

www.digikey.comSource for electronic parts.

www.mpja.comSells the LCD module used in this article.

RESOURCES

Rubberbands.qxd 1/3/2005 4:17 PM Page 11

Page 12: Servo Magazine 02 2005

Arobot without sensors is just afancy machine. If “clothes make

the man” (this applies to women, too, of course), then sensors make the robot. Many robots have basicmechanical and optical sensors —touch switches for detecting a collisionwith an object, for example, or infraredsensors that sense nearby objects.

In this column, you’ll find sensorsthat extend beyond basic touch andinfrared. There’s a whole world ofunique sensors — originally designedfor medicine or industry — that can beapplied to robotics. These sensors can be quite expensive and severalhigh-end variations are listed in thesources that follow.

However, most of the resourcespresented here are either on theaffordable end of things or offer con-cepts (with data sheets and applicationnotes) that you can study as you learnhow the various sensor technologieswork.

Note that, while some sensor manufacturers will sell directly to thepublic, those that do often have minimum order requirements. If yousee a sensor that you’d like to try, consider contacting the manufacturerand asking for a sample. Try their websitefor a list of distributors and be sure tocheck out the usual sources of elec-tronics parts, including Jameco,Mouser, Acroname, BG Micro, Digi-Keyand other advertisers in this magazine.You’d be surprised what goodies youcan find if you dig deep enough.

Some sensor categories that aren’tincluded are tilt and accelerometer (see“Robotics Resources,” June 2003 inNuts & Volts Magazine). We’ll also skipvideo vision sensors and incrementalencoders this time around, as these are

special types worthy of their ownfuture column.

General Sources forSensors

Here are sources for general industrial sensors, which includemechanical and electronic (usuallypeizoelectric) gyroscopes, ultrasonicsensors, inductive sensors, and impactsensors. Most of these sources aremanufacturers and offer fairly high endproducts for medical and industrialapplications (think $$$).

However, even if you can’t afford a$450.00 gyro, you can read throughthe application notes and spec sheetsfor ideas.

Baumer Electric, Ltd.www.baumerelectric.com

Baumer makes industrial sensors:inductive capacitive, photoelectric,retro-reflective, thru-beam, ultrasonic,proximity, and rotary encoders. Thisstuff isn’t cheap, but — if you needquality — this is where you’ll find it.The web page is in English andGerman.

Carlo Gavazzi Holding AGwww.carlogavazzi.com

High end industrial automationcomponents. Sensors (proximity, photoelectric), solid-state relays, andmotor controllers.

Crossbow Technology, Inc.www.xbow.com

Crossbow is into industrial sensors.Among their product line are inertialand gyro systems, accelerometers,wireless sensor networks, tilt sensors,and magnetometers.

Robotics Resources:

by Gordon McComb

BBEEYYOONNDD TTHHEEFFIIVVEE SSEENNSSEESS

RoboResources.qxd 1/3/2005 1:24 PM Page 12

Page 13: Servo Magazine 02 2005

Davis INOTEKwww.inotek.com

Sensors (Omron proximity, others),test equipment, and RFID.

Entran Devices, Inc.www.entran.com

Manufacturer of strain gauges,load cells, accelerometers, and pressure sensors — not cheap. Thewebsite is in English, French, German,and Spanish.

Honeywell International, Inc.www.honeywell.com

Honeywell is a manufacturer ofautomation and control products.Several of their products are availablethrough distributors. The company alsosells some products direct.

Measurement Specialties, Inc.www.measurementspecialties.com

Measurement Specialties makesand sells sensors, particularly peizo sensors using Kynar plastic. These sensors can be used for such things as ultrasonic measurement, touch orvibration sensors, and as accelerome-ters. The company provides online buying, but the minimum order is$100.00. Some of their products arealso sold by other distributors.

Murata Manufacturing Co.www.murata.com

Makers of pyroelectric infraredsensors, peizoelectric gyroscopes,peizoelectric ceramics sensors, thermis-tors, magnetic pattern recognition sen-sors, shock sensors, and peizoelectricsound components.

Lots and lots of data sheets.Offices are in Japan, North America,and Europe.

Robot Electronicswww.robot-electronics.co.uk

Robot Electronics — also known asDevantech — manufactures unique and affordable robotic components,including miniature ultrasonic sensors,an electronic compass, and a 50 ampH-bridge for motor control.

The company’s SRF08 high performance ultrasonic rangefinder

module can be connected to almostany computer or microcontroller and provides real time, continuousdistance measurements using ultrasonics. The measurement valuesare sent as digital signals and areselectable between microseconds,millimeters, or inches.

SensCompwww.senscomp.com

Ultrasonic sensors, including(what were) the Polaroid electrostatictransducers and driver boards.SensComp bought out the Polaroiddivision that made these transducersand is now the source for these excellent products.

Sensors, Inc.www.sensorsincorporated.com

Sensors, what else? Online retailer/distributor for Hohner (encoders),Carlo Gavazzi (proximity), Cutler-Hammer, SICK, and others.

SICK, Inc.www.sickoptic.com

SICK is a manufacturer of high end industrial sensors and electronicmeasurement systems, including laserproximity scanners, barcoders, and 2-Dlaser radar. Technical white papers areavailable on the site.

Sunx Sensors USAwww.sunx-ramco.com

Specialty miniature sensors forindustrial control applications: photo-electric, fiber optic, inductive proximity,micro-photo, laser beam, color andmark detection, ultraviolet, ultrasonic,pressure, and vacuum. Spec sheets arein Adobe Acrobat PDF.

Vishay Intertechnology, Inc.www.vishay.com

Vishay is a leading manufacturerof all sorts of electronic components,including motion sensors, optical sensors, conductive plastic rotationsensors, and more. Their website liststhe major categories of products —complete with PDF data sheets. Spenda few hours browsing and you’re sureto find some interesting stuff!

GPS SensorsGPS stands for global positioning

satellite, a system of special communi-cations satellites used to pinpoint loca-tions on the ground. Though oncestrictly for use by the military andselect commercial applications, GPSsystems are now routinely available forconsumer use. Several GPS receiverscome ready-made for connectiondirectly to a computer, which — with

ROBOTICS RRESOURCES

yEngineeringyEngineeringyEngineeringyEngineeringThe technology builder's source for kits, components, supplies, tools, books and education.

Robot Kits For All Skill Levels

Motors, Frame Componentsand Scratch Builder Supplies.

ICs, Transistors, Project Kits

ponents

Books andK

Most orders ship the day received! World-wide shipping. Convenient pay .

Order by Internet, phone, fax or mail.

www.HobbyEngineering.com

1-866-ROBOT-501-866-762-68501-650-552-9925

1-650-259-9590 (fax)[email protected]

180 El Camino RealMillbrae, CA 94030

Visit our store near SFO!

SERVO 02.2005 13

RoboResources.qxd 1/3/2005 1:26 PM Page 13

HobbyEngineeringHobbyEngineeringHobbyEngineeringHobbyEngineeringThe technology builder's source for kits, components, supplies, tools, books and education.

Robot Kits For All Skill Levels

Motors, Frame Componentsand Scratch Builder Supplies.

ICs, Transistors, Project Kits

BEAM Kits and Components

Books andEducational K

Most orders ship the day received! World-wide shipping. Convenient payment options.

Order by Internet, phone, fax or mail.

www.HobbyEngineering.com

1-866-ROBOT-501-866-762-68501-650-552-9925

1-650-259-9590 (fax)[email protected]

180 El Camino RealMillbrae, CA 94030

Visit our store near SFO!

Page 14: Servo Magazine 02 2005

ROBOTICS RRESOURCES

proper software — can interpret thepositioning signals. GPS receivers canbe used with outdoor robots to givethem a sense of exactly where they arein the world.

Garmin, Ltd.www.garmin.com

Garmin is a major manufacturerof GPS systems, including OEM modules. A popular GPS unit that isused in robots is the eTrex miniatureGPS handheld.

You can buy accessories (datacables, mounting brackets, etc.) fromGarmin, but the GPS units themselvesare only sold through resellers. Onlineresellers include GPS City, GPSDiscount, and others.

GPS Citywww.gpscity.com

Sells GPS units for all occasions.Among many products, they sell theGarmin GPS 35 OEM sensor, which can be connected to any PC or micro-controller through an RS-232 serialinterface.

Lowrance Electronics, Inc.www.lowrance.com

Lowrance is in the business of GPSand sonar devices. Check out their GPSTutorial.

Magellan/Thales Navigationwww.magellangps.com

Manufacturer of GPS systems.

National Marine ElectronicsAssociation (NMEA)www.nmea.org

A technical association that helpsset standards for marine electronics.One such standard of importance toamateur robot builders is NMEA-0183. This is a voluntary standard followed by many manufacturers ofglobal positioning satellite receivers. Itallows the GPS module to interfacewith other electronics, such as a computer.

Navtech Seminars and GPSSupplywww.navtechgps.com

Navtech is a reseller of global

positioning satellite (GPS) equipment,including receivers, antennas, differential GPS modules, OEM GPSkits, and books. They also provide seminars on GPS.

Synergy Systems, LLPwww.synergy-gps.com

OEM and board level GPS systems, using Motorola modules. Sellsstarter kits for quick prototyping and developing.

Optical SensorsOptical sensors use light to detect

objects. Depending on the sensor technology used, it’s possible to uselight to not only determine if an objectis near (proximity), but also how faraway an object is (distance).

These resources specialize in optical sensors, which include infrared,passive infrared (like the kind used inmotion detectors), and ultraviolet. Each variation has its own unique applications.

Glolab Corp.www.glolab.com

Glolab manufactures and sellsmulti-channel wireless transmitters andreceivers, along with encoder anddecoder modules (to permit controllingmore than one device through a wireless link).

They also provide pyroelectricinfrared sensors and suitable Fresnellenses. An amplifier and hook-up diagram for the PIR sensor are availableon the site.

Hamamatsu Corp.www.hamamatsu.com

The main Japan office is listed; the web page is provided in many languages and local offices are in manycountries, including the US, France, theUK, Germany, and Italy.

Provides: photonics detectors,flame detectors, photo-multipliertubes, imaging systems, and optical linear arrays. Products are available inlimited sample quantities and are soldthrough distributors. Some items ofparticular interest are (app notes provided for many sensor types): flame

14 Circle #25 on the Reader Service Card.

RoboResources.qxd 1/3/2005 1:29 PM Page 14

Page 15: Servo Magazine 02 2005

sensors (UV TRON), CdS photoconductive cells, infrareddetectors, and photo ICs.

Leica Distowww.disto.com

Manufacturers of handheld laser range finders. The costisn’t exactly cheap, but reasonable for a high end bot. Part ofthe worldwide Leica Geosystems group (address provided isfor the US office); products are available from distributors or online.

RFID SensorsRFID stands for radio frequency identification, which is

a kind of sensor that is similar in purpose to barcodes, butis meant to operate over longer distances, and eventhrough other objects. (Implantable biochips — like thekind used for pets and now people — are miniature RFIDunits.)

Applications in robotics are both obvious and numerous:you can use RFID for robot-to-robot identification, robot-to-human identification, navigation, beacon systems, and muchmore. A benefit of RFID is that the sensitivity of the readerelectronics can be varied, so that you can directly controlmaximum working distances. In this way, a room could befull of RFID elements, yet your robot will only “see” the oneclosest to it.

As yet, there are few RFID systems within affordablereach of most amateur robot builders; still, it’s an interestingtechnology and it’s only a matter of time (perhaps justmonths) before affordable entry-level solutions become available. If nothing else, you can use the resources to learnmore about this technology.

CopyTag Limitedwww.copytag.com

Makers of RFID receivers and tags (transponders).

Microchip Technologywww.microchip.com

Microchip makes a broad line of semiconductors, including the venerable PICmicro microcontrollers. Their website contains many data sheets and application notes onusing these controllers and you should be sure to downloadand save them for study.

The company is also involved with RFID, selling readersand tags, as well as developer’s kits.

OMRON Corpwww.omron.com

Omron is a multi-talented company, manufacturing awide array of sensors and semiconductors. Of note are theirRFID tags and readers and machine vision products:

RFID — www.omron.com/card/rfid/Machine vision — http://oeiweb.omron.com/machine-vision.shtm

RFID, Inc.www.rfidinc.com

Makers and sellers of RFID receivers and transpondertags. Offer relatively inexpensive starter kits with samplertags and receiver.

Strain Gauges and Load CellsStrain gauge sensors — and their close cousin, the load

cell — are used to measure a variety of physical attributes,including pressure, torque, tension, and bending. They areroutinely used in commercial products, such as bathroomscales and automotive digital torque wrenches.

Though industrial strain gauges and load cells arequite expensive (upwards of $500.00 for even a basicunit), there are a number of sources for low precision sensors that are quite well-suited for robotics. These and other sources for strain gauges and load cells are provided here. (However, note that possible minimumorder requirements exist.)

Interlink Electronics, Inc.www.interlinkelec.com

Touch sensors and pads for laptop mice. The touch sensors use strain gauge (they call it a force sensing resistor)technology. They sell developer’s kits online (though they’re

ROBOTICS RRESOURCES

15Circle #37 on the Reader Service Card.

RoboResources.qxd 1/5/2005 10:47 AM Page 15

Page 16: Servo Magazine 02 2005

16 SERVO 02.2005

a bit expensive) and provide free literature on how it all works. The company also manufacturers and sells(via their online store) consumer prod-ucts, including keyboards and mice.

Measurement Systems, Inc.www.measurementsystemsinc.com

Manufacturer of joysticks andminiature joysticks.

OMEGA Engineering, Inc.www.omega.com

Omega makes sensors and dataacquisition equipment. Of primaryimportance to us robo-builders aretheir line of low cost, general-purposestrain gauges. These miniature sensorscan be used to indicate stress or strainon an object, like the pad of a foot in awalking robot.

The sensors are sold in packs of 10 and their per-piece cost is $5.00 to $8.00 for many sizes. This is considerably less than the averagestrain gauge that is designed for super-precise industrial measurements.The company website provides copiousamounts of data sheets, app notes,and engineering articles.

Semtech Corporationwww.semtech.com

Makers of encoders for “pointingstick” style laptop strain gauge pointing devices. The website offersdata sheets and application notes.Items are available in sample quantitiesand from distributors.

MiscellaneousSensors

The following are makers and sellers of miscellaneous sensor types,such as optical mouse sensors, mag-netic sensors, and toxic gas sensors.

Agilent Technologies, Inc.www.semiconductor.agilent.com

Makes and sells unique optical sen-sors for use in desktop computer mice.

Banner Engineering Corp.www.bannerengineering.com

Manufacturer of industrial photo-electric and fiberoptic sensors.

Dinsmore Instrument Co.www.dinsmoresensors.com

Dinsmore manufactures inexpensivedigital and analog compass sensors.

The popular 1490 outputs eight digitalcompass positions (N-NE-E-SE-S-SW-W-NW). The 1525 sensor outputs a continuous analog sine/cosine signalcapable of being decoded to anydegree of accuracy.

Figaro USA, Inc.www.figarosensor.com

Makers of toxic gas and oxygensensors.

PNI Corp./Precision Navigationwww.pnicorp.com

PNI makes compass, radar, magne-tometer, and inclinometer sensors.

TAOSwww.taosinc.com

TAOS manufactures low cost optical array and colormetric sensors.Their linear sensors can be used in suchapplications as line following, patternrecognition, and odometry. The colorsensors detect the color of objects andcan be used for rudimentary objectrecognition. Parallax (www.parallax.com) packages the TAOSTCS230 color sensor on a convenientproject board for use with the BASICStamp and general robotics projects.

Xilor, Inc.www.rfmicrolink.com

Check out their ZOFLEX ZL seriesmaterial — a pressure-activated conduc-tive rubber. According to the website,the resistance change with pressure isvery drastic. The material is at highresistance (30 Mohms) when pressureis below the actuation pressure.Resistance drops to 0.1 ohms or lesswhen the material is at or above the activation pressure. The pressure required is too much for a“soft touch” sensor, but other applications are possible. SV

ROBOTICS RRESOURCES

FIGURE 1. TAOS provides a variety of unusual (yet reasonably priced) imaging and color sensors.

Gordon McComb is the author ofseveral best-sellers about robotics. Inaddition to writing books, he operates www.budgetrobotics.comwhich is dedicated to low-cost amateur robotics. He can also bereached at [email protected]

AAbboouutt tthhee AAuutthhoorr

RoboResources.qxd 1/3/2005 1:31 PM Page 16

Page 17: Servo Magazine 02 2005

Last time, we examined the fiverequirements for the Uno robotdesign — an update of a 1950s

light-sensing, collision-detecting robot.Two of the five requirements devel-oped for the Uno robot project are listed in Table 1. These two require-ments both utilize miniature electroniccomponents.

One source of electronic compo-nents is Jameco Electronics(www.jameco.com). Jameco’s onlinecatalog makes it easy to locate anyitem in their large inventory. Table 2shows the Jameco information for theminiature components identified inTable 1.

Figure 1 shows the actual size ofthe two components. Their miniaturenature suggests that care should beused when working with them. Thisincludes handling (dropping them orbending the leads excessively), construction (lead soldering time andtemperature must be limited), andoperation (proper amount of biasingcurrent).

When the parts arrived in the mailfrom Jameco, it was too tempting toresist playing with them. In particular, aseries of tests was performed on thephotocell, all designed to watch itsresistance change in relation to theamount of light presented.

A digital ohmmeter was connectedacross the photocell and the photocellwas placed 6 feet from an ordinary 40

W light bulb. With the surface of thephotocell facing the light bulb, theresistance measured 7.6K ohms.Leaving the photocell alone, the 40 Wbulb was replaced with a 100 W bulb. The new photocell resistancemeasured 4.4K ohms. The resistancedropped due to an increasce in thelight intensity.

Grabbing a very bright flashlightand shining it directly into the photocellfrom only inches away caused the photocell resistance to drop to 150ohms. Again, the brighter the lightintensity, the smaller the resistance.This is because the material used to

construct the photocell is receptive tothe photons that make up light. Morephotons mean more energy, whichleads to more current flow (and, thus,less resistance).

With all lights off, the photocellmeasured 300K ohms. As we mightnow expect, the dimmest light has produced the largest resistance. Table3 summarizes these intensity results.

The initial intensity results fromTable 3 show what we might expectto see as a maximum range of opera-tion for the photocell. Remember thatUno will be in a room with at least onebulb illuminated, so we will never

bbyy JJaammeess AAnnttoonnaakkooss

Part IInspection —— Round ## 11: The MMiniature CComponents

SERVO 02.2005 17

Component Part Number Description Price

Photocell 202366CDS (Cadmium Sulfide)Photocell 90 mW, 150Vp. 0.3 M min dark

$1.69

Tilt Switch 235926Switch,Tilt,Vibrationsensor SPDT 0.5 A,24 VDC

$1.49

Note that Jameco refers to photocells and not photoresistors,but that these two terms are interchangeable.

Table 2. Jameco Electronics catalog information.

Requirement Uno Component

Seek a light sourceA photoresistor for sensing brightness.An analog-to-digital converter will digitize the intensity level.

React when encountering an obstacle Tilt switch used to detect the bump of a collision with an obstacle.

Table 1. Two miniature-sized components used in Uno’s construction.

AssemblyLine.qxd 1/3/2005 1:17 PM Page 17

Page 18: Servo Magazine 02 2005

approach the dark resistance of 300Kohms.

A second test was performed onthe photocell to see how resistancechanged as a function of distance. Inthis test, a single 40 W bulb was used.The photocell was moved to variousdistances and its resistance wasrecorded. These values are shown inTable 4.

The nice spread of resistance indicates that we will easily be able to sense when the light intensity ischanging.

The last test performed on the pho-tocell checked its response to the angleof light rays striking its surface. Here,the photocell was moved so that lightstruck it at 0°, 30°, 45°, 60°, and 90°.A 40 W bulb was kept at a distance of

6 feet during the test.Table 5 shows the results.

Clearly, light must fall directly onthe photocell to have the greatesteffect. It was interesting to see that —even with the photocell facing totallyaway from the 40 W bulb — there wasstill only 23 K ohms of resistance, muchless than the 300 K ohms when thereis no light at all.

One more aspect of the photocellrequires investigation. Recall fromTable 2 that the rated power for thephotocell is 90 mW. Let us think aboutwhat this means. Suppose you want toput the photocell into a 5 volt biasingcircuit and the design allows all of the5 volts to develop across the photocell.Furthermore, suppose we are shining a bright light on the photocell when there is 5 volts across it. The lowresistance of the photocell (100 ohms,see Table 4) will cause 250 mW ofpower to be delivered:

P = V2

= 5V2

= 250 mWR 100Ω

That will surely do a nice job ofburning up the unfortunate photocell,which is only rated for 90 mW, maxi-mum. Thus, care must be used in our

biasing circuit so that the maximumpower delivered to the photocell isalways less than 90 mW. If we limit thepower to 45 mW (operate at half-loadto extend the device’s life), we cansolve the power equation backward tofind the maximum voltage allowedacross the photocell (for its 100 ohmoperating point at high intensity):

V = √P•R = √45 mW•100Ω = 2.1 V

Knowing the limits, we can thendesign the biasing circuit in a way thatprotects the photocell while still leavingit sensitive to light.

The tile switch is a fascinatingdevice. If its body is tilted above thehorizontal axis, its internal switch closesand there is a low resistance (around 1 ohm) between the device terminals.However, tilt the body of the devicedown so that its axis is below the horizontal and the switch opens up.Thus, we have a straightforward binarycondition: Tilted = Closed, Not-tilted =Open. The leads of the tilt sensor arespringy. This will allow us to mount it so that any collisions will cause it to temporarily spring into the tiltedposition, then spring back to its normal, untilted position.

Next up will be the motors and the microcontroller and all of therequired interfacing. When the hardware interface is finished, the software design will take over. SV

Figure 1.To the left of the dime is the tile switch sensor.On the right is the CDS photocell.

TTHHEE AASSSSEEMMBBLLYY LLIINNEE

18 SERVO 02.2005

Light Intensity Photocell Resistance

Dark room 300K ohms

40 W bulb at 6 feet 7.6K ohms

100 W bulb at 6 feet 4.4K ohms

Flashlight from inches away 150 ohms

Table 3. Initial intensity versus resistance test results.

Distance PhotocellResistance (Ohms)

2 inches 100

1 ft 675

2 ft 1.1K

3 ft 2.5K

4 ft 3.6K

5 ft 5.8K

6 ft 7.8K

7 ft 8.7K

8 ft 10.7K

9 ft 11.3K

10 ft 13K

20 ft 35K

Table 4. Resistance change for each foot of distance from photocell.

Angle (Degrees) Photocell Resistance

0 5K ohms

30 5.1K ohms

45 5.8K ohms

60 6.2K ohms

90 9.5K ohms

180 23K ohms

Table 5. Effect of angle of incidence on photocell resistance.

James Antonakos is a Professor inthe Departments of ElectricalEngineering Technology and ComputerStudies at Broome Community College.You may reach him at [email protected] or visit his website atwww.sunybroome.edu/~antonakos_j

AABBOOUUTT TTHHEE AAUUTTHHOORR

AssemblyLine.qxd 1/4/2005 12:59 PM Page 18

Page 19: Servo Magazine 02 2005

SERVO 02.2005 19

bbyy SStteevvee GGrraauu

WWWhen it comes to building hobby robots, there are manygreat resources and products you can rely on for the

mechanics and electronics that will become your robot.Whether it’s a chassis, wheels, motors, a compass, a rangesensor, or a controller board, there is no shortage of products to choose from. However, when it comes to thesoftware that will form your robot’s intelligence, the choicesare much more limited. Few plug-and-play software compo-nents exist. Without pre-built software components, youmust either write all of your robot’s control software fromscratch or cobble it together by modifying and integratingvarious snippets of code others have published.

With the advent of several object-oriented programminglanguages — Java™ and C# (pronounced C sharp) — the software industry has made great strides in moving towardindustry-wide reuse of pre-built components. Both of theselanguages provide the ability to build and package softwarecomponents that can be used in a wide range of applicationswithout modification.

This is the first in a series of tutorials on building reusablerobotics software components. In each article, we will develop new components that add to the intelligence of arobot named the RidgeWarrior II. A few of the interestingcomponents we will develop are: a shaft encoder to measurewheel rotation using an infrared photoreflector sensor, an odometer to keep track of a robot’s position, and a navigator to successfully move a robot from place to place.We will strive to make the components reusable, so you canput them to use in other robotics projects.

The RRobot PPlatformThe focus of this series is building software components;

therefore, we will use an off-the-shelf kit — the IntelliBrain™-Bot kit from RidgeSoft (www.ridgesoft.com) — as the chassis and controller for the RidgeWarrior II, rather than

delving into themechanical and electronic aspects of building robots. Anassembled IntelliBrain-Bot is shown in Figure 1.

The IntelliBrain robotics controller will provide the brain-power for our RidgeWarrior II robot. This controller willallow us to implement software using a modern, object-oriented programming language — Java. In addition to itsobject-oriented nature, Java has built-in support for multi-threading and floating point arithmetic — both featuresthat will facilitate creating interesting robotics software components that are reusable.

A LLittle BBackgroundThe RidgeWarrior II robot we will be developing is a follow

-up to the original RidgeWarrior robot, which was modeledafter the Rug Warrior robot discussed in the book MobileRobots: Inspiration to Implementation by Jones, Flynn, andSeiger. The Rug Warrior robot was based on the Motorola68HC11 microcontroller and the Interactive C programminglanguage to implement a behavior-based robot. The originalRidgeWarrior robot used the MIT Handy Board controller,also based on the 68HC11 microcontroller, but it was programmed in Java using the RoboJDE™ robotics softwaredevelopment environment instead of Interactive C.

For the RidgeWarrior II robot, we will use the IntelliBrainrobotics controller, which is similar in functionality to theHandy Board, but is based on the Atmel ATmega128 microcontroller. The IntelliBrain controller has significantlymore computing power and memory than the Handy Board,which will allow us to take greater advantage of Java’sobject-oriented programming and multi-threading features.

The IntelliBrain-Bot kit is the combination of the ParallaxBoe-Bot™ chassis and the IntelliBrain robotics controller. Aswe program the RidgeWarrior II, we will build on software

Figure 11

Grau1.qxd 1/3/2005 3:03 PM Page 19

Page 20: Servo Magazine 02 2005

components that already exist in the RoboJDE library and wewill create our own new software components.

Creating RReusable SSoftwareComponents

Our goal is to create software components that are bothuseful and easy to reuse in future robotics projects withoutmodification. Three keys to achieve this goal are:

1. Creating components that are cohesive and provide usefulfunctionality.

2. Creating the components such that they have minimalinterdependencies — in other words, they are loosely coupledto the rest of the system.

3. Designing generic interfaces to components that promoteinterchangeability.

The hobby servo is a wonderful electromechanical exampleof a reusable hardware component exhibiting these threecharacteristics. A motor, gears, electronics, and packagingform a cohesive component: a servo. It provides a very usefulfunction — a controllable means for converting electrical energy to motion. While the servo packs a lot of functionalityinto a small package, it does so in a way that allows it to beloosely coupled to the rest of the robot. Furthermore, servosimplement a simple, generic interface to other components ofthe system: three wires for power and control, a rectangularcase with four mounting tabs, and an output shaft withsplines. The simplicity and utility of this interface has facilitateda multitude of interoperable and interchangeable products.

Unfortunately, there aren’t many robotics software com-ponents that hobbyists can incorporate into their projects aseasily as they can incorporate hobby servos and other popularmechanical and electronic components. To date, many of the most popular robotics software development tools andlanguages have lacked built-in features to facilitate creationand reuse of software components. Fortunately, Java does!

Java aand SSoftware RReusabilityJava was designed from the ground up to support object-

oriented programming, a software development paradigmthat is ideal for developing cohesive software components and loosely coupled software systems. In addition to beingobject-oriented, Java supports multi-threading, making it mucheasier to implement multi-tasking, real time systems — such asa robot — with minimal coupling between components.

Java has a built-in mechanism for defining and using soft-ware interfaces, allowing a variety of software componentsthat implement an interface to be used interchangeably.

Java also provides a means to share pre-built softwarecomponents without dependencies on vendor specific develop-ment tools — like a compiler or assembler — or dependencies ona specific microcontroller. Instead, pre-built components can

be built once, packaged, and shared without end users needing to be concerned about any of these things.

Enough TTheory!Okay, you’re probably ready to get on with creating some

components. We will skip over the robot assembly and other“getting started” steps, as these things are described in detailin the IntelliBrain-Bot Assembly Guide, the IntelliBrain UserGuide, and the RoboJDE User Guide, all of which come on CD-ROM in the IntelliBrain-Bot kit and are also available onRidgeSoft’s website. Throughout this series, we will develop anumber of interesting software components for theRidgeWarrior II robot. Let’s start by developing a few compo-nents to create a user interface framework. By developing theuser interface framework first, we will be able to use it through-out the project to test and debug other components we build.

User IInterface RRequirementsAs with anything, there are many ways to implement a

user interface. For this project, we will implement our userinterface based on the following requirements:

1. Display output using the IntelliBrain controller’s two lineLCD module.

2. Provide for multiple screens displaying different groups ofdata.

3. Allow the active screen to be selected using the IntelliBraincontroller’s thumbwheel while the program is running.

4. Periodically update the currently displayed screen withoutinterfering with what the robot is otherwise doing.

5. Allow the robot operator to select one of several pre-programmed functions for the robot to perform.

The RoboJDE class library — which contains foundationsoftware components (Java classes) — provides a class named“Display.” This class interfaces to the IntelliBrain’s LCD displayand provides a method for printing text strings to either of thetwo lines of the display. We need to add the ability to createmultiple screens. Each screen must have the ability to display itsdata on the screen when it is told to update the display. Toaccomplish this, the screen interface only needs one function— or “method,” as they are typically called in object-orientedprogramming languages. We will name this method “update”and create the following generic definition for a “Screen” class:

public interface Screen public void update(Display display);

With Java, the source code for a class or interface is nor-mally stored in its own file with a “.java” extension. Therefore,our newly defined interface should be in its own file, named

20 SERVO 02.2005

Creating RReusable RRobotic SSoftware CComponents

Grau1.qxd 1/3/2005 3:05 PM Page 20

Page 21: Servo Magazine 02 2005

“Screen.java.” We can create this file with RoboJDE using theFile->New Class menu item and entering the name “Screen”as the class name. One other thing we have to do is let theJava compiler know where to import the Display object from.We do this by adding an import statement at the beginningof the file. The complete code for the class is:

import com.ridgesoft.io.Display;

public interface Screen public void update(Display display);

Now that we’ve defined the Screen interface, it’s time tocreate a class that implements it. Let’s create a screen class thatjust displays two lines of unchanging text. This will enable us tohave the program display its name and version number. We cando this by again using RoboJDE’s File->New Class menu itemand creating the “StaticTextScreen” class, as follows:

import com.ridgesoft.io.Display;

public class StaticTextScreen implements Screen private String mLine1;private String mLine2;

public StaticTextScreen(String line1, String line2)

mLine1 = line1;mLine2 = line2;

public void update(Display display) display.print(0, mLine1);display.print(1, mLine2);

Because this class declares that it implements the“Screen” interface, it is required to implement the “update”method defined by the Screen interface. Our update methodsimply prints predefined text strings to each line of the display. In addition to the required method, our class alsodefines two member variables:

private String mLine1;private String mLine2;

which refer to each of the strings and a constructor:

public StaticTextScreen(String line1, String line2)

mLine1 = line1;mLine2 = line2;

which allows an instance of a StaticTextScreen to be createdand initialized.

Managing MMultiple SScreensOur next step is to create a class that will manage several

screens and allow selection among screens to display whilethe program is running. We will create a Java class named“ScreenManager” to do this. We will extend Java’s “Thread”class, which is part of the base Java class library. This will allow the screen updating code to be implemented independent of other portions of the program.

Running different parts of a program on differentthreads really makes it much easier to create componentsthat are loosely coupled and easy to reuse. Java’s threadingsystem takes care of scheduling when each thread runs andallows higher priority threads to preempt lower prioritythreads. In a single threaded system, we would need to writecode to manage the scheduling and prioritization of therobot’s activities. We would also need to write the programin such a way that screen updates wouldn’t interfere withother more important and time critical tasks, like avoidingrunning into a wall. Instead, we will just give theScreenManager thread a low priority, so it will only executewhen there isn’t anything more important to do.

We will need to create the ScreenManager class, similarto how we created the StaticTextScreen class. We will needto declare that the ScreenManager extends the Thread classas follows:

public class ScreenManager extends Thread

We also need to create member variables to keep trackof the Display object, the list (array) of screens that can bedisplayed, and the input that will be used to select which

SERVO 02.2005 21

MAGNIFY Your

Optical Savings!

Dept. B051-X914, 101 E. Gloucester Pike, Barrington, NJ 08007Tel:1-856-573-6865 Fax:1-856-546-1965 E-mail:[email protected]

www.AnchorOptical.com .ANCHOR OPTICAL SURPLUS

EXPERIMENTAL& COMMERCIALGRADE LENSES

Start Up Research Prototype Single Unit Applications Educational Applications Initial Run Requirements

Over 5000 seconds, overruns & overstocks ready for delivery at big savings!

a division of Edmund Optics

NEW!

Order on-line or

call for

free optics catal

og!

Circle #44 on the Reader Service Card.

Grau1.qxd 1/4/2005 2:02 PM Page 21

Page 22: Servo Magazine 02 2005
Page 23: Servo Magazine 02 2005
Page 24: Servo Magazine 02 2005

SUPPLIER

Product Nam

e

Model

DC VoltageAccuracy

Accuracy

AC Voltage

DC Current

AC Current

Accuracy

AccuracyResistance

Capacitance

budget digital multimeters

24 SERVO 02.2005

B&K Precisionwww.bkprecision.com

BK 2704B Tool KitDMM

2704B 1,000 0.5 750 1.5 200 mA 1 2 A 1.2 20 Mohm 20 µF

Mini-Pro Multimeter 2405A 600 2 600 2.9 10 A 3 N/A N/A 20 Mohm N/A

Elencowww.elenco.com

Digital Multimeter M-1700 600 0.9 600 1.9 10 A 1.5 10 A 2.5 20 Mohm 20 µF

Digital Multimeter M-2785 750 0.5 750 1 20 A 1 20 A 1.5 200 Mohm 200 µF

Extechwww.extech.com

MV110 MultiView SeriesDigital Multimeter MV110 1,000 0.5 750 0.8 2 A 1.2 2 A 1.8 200 Mohm N/A

MultiPro Multimeter MT310 1,000 0.5 700 1.5 20 A 1.2 20 A 2 40 Mohm 100 µF

Flukewww.fluke.com

Fluke 110 DigitalMultimeter 110 600 0.7 600 1 20 A 1 10 A 1.5 40 Mohm

9,999µF

Protekwww.protektest.com

3-3/4 Digit 3,200 CountValue-Priced DMM

With BargraphD980 1,000 0.5 750 1.2 300 mA 1.2 300 mA 2 30 Mohm N/A

2,000 Count,Advanced DMM

410 1,000 0.8 750 1 10 A 1 10 A 2 20 Mohm N/A

RadioShackwww.radioshack.com

15 Range DigitalMultimeter 22-810 500 0.8 500 1.5 200 mA 2 N/A N/A 2 Mohm N/A

29 Range DigitalMultimeter 22-813 600 0.8 600 1.2 10 A 1.5 10 A 2 40 Mohm N/A

42 Range DigitalMultimeter With Electric

Field Detection22-811 600 ±0.8% 600 ±1% 10 A 1 10 A 1.2 4 Mohm 400 µF

Wavetekwww.metermantesttools.com

5XP Digital Multimeter 5XP 1,000 1 750 1.5 200 mA 1.5 200 mA 2 20 Mohm N/A

35XP Digital Multimeter 35XP 1,000 0.5 750 1.5 2 A 2 2 A 2.5 40 Mohm4,000

µF

BrainMatrix.qxd 1/3/2005 3:30 PM Page 24

Page 25: Servo Magazine 02 2005

Dim

ensions, mm

Power

Standard Accessories

Auto Off M

ode

Data H

old

Transistor Test

FrequencyD

iode Check

Continuity Check

Battery Test Under

Temperature

Weight, oz (g)

List Price

SERVO 02.2005 25

Upcoming topics include SBCs and H-bridges, sensors, kits, and actuators. If you’re a manufacturer of one of these items, please sendyour product information to: [email protected] Disclaimer: Pete Miles and the publishers strive to present the most accurate data possible in this comparison chart. Neither is responsible for errors or omissions. In the spirit of this information reference, we encourage readers to check withmanufacturers for the latest product specs and pricing before proceeding with a design. In addition, readers should not interpret the printing order as any formof preference; products may be listed randomly or alphabetically by either company or product name.

by Pete Miles

15 MHz Yes Yes No No No Yes NoTest Leads, Battery,

Rubber Boot Protection9 V 150 x 79 x 33 9 (250) $59.00

N/A Yes No Yes No No No No Test Leads, Battery 9 V 143 x 68 x 47 7.3 (200) $27.00

20 MHz Yes Yes No No No Yes NoHolster,Test Leads,

Fuse, Battery9 V 151 x 70 x 38 7 (200) $49.95

20 MHz Yes Yes No No Yes Yes 30 min Test Leads, Rubber Holster 9 V 90 x 190 x 35 12 (340) $66.50

N/A Yes Yes Yes No No Yes 15 min Test Leads 9 V 189 x 85 x 32 9.7 (300) $39.00

10 MHz Yes Yes No No Yes No 30 min Test Leads, Rubber Holster 9 V 88 x 178 x 33 11 (315) $79.00

50 kHz Yes Yes No No Yes No 20 minHolster,Test Leads,

Battery9 V 460 x 960 x 160 12 (350) $109.00

N/A Yes Yes No No Yes No No Test Leads, Holster 2 x AAA 165 x 76 x 38 11 (300) $75.00

N/A Yes Yes No Yes Yes Yes NoTest Leads with

Aligator Clips,Type K Thermal Couple

9 V 178 x 84 x 33 9 (250) $31.00

N/A Yes No No No No No 30 min Test Leads, Case 12 V 118 x 80 x 18 3.5 (100) $19.99

N/A Yes Yes Yes No Yes No 30 min Test Leads, Fuse 3 x AAA 150 x 74 x 38 6 (170) $29.99

4 MHz Yes Yes No No Yes No 30 min Test Leads, Fuse 9 V 161 x 80 x 39.5 6.8 (195) $49.99

N/A Yes Yes Yes No Yes No NoHolster,Test Leads,

Battery, Fuse,Magnetic Strap

9 V 155 x 72 x 32 7.4 (210) $39.95

40 MHz Yes Yes No Yes Yes No 10 minHolster,Test Leads, Battery,Fuse, Magnetic Strap,Type K

Thermal Couple9 V 155 x 72 x 32 14 (400) $79.95

BrainMatrix.qxd 1/4/2005 12:48 PM Page 25

Page 26: Servo Magazine 02 2005

Step Up to the Motorvator. Step Up to the Motorvator. Step Up to the Moto

Best.qxd 1/5/2005 2:45 PM Page 26

Page 27: Servo Magazine 02 2005

For precision applications, just driving a MOSFET or transistor switch circuit for each stepper motor winding with basic stepper motor sequence code won’t cut it. You’ll needsome extra external hardware to make sure the stepper motor goes where you want it to goand stops where you want it to stop. Also, you’ve got to do this without burning up themotor windings or smoking your motor drive electronics. The burden of designing an X-Ystepper motor driver system is doubled as your application is running both X and Y axes,which requires two motors, two motor drivers, plus the common driver firmware, and themicrocontroller or pair of microcontrollers to oversee it all.

If precision positioning in two dimensions is your goal, chances are you’ll need a minimum of two stepper motors, which dictate the use of the equivalent of a pair of steppermotor drivers. For those of you out there who have visions of home-brew precision X-Ytables, getting past the electronic hardware design can be just as tough as writing thefirmware for your mechanical X-Y table design. I can’t help each of you with the uniquemechanics of your particular X-Y table design, but I can “step” you through the design andrealization of a dual microstepping stepper motor driver based on a pair of AllegroSemiconductor’s A3977SED Microstepping DMOS Driver/Translators.

SERVO 02.2005 27

by Peter Best

Driving a stepper motor with a microcontroller is pretty much oldhat these days, as there are a multitude of Internet entries that

tell you exactly how to make that happen. That’s great if just wildlyturning the shaft of the stepper motor is all you want to do. If you planto use the stepper motor in an application that requires precision con-trol of the angular motion generated by the stepper motor, you’ll haveto add a bit more code to those basic sequence-oriented motor driverroutines that you downloaded from the net. In addition to writing somepretty hairy stepper motor driver code, you’ll have to put on your high-voltage-high-current-analog-digital hardware designer’s hat, as well.

STEPUp to the

Motorvator

p to the Motorvator. Step Up to the Motorvator. Step Up to the Motorvator.

Best.qxd 1/5/2005 2:47 PM Page 27

Page 28: Servo Magazine 02 2005

Step Up to the Motorvator. Step Up to the Motorvator. Step Up to the Moto

The A3977SEDAlthough the bulk of the on-chip A3977SED analog and

digital subsystems are important support structures for driving the A3977SED’s pair of internal low rDS(on) DMOS H-bridges, the A3977SED translator subsystem puts theA3977SED in a stepper motor driver IC class of its own. TheA3977SED translator subsystem eliminates the need for additional microcontroller firmware and I/O lines that mustbe incorporated to realize complete control of motor stepand direction when using other stepper motor driver ICs.

Without a translator, the stepper motor driver designermust incorporate DACs (Digital to Analog Converters), comparators, and various low-pass filters to regulate and control PWM (Pulse Width Modulation) current flow to thestepper motor being driven. Incorporating the A3977SEDinto your stepper motor design virtually eliminates the needfor the external components and circuitry I just mentioned. Asimple low-to-high logical transition applied to theA3977SED’s translator STEP input pin results in a single stepor microstep of the bipolar stepper motor under tow behindthe pair of A3977SED DMOS H-bridges.

Changing the stepper motor’s rotational direction usingan A3977SED is just as easy. Clockwise or counterclockwisemotor rotation is achieved by presenting a logical high or logical low to the A3977SED’s translator DIR input pin. TheA3977SED logic subsystems can be powered by voltages in

the range of +3.0 VDC to +5.5 VDC and draw very little current. That makes the A3977SED compatible with mostany microcontroller you want to include in your steppermotor driver design.

Being able to easily drive your stepper motor in full stepmode has advantages in certain situations. However, the abilityto microstep your stepper motor is an absolute necessity ifyou want to move an axis of your X-Y table with extreme precision. So, in addition to being capable of driving a stepper motor in its native full step mode, the A3977SEDtranslator provides a pair of microstepping inputs (MS1 andMS2) that — when stimulated with a predetermined patternof logical input voltages — force the bipolar stepper motorbeing driven to operate in full-, half-, quarter-, or eighth-stepmodes. The microstepping truth table for the MS1 and MS2translator inputs is shown here:

MS1 MS2 ResolutionL L Full StepH L Half StepL H Quarter StepH H Eighth Step

The A3977SED translator is also capable of shuttingdown the DMOS H-bridge outputs and setting itself to aknown state, which is referred to as the home state in theAllegro documentation. This is done by applying a logical low

to the translator’s RESET pin.While in the RESET mode(RESET pin held low), the trans-lator’s HOME output signalgoes low and all STEP inputs areignored. The A3977SED HOMEsignal is not really a physical“position,” but is a unique statein which the stepper motor coilpositive phase currents are balanced evenly. HOME is alsothe logical starting point for thetranslator. Changes to stepmode can be made while in theHOME state, as doing so willnot disrupt the integrity of thedriving current waveform.

The rest of the A3977SED’stweakable knobs are linkeddirectly to its internal controllogic subsystem. An active lowENABLE input enables all of theDMOS H-bridge outputs. Sincethe ENABLE input is under con-trol of the A3977SED’s controllogic subsystem, all of the trans-lator motion control inputs(STEP, DIRECTION, MS1, andMS2) are active, even when theENABLE pin is presented with a

28 SERVO 02.2005

GATE D

RIVE

CO

NTRO

L L

OG

IC

CHARGE PUMP

REGULATOR

BANDGAP

PWM TIMER

PWM TIMER

TRAN

SLATO

R

DAC

DAC

4

4

LOAD SUPPLY

DMOS H BRIDGE

DMOS H BRIDGE

UVLO AND FAULT

SENSE1

SENSE2

STEP

DIR

RESET

MS1

MS2

HOME

SLEEP

SR

ENABLE

RC1

REF

VDD

2V

PFD

VC

P

VBB1

VBB2

OUT2B

CP

1

CP

2

VR

EG

VCP

SENSE1

RC2

OUT1A

OUT1B

OUT2A

+ -

+ -

STEPPER MOTOR

FIGURE 1. This is a simplified block diagram of the A3977SED internals. It looks busy until you understand what everything really does.

Best.qxd 1/3/2005 2:36 PM Page 28

Page 29: Servo Magazine 02 2005

logical high, which disables the DMOS H-bridge outputs. By allowing the disabled state to coexist with an active

translator state, you can step the stepper motor to a particularpoint in the physical X-Y axis movement program and thenreenable the DMOS outputs at that point. In addition to theENABLE input, the control logic subsystem is responsible forinitiating SLEEP and WAKEUP states for the A3977SED’s inter-nal logic. An active low SLEEP input to the on-chip control logicsubsystem gives the stepper motor driver designer full controlof the SLEEP and WAKEUP features of the A3977SED.

Probably the most important job the control logic subsystem has is the management of the sequencing of theindividual DMOS devices. This sequence managementprocess is called synchronous rectification and is enabled bypresenting a logical low to the control subsystem’s SR inputpin. In most cases (including the design we will be discussingin this article), synchronous rectification eliminates the needfor external current steering diodes.

There are many other A3977SED internals we need totalk about and the best way to describe them is to examinethem as we assemble some A3977SED-based stepper motordriver hardware that I call the Motorvator.

Designing and Building theMotorvator

The Motorvator is centered around a PIC18F8520 thatholds court over a pair of Allegro Semiconductor A3977SEDstepper motor driver ICs. The PIC18F8520 is a member ofMicrochip’s 80-pin high-performance microcontroller family.Running at 40 MHz and packing32K of program Flash, thePIC18F8520 has more thanenough I/O, data memory, analog-to-digital converter inputs, andtimers to control and even pickup after the pair of A3977SEDstepper motor drivers.

As most of the motor driving work will be done by theA3977SED ICs, the PIC18F8520will be primarily concerned with providing logic levels to the A3977SED subsystems andacting as an interface betweenexternal controls (switches,potentiometers, etc.), the step-per motor driver ICs, and thestepper motors.

Power for the A3977SEDlogic and the PIC18F8520 is pro-vided by an LM317 adjustablevoltage regulator, which receivesits raw input voltage from themotor power supply. The LM317was chosen because of its abilityto handle higher input voltages

than its fixed-voltage cousins. The A3977SED is designed todrive a stepper motor from incoming motor voltages as highas +35 VDC at motor currents up to ±2.5 Amperes. Withinput motor voltages ranging from +8 VDC to +35 VDC, apair of filter and bypass capacitors along with a couple of 1%tolerance resistors are all that you need to set the output ofthe LM317 at a rock-solid +5 VDC.

The LM317 is capable of delivering up to 1 A of currentto a load, when properly heatsinked. The Motorvator’sLM317 is mounted on a heatsink pad on the Motorvator PCB(printed circuit board). The PIC18F8520, the pair of

p to the Motorvator. Step Up to the Motorvator. Step Up to the Motorvator.

SERVO 02.2005 29

PHOTO 1. The Motorvator PCB includes pads for externalcurrent steering diodes and a fully pinned out PIC18F8520

for those that want to walk on the wild side.

PHASE 1

CURRENT

(cos)

sin(0°)=0.0

cos(0°)=1.0

sin(45°)=0.7071067811

cos(45°)=0.7071067811

sin(90°)=1.0

cos(90°)=0.0

PHASE 2

CURRENT

(sin)

Home State = 45°

RADIUS = 1

0.0°

45.0°

90.0°

0.0°

45.0°

90.0°

FIGURE 2. The idea here is to convey that the step angle of the phase currents hasabsolutely nothing to do with the step angle of the stepper motor shaft.

Best.qxd 1/3/2005 2:38 PM Page 29

Page 30: Servo Magazine 02 2005

30 SERVO 02.2005

A3977SEDs, and all of the Motorvator’s LEDs and voltagedividers don’t even come close to taxing the LM317’s currentoutput capacity. During testing of the Motorvator, I foundthat — at low input voltages (+12 VDC to +18 VDC) — the LM317 never got much more than warm to the touch. Thesame goes for the A3977SEDs, which are heatsinked by themassive amount of ground plane area on the Motorvator PCB.The A3977SEDs are attached to the PCB heatsink/ground-plane by 12 internally grounded heatsink pins.

A look at my Motorvator in Photo 1 reveals thePIC18F8520, the 40 MHz oscillator, the LM317 logic powersupply, and the 10-pin Microchip ICSP programming/debug-ging socket sandwiched between an identical pair ofA3977SED stepper motor drivers designated logically as DriverA and Driver B. The four six-pin right-angle header assembliesclosest to the quartet of 10-turn trimmer pots form a micro-controller input portal for all of the external control inputs.

External control inputs can be just about anything theuser deems necessary to gain control of the movement of thestepper motors via the PIC18F8520. Motor and logic inputpower is obtained from the center pins of either of the singlesix-pin right-angle stepper motor interface headers that surround the LM317 voltage regulator. A single ULN2003Darlington array is used instead of discrete transistor switches to drive the Driver A and Driver B, HOME LEDs, andan auxiliary SPDT +5 VDC coil relay.

I’ve supplied a full schematic depiction of theMotorvator. However, to help make things a bit clearer as I describe the details of the Motorvator hardware and firmware, I suggest downloading the A3977SED data

sheet (www.allegromicro.com)and using it to supplement theA3977SED information that I willprovide for you in this discussion.Within the A3977SED data sheet,you will find some familiar conceptsthat we’ve already discussed, such asthe translator and the control logicsubsystems. With that, follow alongusing the A3977SED functionalblock diagram in Figure 1 as I continue to describe the remainingdesign points we’ll need to cover tobring the Motorvator to life.

At power-up or with the initiationof a reset via the RESET pin, the trans-lator uses its pair of four-bit DAC con-trol lines to force the output of thepair of DACs into the home state.Motor phase current polarities foreach motor phase are also set to theirhome state conditions and the currentregulators for both of the motorphases are set to mixed-decay mode.

The idea here is to step themotor as smoothly as possible. Thissmooth stepping action is achieved

when the motor is driven with a sinusoidal current waveform.Within the A3977SED, this sinusoidal waveform is quadraturein nature, meaning that the phase current waveforms are 90°out of phase. I’ve put together a graphic in Figure 2 thatgives you a feel as to how the motor phase currents relate toeach other and the A3977SED HOME state.

If you visualize the phase current waveforms as sine andcosine functions and relate that to what the A3977SED calls the HOME state, the math in Figure 2 says it all. HOMEstate is defined as a point in the sinusoidal phase currentwaveforms where both motor phase current levels are70.71% of the maximum phase current value. Check ourmath against the A3977SED data sheet and you’ll find thatHOME state is located at the 45° position of each of thephase current waveforms. Don’t confuse the 45° positionwith an angle on the motor shaft. This position is an angularposition in the phase current waveforms. For instance, if wemove 45° positively away from HOME position, the PHASE1CURRENT level is at 0 while the PHASE2 CURRENT level is at100% of the maximum phase current.

Since the HOME position is the translator’s beginningpoint in a step sequence and 360° constitutes a full cycle, itwould be safe to say that we’ll end up at the 45°, or HOMEposition, at the end of one full cycle.

In full step mode, a two-phase stepper motor requiresfour steps to complete one full phase cycle. That’s 90° perstep. If the stepper motor is running in half-step mode, thenumber of steps required to move from HOME position tothe next HOME position is eight steps. Get the idea? A stepper motor running in eight-step mode needs 32 steps to

Step Up to the Motorvator. Step Up to the Motorvator. Step Up to the Moto

SENSE

D

A

C = OFF

B = OFF

Itrip Itrip

B

D

Toff

Itrip

D = OFF

B = OFFA = OFF

FAST DECAY

SLOW-DECAY MODE

D = ONC

Toff

B

MIXED DECAY

Toff

BVB

FAST-DECAY MODE

A = OFF

C = OFFC

SENSE

SLOW DECAY

BVB

A

Tfd

FIGURE 3. You can clearly see here that the slow-decay mode ripple is very lowwhen compared to the fast-decay mode current ripple. The A3977SED uses the best of both decay worlds to produce a sinusoidal current drive to the

stepper motor attached to its pair of H-bridges.

Best.qxd 1/3/2005 2:40 PM Page 30

Page 31: Servo Magazine 02 2005

traverse the 360° between adjacent HOME positions in thephase current waveform.

The A3977SED automatically employs mixed-decaymode, which results in a motor current waveform that closelyapproximates the ideal sinusoidal current waveform we needto smoothly power our stepper motor. Mixed-decay mode isthe product of slow-decay mode and fast-decay mode. Decayis defined as the time it takes to get the recirculating currentout of a motor winding. The weird noises you hear comingfrom stepper motors are caused by distortions in the sinu-soidal current waveform. The distortion is caused by theimproper selection of a decay mode during a particular angulartime within the sinusoidal current flow. Let’s take a look atwhat decay is and how it is handled by the A3977SED.

Figure 3 depicts typical H-bridge configurations with VBBrepresenting the incoming motor power. To apply currentacross the motor winding, the DMOS devices are activateddiagonally. For instance, by turning on the A and D DMOSdevices, current can flow from the VBB source through the ADMOS device, which has shorted out its body diode, throughthe coil and across DMOS device D, which has also shorted

out its body diode through the SENSE resistor to ground. The current can also flow in the same manner — but in theopposite direction — by energizing DMOS devices B and C.

The A3977SED H-bridges are driven by a fixed-off-timePWM current control circuit. The load current limit (ITRIP) isalso controlled by the PWM current control circuit. Anotherlook at Figure 1 shows us that the A3977SED DAC outputvoltages and the voltages across the H-bridge current-senseresistors are fed into current-sense comparators that reportto the A3977SED’s PWM generators. When the voltageacross the sense resistor equals the voltage that is being generated by the DAC, the PWM latch within the PWM Timersubsystem is reset.

At this point, the H-bridge enters one of the decaymodes. The motor current will recirculate and decrease untilthe fixed-off time expires. The act of automatically routingthe recirculating motor winding current using the DMOSdevice’s body diodes and one of the decay modes is synchro-nous rectification. When the A3977SED’s translator SR inputpin is presented with a logical low, synchronous rectificationis automatically performed by the logic within the A3977SED.

SERVO 02.2005 31

p to the Motorvator. Step Up to the Motorvator. Step Up to the Motorvator.

STOP

HOMEA_LED

UND5

LS2

U2

PIC18F8520

123456789

1011121314151617181920

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

4142434445464748495051525354555657585960

6162636465666768697071727374757677787980

RH2RH3RE1RE0RG0RG1RG2RG3MCLRRG4VSSVDDRF7RF6RF5RF4RF3RF2RH7RH6 R

H5

RH

4R

F1

RF

0A

VD

DA

VS

SR

A3

RA

2R

A1

RA

0V

SS

VD

DR

A5

RA

4R

C1

RC

0R

C6

RC

7R

J4R

J5

RJ6RJ7RC2RC3RC4RC5RB7VDD

OSC1OSC2

VSSRB6RB5RB4RB3RB2RB1RB0RJ3RJ2

RJ1

RJ0

RD

7R

D6

RD

5R

D4

RD

3R

D2

RD

1V

SS

VD

DR

D0

RE

7R

E6

RE

5R

E4

RE

3R

E2

RH

0R

H1

START

C20.1uF

START

PWR LED

SR

B

UND4

REV1

LS1

SLE

EP

B

+5VDC

C16.1uF

R10 - R21

+ C2110uF

ST

EP

A

SR

A

NC

AUTO

PGC

UND1

+5VDC

VR1LM317

1 3

2

VIN VOUT

AD

J

ENABLEB

LS2

AUXO

CONST

UND2

R12715

K1

RELAY SPDT

54

613

DIR

A

MS

1A

ROTARY MOTION SPEED

MCLR

C22.1uF

R10

10K

+5VDC

R11

240

J5

ICSP

12345678910

10K PULLUP RESISTORS

EN

AB

LEA

RE

SE

TA

HOMEA

MS

2A

DIRB

UND4

.1uFC17

+5VDC

D91N5819

NO

PGD

C14

.1uF

MS

2BS

TE

PB

+5VDC+5VDC

STOP

COMMON

HOMEB

AUXO_PINRELAY

UND5

C15.1uF

HO

ME

A

AUTO

C18.1uF

CONST

+5VDC

VBB +5VDC

AU

XO

+5VDC

REV1

C19.1uF

R13470

LS1

UND3

MS1B

LINEAR MOTION SPEED

UND3

HOMEB

SLE

EP

A

RE

LAY

40MHz

1 8

4 5

NC VDD

GND CLKOUT

CU

RLI

MB

AC

UR

LIM

B

HOMEB_LED

RE

SE

TB

UND1

U31234567

16161413121110

8 9

IN1IN2IN3IN4IN5IN6IN7

OUT1OUT2OUT3OUT4OUT5OUT6OUT7

GND CLMP

UND2

+5VDC

SCHEMATIC 1. The PIC18F8520 has much more I/O, program memory, and data memory than a basic Motorvator needs.The good news is that there are plenty of microcontroller resources left for you to do with as you please.

Best.qxd 1/3/2005 2:40 PM Page 31

Page 32: Servo Magazine 02 2005

Slow-decay mode is entered when the source drivers (Aand B) are turned off and the sink driver D is turned on. Thecurrent in the motor coil is dissipated slowly by being forcedto recirculate through the resistances offered by the coil itselfand the body diode of DMOS device C. If you’re wonderingif DMOS device C can be energized and conducting in thismode, the answer is yes, but it’s not necessary, as the DMOSdevice C body diode allows the current to circulate throughthe motor winding. Since back EMF from the motor windingcan override the operation of slow-decay mode on the fallingslope of the current sine wave and cause distortion of the current waveform (which causes the motor to chatter),slow-decay mode is employed on the rising quadrants of thesinusoidal current waveform.

Turning off all of the DMOS devices puts the H-bridgeinto fast-decay mode. Fast-decay mode allows for the rapiddissipation of the latent motor winding current. As you cansee in Figure 3, the body diodes of diagonal pairs of DMOSdevices form the escape path for the recirculating motor current. Fast-decay mode produces much more current ripplethan slow-decay mode and, thus, heats the motor a bit morethan slow-decay mode does.

The ideal situation would be to have the power to mixthe slow-decay and fast-decay modes to fine-tune our sinusoidal current waveform that is driving our steppermotor. This condition would produce a tradeoff between thehigh and low ripple currents and provide enough recoveryspeed to help drive the stepper motor with a pretty accuratesinusoidal current waveform. The good news is that we dohave the power and the resultant mode is called mixed-decaymode. As you have already surmised, mixed-decay mode is anoptimal mixture of slow-decay mode and fast-decay modeand — eventhough mixed-decay mode is automatic with theA3977SED — we have some control over how it operates.

Let’s begin by determining the value of the H-bridge senseresistors, which directly affects the maximum ITRIP currentvalue. Since the A3977SED can handle a maximum of ±2.5A,let’s set up our H-bridge current sense resistors to meet themaximum current value that the A3977SED can process. Thevalue of the sense resistors is computed as follows:

Rs = 0.5/ ITRIP max

Where: Rs = sense resistor valueITRIP max = 2.5A

Rs = 0.2Ω

The only “gotcha” to watch out for is to make sure youselect a sense resistor that has very low inductance. I’ve spec-ified a suitable resistor for the Motorvator in the Parts List.

Now that we’ve chosen a sense resistor value, we canuse a voltage divider consisting of a standard 10-turn 10Kohm pot to provide a voltage to the A3977SED REF pin thatwill dial in our desired amount of current limiting that can beless than, but not greater than, our ITRIP max value of 2.5A.The desired current limit reference voltage is calculated using

the following transconductance function:

ITRIP max = VREF / (8Rs)

Substituting a value of 2.5 A for ITRIP maximum and avalue of 0.2 ohm for Rs yields a maximum value of 4.0 voltsfor VREF. If you’re wondering where the eight multiplier forthe sense resistor value comes in, take a look at Figure 1. Thevoltage applied to the A3977SED REF pin is divided by 8before being handed to the DACs.

Take another look at the Figure 2 graphic. The phase current sine waves appear to be smooth. In reality, there arevery tiny steps all along the phase current sine waves thatrepresent a function of the DAC output voltages versus a percentage of the ITRIP max value. The ITRIP current at eachstep along the way of the phase current sine waves can becalculated with the following formula:

ITRIP = (%ITRIP max/100) x ITRIP max

A table of ITRIP max percentages versus their appear-ance in the phase current sine wave is provided in theA3977SED data sheet.

Let’s get back to exercising our little bit of control over thedecay mode process. Another quick look at Figure 3 shows usthat the fixed-off time of the PWM current control circuitry isdefined as TOFF. The PWM fixed-off time is determined by anexternal RC circuit tied to a one-shot within the PWM currentcontrol circuitry. A minimum fixed-off time of 30 µS is specifiedby the A3977SED data sheet. To meet that minimum fixed-offtime, I mounted a pair of RC circuits to the A3977SED’s RC1and RC2 pins. I determined the values of the components yousee in the Motorvator schematic with the following formula:

TOFF = R2C2 for RC1 and TOFF = R4C4 for RC2

Do you recall my mention of additional low pass filteringthat would be needed if we were not going to implement theA3977SED? The A3977SED gets around having to include afilter between the sense resistor and the current sense comparator by blanking the output of the current sense comparator when the current control circuitry switches theoutputs. The blanking function is dependent upon the valueof the capacitor in the fixed-off time RC circuitry and isapproximated as follows:

TBLANK = 1900 x (C2 or C4)

TFD in Figure 3 represents the fast-decay time of themixed-decay mode. As you can see in the mixed-decay graphicportion of Figure 3, TFD is the time within the PWM currentcontrol fixed-off time that the fast-decay mode will be invoked.Fast-decay mode begins when the ITRIP threshold is reachedand remains in effect until the voltage on the RCx pin decaysto the voltage presented at the PFD pin. Once the fast-decaytime is depleted, the decay mode switches to slow-decay modefor the remainder of the PWM current control fixed-off time.

32 SERVO 02.2005

Step Up to the Motorvator. Step Up to the Motorvator. Step Up to the Moto

Best.qxd 1/3/2005 2:44 PM Page 32

Page 33: Servo Magazine 02 2005

TFD is a function of the PWM current control fixed-offtime and a voltage applied to the A3977SED’s PFD input pin,which feeds both of the PWM timers. The setting of the PFDvoltage depends on how you want to run your steppermotors. So, to provide an easy means of adjusting the TFDtiming threshold, I’ve placed another 10-turn 10K ohm potacross the PFD pin. The following formula, actual voltage,and component values I used on my version of theMotorvator will give you an idea of what my Motorvator TFDvalue looks like:

TFD = R2C2(ln(0.6Vcc/VPFD)

Where: R2 = 30K ΩC2 = .001 µFVcc = 5.0 VDCVPFD = 2.5 VDC

TFD = 5.47 µS

That does it for things that we can control using formulas

and their resultant component values. The remainder of the A3977SED’s supporting components are specified in the A3977SED data sheet and are reflected in theMotorvator schematic. So, let’s write some HI-TECH PICC-18C code to put all of that stepper motor driver theory and hardware to work.

The Motorvator FirmwareWriting the Motorvator firmware was loads of fun. I’ve

written some code to demonstrate some of the concepts wediscussed in the early stages of this article. I’m not going topost all of the code I wrote here, but will instead provide itto you as a download from the SERVO website (www.servomagazine.com). However, I will give you a jist of what I didand show you how to use the HOME position output signalto back-up what I told you about how the translator uses theHOME state.

The very first thing I did was to assign a meaningful Cname to each of the A3977SED interface pins. I then relatedthe names of the A3977SED pins to the pins that they

SERVO 02.2005 33

p to the Motorvator. Step Up to the Motorvator. Step Up to the Motorvator.

D5 D7

C8

.1uF

R3 10K

DRIVER A

OUT1B

RD4

+5VDC

R520K

VBB

RD1

D3

D8

R430K

+

C6 10uF

R1 10K

U1

A3977SED

1 2 44 11 12 13 22 23 24 33 34 35

3

45

6

9101415

16

18

2019

21

2543

2627

28

31

32

36 37 38

404142

GN

DG

ND

GN

D

GN

DG

ND

GN

D

GN

DG

ND

GN

D

GN

DG

ND

GN

D

SENSE1

HOMEDIR

OUT1A

PFDRC1REFRC2

VD

D

OUT2A

MS1MS2

SENSE2

VB

B2

VB

B1

SRRESET

OUT2B

STEP

VREGVC

P

CP

1

CP

2

OUT1B*ENABLE*SLEEP

REF

D1

C23.1uF

MG1BIPOLAR STEPPER MOTOR

1

2

3 4

RH1

U31234567

16161413121110

8 9

IN1IN2IN3IN4IN5IN6IN7

OUT1OUT2OUT3OUT4OUT5OUT6OUT7

GND CLMP

D4

C7

.1uF

+5VDC

D2

OUT1A

R8

.02

PFD

LED1

HOME A

+5VDC

RD5

D1-D8 NOT MOUNTED WHEN SR IS ACTIVE

C10 .22uF

R230K

RD7

C11 .22uF

+

C12 100uF

D6

RE7

C9

.22uF

RD3

+5VDC

RD2

C3

.1uF

C13

.1uF

R9332

C4

.001uF

C1

.1uF

VBB

R7

.02

OU

T2B

C2

.001uF

OU

T2A

RD0RD6

C5

.1uF

SCHEMATIC 2. This is a schematic of the A-side motor driver. All of the components that support the A3977SED in this depiction match those found in the B-side motor driver schematic.

Best.qxd 1/3/2005 2:47 PM Page 33

Page 34: Servo Magazine 02 2005

attached to on the PIC18F8520. For instance, Driver A’sRESET pin is designated as pRESETA and defined as LATD7,while Driver B’s RESET pin is identified as pRESETB attachedto LATC1 on the PIC18F8520. Any C reference that beginswith a “p” denotes that the reference is actually a physicalpin on either the PIC18F8520 or the A3977SED. To keepthings from getting too confusing, I used the actualA3977SED data sheet pin names in my descriptions where Icould.

Once all of the pin assignments were defined, I wentabout putting together simple macros that used the pin definitions to form functional blocks of code. For example,pRELAY is attached to LATE6 of the PIC18F8520. A logic highapplied to pin 6 of the ULN2003 drives pin 11 of theULN2003 low and provides a ground path for the relay coil. The following code definitions can be used in your application code to control the relay:

#define RELAY_ON pRELAY=1;#define RELAY_OFF pRELAY=0;

In a similar manner, the RESET function of the A3977SEDcan be simplified with the following code:

#define RESET_A pRESETA = 0; \Delay_ms(50); \pRESETA = 1;

#define RESET_B pRESETB = 0; \Delay_ms(50); \pRESETB = 1;

I needed a delay source for both the RESET and STEPfunctions. So, I implemented a millisecond timer using the PIC18F8520’s TIMER0. At 40 MHz, each instruction cycle accounts for 100 nS of time. That means that everymicrosecond of delay time I need requires me to expend 10instruction cycles. One millisecond is 1,000 microseconds. So, I need to expend 10,000 instruction cycles for every millisecond of delay I need in my routines. By dividing orprescaling the timer clock cycles by 16, my multiplier for 1 millisecond of delay time is 625.

Step Up to the Motorvator. Step Up to the Motorvator. Step Up to the Moto

34 SERVO 02.2005

R7

.02

RC0

+5VDC

C9

.22uF

R520K

RH0

+5VDC

C1

.1uF

LED1

HOME B

RC5

R3 10KREF

OU

T2A

OUT1A

OU

T2B

C23.1uF

R1 10K

+5VDC

RC1

RC3

+5VDC

RC2

D1-D8 NOT MOUNTED WHEN SR IS ACTIVE

+

C12 100uF

D4

C13

.1uF

C3

.1uF

D7

C8

.1uF

U31234567

16161413121110

8 9

IN1IN2IN3IN4IN5IN6IN7

OUT1OUT2OUT3OUT4OUT5OUT6OUT7

GND CLMP

RC7

R8

.02

C5

.1uF

C2

.001uF

D8

C4

.001uF

R9332

DRIVER B

C7

.1uF

VBB

U1

A3977SED

1 2 44 11 12 13 22 23 24 33 34 35

3

45

6

9101415

16

18

2019

21

2543

2627

28

31

32

36 37 38

404142

GN

DG

ND

GN

D

GN

DG

ND

GN

D

GN

DG

ND

GN

D

GN

DG

ND

GN

D

SENSE1

HOMEDIR

OUT1A

PFDRC1REFRC2

VD

D

OUT2A

MS1MS2

SENSE2

VB

B2

VB

B1

SRRESET

OUT2B

STEP

VREGVC

P

CP

1

CP

2

OUT1B*ENABLE*SLEEP

MG1BIPOLAR STEPPER MOTOR

1

2

3 4

C11 .22uF

D1

RC4

D3

RF0

+

C6 10uF

RC6

D2

D5

VBB

R230K

PFD

R430K

C10 .22uF

D6

OUT1B

SCHEMATIC 3. Here’s a schematic depiction of the B-side motor driver. Note the differences in the PIC pins that drive the A3977SED and the U3 drive for the HOME B LED. Every other component is identical

to the ones used by the A-side motor driver.

Best.qxd 1/3/2005 2:48 PM Page 34

Page 35: Servo Magazine 02 2005

The PIC18F8520 timers count positively and overflow tozero. My delay routine simply puts enough counts into the timer to allow it to count up the desired number of milliseconds and overflow. I watch for the overflow using the TIMR0IF (TIMER0 Interrupt Flag) bit, which signals theend of my selected millisecond timing period. Here’s whatthe delay code looks like:

void Delay_ms(unsigned int mticks) //use with prescaler set for 1:16WRITETIMER0(0xFFFF -(mticks * 625));TMR0IF = 0;while(!TMR0IF);

I then integrated the delay timer function into a STEPfunction. The basic STEP macro looks like this:

#define STEP_Ams(x) pSTEPA = 1; \Delay_ms(x); \pSTEPA = 0; \Delay_ms(x);

#define STEP_Bms(x) pSTEPB = 1; \Delay_ms(x); \pSTEPB = 0; \Delay_ms(x);

As I alluded to earlier, a low-to-high transition on theSTEP input pin produces a single step or microstep. Thespeed of the motor is determined by the length of the delay.The A3977SED’s maximum step rate is commanded with aninterstep delay of 2 microseconds.

Here’s a bit of code that counts the number of stepsbetween successive HOME states. Recall that a steppermotor stepping in eighth-step mode will take 32 steps between a starting HOME state and the following

HOME state.

unsigned int stepcount;void main(void)unsigned int j; //used for a breakpoint position

T0CON = 0b10000011; //start Timer0 with a 1:16 //prescaler

INIT_3977(); //init the A3977EIGHT_B; //enable eighth-step modeENABLE_B; //enable the Driver B H-bridgeDIRB_CW; //turn the motor clockwisestepcount=0; //zero the step counterdoSTEP_Bms(1); //step every 1 millisecond++stepcount; //increment the step countwhile(pHOMEB); //look for the HOME signal to go

//low++j; //stop here with a breakpoint

When the motor stops and the breakpoint is reached,you’ll find that the variable stepcount contains the value of 32. Replacing EIGHT_B with FULL_B will result in a finalstepcount value of 4.

My VEXTA stepper motor steps in 1.8° increments.Thus, it would take 1,600 steps to complete one shaft revolution using the eight-step mode. Here’s what shouldhappen when you compile and run the code below. TheDriver B HOME indicator LED will be dark following the initialization routine indicating that the A3977SED translator has put the driver into HOME state. Once thesteps start, the HOME indicator LED will blink off as it passes through every successive HOME state (every 32steps). When the 1,600 steps have been taken, the steppermotor shaft will have traversed one revolution and theHOME indicator LED will again go dark indicating that it hasreturned to a HOME state.

p to the Motorvator. Step Up to the Motorvator. Step Up to the Motorvator.

WWW.SOZBOTS.COM

These awesome kits are the latest craze in Japan.

Robot has 17 motors for fluid movements. Programed and Controlled via PC. Upgradable to Bluetooth wireless.

Ne

w

BROUGHT TO YOU BY

KHR-1 Robo-One Robot Kit

SERVO 02.2005 35Circle #63 on the Reader Service Card.

Best.qxd 1/4/2005 4:52 PM Page 35

Page 36: Servo Magazine 02 2005

void main(void)unsigned int i,j; //use j for a breakpoint posi-

//tion

T0CON = 0b10000011; //start Timer0 with a 1:16prescalerINIT_3977(); //init the A3977EIGHT_B; //enable eighth-step modeENABLE_B; //enable the Driver B H-BridgeDIRB_CW; //turn the motor clockwisefor(i=0;i<1600;++i) //step 1 full shaft revolutionSTEP_Bms(1); //step every 1 millisecond++j; //stop here with a breakpoint

A slight variation on the full shaft rotation code uses theresultant state of the pDIRB translator pin to reverse thedirection of the stepper motor after one full shaft rotation.

void main(void)unsigned int i; //use i as a loop counter

T0CON = 0b10000011; //start Timer0 with a 1:16prescalerINIT_3977(); //init the A3977EIGHT_B; //enable eighth-step modeENABLE_B; //enable the Driver B H-bridge

DIRB_CW; //turn the motor clockwisewhile(1) //do foreverfor(i=0;i<1600;++i) //step 1 full shaft revolutionSTEP_Bms(1); //step every 1 millisecond

if(pDIRB) //check the direction bit andpDIRB = CW; //reverse the direction

elsepDIRB = CCW;

Stepping OutBefore I go and leave you to build your own Motorvator,

I’ve got one more trick I want to show you. Recall that we canuse the voltage at the A3977SED REF input to limit the maxi-mum current we deliver to a stepper motor. With the additionof a single resistor and one PIC18F8520 I/O pin, we can dumpa dormant motor into low-current hold and instantly return toour original maximum current value when stepping resumes.

I placed a 30K resistor in series with the REF pot andattached a PIC18F8520 I/O line at that junction. When thePIC18F8520 I/O line is an output and is at a logical high, +5 VDC is supplied as usual to the REF pot and the REF potvoltage divider controls the voltage presented at theA3977SED REF pin. Transitioning the PIC18F8520 I/O line toan input state allows the 30K resistor to become part of theREF voltage divider. This results in a lower voltage presentedto the A3977SED REF pin, which results in a lowered ITRIPmax value. I’ll leave you with the current limit macros:

#define CURLIMA_OFF TRISH1 = 0; \pCURLIMA = 1;

#define CURLIMB_OFF TRISH0 = 0; \pCURLIMB = 1;

#define CURLIMA_ON TRISH1 = 1;#define CURLIMB_ON TRISH0 = 1;

For those of you who want to experiment with your ownMotorvator, the PCB and all of the associated parts are availablefrom EDTP Electronics, Inc., at www.edtp.com As always, ifyou have any questions or comments, I’m always available toyou via Email [email protected]. See you next time ... SV

Step Up to the Motorvator. Step Up to the Motorvator. Step Up

THE PREMIER

GLOBAL EVENT

IN POWER

ELECTRONICSVisit the conferenceweb site below for continual updates

www.apec-conf.orgwww.apec-conf.org

SPONSORED BY

2005March 6–10, 2005Austin Hilton Austin, TX THE PREMIER

GLOBAL EVENT

IN POWER

ELECTRONICS

The MicroMouse ContestMonday, March 6 startingat approximately 8:00 PM

36 SERVO 02.2005

A3977SED, ULN2003, Allegro Microsystemswww.allegromicro.com

Motorvator printed circuit board, EDTP Electronics, Inc.www.edtp.com

HI-TECH PICC-18 Compiler, HI-TECHwww.htsoft.com

PIC18F8520, Microchipwww.microchip.com

SOURCES

Best.qxd 1/4/2005 4:54 PM Page 36

Page 37: Servo Magazine 02 2005

SERVO 02.2005 37

by Michael Simpson

Iwas working on a book project and needed to create severalwalker robot prototypes with several small, curved parts of var-

ious shapes and sizes. I have a large band saw, but it was just toodifficult to cut the small curves and details needed and there wasno way to make the inside cuts required for many of the pieces.

Several years ago, I had a small 15” scroll saw and tried to cutacrylic, but just could not achieve a smooth cut. The plasticwould melt and fuse back together behind the blade.

Recently, at a local tool show, I managed to talk some of thescroll saw exhibitors into letting me cut some scrap plastic I hadwith me. After a few tips, I was cutting expanded PVC andacrylic like a pro.

Simpson.qxd 1/3/2005 1:02 PM Page 37

Page 38: Servo Magazine 02 2005

I decided it was time to look into purchasing a scroll sawand visited a few local retail stores in my area. After a bit ofresearch, I found that the following three saws represented agood mix of what was available for $400.00 or less:

• Ryobi SC164VS 16” scroll saw• Dremel 1800 18” scroll saw• Dewalt DW788 20” scroll saw

I decided to purchase all three and give each a whirl. Ialso picked up several blade types so I could see which oneswould work best for this project. Scroll saw blades come 12to the pack and are rated by the number of teeth per inch.

With three saws and 480 blades, I decided to build threecomplete bots on each saw. This would get me past thelearning curve and help me get a real feel for the saw and itscapabilities.

Two of the bots would be made from 1/8” Baltic birchplywood — the kind you get from craft stores. This plywoodhas no voids and finishes up very nicely. It is lighter andfirmer than expanded PVC and is more heat resistant. Even ifyou plan to build a robot in expanded PVC or acrylic, I recommend using the Baltic birch plywood for the prototype.

I also cut the parts for a walker bot out of expandedPVC. I did enough parts for one bot on each saw. Now,

let’s take a look at each sawand see how all of them performed the task.

Ryobi SC164VSThis was the least

expensive saw I tested.While it worked okay and Iwas able to build the threewalker bots, I found myselfconstantly at odds with thissaw.

The removable key lockis a nice feature if you havesmall children running

around the shop. The saw is also the lightest and the easiestto transport. Unfortunately, these are the only nice things Ihave to say about this saw.

The blade tension is adjusted at the rear of the saw. Ifound this irritating, as I had to reach around the saw to tension the blade. I don’t like saws where the power andspeed controls are located under the table. This makes themdifficult to reach in an emergency shutdown.

There are three problems that stand out with this particular saw:

1. There is very little room under the table to access the bladeclamps and thumb screws. This makes blade changes verydifficult.

2. The table was very rough. No amount of waxing couldsmooth it out. This makes turning tight corners difficult. Ieventually made a top out of waxed 1/8” plywood andattached it with double-sided tape. While this is not the onlysolution to the rough surface, it worked quite well for me.

3. The rubber knob that tightens the table tilt mechanism isvery easy to break. The knob on this saw broke with only oneuse. Thereafter, I had to use a wrench to loosen and tightenthe table. This was not much of a problem, since you won’t

be tilting the table withmost robotic projects.

This saw repre-sents the low-end classfor scroll saws. You willfind saws in this classthat are very similar insize, shape, and design.Many of them mayhave been built in thesame factory. I justcan’t see these or otherlow-end saws holdingup to everyday use.

38 SERVO 02.2005

The Ryobi SC164VS.

The custom birchwood insert. The Dewalt DW788.

The Dremel 1800.

Simpson.qxd 1/3/2005 1:08 PM Page 38

Page 39: Servo Magazine 02 2005

Dremel 1800Dremel calls this an 18” Scroll Station. While the included

5” disk sander is an added feature, you won’t be using itmuch on your robotics projects. I did not use it once on thethree walker bots I built using this saw. You would be betteroff purchasing the optional flex shaft and using one of theDremel sanding drums. The disk is somewhat of a pain to geton and off, so you will have to choose one or the other.

Like the Ryobi, this saw will accept both pin and plain-end blades. There is a hinged access drawer that makeschanging the blades a bit easier than with the Ryobi. The sawhas almost twice the weight of the Ryobi and, with this, itvibrates much less. The table is polished cast iron and onlytook four layers of paste wax to get to a silky smooth surface.

For blade storage, there is a small drawer under thetable, but I don’t recommend it for serious users. Mostblades are impossible to tell apart, so I suggest some type ofsorting tubes for your blades.

The controls are all up front, on top of the saw, so it’svery easy to access them. One really nice feature is a smallLED light located on the saw. While it won’t illuminate yourwork surface, it will keep a beam on your saw line.

The saw has a flexible air tube that puts out quite a bitof air that will keep your saw line free of sawdust. However,when I cranked the RPMs up past 1,000, the vibration causedthe flex tube to eventually drop to the table surface. Using ascroll saw stand or bolting the saw to the table will help alleviate this problem.

Another area that is of concern to me was the largeblade insert. It had very large blade grooves and did not sitflush with the table surface. Luckily, the design was simpleand, by tracing the insert on to 3 mm birch plywood, I wasable to create an insert that I could wax and then drill a verysmall hole for blades. This was perfect for the small pieces Icut for my walker bot projects.

The saw has small vinyl covers on the power and lightswitches. These are used to keep dust out of the switchmechanisms. They both eventually came off during use and Ifound it made using the switches much easier.

The saw weighs in at over 50 lbs, so you won’t be totingit around the shop, but there is a handle on the top just incase you feel up to it.

I liked this saw. It worked very well on wood, expandedPVC, and acrylic. Dremel also makes a 16” scroll saw with acast iron table and a 45 degree tilt both ways. It’s about$80.00 less, so you may want to look into that one if youwant something a bit smaller and less expensive.

Dewalt DW788A high end scroll saw can cost you well over a

$1,000.00. Are they worth it? Well, that depends upon youruse of the saw. If you use it once or twice a year, it may bebetter to purchase a smaller, less expensive saw. If, on theother hand, you plan on using the saw everyday, a high end

saw is right for you.The Dewalt scroll saw has a $399.00 street price and

is the closest thing to the high end saws that I could findlocally. The saw is actually manufactured in Canada by thesame company that manufactures the Excalibur (high end)line of scroll saws.

All scroll saws vibrate; it’s just a matter of how much.From the $60.00 saw to the most expensive $3,000.00 saw,it’s the nature of the beast. The saw’s mass will affect vibra-tion; the heavier saws don’t vibrate as much as the lighterweight saws. You can also lower the vibration by bolting the

The open design of the Dewalt.

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

SERVO 02.2005 39

Simpson.qxd 1/3/2005 1:10 PM Page 39

Page 40: Servo Magazine 02 2005

saw to a heavy table or stand. Design can affect vibration, aswell. For instance, on the Dewalt, the pivot points for thearms are up front near the blade. This provides for less moving mass and yields much less vibration. Couple this with

the fact that the saw weighs in at over 70 lbs and you get avery smooth running saw.

The Dewalt is the epiphany of simplicity. Things justdon’t get simpler. The open design under the table meansyou can access and change a blade in a matter of seconds. Ifyou check out other high end saws, they all seem to have thisopen design. The Dewalt is so open that they have actuallyadded a small guard in front of the clamp mechanism. This isto keep you from accidentally pinching a finger while the sawis running.

Blade clamps are in a fixed position so they are easy totighten and loosen. This also means less blade deflection.The dust blower is sturdy and does not change position during operation. The table is cast iron and was so smooththat I only needed two coats of paste wax. The table has asmall hole for the blade, which is perfect for the small piecesyou will be cutting. You won’t have to worry about making anew insert.

All controls for the saw are up front and, with thisdesign, you can adjust the blade tension while the blade is inmotion. The tension lever is also indexed, so you can get

the exact same blade performance each time you remove and attach a blade — which is veryimportant for inside cuts.

Of the three saws I tested, the Dewalt wasthe only saw with no dust collection port. This didnot bother me, as I had not planned on using aconnected dust collector with any of the saws.

Scroll saws have small blowers that keep the

40 SERVO 02.2005

Clip lights are inexpensive and make your work easier.

Steps to making an inside cut.

The three materials I tend to work with the most when buildingmy robots and prototypes are wood, expanded PVC, and acrylic.On occasion, I have also cut softer metals.

WoodI used 1/8” Baltic birch plywood for most of the bots in this

project. You can purchase 12” x 24” sheets for $4.00 at most craftand hobby stores.

You can also cut up to 2” thick pine with ease. Hardwoods, suchas oak and maple, will start to get more difficult as the thicknessincreases and you will need to use a larger blade.

Expanded PVCExpanded PVC is very easy to work with. When this material is

cut, the edges will yield a dull, coarse surface. While the finest bladewill create an ultra smooth surface, you will never get the glossytype finish as you do on the flat surface of the plastic. I use a #1blade when cutting 1/8” and 1/4” stock. When stacking expandedPVC greater than 1/4”, you will need to use a #4 or larger blade.

AcrylicYou cut acrylic much like you do expanded PVC. The surfaces of

the acrylic must be covered. When purchased, the surfaces are nor-mally covered. You can also use masking tape for this. On 1/8”stock, I use a #1 blade. On 1/4” stock, you have to move up to a #4.

MetalTo cut metal on a scroll saw, you must use special hardened

metal cutting blades. I prefer to use the smaller, thinner blades likea #0 metal cutting blade. Just slow the saw down and take it slow.I have cut up to 1/8” aluminum with these blades.

MATERIALS

Simpson.qxd 1/3/2005 1:11 PM Page 40

Page 41: Servo Magazine 02 2005

scroll line clear, so they tend toblow a bit of dust in the air.The simplest and most effec-tive solution for dealing withthe airborne dust is to use asmall window fan with a filtertaped to the front of it. Thistends to capture all the air-borne dust and is fairly quiet.

Saw ChoiceConclusions

The fit and finish on allthree saws was very nice. Allthree saws had no problems cutting the wood, plastic, andacrylic needed for my walker bots. However, there was noway my boss (wife) was going to let me keep all three saws,so I had to choose only one.

I decided on the Dewalt saw, mainly because I see myselfusing the saw on just about every robot project in the future.This saw features full ball bearings and less overall mainte-nance than the other saws. Factor this with the ultra lowvibration and my choice was made for me. Had the cost beenmore of a factor, I would have chosen the Dremel 1800.

If you decide to purchase a scroll saw, here are some ofthe features to look for:

• Table finish.• Variable speed• Plain-end blade support• Ease of blade change• Blower for clearing stock line

You will also want to pick up some sort of light. I like theinexpensive $7.00 clip-on lights. You can add as many as youwant. Use a 40 watt bulb to keep the heat down.

TechniquesInside Cuts

Making an inside cut with a scroll saw is very easy:

Step 1:Lay out your cut. In this case here, we are cutting a servomount.

SERVO 02.2005 41

No adhesive required!Sample shape transition pieces.

Scroll saw blades come with plain-end and pin-endconfigurations. Most high end scroll sawsonly use the plain-end type. There are manymore types of scroll saw blades available inthe plain-end configuration. Generally, pin-end blades should be easier to change;however, on the saws I tested, I found this tonot be true. The Ryobi and Dremel acceptboth types of blades, but are a bit morecomplicated because they accept both theblade connectors.

Once you decide on the blade end configuration, there are many types ofblades available in various widths and tooth

patterns. These range from skip tooth to reverse toothtypes. There are even spiral blades that will cutin any direction.

There is a universal number system used toreference plain-end blades. Most manufacturersuse it and it’s a good guide when selecting thefinish type and cutting radius of a scroll sawblade. The smaller the universal number, thethinner the blade and the more teeth per inch.

I have found that a #1 blade works verynicely in 1/8” plywood or plastic. It leaves avery fine finish and requires no clean-up. Youcan just about turn in place to cut extremelytight corners.

SCROLL SAW BLADES

Cutting multiple pieces saves time.

Simpson.qxd 1/3/2005 1:14 PM Page 41

Page 42: Servo Magazine 02 2005

Step 2:Drill a small hole in one of the corners, just touching two of thesides. This hole should be large enough to insert the saw blade.As an option, you can drill four holes, one in each corner.

Step 3:Unclamp the blade at one end. Insert the blade through thehole and then clamp the blade back in place. You can releasethe top or bottom of the blade; it does not matter.

Step 4:Cut the stock. Once cut, unclamp the blade and remove thestock. In this case, I drilled the holes with a drill press.

Shape TransitionsThere are times when you want a vertical piece to

transition to a horizontal piece. In this case, we are making abot leg that will be connected to a servo. We could applyheat and bend the leg, but bending is not an option in manysituations. For instance, with expanded PVC, it would yield aleg that’s just not rigid enough to support the weight of thebot. If you are using plywood, heat alone is not enough tobend the leg.

In this case, I cut two pieces with slots where the pieceswill overlap. The slot is half the length of the overlap. Thewidth of the slot is the thickness of the stock. Once cut, thepieces are joined together by sliding the slots into each other.This makes for a very strong and rigid leg. In most cases, youwon’t even need to use an adhesive to hold them together.

While this technique works well for both wood andexpanded PVC, it is a bit more difficult when using acrylic.Acrylic is a little more brittle and will break if the slots are tootight. In this case, you are better off cutting the joints a bit larger

and laying down a bead of hot glue.

Cutting MultiplePieces

There are times you need to cut multiple pieces that are the same shape.To do this, stack several of the piecestogether using thin strips of double-sided tape. Carpet tape works nicely.

If you are cutting expanded PVC oracrylic, you will also want to coat the topwith masking tape. Not only does thetape aid in the cutting of the stock, butit also gives you a surface to transferyour pattern onto. Once the pieces arecut, you can do all your sanding whilethey are still connected.

There are some disadvantages tobulk cutting. If you make a mistake, youwill ruin all your pieces — not just one.Also, you will have to use a coarser blade,which will yield a rougher cut. To cut thestock shown here, I had to use a #4 bladeverses the #1 I normally use. SV

Saw Model Ryobi SC164VS Dremel 1800 Dewalt DW788

Size 16” 18” 20”

Speeds (SPS) Variable 400-1,600 Variable 500-1,700 Variable 400-1,750

Blade Size 5” 5” 5”

Blade Types Plain, Pin Plain, Pin Plain

Blade Stroke 3/4” 3/4” 3/4”

Cutting Capacity 2” 2” 2”

Table Tilt Right 45 Deg 45 Deg 45 Deg

Table Tilt Left N/A 5 Deg 45 Deg

Shipping Weight 33 lbs 53 lbs 73 lbs

Motor Amperage 1.2 A 1.6 A 1.3 A

Motor Voltage 120 V 60 Hz 120 V 60 Hz 120 V 60 Hz

Vibration Good Good Excellent

Table Material Aluminum Cast Iron Cast Iron

Table Surface Poor Good Excellent

Blade Insert 3” 3” N/A

Blade Change Poor Good Excellent

Tension Adjustment Good Excellent Excellent

Dust Collection Port Yes Yes No

Air Blower Good Good Excellent

Light No Yes Option

Other Features Includes six bladesDisc Sander, Bladedrawer, Includes

12 blades

Full Ball bearings,Low maintenance,

Includes two blades

Street Cost $87.00 $239.00 $399.00

COMPARISON CHART42 SERVO 02.2005

Michael Simpson has been anavid woodworker for 20 years. Heruns the MGS Woodworking site atwww.mgsweb.com/woodworkingHe also runs the Kronos Roboticswebsite at www.kronosrobotics.comKronos Robotics caters to beginnerelectronic enthusiasts, as well asseasoned engineers.

ABOUT THE AUTHOR

Simpson.qxd 1/3/2005 1:16 PM Page 42

Page 43: Servo Magazine 02 2005

Send us a high-res picture of your robot with a fewdescriptive sentences and we'll make you famous.Well, mostly. [email protected]

Orestis Kalantzis

Roverbot is an autonomous robotic platform that moves on wheels andhas the ability to be self-guided or remote-controlled (locally or via a wire-less LAN or the Internet).

Its basic principles are two independent motor wheels (and a third one— a smaller, free-turning wheel — for support). The speed divergence of thewheels makes Roverbot turn just like a tracked vehicle, eliminating the needfor the use of a steering gear and, therefore, facilitating spatial placement.

I also found it necessary to use a PC instead of any other computer system (microcontroller-based or PLC) due to the wide range of developing software, operating systems, networking capabilities, and peripherals ingeneral.

Characteristics:

Dimensions:Length: 22.5 inHeight: 15 inWidth: 22.5 in

Weight: about 88 lbs

Cost: about $864.00 (expected to reach $2,000.00).

History:I started designing Roverbot in 1992. I wanted to experiment and

acquire some real experience in robotics, but also to build a platform for fur-ther experimenting in self-direction, automated map-making, and otherapplications of Artificial Intelligence and Neural Networks.

Simulation appeared to be an alternative course, but one I had to rejectbecause of the obvious danger of being driven to wrong or non-applicableconclusions (due to its inevitable distance from reality), but also because itwould deprive me of the chance of designing/developing electronic andmechanical hardware.

Beside the subsystems of stepper motors and their drive circuits that Idesigned (and built as prototypes) in 1996, all the rest was manufacturedbetween May and October of 2002.

For more information, please visit http://roverbot.netfirms.comwhere you can find photos, videos, VRML 3-D models, and more.

RRoovveerrbboott

SERVO 02.2005 43

Menagerie.qxd 1/5/2005 8:34 AM Page 43

Page 44: Servo Magazine 02 2005

Smart Servos Put It All Together

Garage Technologies, Inc., hasannounced that AI Motors are

now available in the US. AI Motorscombine a serial bus control inter-face, modular mechanical connec-tions, and position and loading read-out. As true robotics motors, theyprovide the functionalities of a servo,gear motor, wheel encoder, andmotor interface. Special capabilities include:

• Simple serial interface (RS232 at TTL levels) — no need for a multi-channel PWM interface. Up to 31 motors can beplaced on a single four-wire bus.

• Position readout — no need for a position encoder.• Current readout. Motor current provides a reading propor-

tional to mechanical loading. Each motor also providesoverload protection by shutting down in the event ofover current.

• In addition to commanding position and speed, you can set over current limits, motion limits, and control-algorithmcoefficients individually for each motor.

• Full 360° rotation mode under software control — no need

to modify servos for wheeled platforms.• Modular mechanical connection — front and side axle

attachments and side and rear mounting points.

Each motor incorporates a microprocessor to supportthese capabilities with an easy-to-use interface. Eachmotor includes two cables for daisy-chaining and 11 differ-ent mechanical links. Innumerable configurations are pos-sible, such as two-wheel platforms, dogs, and humanoidswith few or no additional mechanical parts. Both motorsoperate from 5 to 10 VDC and offer three software-configurable range/resolution modes:

• 332° at 1.3° resolution• 166° at 0.65° resolution• 360° continuous rotation at 15 different speeds.

At 9.5 V, the AI-701 provides 7 kg*cm stall torque anda maximum of 80 RPM and the AI-1001 provides 10 kg*cmtorque and 60 RPM. Configuration GUI and example sourcecode are available for free download. The AI-701 is pricedat $65.00 each and the AI-1001 at $90.00. Complete eval-uation and humanoid robot kits are also available.

For further information, please contact:

NNeeww PPrroodduucc ttssNew Products

93 Norton Ave.San Jose, CA 95126Tel: 408•347•0556

Email: [email protected]: www.Garage-Technologies.com

GarageTechnologies,

Inc.

Circle #124 on the Reader Service Card.

MOTORS

44 SERVO 02.2005 Circle #111 on the Reader Service Card.

FebNewProducts.qxd 1/4/2005 12:44 PM Page 44

Page 45: Servo Magazine 02 2005

Binary Player Robot

OWI introduces thesecond generation

of its binary navigat-ing robot kit.Binary PlayerRobot is a verypredictable two-wheeled robot. Aninternal program stored ona memory disk created by theuser ascertains its predictability.Therein, however, lies the fun. BinaryPlayer Robot is easily re-programma-ble by the controller ... you.

Binary Player Robot is controlledby black and white patterns on a disk,which are read by an infrared sensor.Particular patterns activate either oftwo wheels to turn left, right, for-ward, or pause. These on/off com-mands illustrate the basic principles ofbinary coding. To change a move-ment program, the operator simplycreates a new disk pattern and/orchanges the speed variation on thethree-speed gearbox.

This is a good beginner’s robot.The battery-controlled kit can teachthe basic principles of robotic sensingand locomotion. It features a pre-assembled printed circuit board(PCB), hardware, and mechanicaldrive system that can be handled by almost anyone. Only basic handtools are required for assembly. Aninfrared sensor and PCNB controls therobot.

Easy-to-assemble, this OWIKitbeginner building level robot makes agreat entry for robotic competitions,science fair projects, robotic work-shops, science enrichment camps,and classroom activities. The suggest-ed retail price is $34.95.

For further information, pleasecontact:

Take Education OffRoad

Ro g u eRobotics

in t roducesthe new RogueATR ERS™ (ATR — AllTerrain Robot, ERS — EducationalRobotics System) robot kit. This systemis the first of its kind for high schoolclassrooms and hobbyists, providingrobotics, electronics, and object-orient-ed programming in one system, whileoffering unparalleled all-terrain mobility.

Rogue ATR ERS features an 8”base with rubber tracks, Rogue’s uni-versal sensor mount system, dual DCgear motors, extra level capability forexpansion, and a 1.1 A dual H-bridgemodule, extra level capability forexpansion, a 7.2 V NiCad battery, andan OOBoard™ educational develop-ment board as its brain. The RogueATR ERS is made from the same laser-cut, powder-coated aluminum as thepopular Rogue Blue robot base.

The kit is bundled with a curricu-lum text full of experiments, a partskit, and a plastic storage box to housethe fully assembled robot neatly in aclassroom or under your workbench.

Powering the Rogue ATR ERS isthe OOBoard, with an embeddedOOPIC® object-oriented processor,which can be programmed in C,Java™, or Basic syntax. The kit includesa CD ROM that contains the program-ming editor for the OOBoard, as wellas samples and curriculum materials.

The Rogue ATR ERS is the SUV ofEducational Robots; small objects,uneven floors, and cables are not bar-riers for this robot. The Rogue ATRERS robot kit sells for $324.95 andthe OOBoard sells for $119.00.

For further information, pleasecontact:

17141 Kingsview Ave.Carson, CA 90746

Tel: 310•515•1900Fax: 310•515•1606

Website: www.owirobot.com

OWI,Inc.

Circle #135 on the Reader Service Card.

103 Sarah Ashbridge Ave.Toronto, ON M4L 3Y1

CanadaTel: 416•707•3745Fax: 416•238•7054

Email:[email protected]

Website:www.roguerobotics.com

RogueRobotics

Circle #148 on the Reader Service Card.

ROBOT KITS

SERVO 02.2005 45

FebNewProducts.qxd 1/5/2005 8:37 AM Page 45

Page 46: Servo Magazine 02 2005

Modern electronic speed controls(ESCs) incorporate very versatile

microcontrollers — a microprocessortype of device that is entirely self contained. This project describes anESC that uses the Microchip 16F873

microcontroller. This device includesfive analog inputs and two pulsewidth modulation (PWM) outputs.The ESC firmware listing is availablethrough the SERVO website(www.servomagazine.com) and is

somewhat unusual; it includeseight different functions, asdescribed in the Sidebar below.

This ESC is designed for thehigher power cobalt brush typemotors, although any of the can-type motors can also be used.The total cost of all parts —excluding the circuit board — isabout $35.00. The ESC functioncan be built in several differentvoltage ranges. The standardrange is 7 to 15 NiCad cells (8.4-18 volts). By exchanging diodeD1 for a resistor, R13, it allowsoperation from 16 to 21 NiCad

cells (19.2-25.2 volts). The 7 to 21 cellversions will handle 35 amperes contin-uously, with a peak capacity of 50amperes for 60 seconds. The final ESCmeasures 1.9 by 2.5 by about 1/2 inchand weighs about 1-1/4 ounces withoutlead wires. With the addition of severalmore components and componentchanges, this ESC can be constructed tohandle 40 NiCad cells (48 volts) with amaximum current rating of about 35amps. The addition of heatsinks for theFETs will allow substantially higher maximum current ratings.

Build the ESCThe three ExpressPCB circuit

boards (board layouts are atwww.servomagazine.com)eachhave two ESC boards for a total of sixESC circuit boards. The boards must

Build a PICChip Electronic Speed Control

by Dennis Volrath

46 SERVO 02.2005

The PICChip and connections.

The ESC mode includes the followingitems:

1. Reduction of maximum availablemotor power levels on low batterycondition.

2. Switching speed of 2,500 Hz (cyclesper second).

3. Linear motor POWER versus trans-mitter stick operation for propellerdrive.

4. Motor power down on wrong signalfrom RC receiver.

5. Automatic calibration of the lowand high transmitter throttle positions.

6. Nine volt doubler circuit for theHEXFET gate driver circuit.

7. Error counting at the rate of 30counts per second to a maximum of65,000 for receiver errors. (Binaryerror output is on pins 15 and 16.)

8. Receiver Battery Elimination Circuit(BEC) for 7 or 8 cell operation.

9. Output 0 or 5 volt signal on pin 19for an optional brake function (notcovered).

10. Valid receiver monitor indicator onpin 27 that reads 0 volts DC for no signal or wrong signal and 5 volts forvalid radio signal.

11. Output on pin 28 that will read 0volts and will change to 5 volts DCafter the PICChip is “armed.”

12. Pin 21 changes to 5 volts DC on the

1,200 Hz beep.

13. Pin 22 changes to 5 volts DC on themiddle beep.

14. Pin 23 changes to 5 volts DC on thehigh beep.

15. Pin 24 changes to 5 volts DC afteran accumulated loss of radio signal ofabout 10 seconds.

16. Pin 25 changes to 5 volts DC afteran accumulated loss of radio signal ofabout 2 seconds.

17. Pin 26 changes to 5 volts DC afteran accumulated loss of radio signal ofabout 1/2 second.

(These status pins can drive an LEDthrough a 680 ohm resistor.)

In-depth Info on the ESC Mode

Volrath.qxd 1/3/2005 2:23 PM Page 46

Page 47: Servo Magazine 02 2005

be cut in half before assembly. Thesimplest way to cut them is to lightlyclamp a steel edge to the middle ofthe circuit board. Then use a smallcoping saw with a thin blade to cutagainst the steel edge to separate thetwo ESCs from the board. Makeabsolutely certain that the steel edgeis placed such that no copper foil patterns are cut.

Next, the ESC will be constructed.Load the “Connections plusparts.pcb” (at www.servomagazine.com) into the ExpressPCB program.Refer to the photograph and parts lay-out drawing for the location of allparts. First, insert all parts, installingthe four transistors last. Be especiallycareful with the orientation of thetransistors, diodes, and capacitors.The 3 amp diode is “standing onend.” Switching the 2N2904 (NPNswitching transistor) with a 2N2906(PNP switching transistor) or installingthese transistors backward will causeall sorts of troubleshooting problems.

Also note that the various diodesand capacitors must not be accidentally

reversed. For the record, a reversedtantalum capacitor may not fail untilmonths after construction of this project.Note that the 2N2904 and 2N2906transistors have been discontinued.RadioShack has equivalent transistorsavailable in bulk. Just make certain

that whatever transistors are used areconfigured as “Emitter-Base-Collector”and are of the TO-18 type.

Next, install the HEXFETs. Notethat they have the two outside leadwires soldered. The center lead is notused. The two outside HEXFET leads

SERVO 02.2005 47

Build a PICChip Electronic Speed Control

The schematic for the PICChip Speed Controller.

Download the “Connections plus parts.pcb” for the PICChip.

Volrath.qxd 1/3/2005 2:24 PM Page 47

Page 48: Servo Magazine 02 2005

are soldered through the circuitboard. The third connection isthrough the four 4-32 screws, lockwashers, and nuts that hold theHEXFET to the circuit board. Note thatthe negative motor lead is connecteddirectly to one of the four 4-40 screwsthat secure the HEXFETs to the circuitboard. If this ESC is going to be usedin a poorly ventilated area, heatsinksshould be inserted under the HEXFETs.A small piece of aluminum — a fewinches wide — will suffice.

Lastly, note that the layout drawingcalls for either a small jumper wire ora small switch for “turning off theESC.” This same switch will also turnoff the battery elimination circuit(BEC) if the ESC is so configured. Thisswitch completely turns off the ESCand will result in zero battery drain.

Remove all flux from both circuit

boards with pure alcohol or appropriatesolvent. Pay particular attention to the connections around the crystal resonator and pins 9 and 10 of thePIC. Any water or solder flux residue inthis area can prevent the crystal fromstarting, preventing operation of themicrocontroller. Shake off all solventand blow the board dry with the out-put of a vacuum cleaner or hair dryer.

NOTE: This ESC will be susceptible tomoisture. If it is to be used in a floatplane, take precautions against water.

Use the following procedure tocheck out the ESC microprocessorboard. Remove the PIC from the board.Next, connect a 9 volt alkaline batteryto the ESC red and black battery leadwires. Connect a DC voltmeterbetween the battery black wire and pin

2 of the PIC. Adjust trimmer resistor R1to set this voltage to 3.3 volts DC. (ThePIC will not allow the voltage on pin 2to exceed 5.5 volts DC, appx.) The voltage between the battery minusand both pins #1 and #20 of the PICshould measure 5.0 volts DC. If theBEC is being used, check for 5 voltsbetween the black and red wire of theservo connector. Disconnect the batteryand install the PIC. Do not install thePIC upside down. Reconnect the 9 voltbattery and verify that the ESC currentdrain is about 12 mA.

If all looks well, connect the ESCmicrocontroller board to the receiver.If the ESC does not include the BECconnection, connect a four cell NiCadpack to the R/C receiver. Power-up thetransmitter, receiver, and ESC. Checkfor 9 volts between the motor batterynegative black wire and test point “Z.”

This ESC controller wasdesigned for use with high per-formance model airplanes pow-ered by electric motors. The typ-ical motor used involves anAstroflight Cobalt 40 size motorwith a gear box that can be runon 22-2.4 Ah NiCad cells at cur-rent levels of 40 A. This is a verysignificant amount of power;the Astroflight motor will turn a13 inch (10 inch pitch) propellerat about 7,800 RPM. Be awarethat this can cause significantinjury to the unwary.

Because of this, this ESCrequires an “Arming” processeach and every time the ESC ispowered down and poweredback up by battery power. TheESC verifies proper receiver signal on power-up. After about1 second of valid signal with thethrottle set at less than 50%,the ESC sends a 1,200 Hz verylow power “beep” to themotor. (If the throttle is over50%, nothing will happen!)

After this, quickly move thethrottle to full throttle, wait for amedium pitched motor beep,then move the throttle to mini-mum and wait for a high pitched

48 SERVO 02.2005

The different modes of operation havealso been assembled on the popularRadioShack perf boards listed in the partslist. The wiring and connection diagramsare all available through the SERVOwebsite (www.servomagazine.com).

The PICChip has the following eightprograms built in:

1. Standard ESC with low battery motorpower-down and receiver error detection.

2. Receiver error monitoring with onePICChip, one ceramic resonator, and oneor two other parts.

3. Battery voltmeter with LCD display witha range from 6 to 20.46 VDC with 0.02 voltresolution.

4. Servo DRIVER, allowing the PICChip toprovide the signals to operate a servo. Thisfunction has an optional LCD that directlydisplays the servo output signal with arange from 0.85 to 2.12 milliseconds.

5. Servo DRIVER configured for 0.01 to 2.55milliseconds. This mode was used todesign the ESC. (Be careful when using the 0.01 to 2.55 millisecond configurationwith a servo. It will run the servo past its

mechanical stops.)

6. Read-back functions with LCD display thatread the error log from items 1 and 2.

7. The LCD displays the receiver pulsewidth measurement and the receiverpulse width output from 0.01 to 2.54 milliseconds with 0.01 millisecond resolu-tion.

8. Servo test mode with LCD display withleft, center, and right repeated tests, alongwith three different servo ramp-up andramp-down rates to test servos.

These different modes are configuredby the input voltage to three of the PICChipinputs during power-up. Items 4 through 8are constructed on one “Hole board” fromRadioShack. The different functions are setup with those little PC shorting blocks, alsoavailable from RadioShack.

The PICChip used in this project canbe programmed with the PICSTART PLUSprogrammer, available from Digi-Key. The PIC16F873 has a set-up configurationbit file for the PIC16F873 device. This configuration file must be set up where theOscillator function “XT” and everythingelse is turned off or disabled.

PICChip’s Built-in Programs

Build a PICChip Electronic Speed Control

Volrath.qxd 1/3/2005 2:25 PM Page 48

Page 49: Servo Magazine 02 2005

motor beep. The ESChas just memorized thehigh and low throttlepositions. The nextthrottle movement willrun the motor. Thiswhole process takes lessthan 10 seconds.

This ESC wasdesigned to power anelectric motor under pro-peller loads. The horsepower to turn a propelleris related to the RPMratio raised to the thirdpower. The PIC uses alook-up table for thepulse width modulationoutput that accounts forthe propeller effect. Ifthis ESC is to be used forother purposes, the look-up table can be modifiedto provide any throttleverses power output.Note that the ESC doesnot provide motorreversing. The web pageincludes a linear assem-bly file for drives notinvolving propellers.

Next, connect the ESC, fullycharged motor battery, and motorwithout a prop per the ESC wiringdiagram. Connect a DC voltmeterbetween the motor battery blackwire and pin 2 of the PICChip. Adjustthe trimmer resistor R1 to set this voltage to 3.3 volts DC

The final step is to securelymount the motor and prop, fire upthe radio and ESC, and run the motorbattery down to about 0.9 volts DCper cell. Then, adjust R1 so that themotor battery stays at 0.9 volts percell or the low battery voltage of yourchoice. The ESC will shut off drivepower to the motor when thePICChip pin 2 is less than 2.30 VDC. Itallows full power to the motor whenpin 2 is over 2.50 VDC. Betweenthese two voltage levels, the ESCallows 20%, 40%, 60%, or 80%power output.

In conclusion, this project has

many different functions in roboticsand other hobbyist applications;

the limits are only defined by yourimagination. SV

Part ID Part No. QuantityFET (7 to 21 cells) IRL3705N-ND HEXFET (Price reduction at 10 pcs) 45 V REG LM2940CT-5.0-ND 1 A low drop reg 1C1 272-1029 220 µF cap 1C2, C4, C5 P2022-ND 2.2 µF cap 3C3, C7 272-134 0.047 µf 1C6, C8 272-123 100 PF cap 1D1 276-1101 1 amp diode (7 to 15 cells) 1D2, D3 SD103ACT-ND 400 MW 40 V Schottky diode 2D4 (7 to 21 cells) 1N5822-ND 1N5822 3 amp Schottky diode 1PCB Per ESC articlePIC PIC6F873-04/SP-ND PICChip (Must be programmed!) ** 1Q1, Q2, Q4 2N2904 2N2904 (RadioShack 276-1617) 3Q3 2N2906 2N2906 (RadioShack 276-1604) 1R1 CT94W203-ND 20 K 10 turn pot 1R13 470 QBK-ND 470 ohm (16 to 21 cells) 1

R2, R12 22K EBK-ND 22 Kohm 1/8 watt 5R3, R10, R11 47K EBK-ND 47 Kohm 1/8 watt 5R4, R5, R6, R7 150 EBK-ND 150 ohm 1/8 watt 5R8, R9 10K EBK-ND 10 Kohm 1/8 watt 5XTL PX400MC-ND 4 MHz resonator ** 1SOCKET 276-1999A 14-pin socket (two end-to-end) 2

1Digi-Key (All -ND parts) Remaining parts from701 Brookes Ave South RadioShack andThief River Falls, MN 56701 local hobby shops800-344-4539

Resistor Note: Digi-Key minimum order on 1/8 watt resistors is five pieces. ** DO NOT SUBSTITUTE!!

PIC 877 Speed Control Parts List

Build a PICChip Electronic Speed Control

SERVO 02.2005 49Circle #75 on the Reader Service Card.

Volrath.qxd 1/3/2005 2:26 PM Page 49

Page 50: Servo Magazine 02 2005

TEXAS ART ROBOTSH A N D M A D E I N T E L L I G E N C E

WWW.ARTBOTS.COM

UNIQUE LIMITED EDITIONS

INTELLIGENT & AUTONOMOUS

HAND CRAFTEDElectronic Parts & Supplies

Since 1967

MeccanismsTM

www.meccanisms.com

Control 4 Motors, 2 Servos, 3 Relays6 Analog & 8 Digital Inputs. Adv.O/S & Development Environment.Plug-In Connectors, No Soldering

Control 4 Motors, 2 Servos, 3 Relays6 Analog & 8 Digital Inputs. Adv.

O/S & Development Environment.Plug-In Connectors, No Soldering

www.meccanisms.com

Control 4 Motors, 2 Servos, 3 Relays6 Analog & 8 Digital Inputs. Adv.O/S & Development Environment.Plug-In Connectors, No Soldering

Maximum PowerMaximum PowerMaximum Power

Minimum FussMinimum FussMinimum Fuss

www.gatewayelectronics.com(Electronically Speaking, Gateway’s Got It!)

MAIL ORDERS CALL TOLL-FREE-1-800-669-5810

For the finest in robots, parts, and services, go towww.servomagazine.com and click on Robo-Links

to hotlink to these great companies.

50 SERVO 02.2005

Robolinks.qxd 1/5/2005 1:17 PM Page 50

Page 51: Servo Magazine 02 2005

SERVO 02.2005 51

In last month’s article, I spoke about many features of theAtom and I began to talk about how I used the Atom in

my robot (pictured here). This month, I will go into furtherdetail on code that is specific to the Atom microprocessor(see Figure 1). I encourage you to download my programexamples from the SERVO website or from my own website(see the Resources sidebar).

The ProgramAfter spending much time, making many additions to my

code, and watching the code grow larger with every revision, Iam extremely happy Ichose the

Atom processor. To give you some idea of what my programis doing before I go into detail on the Atom specific code, adiagram of the program is in order. I encourage readers to download the full program and keep it on hand whilereading this article. It is not my intent to describe the fullrobot program here, just the sections pertinent to the Atom.

The following code summary is laid out exactly as it iswritten in the full program:

Hardware Interrupts initiated and set running in background

Main LoopCheck for Interruptflag

If the Hardware Interrupt has been activated,branch to object detected.

— BY KERRY BARLOW —

Barlow2.qxd 1/3/2005 4:27 PM Page 51

Page 52: Servo Magazine 02 2005

Read four SRF04 Sonar and store values into sonar variables

Branch to four subroutines and store values into sonar variables.

Read GP2D02 and store value in variableDecision statement if range is too low

Check if GP2D02 has returned a short range.Set up sonar flags into a binary truth table using IFstatements

If Ldist <= 10, then Lflag = 8.Stop tracks if Sonar returns any detection.

If Lflag = 8, c1flag = 4, c2flag = 2, or Rflag = 1, then gosub stoptrack.If any flags are set, then gosub StopTrack.

Add all binary values together for Sonar sensorsObjectflag = Lflag + c1flag + c2flag + rflag.

Check Light sensorGosub lightincenter and perform subroutine functions.

Check for robot being trappedIf the robot becomes trapped, it may swivel around forawhile looking for an opening. In this case, gosub back-up and find the proper direction to turn.

Do Binary calculation for direction subroutinesIf objectflag = 0, then gosub forwardtrack.If objectflag = 1, then gosub left15.Additional IF decision lines ...

Return to MainHardware interrupts disabled

Interrupt LoopThe reader should note that, at the same time the main

loop is running, the hardware interrupts are also running. Atany time while the program is within the main loop and anIR edge sensor outputs a 0, then the hardware interrupt pinwill initiate an interrupt to the main loop and send control toa special subroutine. In this subroutine, I stop all motors andsearch for an opening around the robot. Once an opening isfound, I resume the interrupt subroutine and continue withmy main loop’s code. I wish to emphasize that this interruptoccurs in hardware and is much more reliable than softwaresolutions to implementing interrupts.

It should be noted that Basic Micro states that the hardware interrupts will occur between lines of code. Thismeans that, if you have something like a pause 5000 (5 seconds), the hardware interrupt will not be processed during this pause routine. A long sound statement or somesimilar line of code that takes extra time to run will also causethe interrupt code to wait while it executes this line.

This is not normally a problem if a person is aware of it and designs the main loop code to avoid such problems. For example, if you do need a long pause, then — instead of a pause 5000 — break this down into a small for-next loop,such as:

for I = 1 to 50pause 100next I

The Atom interrupts would then be active on each of thethree lines of code and only a pause 100 (.1 second) wouldthen cause the interrupts to be disabled.

As far as speed of execution, I cannot say empiricallyhow fast the Atom is compared to other processors. Onpaper it is, indeed, faster (33 K instructions/second), but I amsure the readers would like some real world proof. All I cansay to this is that, after reading four SRF04 sensors, detect-ing a GP2d02, checking a light sensor, and making decisionstatements, I notice no lag in object detection whatsoever.

Lag or detection in a program such as this is going to behard to measure because, sometimes, it is unknown whetheran object simply was not detected or the robot drove past anobject before its code could detect it. For the hardware inter-rupts, I test them while the robot is moving by holding a narrowyardstick in the robot’s path. As far as I can tell, the instant Iplace the yardstick within range of an edge sensor, I havedetection and the robot code stops the tracks. I know this isnot scientific, but it is my real world observation.

The final and working version of the robot has the following hardware installed. The program is available onlineat the SERVO website or from mine.

• Four SRF04 sonar range finders using a 4502 multiplexor(see Figure 2).

• One GP2D02 range I/R finder.• Three CDS light sensors using the A/D input (see Figure 3). • One PIR heat sensor: currently not working.• Six I/R wall edge sensors, interrupt controlled.• One speaker.• One LCD.• One rotating sensor head.• Dual motor track drive.

Program DetailLet’s go into detail on sections of the program that are

unique to the Atom. A few of my program routines may behard to understand, so I will also review sections of the codethat need explanation. The main loop has been detailed

THE ATOM 24-PIN MICROPROCESSOR

52 SERVO 02.2005

FIGURE 1

Barlow2.qxd 1/3/2005 4:28 PM Page 52

Page 53: Servo Magazine 02 2005

previously, so I will not belabor that point again. I cannot talkabout all of the sections of my program at this time. If anyone has questions on the complete robot program, pleasefeel free to write me or post a question on the Nuts & VoltsForum (www.nutsvolts.com select Bulletin Board).

4052 Multiplexor and SRF04 CodeAs readers may have guessed by now, I was running out

of I/O lines quickly. When I decided to use four sonar sensors, I had to make a design decision. I could have usedthe modern SRF08 sensor on the Atom’s I2C bus; however, Icould not afford the additional price of the sensors. I did nothave enough I/O lines to waste on four sonar sensors, either.The 4052 is a four-channel analog chip controlled by twologic lines. This was made to order for my application (seeFigure 2). The connections are straightforward and I am sureall readers will be able to follow the schematic easily.

Simply put, the four channels are connected to the inputchannels, depending on binary logic applied to their A and Bcontrol lines. For example, if a low or 0 is placed on both theA and B control lines, then the Y and X lines are connectedinternally to the Y0 and the X0 lines. In my schematic, thiswould be SRF04 sensor 1 enabled. Software code thenwould call the SRF04 normally. The 4052 chip will come witha logic truth table for its four states.

The code to implement an SRF04 on an Atom is a bit different than the code on a BS2. The code will bring the Initline high and then low to initialize the SRF04, then the echo

may be read in using the pulsin command. A pause 10 is used toensure that the echo is received properly and to prevent ringingof the transducers. For an example of using the multiplexorwith the SRF04 sensors, please download the SRF04 program.

Servo CodeUsing a servo with the Atom is very straightforward. This

was a feature I was very happy to find out about after purchasing the Atom. The entire servo command consists ofthree statements on one line:

SERVO PIN, ROTATION, REPEAT

SERVO PIN is the I/O port on the Atom that you want theservo connected to. ROTATION is a variable or degree youwish the servo rotated to (-1,200 to 1,200) and REPEAT is thenumber of times you wish the command repeated internally.All servos will be different. On my servo, a command of servo15, 0 will drive the servo on pin 15 to center. This is all thatis necessary to drive a servo on the Atom processor. To movethe servo a full clockwise rotation, use the command servo15, 750.

GP2D02 CODEThe Sharp GP2D02 code is identical to that of the BS2.

Bringing the Sharp’s clock line low will enable the sensor totake readings. The Atom’s Shiftin command is then used to

THE ATOM 24-PIN MICROPROCESSOR

FIGURE 2

SERVO 02.2005 53

Barlow2.qxd 1/3/2005 4:29 PM Page 53

Page 54: Servo Magazine 02 2005

54 SERVO 02.2005

read in the information:

shiftin datainput,cl,MSBPOST,[val02]

Datainput is the Sharp’s output pin and CL would be the Sharp’s clock input pin. MSBPOST will tell the Atom whatformat to read in the data. In this case, sample the bits aftera clock pulse and put this into the variable called val02.

A/D CODEThe special built-in hardware-driven A/D code is quite

easy to use. Basic Micro has a nice demo program in theirdocumentation. Refer to Code 1 to see my example of usinga CDS light sensor. Refer to Figure 3; you can see how simple the CDS cells connections to the Atom’s A/D pins are.

Code 1 will read all three light sensors and output thevalue to the Atom’s debug screen. Pin names for the threeinputs are called ax0, ax1, and ax3. This can be confusing attimes. Pin ax2 can only be used as an I/O port, but — if youwish — you may reference it as ax2 in your software andenable one extra I/O port on your Atom. This is digital I/O —no A/D on ax2. Simply call this pad ax2 instead of a differentpin name — such as pin 1 — as you normally would.

The command to read a CDS cell may be shown in a single line, as follows:

ADIN pin, clk, adsetup, var

In my program, you will see that I have used names forthe command fields as follows:

adin ax0,clk,ad_ron,tempax0

Ax0 refers to the port for A/D. The Clk option sets the sam-pling time for the A/D conversion. The name ad_ron is usedto set up the options available with the ATOM hardware; thisis described in the Atom documentation. In my example, Ihave chosen right justified input to give a real number outputthat is easier to read in my program. Tempax0 is a variablename I have chosen to store my CDS value.

Hardware Interrupt CodeAs mentioned previously, the Atom has several interrupt

sources, which can occur from internal or external sources.

External sources:EXTINT: An external interrupt may be detected on Pin 0,

either through a high to low change (used in my program) orthrough detecting a low to high change.

RBINT: Upon change, an interrupt can occur on P4, P5,P6, or P7. This interrupt will trigger if a pin state changesfrom low to high (or high to low).

Internal sources:Internal interrupts have many variants. These are exten-

sively documented by Basic Micro. Some of these are:

TMR0INT, TMR1INT, TMR2INT: An interrupt occurs whenevera timer overflows; this is useful for creating a real time clockon the Atom. There are three internal timers that may be setin the Atom.

ADINT: ADInt interrupt occurs when A/D conversion finishes.It is used in conjunction with the ADin command.

RCINT: RCInt interrupt occurs when a byte is received by theHardware USART.

TXINT: TXInt interrupt occurs when a byte finishes transmittingfrom the Hardware.

USART: This interrupt is disabled if you are usingHSERIN/HSEROUT.

CCP1INT, CCP2INT: CCPInt interrupt occurs onCapture/Compare/Period match.

EEINT: EEInt interrupt occurs when a byte is finished writingto the onboard EEPROM.

Basic Micro provides a few examples of interrupt usage intheir documentation. One of these examples is a real timeonboard clock. In my robot, I used an interrupt on pin 0 for myedge detectors. Interrupt code must be written in the correct

'CODE1.BAS 10/4/2004 'NOTE higher value is darker loca-tiontempax0 var wordtempax1 var wordtempax3 var wordclk con 2mainadin ax0,clk,ad_ron,tempax0 'a/d port 1adin ax1,clk,ad_ron,tempax1 'a/d port 2adin ax3,clk,ad_ron,tempax3 'a/d port 3debug ["one ", dec tempax0, " two ", dec tempax1, "three ", dec tempax3,13]goto main

CODE 1

THE ATOM 24-PIN MICROPROCESSOR

FIGURE 3

Barlow2.qxd 1/3/2005 4:30 PM Page 54

Page 55: Servo Magazine 02 2005

manner as prescribed by Basic Micro or they say you can havestack overflow. I can attest to the fact that this is true. I spentquite awhile initially debugging my robot program and couldnot figure out why I was getting resets after 30 seconds of runtime. An astute person on the Atom forum was able to diagnose my problem and correct it for me. To start using aninterrupt, three lines of code are necessary to enable hardwareinterrupts. One line of code is used to disable interrupts belowa certain point in your program. The actual subroutine branchpoint and a resume command are the final lines of code necessary to use External Interrupts. These code lines are:

Oninterrupt interrupt source, labelOninterrupt is an operator used to tell your program where

to go if a specified interrupt occurs. Interrupt source specifieswhat type of interrupt to act on. Label is used to specify theplace to jump to in a program if the interrupt occurs.

SetExtInt modeSetExtInt sets the external interrupt pin to input and sets

the state that will cause an interrupt (EXTINT must beenabled). Mode is the setting that will trigger the actualinterrupt. There are two choices available:EXT_H2L = Will activate when pin is pulled low (from high).EXT_L2H = Will activate when pin is pulled high (from low). Enable Interrupt Source

Enable interrupt is used to turn on the interrupt system.If no interrupt is given, all interrupts set up using ONINTER-RUPT are enabled. Enable interrupt can be used to turn onspecific interrupts.

Your program code goes here ...

disable extint ‘ Disable interrupt can be used to turn off specific interrupts or all interrupts at once. If no interrupt is

THE ATOM 24-PIN MICROPROCESSOR

FIGURE 4

SERVO 02.2005 55Circle #87 on the Reader Service Card.

Barlow2.qxd 1/3/2005 4:31 PM Page 55

Page 56: Servo Magazine 02 2005

given, all interrupts are disabled.

Your subroutines and additional user program code ...

ProgInt ‘ This is the subroutine that the interrupt branchesyou to.User code ’ This does whatever you wish your subroutine todo inside this code.resume ‘ This returns you to main program flow where theinterrupt occurred.

In my robot program, the code is written as follows:

Oninterrupt Extint, Progint ‘ Extint tells the Atom that I willhave an interrupt occurring on pin0. Progint is the subroutineI jump to if an interrupt occurs.

SetExtInt EXT_H2L ‘ This will generate an interrupt if pin 0goes from high to low. Enable Extint ‘ This enables interrupts from this point downin the program. This line is necessary to actually turn on theinterrupt function of the Atom.Main ‘ The start of your main loop.while 1

The main loop code of your program goes here ...

wenddisable extint ‘ Disable interrupt can be used to turn off specific interrupts or all interrupts at once. If no interrupt isgiven, all interrupts are disabled below this line.User Subroutines ‘These are the additional program codesand all of your subroutines. ProgInt ‘ This is the subroutine branched to after an inter-rupt occurs.low motora1 ‘ Turn off all my track motors.low motora2low motorb1low motorb2resume ‘ Note that this is a special command to tell theAtom to resume from where the interrupt occurred.

You may do anything you wish after an interrupt hasoccurred. In this particular program, I set an interrupt flag that Icheck after returning to my main loop. If this flag is set, then Ibranch to my object detection subroutine and process the code.

Future PlansThere is a lot more that can be done with this robot. I still

have many unused functions on the Atom. Future plans includebetter sound functions to show what is actually happening tothe robot for debug purposes. The LCD display is good, buthard to read while the bot is moving around. Morse code or a voice output chip would solve this problem. Onboard temperature reading is planned for the I2C bus of the Atom.

I hope to someday get a working PIR sensor installed.Additional sonar and I/R sensors need to be added. I cannotemphasize this enough: In my experience, you can neverhave too many sensors on a robot. There need to be additional forward sensors, as well as rear side sensors andmore aft sensors. This may require the addition of anotherprocessor or an extra multiplex chip. I hope these articleshave shown you some of the many capabilities of the BasicMicro Atom 24-pin microcontroller and all the possibilitiesthat using it opens up. SV

I/R receiverwww.parallax.com/detail.asp?product_id=350-00014

SRF04, PIR Sensor, and GP2D02http://acroname.com

SN754410 and CD4052www.mouser.com

A/D wiring, Program, and Author Contacthttp://mntnweb.com/hobby/bolo/

Atom 24 and Manual www.BasicMicro.Com

SERVO Magazinewww.servomagazine.com

RESOURCES

THE ATOM 24-PIN MICROPROCESSOR

56 SERVO 02.2005

Barlow2.qxd 1/5/2005 10:43 AM Page 56

Page 57: Servo Magazine 02 2005

SERVO 02.2005 57

My wife gave me a RoboSapien asa birthday gift in June, 2004. She

found it at Fry’s Electronics inCalifornia shortly after they becameavailable. After playing with it, I wasconvinced it was not just another cuteremote controlled toy. It could formthe basis for a low cost autonomousmobile robot.

Like many other electronic hobbyexperimenters, in the past I havedestroyed a great many devices by trying to make them work better, so Iwas reluctant to experiment on theRoboSapien. Then the August issue of SERVO Magazine announced theHack-a-Sapien contest. I decided totake a chance and build anautonomous controller for the robot.

The controller would have sensorsto inform the robot, a processor to ana-lyze the sensor data, and a commandgenerator to control the RoboSapien inperforming autonomous tasks. Thisevolved into a Smart Hat that is put onthe robot to let it achieve autonomousoperation.

At first, I planned to mount every-thing inside the robot body by makingextensive changes to the mechanics,sensors, and wiring. This was a hugeeffort and I feared this approach hadthe potential of joining my growing

collection of partially finished projects.Instead, I considered following a smallset of design goals for the contestentry:

• Make no permanent modifications orinternal changes to the RoboSapien.

• Use only a simple autonomous micro-controller programmed using a PC.

• Use only off-the-shelf sensors andactuators — no custom electronics ormechanics.

• Use only the remote IR optical inputto the robot for send-ing commands.

• Make the final resultlook good and be inthe style of theRoboSapien design.

As always, I choseto salvage existingparts from other proj-ects rather than buyor build anything new.This meant I woulduse components that Iwas familiar with fromother applications. It

also suits my philosophy of value engi-neering for low cost experiments,which translates into “make it cheapand cheerful.”

The PartsFor the microcontroller, I used a

Kronos Robotics preassembled Dioscircuit board that has proved successfulon many other small projects. This PCBis small (2.5 x 3 inches), lightweight,low power, and very easy to programfrom a PC serial port. It has a veryimpressive 10 Mips PIC microcontrollerwith built-in analog to digital

Figure 1. Smart Hat has side IR sensors, a front servomounted ultrasonic sensor, and a programmable

controller while keeping the face visible.

Smart Hat for a Stylish RoboSapien

Pfister.qxd 1/3/2005 4:23 PM Page 57

Page 58: Servo Magazine 02 2005

conversion, serial communication, andmany other features, such as onlyrequiring a 9 volt battery to operateautonomously.

The controller choice drove thesize of the add-on to the robot. It wasa bit too big to be placed inside thebody without major modification. Iexperimented with both a backpackand a waist pack for mounting, butthese displaced the center of gravityand limited the walking agility of therobot. To preserve the existing robotmotions, the center of gravity wouldhave to be carefully maintained andwas a definite mechanical constrainton the possible design choices.

For sensors, I planned to use twoSharp GP2D12 IR range sensors thatinterface easily to the microcontroller.These give a reasonable range read-ing using an analog signal that is veryreliable. My first thought was tomount them on the front of therobot, but I had one more sensor Iwanted to use.

This is an SRF08 ultrasonic rangingsensor from Devantech that uses an I2Cinterface bus available on the Diosmicrocontroller. It was a perfect choicefor the front of the robot, both in

function and looks. I had been using it mounted on a standard size hobbyservo to scan a 180 degree field of view and was confident in its performance.

By going to a smaller and lightermicro servo, I could mount it on therobot, but this would require anotherbattery pack for the servo power — andmore weight. One night, I dozed offpondering different designs. I needed agood idea for mounting the controller,sensors, servo, and batteries. I woke upthe next morning with the concept ofremoving the robot head and replacingit with a new one. Unfortunately, thisviolated my first design rule.

The simple solution was that Iwould not remove the head, but add ahat to the robot instead: a smart andstylish hat with sensors, batteries, aservo, and a controller that only sits over the robot head with no connections other than an optical IRtransmitter LED for command output.It would mount directly over therobot’s center of gravity and wouldhave only a minor effect on themotion of the robot.

The Hat DesignFor a while, I have

wanted to use PololuCorporation’s plasticlaser cutting design serv-ice, just to see how itworks. This was mychance; since I alreadyhad all of the otherparts, it was not a biginvestment to buy some

custom-cut plastic parts. I began toexperiment on part layouts using myfavorite free CAD program, CadStd,to produce some potential designs.

I looked at other laser cut projects and plastic parts and beganto simplify my concept. Curved surfaces were out. I would concen-trate on a simple, open box style withfour sides and a top. I tried a fewdesigns, printed them out, and thencut out paper models to test the fit,look, and feel. In the end, the CADdesign was reviewed and a $16.00cost quoted by Pololu. It was cut

once, air mailed in two days, and fitperfectly. This may be the first time Ihave ever had anything I designedwork on the very first try.

The Smart Hat design is a box cutfrom 1/8 inch ABS plastic. White colored ABS often has brown edgesfrom the laser cutter, so Pololu suggestedusing black stock with a smooth sideand a textured side. The top is recessedto mount the PCB, the servo batterypack of four AAA cells, and the 9 voltbattery for the PCB; in addition, it provides rear access to the serial portand a power connection.

All hat parts are symmetric so thateither the smooth side or the texturedside can be used as the outside surfaceof the hat. The accuracy of the lasercutter is about 0.01 inch and providesa very tight fit with no loose joints. Theback of the hat extends into the neckslot of the robot and the front extendsdown to the chest with holes formounting screws.

A major control problem is thatthe RoboSapien rocks from side to sideup to 30 degrees as it moves. Thismakes the side-looking IR range sensormeasurements very inaccurate. Thesolution was to use a mercury switch to detect the upright position of thebody and to only do the side rangemeasurements during the upright timeperiod. The front-looking ultrasonicsensor is not as subject to errors fromthe rocking motion, but it can also usethe upright detection data to triggerthe sensor operation.

In the final design, connector pinsto the Dios ultra board mount to aRadioShack prototype circuit board.

58 SERVO 02.2005

SERVO MMagazine Hack-a-Sapien Second Place WinnerSERVO MMagazine Hack-a-Sapien Second Place Winner

Figure 2. Parts for the Smart Hat — Dios processor, IR sensors, and batteries.

Figure 3. Plastic parts for the Smart Hat with a CAD drawing and paper fit test.

Pfister.qxd 1/3/2005 4:24 PM Page 58

Page 59: Servo Magazine 02 2005

This board holds the micro servo, theSRF08 ultrasonic sensor, a mercuryswitch tilt sensor, an IR LED for commu-nication to the robot, and connectorsfor the GP2D12 IR sensors. The Diosboard rests on the top plastic panelwith a four cell AAA battery packattached by screws and a 9 volt logicbattery for the Dios controller. TheGP2D12 IR range sensors are mountedat the top of each side panel.

The circuit for the Smart Hat consistsof connecting interface pins to sensorsand actuators. No external digital logicor analog interfaces are required.Inputs to the Dios board are two analog channels from the IR range sen-sors and a digital line from the mercuryswitch tilt sensor. Outputs from theboard are one control line for the servo and one control line for the IRtransmitter LED. A logic power plug isprovided along with a screw type inter-face for the servo battery pack.Communication with the ultrasonicrange sensor is over the built-in I2C busthat uses two wires for clock and data.

The final Smart Hat weighs 400grams. The robot weighs 900 gramsfor a total of 1,300 grams or just underthree pounds. The hat batteries arerechargeable NiMH and last for aboutan hour with proper sensor manage-ment. The hat is attached to the robotby sitting in the back neck slot and rest-ing on adjustment screws on the front.

Rubberbands can beplaced under the arms toprovide a solid, stablemounting. The hat doesnot touch the robothead and the front holelets the robot face andeyes see the world.

The ProgramIn 1977, the IEEE

held the first micromouse contest in NewYork, where the goalwas to produce anautonomously controlledrobot mouse to find itsway through a maze. Byusing the simple rule ofhugging the left wall, amouse can get througha simple maze. This is tobe the first autonomoustest program for theSmart Hat: to simplyemulate the historicrobot mouse. Manymore complex behaviorswill follow, but this firstone is a necessary step for learningabout the control characteristics of therobot.

The structure of the program is a simple repeating loop with the following steps:

1. Start up and initialize the program andactivate robot.

2. Detect if the robot is active by readingthe mercury switch.

3. Measure the side range distances withthe IR sensors.

SERVO MMagazine Hack-a-Sapien Second Place WinnerSERVO MMagazine Hack-a-Sapien Second Place Winner

Figure 4. Circuit connections to the Dios processor for the Smart Hat board.

SERVO 02.2005 59

Pfister.qxd 1/3/2005 4:25 PM Page 59

Page 60: Servo Magazine 02 2005

60 SERVO 02.2005

4. Rotate the servo beginning from left to a start angle.

5. Read the ultrasonic range for the rota-tion angle.

6. Move the servo and repeat step 5 untilend of rotation.

7. Based on side ranges and forward obstacles, choose a command.

8. Send a command to the robot using the IR transmitter LED.

9. Wait for a brief period of time and sample tilt switches.

10. Repeat, starting at step 3.

This program is implementedusing the Dios programming lan-guage. The language provides anextensive library of built-in functionsfor the I2C bus, IR modules, servo control, LEDs, and switches. A largeamount of sample code is provided tomake program construction a veryeasy task.

I estimate my programming timeto be 10 times faster than with C and100 times faster than with assemblylanguage. As in all object-oriented soft-ware systems, there is a learning curve

and a rigid syntax. Inaddition, your design hasto be compatible with thereal time constraintsimposed by the system. In the case of the Smart Hat, no severe realtime constraints exist andthe Dios language provides an easy programdevelopment for robot

control. Best of all, it is provided freefor use with the Dios products.

The OperationMy RoboSapien fitted with a

Smart Hat is being tested to determinehow well it moves on both carpet andwood surfaces. This requires sensing asidewall, detecting any front obstacles,determining the command to transmitto the robot, and then transmitting thiscommand continuously. The Smart Hatmonitors the movements of the robotand updates the commands asrequired.

When it detects a movementanomaly, it halts the program andstores a diagnostic readout in the EEPROM memory for future PC analysis. In general, the robot movesslowly on carpet and faster on smoothsurfaces. It can turn and maintain afixed distance from a sidewall and candetect and avoid large, fixed obstaclesin its path. The Smart Hat is now readyto autonomously control a robot and to be programmed to do many

other useful things.

The FutureI have some future plans and ideas

for using the Smart Hat RoboSapien. Asimpler first project will be to add astandard TV remote IR receiver, asshown in the circuit diagram. This willallow the use of a much simplerremote, such as my favorite — the six button RadioShack model URC-1030B01. This will let someonecontrol the Smart Hat robot motionswithout having to master the complexcontroller supplied with theRoboSapien. This interface can also beused to provide low rate, low power,and limited range wireless computercommunications.

Another intriguing project is tomake a second Smart Hat RoboSapienand then program the pair to competeand cooperate, similar to the MIT6.270 student autonomous designcompetition class. I plan to use a pairof proven IR beacon kits from Pololufor mutual robot location.

Another robot contest is Robo-Hoops 2004, held at Penn State,Abingdon in December of 2004. Theyhad a special innovation challenge usinga RoboSapien that is autonomouslycontrolled. It must dunk a four inchfoam ball in a 10 inch hoop, located 12 inches above the ground.

One definite experimental researchobjective of the Smart Hat is to develop behavior-based autonomousrobot control programs. The goal is toallow the implementation of moderncomputing concepts on a PC and transmit the programs to the SmartHat for embodied operation. Someconcepts include finite state machines,fuzzy logic, neural networks, and other machine learning techniques forintelligent robotics.

In summary, the combination of aRoboSapien for under $90.00, alongwith a Smart Hat for under $100.00and a PC can provide an experimentalautonomous robot system with greatcapability. At this low cost, multiplerobots can be used to cooperateand compete in a wide range of experimental environments. SV

SERVO MMagazine Hack-a-Sapien Second Place WinnerSERVO MMagazine Hack-a-Sapien Second Place Winner

Figure 5. Robot controller and a simple TV remote with receive and transmit test circuit.

Kronos RoboticsP.O. Box 4441, Leesburg, VA 20175

www.kronosrobotics.com

Pololu Corporation6000 S. Eastern Ave., Suite 5-E,

Las Vegas, NV 89119www.pololu.com

Devantech, Ltd. (Robot Electronics)Unit 2B Gilray Road, Diss, Norfolk,

IP22 4EU, Englandwww.robot-electronics.co.uk

Visit the Smart Hat website fordemonstration programs, mpeg

movies, and detailed technical infor-mation for design and construction.

www.sosrobots.com

CAD Standard drawing program byJohn Apperson

www.cadstd.com

Robo-Hoops 2004 at Penn State,Abingdon on December 4, 2004

www.ecsel.psu.edu

TThhee SSoouurrcceess

Pfister.qxd 1/3/2005 4:26 PM Page 60

Page 61: Servo Magazine 02 2005

S E C O N D A N N U A L

Conference and ExpositionThe Nation’s Premier Business Development Event

for Mobile Robotics and Intelligent Systems

May 10-11, 2005Hyatt Regency Cambridge

Cambridge, MA

www.roboevent.com

Profiting from the1st New Industry of the 21st Century

Produced by:

RoboticsTrends

Corporate SponsorsPremier Sponsor

Media Sponsors

Association Sponsors

"The resounding success of the 2004 conferenceis an indication that there is a growing new market for personal, service and mobile robotics. From its academic and research nascency, robotics technology is moving into a number of diverse consumer and business-to-business applications."

Colin Angle, Co-founder and Chief Executive Officer, iRobot

SERVO 02.2005 61

Full Page.qxd 1/5/2005 7:56 AM Page 61

Page 62: Servo Magazine 02 2005

62 SERVO 02.2005

Have you been thinking about participating in theDARPA Grand Challenge this year? If so, don't forget thatFebruary 11 is the deadline for teams to complete part oneof the five-part application process. Basic team informationand certification of funding must be completed by the 11th.The deadline for the next part of the process is March 11th,when vehicle specifications and a video must be submitted.

If you're not up for the Grand Challenge, don't worry.There are plenty of smaller robot events scheduled for thecoming months.

— R. Steven Rainwater

For last minute updates and changes, you can always findthe most recent version of the complete Robot CompetitionFAQ at Robots.net: http://robots.net/rcfaq.html

FFFFeeeebbbbrrrruuuuaaaarrrr yyyy 2222000000005555

4-6 RobotixIIT Khargpur, West Bengal, IndiaOrganized for students of IIT Khargpur, this contest includes events for both autonomousrobots and radio-controlled machines.www.robotixiitkgp.com/

19 DPRG Table Top and Fire Fighting CompetitionsThe Science Place, Dallas, TXThe DPRG is combining their spring Table Toprobotics event with the regional Trinity Fire FightingRobot Competition this year. The Table Top contestoffers a variety of events for small autonomousrobots.www.dprg.org/

MMMMaaaarrrrcccchhhh 2222000000005555

6-10 APEC Micromouse ContestHilton Hotel, Austin, TXThis will be the 18th annual APEC Micromouse event.www.apec-conf.org/

11-12 AMD Jerry Sanders Creative Design ContestUniversity of Illinois at Urbana-Champaign, IL

The design problem for this contest is new and different each year. Check the website for the latestnews and details.http://dc.cen.uiuc.edu/

19-20 Manitoba Robot GamesManitoba Museum of Man and Nature,Winnipeg, Manitoba, CanadaA variety of events, including sumo, a robot tractorpull, and Atomic Hockey.www.scmb.mb.ca/

24-27 ROBOlympicsSan Francisco State University, San Francisco, CALots of events, including sumo, BEAM, Mindstorms,FIRA, and robot combat.www.robolympics.net

AAAApppprrrr iiii llll 2222000000005555

9-10 Trinity College Fire Fighting Home Robot ContestTrinity College, Hartford, CTCould the fire have been set by a robot builder frustrated with the voluminous rules?www.trincoll.edu/events/robot

12-14 DTU RoboCupTechnical University of Denmark, Copenhagen, DenmarkImagine your typical line following contest. Nowadd forks in the line, ramps, stairs, gaps in the line,shifts from indoor to outdoor lighting, reversals ofthe line shading (white to black), and 50 cm "gates"though which the robot must pass.www.iau.dtu.dk/robocup/about_robocup.html

15 Carnegie Mellon Mobot RacesWean Hall, CMU, Pittsburgh, PAThe traditional Mobot slalom and MoboJoustevents.www.cs.cmu.edu/~mobot/

16 UC Davis Picnic Day Micromouse ContestUniversity of California at Davis, CAEvery year, UC-Davis has a campus-wide event

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

Events.qxd 1/3/2005 3:54 PM Page 62

Page 63: Servo Magazine 02 2005

known as Picnic Day. EveryPicnic Day includes the annualmicromouse contest. Theevent follows standard micro-mouse rules.www.ece.ucdavis .edu/umouse/

23 RoboFestLawrence Technological University, Southfield, MIA competition and exhibitionof autonomous LEGO robots.Designed to spur students’interest in science, engineer-ing, programming, and tech-nology.http://robofest.net/

27-29 Singapore Robotic GamesRepublic of SingaporeAn amazing assortment ofevents, including pole balanc-ing, legged robot obstaclecourse, legged robotmarathon race, wall climbingrobot race, micromouse,sumo, robot soccer, robotgladiator competition, andthe robot colony competition.http://guppy.mpe.nus.edu.sg/srg/

MMMMaaaayyyy 2222000000005555

10-11 RoboBusiness Conference Hyatt Regency, Cambridge,MAThe nation’s premier businessdevelopment event formobile robotics and intelli-gent systems, dedicated tocommercialization and appli-cation of robotic systems.www.roboevent.com

• 3 Tools in 1 – Lathe, Mill Drill• Ve rs a t i l e – Ma c h i ne Me t a l s, Plastic, More• P re c i s e – Built to tolera nces up to0.0005 inc h• CNC Compatible – Mo dels ma nu fa c t u re dto easily adapt CNC systems • E A SY to Us e – Full Ins t r uc t ions &L i f e t i me Tech Support

And ONLY the Smithy is...• G UA R A N T E E D to Pay for Itself or

Your Mo ney Back!

Get Your FREE FACT KIT!

Put a COMPLETE MACHINE

SHOPon Your

Bench To p !

Machine It Yourself &S a v e . . . G u a r a n t e e d !Tired of PAYING for Machining?

Now 7Models!

Call To d a y1 - 8 0 0 - 4 7 6 - 4 8 4 9

Ask for operator SERAsk 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

SERVO 02.2005 63

RRoobboottiiccss SShhoowwccaasseeRRoobboottiiccss SShhoowwccaassee

Events.qxd 1/5/2005 12:02 PM Page 63

Page 64: Servo Magazine 02 2005

64 SERVO 02.2005

AUV Travels from WoodsHole to Bermuda

In a voyage that ran fromSeptember 11 until early November oflast year, an underwater robot traveledfrom about 100 miles south ofNantucket Island, MA, to Bermuda.Developed by scientists at the ScrippsInstitution of Oceanography (at theUniversity of California, San Diego)and the Woods Hole OceanographicInstitution, with support from theOffice of Naval Research, the “Spray”autonomous underwater vehicle(AUV) is a 6 ft long ocean glider witha 4 ft wingspan.

A perceptive reader will note thatno external means of propulsion is visible and, in fact, it needs none.Spray glides up and down through thewater on a preprogrammed course bypumping mineral oil between twobladders, one inside the aluminum hulland the other outside. This changesthe volume of the glider, making itdenser or lighter than the surroundingwater and the vehicle floats up andsinks down while using its wings toprovide lift and forward motion.

Batteries power buoyancy change,onboard computers, and other electron-ics. In a typical cycle, it might descend1,000 m (3,300 ft) and travel 5 km (3mi) laterally in about 10 hrs. Betweencycles, it spends about 15 minutes on

the surface to relay its position andinformation about ocean conditionssuch as temperature, salinity, and pres-sure via satellite back to the home base.

In theory, Spray has a range of6,000 km (3,500 mi), which wouldallow it to cross the Atlantic Ocean. Thismeans that it can remain at sea formonths, allowing scientists to observelarge-scale changes in the ocean environment that might otherwise notbe detected. The vision is to build a fleetof AUVs that can be equipped with cus-tomized arrays of sensors that measuresuch things as dissolved oxygen, carbondioxide, alkalinity, salinity, turbidity, andnutrients in the water. For details, visitspray.ucsd.edu

Robo Dog Gets VideoCapability

So let’s say you’re planning aromantic evening with Paris Hilton.You’ve actually taken a shower, put on something nicer than the stainedcut-offs and Budweiser-soaked Elvis T-shirt, and slid something in the oventhat doesn’t say “Hungry Man” on it.The game plan includes candles, softmusic, and a box of fine sangria. Itsuddenly occurs to you: there’s no oneto hold the video camera to prove toyour friends that you are capable offinding a date!

The Spray ocean glider. Photo courtesy of Scripps Institution of Oceanography.

The Spray ocean glider.Photo courtesy of Scripps

Institution of Oceanography.

The AIBO®.Courtesy of Sony Corp.

bbyy JJeeffff EEcckkeerrttRRoobbyytteess

Several weeks ago, shortly before Godzilla’s induction to

the Hollywood Walk of Fame (coincidence?), Dave Calkins disappeared, leaving behind only abox of LEGOs, a blown-out pair ofK-Mart headphones, and half acase of Guiness. Sensing the gravity of the moment, the SERVOstaff shifted into emergency modeand promptly drank the remainingstout. Later, possibly still under theinfluence, they recruited me to fillin for Dave. To submit related pressreleases and news items, pleasevisit www.jkeckert.com And goodluck, Dave, wherever you are.

— Jeff Eckert

Robytes.qxd 1/4/2005 12:54 PM Page 64

Page 65: Servo Magazine 02 2005

Never fear! The latest upgrade toSony’s AIBO® canine robot includes —among less important things — videorecording capabilities. Using a combi-nation of the new AIBO EntertainmentPlayer (AEP) and AIBO MIND 2 (a soft-ware application on 32 MB MemoryStick® media), you can actually chooseamong several customized recordingmodes — continuous, time lapsed,motion-activated, and sound-activated.

The MIND 2 upgrade is availableto existing AIBO owners for about$100.00. If you don’t already have thedigital dog, you can buy him for about$1,900.00.

And, yes, he responds to voice com-mands, dances, plays digital music files,and so forth. I can’t help but wonder,though. If AIBO lifts his leg, do drainedbatteries come out? The answer may beavailable at www.sonystyle.com

Swarm IntelligenceSymposium Scheduled forJune

A perpetual objective in robotictechnology has been to expand on the machines’ ability to operateautonomously. However, if your inter-ests lie with the little insect-like robots,you may instead be thinking in termsof how large numbers of extremelysimple “bugbots” might interact tosolve complex problems, much likeswarms of virtually brainless creaturesin nature somehow pool their mentalresources to build sophisticated nests,coordinate mass migrations, establishschemes for division of labor, and findtheir ways to *NSYNC concerts.

If so, check out the 2005 IEEESwarm Intelligence Symposium, sched-uled for June 8-10, 2005 at the WestinHotel in Pasadena, CA. Co-sponsored

by the IEEE Computational IntelligenceSociety, the IEEE CommunicationsSociety, and the IEEE Robotics andAutomation Society, with cooperationfrom the Jet Propulsion Laboratory, itwill, “focus primarily on theoreticalfoundations of swarm intelligence,models and analysis of collectivebehavior in natural societies, anddesign, control, and optimization ofcollective artificial systems based onprinciples of swarm intelligence.”

There will also be two panel discus-sions focused on, “growing commercialinterests in swarm intelligence applica-tions and research funding opportunitiesin government.” (Translation: How tosell this stuff to industry and suck upmore federal bucks.) Participants willalso have an opportunity to tour the JetPropulsion Lab. For more information,visit www.ieeeswarm.org SV

RRoobbyytteess

SERVO 02.2005 65

Robot Building Blocks

Motor Speed Control

PID Motor Position Control

Phone 530-891-8045

Solutions Cubed

www.solutions-cubed.com

Affordable Motion Control ProductsAffordable Motion Control ProductsAffordable Motion Control Products

l t nSo u io s 3

Circle #94 on the Reader Service Card.

Robytes.qxd 1/3/2005 2:52 PM Page 65

Page 66: Servo Magazine 02 2005

Q.I was wondering if Lithium Ion or Ni-MH cell phonebatteries are of any use to power robots?

— Marcu KnoesenSouth Africa

A.Cell phone batteries happen to be a rather popularchoice for powering smaller-sized robots because oftheir size and higher energy densities when compared

to Ni-Cd and Alkaline batteries. Many times, these batteriesare taken apart and their sub-cells are placed in robots thatfit in the palm of your hand.

First off, you need to determine if the batteries workproperly. Most cell phones are discarded because their batteries no longer hold a good charge. Lithium Ion batteriesare very poplar (to the manufacturing community) becauseof their smaller size and the fact that they have a finite shelflife of around 2 to 3 years.

Ni-MH batteries are more durable than Lithium Ion batteries, but they are larger and heavier. These batteries can tolerate heavy current drains and can tolerate rapidrecharging better than Lithium Ion batteries. Lithium Ion batteries require special charging circuits to safely charge.Most Lithium Ion cell phone batteries have special circuits

built into them to limit charging and discharging rates. Youshould use these circuits if you use these batteries.

Most Lithium Ion cell phone batteries have a 3.6 volt output and some have a 7.2 volt output. Ni-MH cell phonebatteries have a wider variety of voltages: 4.8, 6.0, 7.2, and9.6 volts. This requires you to use some sort of a voltage regulator/conditioner to supply the proper voltage to yourrobot’s electronics. To get a good idea on how many different types of cell phone batteries there are, just visiteBatts.com (www.ebatts.com). They sell hundreds of differ-ent cell phone batteries and they also provide a set of simplespecifications for the batteries.

The main drawback to using cell phone batteries is thatyou will have to make a custom battery holder for thembecause the batteries are designed to fit inside specific cellphones. They don’t have any simple physical attachmentpoints or electrical connections. You can take them apart toget to the core battery, but they are still difficult to work withbecause they won’t fit in traditional battery holders.

Though cell phone batteries may be difficult to use, they do make good batteries for the smaller-sized robots,especially when they are disassembled and placed inside therobot’s small compartments.

Q.I saw a couple of people cutting lead sheets to makeweights for their mini sumo

robots at last year’s PDXBot. What Ireally liked about this was that it wasa large sheet and it was custom-cut toshape with scissors. Do you knowwhere I can get this stuff?

— JoshPortland, OR

A.I like to use these lead sheets inmy sumo robots. This stuff ispretty amazing and easy to

Tap into the sum of all human knowledge and get your questions answered here! Fromsoftware algorithms to material selection, Mr. Roboto strives to meet you where youare — 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]

66 SERVO 02.2005

Thickness oz/in2 gm/cm2 10 cm MiniSumo

20 cm 3 kgSumo

Part No. for a 12”square sheet

1/24” (0.042”) 0.267 1.173 117 469 9032K111

1/16” (0.062”) 0.394 1.731 173 692 9032K112

3/32” (0.094”) 0.597 2.623 262 1,049 9032K113

1/8” (0.125”) 0.794 3.489 349 1,396 9032K114

3/16” (0.188”) 1.194 5.246 524 2,098 9032K115

1/4” (0.25”) 1.588 6.978 698 2,791 9032K116

1/2” (0.50”) 3.176 13.955 1,396 5,582 9032K117

Table 1. Available lead sheets from McMaster Carr and their impact on sumo robots.

MrRoboto.qxd 1/3/2005 2:56 PM Page 66

Page 67: Servo Magazine 02 2005

work with. Table 1 shows a list of different thicknesses thatare available from McMaster Carr (www.mcmaster.com),along with masses per unit area in English and Metric units.The table also includes a couple of columns that give an ideaon how a single layer of the lead will increase the weight ofthe sumo robot if the sheet covered the maximum area ofthe robot. Lead’s density of 6.352 oz/in3 (10.99 gm/cm3)makes it an ideal material for adding weight to a sumorobot.

I purchased a 12” square piece of the 1/24” thicknessfor $5.99 several years ago and I am still using it for myrobots. These sheets can be purchased for sizes from 12”square up to 4’ x 6’. The thinner sheets (1/8” or less) can easily be cut with regular scissors, the 1/8” to 1/4” thicksheets can be easily cut with tin shears, and you will probably want to use a saw to cut the 1/2” thick sheets. Thislead can be cut, drilled, bent, folded, and twisted to fit anyopening inside your robot. For fine-tuning, an X-acto knifecan clean things up.

While writing this, a really cool idea came to mind.Why not use these lead sheets to make disks that fit insidethe popular mini sumo wheels that most people are using?There is a recess that is about 0.10” deep on both sides ofthese wheels. Filling this recess with lead can greatlyincrease the weight of the mini sumo and put all theweight where it counts the most — on the wheel that is in contact with the sumo ring, which helps to improve traction.

Table 2 shows the weight impact of using three of thedifferent lead sheet thicknesses and Figure 1 shows a photoof the disks being made. Double these values when placingthem on the inside of both mini sumo wheels. Dependingon how much weight you need to reach the maximumweight, you could use different thicknesses or you couldmake smaller diameter disks. What makes this approachattractive is that it doesn’t take up any space inside therobot body and it is out of the way of any maintenanceoperations.

Q.I’ve been think-ing of using theL293D H-bridge

IC to control two DCmotors for both forwardand reverse. Will aBASIC Stamp be able todrive the IC without anyother components? WillI be able to go straightfrom an I/O pin to aninput of the L283D?

— John Ringenaryvia Internet

A.The short answeris yes. Figure 2shows a simple

circuit using a BASIC Stamp 2 from Parallax (www.parallax.com) that I use and it works quite well. The program listing shown in Listing 1 is what I use for controlling thedirections of the motors. There’s not much to it.

Now, with that said, you need to be aware that theL293D does transmit current back to the Stamp through theinput lines when the motor directions are suddenly changed.I have measured voltage spikes when there shouldn’t be any.Every now and then, the Stamp would reset. I don’t know ifthe resetting was due to the voltage spikes or a drop in the

Figure 1. Cutting out lead to make a disk to fit inside a mini sumo wheel.

BASICSTAMP

2

+5V

0

1

Vdd

Vcc

15

2

3

4

470 ohm

GN GNMOTOR

OUTPUT 1

OUTPUT 2

MOTOR

OUTPUT 4

OUTPUT 3

INPUT 1

ENABLE 1

+V MOTOR

INPUT 2

+V LOGIC

INPUT 3

ENABLE 2

INPUT 4

L293D

5

Figure 2. Motor direction control using an L293D and a BASIC Stamp.

SERVO 02.2005 67

Thickness Ounces Grams

1/24” (0.042”) 1.059 30.0

1/16” (0.062”) 1.563 44.3

3/32” (0.094”) 2.370 67.2

Table 2. Mini sumo wheel weight changes due to adding lead disks to their insides.

MrRoboto.qxd 1/5/2005 9:42 AM Page 67

Page 68: Servo Magazine 02 2005

voltage supply to the Stamp (yes, the voltage supply to the motor was a different source). This problem has never

shown up when I take the Enable line low prior to any motor direction change and then take it high after the motor

direction has been set.I have never heard of anyone damaging their

Stamps when using the L293D, but you should be aware that it might happen. If you are really concernedabout protecting your BASIC Stamp, then you should consider using an Optical Isolator circuit betweenthe Stamp’s I/O lines and the L293D. Figure 3 showshow to do this. Again, I have used the L293D to drive small motors for years by directly attaching them to my BASIC Stamps and have never damaged them.

Q.The latest listing of popular gear motors forrobotics use was interesting. However, cansomeone address the issue of units on torque?

Specifically:

1. I’m assuming 1 in/lb torque rating means that itshould be able to lift 1 lb if suspended from a stringwrapped around a pulley 1” in radius. Is that correct?

2. If that is true, is 1 ft/lb = 16*12 oz/in? Obviously, anoz/in would be much less than a ft/lb, but what’s theproper conversion factor?

3. Can you give a decent rule of thumb for how much torque is needed for a given robot? Glossing overfriction, if I have a 3” diameter wheel on a 6 lb robot andI want it to be able to go over “small” bumps (1/4” orless and handle carpet), what torque range would bereasonable?

Assuming I have two drive wheels and a third castor,I could take a wild guess that each wheel supportsapproximately 2 lbs (more or less). If torque is force x distance, would I want 3 in/lbs (1.5” radius x 2 lbs deadlift) in each of the drive motors?

I’m guessing the real world isn’t nearly that easy toquantify. So, again, is there a simple rule of thumb forhow much torque is needed?

— John M.via Internet

A.Your understanding for torque is correct.Technically, torque is defined as the movement created by a force acting on a body where the

perpendicular distance between the line action of the applied force and the center of rotation is multiplied by the perpendicular component of theapplied force. When it comes to wheels (or pulleys), it issimplified to force multiplied by the distance of the axle(in this, case the wheel/pulley radius) to the appliedforce.

The unit of torque is force multiplied by distance —such as ounces, pounds, and newtons — multiplied byinches, feet, centimeters, and meters. Many times,

68 SERVO 02.2005

‘ $STAMP BS2‘ L293D Motor Control Demonstration Program

M1_Enable CON 0 ‘ Motor 1 Enable pin, pin 1 on L293DM1_Pin1 CON 1 ‘ Motor 1 Input 1, pin 2 on L293DM1_Pin2 CON 2 ‘ Motor 1 Input 2, pin 7 on L293DM2_Enable CON 3 ‘ Motor 2 Enable pin, pin 9 on L293DM2_Pin1 CON 4 ‘ Motor 2 Input 3, pin 10 on L293DM2_Pin2 CON 5 ‘ Motor 2 Input 4, pin 15 on L293D

HIGH 15 ‘ LED to show that the Stamp to ‘ indicate that the Stamp is on

Init: ‘ Put the motors in a known stateGOSUB M1_StopGOSUB M2_Stop

Main: ‘ Cycle the motors, forward, reverse,GOSUB M1_Fwd ‘ and stopGOSUB M2_RevPAUSE 2000GOSUB M1_RevGOSUB M2_FwdPAUSE 2000GOSUB M1_StopGOSUB M2_StopPAUSE 2000GOTO Main

M1_Fwd: ‘ Motor 1 ForwardLOW M1_Enable ‘ Disable Motor before changing directionsHIGH M1_Pin1LOW M1_Pin2HIGH M1_Enable ‘ Enable motor to move forwardRETURN

M1_Rev: ‘ Motor 1 ReverseLOW M1_EnableLOW M1_Pin1HIGH M1_Pin2HIGH M1_EnableRETURN

M1_Stop: ‘ Motor 1 StopLOW M1_EnableLOW M1_Pin1LOW M1_Pin2RETURN

M2_Fwd: ‘ Motor 2 ForwardLOW M2_EnableHIGH M2_Pin1LOW M2_Pin2HIGH M2_EnableRETURN

M2_Rev: ‘ Motor 2 ReverseLOW M2_EnableLOW M2_Pin1HIGH M2_Pin2HIGH M2_EnableRETURN

M2_Stop: ‘ Motor 2 StopLOW M2_EnableLOW M2_Pin1LOW M2_Pin2RETURN

Listing 1

MrRoboto.qxd 1/4/2005 4:50 PM Page 68

Page 69: Servo Magazine 02 2005

motor torque is represented as gram-centimeter and kilogram-centimeter.Though technically incorrect, since it is amass multiplied by distance (as opposed tothe proper force multiplied by distance), it iscommonly used because converting thesenumbers to newton-meter yields a verylarge number.

Table 3 is a conversion table that willhelp convert the units of torque from onesystem to another. For example, to convert a5 kg-cm torque motor into inch-pound, multiply the 5 by 0.8680 (the number underthe in-lb column that intersects the same rowas the kg-cm) to get 4.34 in-lb.

Estimating how much torque you willneed for your robot to move always provesto be more challenging than you think.First off, any wheeled vehicle must havefriction to move. Without friction, thewheels will just spin in place. The first thingthat you should decide on is whether you want the wheelsto stall if the robot runs into an immovable object. If youallow to wheels to stall, then the motor current draw willbe at its maximum and chances of burning out the motorsand the motor controller are very likely. However, this stall condition does tell you a lot about your robot’s performance.

Next, estimate how much weight will be on each wheel(including casters). Your assumption of evenly dividing theweight distribution across the wheels and caster is good touse for quick and dirty estimating. The next thing I like todo is assume that the coefficient of friction between thewheel and ground is 1.0. This simplifies the calculationsand, in most cases, it represents a worst case situation.Thus, the stall motor torque will just be the robot’s weighton that wheel multiplied by the wheel radius. In your case,the 3 in-lbs (1.5” wheel radius x 2 lbs dead lift) is a goodestimate.

Now, if you chose a motor that had a greater stalltorque than this, then the wheels will spin if the robot raninto an immovable object. Keep in mind that, as long as thewheels are spinning, you will not be drawing the maximummotor current. Having a motor with more torque than this does not improve its pushing abilityor how well it will move, other thanaccelerating faster.

Now, if the motor’s stall torque isless than this, you will probably stall themotors when your robot runs into some-thing. Remember, all robots will movejust fine along flat, smooth surfaceswith motors whose stall torques are significantly less than the wheel stalltorque described here. I personally usethis as my rule of thumb for sizingmotors.

Estimating how much torque is

required to go over a bump is a fairly complicated processand a good understanding of physics is needed, but here arecouple of general rules of thumb:

1. A wheel won’t self-drive over a bump whose height ismore than 30% of the wheel radius. Self-drive means thatthe wheel is pulling itself over the bump.

2. If the motor’s stall torque is greater than 70% of therobot’s weight on that wheel multiplied by the wheel radius,then it will be able to drive over bumps with heights up to30% of the wheel’s radius.

A worst case torque estimate (robot weight divided by the number of wheels in contact with the ground andmultiplied by the wheel’s radius) will enable the robot to goover rough terrain. A lower motor stall torque will still allow a robot to move around, but smaller bumps will beable to stop the robot much more easily. The motor specsshown in the November 2004 issue of SERVO Magazinerepresent the stall torque. If you need more stall torque froma motor, then you will have to increase the applied voltageto the motor. SV

SERVO 02.2005 69

oz-in in-lb ft-lb g-cm kg-cm N-m

oz-in 1 0.0625 0.0052 72.008 0.0720 0.0071

in-lb 16 1 0.0833 1152.1 1.152 0.1130

ft-lb 192 12 1 13826 13.826 1.3558

g-cm 0.0139 0.0009 0.00007 1 0.001 0.0001

kg-cm 13.887 0.8680 0.0723 1000 1 0.0981

N-m 141.61 8.8507 0.7376 10197 10.197 1

Table 3. Torque unit conversion factors.

GENERICOPTICAL ISOLATOR

i.e. PS2501-2

+5V L293D POWER

STAMP GROUND

1 K STAMP I/O PIN

1 K

L293D GROUND

L293D LOGIC PIN

Figure 3. Optical isolation circuit.

MrRoboto.qxd 1/4/2005 10:27 PM Page 69

Page 70: Servo Magazine 02 2005

We accept VISA, MC, AMEX, and DISCOVERPrices do not include shipping and

may be subject to change.

The SERVO BookstoreMind Candy

For Today’s

Roboticist

Mobile Robotic Car Designby Pushkin Kachroo / Patricia

Mellodge This thoughtful guidegives you complete,illustrated plans andinstructions for buildinga 1:10 scale car robotthat would cost thousands of dollars ifbought off-the-shelf. But, beyond hours ofentertainment and satisfaction spent creating and operating animpressive and fun project, Mobile RoboticCar Design provides serious insight into thescience and art of robotics. Written byrobotics experts, this book gives you a solidbackground in electrical and mechanical theory, and the design savvy to conceptualize, enlarge, and build roboticsprojects of your own. $29.95

Industrial Roboticsby Harry Colestock

With so many industriestaking advantage of thetremendous advances inrobotics, entities rangingfrom small family businesses to large corporations need assistance in the selection, design, set-up,maintenance, and eco-nomic considerations of industrial automation. Industrial Robots shows how toachieve maximum productivity with robotics,classifies robots according to their complexityand function, and explains how to avoidcommon automation mistakes. $39.95

Electronic Gadgets for theEvil Genius

by Robert Iannini The do-it-yourself hobbyist market — particularly in the areaof electronics — is hotter than ever. Thisbook gives the “evilgenius” loads of projects to delve into,from an ultrasonicmicrophone to a bodyheat detector, all the way to a Star WarsLight Saber. This book makes creating thesedevices fun, inexpensive, and easy. $24.95

70 SERVO 02.2005

ROBOT DNA SERIESThree Volume Pack

Everything you need to program yourrobot controller:• Microcontrollers in Robots• Software Development• The Microchip PICmicro Microcontroller• Microcontroller Connections• Designing the Robot System• Going Forward

Everything you need to build your ownrobot drive train:• The Basics of Robot Locomotion• Motor Types: An Overview• Using DC Motors• Using RC Servo Motors• Using Stepper Motors• Motor Mounting• Motor Control• Electronics Interfacing• Wheels and Treads• Locomotion for Multipods

All the data you need to build your ownrobot base:• Mechanical Construction• Electrical Construction• Operating Power• Robot Designs• Constructing a Two-Wheeled Rover Robot• Selecting the Right Materials• Glossary of Terms• Tables, Formulas, and Constants

Subscribers: $62.99 Non-subscribers: $69.99

Limited time only!Offer expires January 31, 2005!

Robot Programmingby Joe Jones / Daniel Roth

Using an intuitive method,Robot Programmingdeconstructs robot control into simple anddistinct behaviors that areeasy to program anddebug for inexpensivemicrocontrollers with littlememory. Once you’vemastered programming your online bot, youcan easily adapt your programs for use inphysical robots. $29.95

Build Your Own All-TerrainRobot

by Brad Graham / Kathy McGowan Remotely operatedrobots are becomingincreasingly popularbecause they allow theoperators to exploreareas that may not normally be easilyaccessible. The use ofvideo-controlled technology has sparkeda growing public interest not only in hobbyists, but also in the areas of research,space, archeology, deep sea exploration,and even the military. Inside Build Your OwnAll-Terrain Robot, the writers enable eventotal newcomers to robots to construct arugged, video-controlled, talking, seeing,interacting explorer bot with a range of overa mile for under $200.00! $29.95

Robot Builder's Bonanzaby Gordon McComb

Robot Builder’s Bonanzais a major revision of thebestselling bible of amateur robot building —packed with the latest inservo motor technology,microcontrolled robots,remote control, LEGOMindstorms Kits, andother commercial kits. It gives electronicshobbyists fully illustrated plans for 11 complete robots, as well as all-new coverageof Robotix-based robots, LEGO Technic-based robots, Functionoids with LEGOMindstorms, and location and motorizedsystems with servo motors. $24.95

Robot Building for Dummiesby Roger Arrick / Nancy Stevenson

Ready to enter the robotworld? This book is yourpassport! It walks youthrough building yourvery own little metalassistant from a kit, dress-ing it up, giving it a brain,programming it to dothings, even making ittalk. Along the way, you’llgather some tidbits about robot history,enthusiasts’ groups, and more. $21.99

BookstoreFeb05.qxd 1/4/2005 1:02 PM Page 70

Page 71: Servo Magazine 02 2005

Check out our online bookstore at www.servomagazine.com for a complete listing of all the books that are available.

SERVO 02.2005 71

To order call 1-800-783-4624 or go to our website at www.servomagazine.com

PIC Microcontroller Project Bookby John Iovine

The PIC microcontrolleris enormously popularboth in the US andabroad. The first editionof this book was atremendous successbecause of that.However, in the fouryears that have passedsince the book was firstpublished, the electronics hobbyist markethas become more sophisticated. Many users of the PIC are now comfortable payingthe $250.00 price for the Professional version of the PIC Basic (the regular versionsells for $100.00). This new edition is fullyupdated and revised to include detaileddirections on using both versions of themicrocontroller, with no-nonsense recommendations on which one serves better in different situations.$29.95

Build Your Own HumanoidRobots

by Karl Williams Build Your OwnHumanoid Robotsprovides step-by-stepdirections for six excitingprojects — each costingless than $300.00.Together, they form theessential ingredients formaking your ownhumanoid robot. $24.95

Robotics Demystifiedby Edwin Wise

There's no easier, faster,or more practical way tolearn the really toughsubjects. McGraw-Hill'sDemystified titles are the most efficient, intriguingly written brush-ups you can find.Organized as self-teaching guides, theycome complete with key points, backgroundinformation, questions for each chapter, andeven final exams. You'll be able to learn morein less time, evaluate your strengths andweaknesses, and reinforce your knowledgeand confidence. $19.95

Machine Nature: The ComingAge of Bio-Inspired Computing

by Moshe Sipper Despite being marvels ofcomplexity and humaningenuity, computers arenotoriously bad at learning new things anddealing with new situations. Researchersat the frontiers of computer science haveturned to nature forsolutions to the problem of machineadaptation and learning. By applying modelsof complex biological systems to the realmof computing machines, they have given riseto a new breed of adaptive software andhardware. In Machine Nature, computer scientist Moshe Sipper takes readers on athrilling journey to the terra nova of computingto provide a compelling look at cutting-edgecomputers, robots, and machines now andin the decades ahead. $24.95

CNC Roboticsby Geoff Williams

Now, for the first time,you can get completedirections for building aCNC workshop bot for atotal cost of around$1,500.00. CNC Roboticsgives you step-by-step,illustrated directions fordesigning, constructing, and testing a fullyfunctional CNC robot that saves you 80 percentof the price of an off-the-shelf bot and canbe customized to suit your purposes exactly,because you designed it. $34.95

JunkBots, Bugbots, and Bots onWheels: Building Simple Robots

With BEAM Technologyby Dave Hrynkiw / Mark W. Tilden

From the publishers ofBattleBots: The OfficialGuide comes this do-it-yourself guide to BEAM(Biology, Electronics,Aesthetics, Mechanics)robots. They're cheap,simple, and can be builtby beginners in just a fewhours, with help from this expert guide complete with full-color photos. Get readyfor some dumpster-diving! $24.99

LINUX Robotics: ProgrammingSmarter Robotsby D. Jay Newman

Robotics is becoming anincreasingly popular fieldfor hobbyists and profes-sionals alike. The cost ofthe mechanics and electronics required tobuild a robot are lowenough that almost anyone can afford it. Thehardware that used to require governmentfunding or a large university grant is now available to the average person. At thesame time, programming is becoming a common skill. This book combines the most sophisticated parts of robotics andprogramming to fill a real gap in availableinformation. Most robotics books today usemicrocontrollers as the “brains” of therobots. This approach is fine for smaller, less expensive projects, but has serious limitations. When attempting to build a robot with sophisticated movements, navigation, vision, and picture-capturing abilities, it is better to use Linux as the controller. This book is available for sale February 15, 2005. $34.95

Robot Builder's Sourcebookby Gordon McComb

Fascinated by the world of robotics, but don’tknow how to tap into theincredible amount of information available onthe subject? Clueless as tolocating specific information on robotics?Want the names, addresses,phone numbers, and websites of companiesthat can supply the exact part, plan, kit,building material, programming language,operating system, computer system, or publication you’ve been searching for? Turnto the Robot Builder’s Sourcebook — aunique clearinghouse of information that willopen 2,500+ new doors and spark almost asmany new ideas. $24.95

Robot Mechanisms andMechanical Devices Illustrated

by Paul SandinBoth hobbyists and professionals will treasurethis unique and distinctivesourcebook — the mostthorough — and thoroughlyexplained — compendiumof robot mechanisms anddevices ever assembled.Written and illustratedspecifically for people fascinated with mobile robots, Robot Mechanisms andMechanical Devices Illustrated offers a one-stop source of everything needed for themechanical design of state-of-the-art mobile‘bots. $39.95

NNEEW!W!

Pre-OrderPre-Order

NONOW!W!

BookstoreFeb05.qxd 1/5/2005 8:10 AM Page 71

Page 72: Servo Magazine 02 2005

72 SERVO 02.2005

When we last left “The Spectacles”from the San Rafael Community

Center, it was mid-October and theywere preparing for their FIRST LEGOLeague (FLL) local tournament. As Iwrite this, almost two months havepassed, their first local tournament hascome and gone, and a lot has changedin both their strategy and the overallrobot design.

Before I let you know how they didin their tournament, let’s take a look atsome of the ideas and strategies theyhad during the course of this season.We’ll start with a recap of their robot

design and then take a look at howthey addressed some of the challenges.

Changing the Specson Spex

In any competition where there areobjectives in fixed locations, it is impor-tant for a robot to hit its mark — to beable to go where you need it to reliablywithout error. The Spectacles were veryexcited with their new “uber chassis”that they called “Spex” (profiled in theDecember 2004 issue of SERVO).

Alas, their design had one fatal

flaw in that it couldn’t go straight forlong. This can be a problem with LEGOrobotics; a weak motor, a lack of sym-metry, or a mistake in programmingcan cause your robot to drift off course.As fate would have it, Spex quicklybecame Spex 1.0-CrisisBot and a mas-sive change to the design took placejust after the last article went to press.

So, the boys from team #8 wouldlike to say, “Thanks for building ourrobot from the last article, but we didn’t end up using it. Sorry.” For infor-mation on how to build their newdesign, please go to their website at

// castling bonusesB8 castleRates[]=-40,-35,-30,0,5;

//center weighting array to make pieces prefer//the center of the board during the rating routineB8 center[]=0,0,1,2,3,3,2,1,0,0;

//directions: orthogonal, diagonal, and left/rightfrom orthogonal for knight movesB8 directions[]=-1,1,-10,10,-11,-9,11,9,10,-10,1,-1;

//direction pointers for each piece (only really forbishop rook and queenB8 dirFrom[]=0,0,0,4,0,0;B8 dirTo[]=0,0,0,8,4,8;

//Good moves from the current search are stored inthis array//so we can recognize them while searching and makesure they are tested first

by James Isom

Some of the team analyzing the problem with Spex 1.0. A couple of Spex 2.0 chassis without the RCX.

A bi-monthly column just forkids!LESSONS

FROM THELABORATORY

LESSONSFROM THELABORATORY

— PART 7 —— PART 7 —The Final Spex Check

LessonsFromTheLab.qxd 1/4/2005 10:16 PM Page 72

Page 73: Servo Magazine 02 2005

SERVO 02.2005 73

http://robotics.megagiant.com/fll/The new design — Spex 2.0 — is a

wider robot that has four wheelsinstead of three; more importantly, itcan hit its mark quickly and accurately.

To best describe Spex 2.0, I giveyou the words of one of its designers —Greg: “Our newest chassis has lessthan half of the pieces of Walker’s Spex1.0. This chassis was designed on thetheory that a new bot should have easilyremovable motors in case one motorbegan to spin slower than another. Thiswas a problem we had with Spex 1.0 inthat, despite its overall symmetry, it stillcouldn’t drive in a straight line.

“In previous seasons, we have useda rotation sensor to measure theamount of rotations a motor spins overa certain number of seconds. We usethe RCX data logging feature along withRobolab Investigator to make a graph ofthe motor speeds so that we could findmatching motors. The removable motoridea proved to be a good one and thischassis will be used at the competition.”

With the chassis crisis over, the teamfound itself in mid-October without asolid strategy for the game. The teamorganized itself into work groups. Eachof these groups replicates the chosenchassis design for use in developingtheir part of the overall game strategy.

Formulating a strategy is tricky; ittakes careful planning and methodicalexecution to combine the nine objectivesof this year’s challenge into the five pro-grams the RCX can hold. They will onlybe able to use one robot at the competi-tion, so they spend quite a bit of timeduring chassis development making surethere are ample places to connect theirattachments for each objective. A majordesign change in the middle of objectivedevelopment can throw the team intoserious turmoil: a lesson learned frompast seasons. Their goal is to reach theend of the season and have each group’sattachment connect perfectly with thechassis through this common interface.

Once the work groups completedtheir individual chassis, the team satdown and plotted out the likely order inwhich they wanted to complete each

objective. The outcome was five workgroups, each of which were assigned oneor more of the nine challenge objectives.

Work groups were comprised ofone to three team members each andwere responsible for the building andprogramming of their chosen objec-tives. As you will soon see, some of theobjectives were completed quickly andyet others dogged the team all the wayinto their first competition.

The ChallengesThe FLL challenge is comprised of

three or more rounds that are 2-1/2 min-utes long. Most challenges consist ofobjectives that deliver an object to orfrom a place on the playing field. Eachround, the robot starts from within thebase — a square in one corner of theplaying field. While in base, teams areallowed to touch their robots, changeattachments, and run different pro-grams. Once the robot leaves base, theteam is not allowed to touch it withoutincurring a penalty. The playing fielditself is a 4’ x 8’ rectangle.Two teams compete at thesame time in two back-to-back playing fields with oneshared objective. This year,it’s “Play Ball” — a basketstraddles the field edge. TheSpectacles’ strategy for the2004 challenge was organ-ized by program number andexecution order and was:

1. Play Ball — Deliver a ball

into the white ring in the center of thebasket.

2. CD and Glasses — Move the CD fromits holder into the CD case area of theplaying field and return to base withthe glasses.

3. Bus Stops — Knock down the whitebus stop sign without knocking overeither of the red signs.

4. Cereal Delivery — Deliver the cerealto the table.

5. Pet Food Delivery — Open the gateand get to the top of the stairs.

For more information on this year’schallenge, visit www.firstlegoleague.org

Play Ball

This was chosen as the first objectivebecause getting the ball in the centerring is worth 50 points (the highest

FIRST LEGO League Challenge 2004 — “No Limits.”

The motors were tested in a small jig made from a few bricks and a rotation sensor.We could then review the graph of how many rotations each motor made over

5 seconds and match the motors with the closest values.

LessonsFromTheLab.qxd 1/3/2005 3:40 PM Page 73

Page 74: Servo Magazine 02 2005

74 SERVO 02.2005

individual point value of the challenge)and, since there is only enough roomfor one ball in the center ring, our teamwanted to be there first. This one camepretty easy.

Greg built a tower the height ofthe basket with a lever mechanism similar to something they had used inprevious seasons. It consisted of twoaxles running parallel to one another tohold the ball in place while a vertical

axle and a touch sensor served as the trigger. A couple of well-placed rubberbands provided tension to themechanism, allowing it to return to itsoriginal state after dropping the balloff into the basket.

The program for this objective ispretty simple. Go forward until you hitthe basket and then back up into base.This program could be repeated overand over again as necessary to fill the

basket with balls; additional balls onyour side of the basket are worth fivepoints each at the end of the round.The strategy was to run the programuntil the ball was placed in the centerand then continue on to other objec-tives, returning to it for additional balldrops at the end of the round, as timepermitted.

Strengths:1. Simple mechanism.

2. Simple program.

3. Fast.

4. Repeatable.

Weaknesses:1. Not always accurate. Slamming intothe basket to drop off the ball cancause problems when dropping theball off or coming back to base.

2. Takes time to attach and detach themechanism.

CD and GlassesThe CD and Glasses team went

through a variety of ideasbefore settling in on their finaldesign. The objective is toremove the CD from a holderjust outside of base and put itinto a graphic of a CD case ashort distance away on themat. This is followed by agrasping maneuver on the eyeglasses before the robotreturns to base.

Zach and Jake first built aforklift that lifted the CD andplaced it on the CD case. Thisparticular design wentthrough several variations andmet with some success. Itsbiggest drawback was that itbecame difficult to control theCD once it was lifted off theholder. Sometimes, the CDwould get caught up and flipoff the forklift before they

The genius of the Play Ball block diagram is in its simplicity.

The CD and Glasses block diagram is more complex.

LessonsFromTheLab.qxd 1/3/2005 3:42 PM Page 74

Page 75: Servo Magazine 02 2005

SERVO 02.2005 75

needed it to and, at other times, itwas difficult to slide the CD off the forks once they reached thedrop point.

The second design addressedthis problem by wrapping a cagearound the forks to control the CDmore precisely. Despite its earlysuccess, two things led to theabandonment of this particulardesign. First, it was slow; all thatlifting, dropping, and maneuveringwas taking up too much time.Second, what about the glasses?This one program had to accom-plish both objectives in a single run and— despite their best efforts — the boyswere having difficulty placing the forksinto the eye holes of the glasses.

Sometime during all this headscratching, one of the team membersfloated the idea of popping the CD offthe holder and onto the CD case. Thisinspiration came from a wayward robotthat had been maneuvering on thefield and accidentally ran into the CD,flipping it across the table.

After several ideas were playedwith, a sliding plow with two forks wassettled upon. It worked pretty muchfrom the start, once a bit of tweakingto the program was done. To grasp theglasses, Zach built a one-way latchmade from a rotating axle and lever.He used a fixed pin that allowed theglasses to enter the latch, but notexit. His program was designed tosimply run into the glasses hardenough that they would be caughtbehind the latch and carried back tobase.

Strengths:1. Attaches and detaches quickly.

2. Simple, solid design that performsboth objectives well.

Weaknesses:1. The program relies solely on timingand doesn’t have any sensor feedback.If the robot gets off course, it is offcourse for the whole run. Saving theoff course robot can incur penalties.

2. Depending on the robot’s approach,there is a slight chance that the glassescan slip through the latch mechanism.

Bus StopsThree bus stop signs sit in a line on

top of one of the 2” x 4” edges thatmake up one side of the playing field.Two are red and the other is white. Theobjective is to find the white bus stopsign and knock it off its vertical defaultposition without knocking over eitherof the red signs. The trick is that thewhite sign is placed in one of the threepositions randomly by a judge at thestart of each round. To explain themechanism used in this challenge, Igive to you the words of one of its creators — Gabe: “The attachment I

designed to flip down the bus stop signis very simple, although it has gonethrough many radical changes.

“The flipper started as a longbeam with sliding pieces on the bot-tom and a rack gear on the top. Amotor with a 24-tooth gear would spinand push the beam outward when alight sensor sensed white. It wasplaced on the top of the RCX. The sen-sor was stuck on another long beam;this one on the bottom of the robot. Itwas placed just beyond the wheel, sothe beam would have enough time tomove outward and flip down the sign.

“This worked, but — after almostnever-ending problems with the slidingbeam system — I went to a much sim-pler and more reliable design: just afew beams stuck together to form a

The Bus Stop challenge presented some difficulties.

Jake tackled the Food challenge.

LessonsFromTheLab.qxd 1/3/2005 3:43 PM Page 75

Page 76: Servo Magazine 02 2005

76 SERVO 02.2005

long lance. The lance was again stuckto the top of the RCX, but facing forward this time — the direction therobot was driving.

“The robot would drive out ofbase, far from the wall, and make aright turn when it sensed the whitesign, flipping it down with the lance asit turned. It then just drove straightback into base without hitting anyother signs.

“Once I had the final idea, it wasvery easy to create a program aroundthe attachment; it probably took aboutan hour. The final attachment and program works very consistently andvery well.”

Strengths:1. Attaches and detaches quickly.

2. Uses a light sensor to find the objec-tive. More accurate than just usingtimed steps.

3. Simple and fast program.

Weaknesses:1. Occasionally overturns and runs intothe table on its return trip due to thehigh speed and width of the chassis.

Cereal DeliveryJust outside the base sits a small

table surrounded by three chairs. Theobjective of this challenge is to delivera small tray of LEGO pieces (simulatingfood) to the top of the table withoutspilling it. Jake took this one on almost

from the beginning and stayed with itthroughout the season.

The mechanism he designed is similar to the one used in “Play Ball” inthat there is a place to put the tray witha trigger hanging below. The idea is to drive into the table and push thetrigger lever in to drop the food off.The mechanism as a whole doesn’tbend very much — just enough to startthe bowl and tray to slide. The momen-tum of the food and tray, combinedwith the robot backing up, is justenough to gently slip the bowl and trayonto the table.

This did not come easily at first.The tray would often get caught up ona chair, resulting in the bowl of foodsliding off the table and onto the floor.The team eventually decided toapproach the table at an angle in orderto bypass the chair.

Strengths:1. Attaches and detaches quickly.

2. Simple and fast program.

3. Stable delivery mechanism.

Weaknesses:1. Can easily get caught up on thechair or the table.

2. If the forward momentum orapproach is even slightly off, the foodis thrown to the floor.

If you are familiar with Robolab,you will notice that Jake set the power

levels for each motor at 2 (the maxi-mum is 5). This setting and the timingprovide just the right amount ofmomentum to deliver the food to thetable without mishap.

Pet Food Delivery,Gate, and Stairs

The team knew from day one thatthis would be the most difficult of theprograms to complete. It involves threeobjectives and the most maneuveringout of all the programs this season.The first of these three objectives is todeliver food (three round LEGO pieces)to a dog and a cat at the far end of theplaying field.

These pets are enclosed in an areasurrounded by a stationary fence and alarge gate. The gate itself is the secondobjective in the sequence. For fullpoints, the gate needs to be openedcompletely so that a small latch catchesthe door. The final objective is to drivethe robot off the playing field and ontoa set of steps. For full points, the robotneeds to be all the way on the top stepat the end of the round.

The initial strategy was to build adevice similar to the mechanism usedin both the “Play Ball” and “FoodDelivery” objectives. The trigger mech-anism was attached to the end of along assembly of axles and would runinto the fence and drop the food intothe pet food area.

The robot would then make a rightturn, slamming the axle assembly intothe gate door, popping it open, andthen back up and turn so that it coulddrive to the top of the stairs. All thisinvolved a lot of precision movement.In order to get where the robot needed to go, the team decided to usea rotation sensor. A rotation sensor is abit like a measuring tape. You can roll the robot to a destination, note the number of rotations it took, andprogram the robot accordingly. Theywould simply count the number ofrotations to each waypoint — in theory,that is.

Unfortunately for the team, they

Spex 2.0 in action at FLL.

LessonsFromTheLab.qxd 1/3/2005 3:45 PM Page 76

Page 77: Servo Magazine 02 2005

SERVO 02.2005 77

were never able to get this one to workthe way they wanted it to. Their firstproblem was that the robot was justtoo fast to execute turns accurately.This problem was made worse by thelong axle assembly sticking out in frontof the robot that often acted as a largependulum, swinging it around too farin the direction it was turning.

On those occasions when it didwork and managed to move on to hitting the gate, the axle assembly wasn’t heavy enough to open the gate.To make matters worse, the axleassembly would get in the way as therobot attempted to climb the stairs.

Dozens of variations were devel-oped and tested all the way up to theday of the competition. The lack of success with this approach at the competition put this idea to rest onceand for all and the team actively beganworking on a new idea while there.However, these things take time and itwasn’t quite ready to serve them con-sistently at the tournament. They are,however, still working on a solutionand will post the results of their laborsto their website when it is finished.

The TournamentFLL competition day is always a big

day for the team. This is their third localcompetition. They have never made itto the state competition in previous

seasons. The competition consists of much more than just the gameitself. There is a presentation to bemade and interviews with judges onprogramming and robot design.

The team keeps a journal of theiractivity over the season. Each membertakes turns interviewing fellow teammembers on their accomplishmentsand existing problems at the end ofeach practice session. Close to the com-petition day, they take this material andform it into a story board of sorts sothat other teams, judges, and onlook-ers can see what the team has been upto during the competition season.

This year’s board was dominatedby their approaches to the challenges,along with information on all theirchassis designs: Why they built themand why they abandoned them. Alltogether, the team did an incredibleamount of design and analysis this season and it surprised them whenthey built this year’s board.

At the Contra Costa local tourna-ment, they were amazed and awed atsome of the other solutions teams hadcome up with. Overall, they played the game well, coming in fifth overall:a personal best in their book. However,where they really shined was in interviews with the judges.

All those problems that hadcropped up and all that thinking andtesting was enough to earn them their

first Best Robot Design Award. Team#8 from the San Rafael CommunityCenter finally made it to the state finalcompetition.

I would just like to say, as a coach,that FIRST LEGO League is a fantasticprogram for 9 to 14 year olds. Join or— better yet — start a team in your areatoday. You won’t regret it. You can goto www.firstlegoleague.org fordetails about next year’s challenge.

I would like to congratulate myteam and also the rookie year girls’team from Miller Creek Middle Schoolthat I helped mentor with eighth gradescience teacher Kim Asso. They made it to the state tournament, as well. Go RoboChicks!

The state tournament is looming. Tosee how it all turns out, be sure to visitthe Spectacles at their website http://robotics.megagiant.com/fll/ SV

James Isom is a part-time robotics teacherand general all-around geek. He has taught robotics to children andteachers in the US and abroad. His website with additionalgoodies (including theMLCAD file of this robot)can be found at ww.theroboticslab.com He canbe reached at [email protected]

AUTHOR BIO

LessonsFromTheLab.qxd 1/3/2005 3:46 PM Page 77

Page 78: Servo Magazine 02 2005

Koolio is a fully autonomous mobilebot with an ice-cold refrigerator

for innards. Brian Pietrodangelo andKevin Phillipson, students in theMachine Intelligence Lab (MIL) at theUniversity of Florida at Gainesville created Koolio to service the third floorof the school’s Benton Hall, where thelab, classrooms, and professors’ officesare located.

Not the least of Koolio’s impres-sive characteristics are the facial

expressions he can muster frombeneath his long, black dreadlocks.Koolio’s personality beams across a19” LCD monitor screen on which hecan be programmed to smile, keep astraight face, or demonstrate othermoods.

What’s a ThirstyCollege Kid to Do?

All that studying, glued to the

books, no time to run down the hallto drop quarters in the machine, evenless time to run down the street for asix pack. What’s a college kid to dowhen he or she needs a cold pop or beer? Necessity — in this case, perhaps desire — made invention itsoffspring.

If you’re a college student andyou get thirsty, it’s good to be an engineering major, so say Brian and Kevin.

78 SERVO 02.2005

[email protected] David Geer

Koolio — Hip Bot, Drink Haven, and Mobile Butler

Paparazzi catches Kooliotaking a stroll. Notice the

unassuming look on his faceand his casual style with

cap and dreadlocks.

Koolio poses with creatorsBrian Pietrodangelo andKevin Phillipson — threebuds just being Koolio.

Geerhead.qxd 1/3/2005 3:22 PM Page 78

Page 79: Servo Magazine 02 2005

Koolio IllustratedUsing Dr. Nechyba — Brian’s and

Kevin’s professor in the MachineIntelligence Lab at UF — as a sampleconsumer, let’s walk through Koolio’sroutine on the third floor of BentonHall.

Let’s say Dr. Nechyba is chained tohis desk with work. He can’t afford to let it go long enough to get a popfrom down the hall. He has anotheralternative. He logs on to the networkvia the computer at his desk and signals Koolio to bring him a pop.

Koolio hears via wireless card andresponds. Koolio determines whichroom houses the computer that themessage came from. He leaves hisdocking station and finds his waydown the hall. This is done using a variety of sensing equipment.

Upon delivering the pop to Dr.Nechyba, Koolio leaves to return to hisdocking station. There, he rechargeswhile waiting for his next request.

Neat Notion’sNitty-Gritty

Koolio is a mobile, fullyautonomous bot that doles out drinksor food to the third floor around theclock and fills up on juice himself at hisown, private docking station.

Koolio hangs at his dock whenhe’s not needed for anything, justkickin’ and taking in a jolt of volts.

Koolio can find his docking stationfrom anywhere on the third floorand returns when he feels short onelectricity.

Koolio’s Fame andFuture

Koolio’s service to human kind has not gone unnoticed orunrewarded; this beverage-haulingbot has garnered loads of exposurefrom the press and tons of praisefrom a growing fan base. Why?Everybody wants one! Someday,they may get their wish.

The two academic roboticistshave a start-up company calledRASTA Robotics — Robotic &Automated Systems TechnicalAssociates. Though there are noimmediate plans to mass-produceKoolio, the possibility is very muchalive.

Kevin and Brian are on thelook-out for companies ready tolicense Koolio and bring him to the

display floors of chains or outlets or to offer him up by some other

SERVO 02.2005 79

GEERHEAD

Koolio’s “sleeping on the dock of thestation, watching his eyes just roll away”

or something like that.

Koolio may sound simple, but heis the result of careful, logical design,using the following hardware and software. Koolio uses a KontronEmbedded PC/104+ Board foronboard vision processing — detectingobjects and reading room numbers.The board controls the hostingbehind a local website that selectusers can access.

An Altera Max 3000 and AtmelMega 128 chip make up Koolio’sbrains. The Altera CPLD uses VHDL

algorithms to keep the control in the Atmel chip simple. The CPLD isbetter equipped to handle big dataand to do it fast. Left to itself, theAtmel would be in over its head,slowing performance.

Koolio, a big fan of open sourcecode, runs the Red Hat Linux version9.0 operating system. Other compo-nents include a 266 MHz PentiumMMX processor, 128 MB DRAM(RAM), and a Cisco Aironet 350wireless card to communicate with

the network.The fridge is a Koolmate40,

which can carry 52 cans of pop orbeer. Sensors include a SharpGP2D12 IR distance measuring sensor, which detects rangesbetween 10 and 80 cm, and aDevantech SRF08 Ultrasonic RangeFinder, which determines rangesbetween 3 cm and 6 m. The bot also employs a CMPS03 magneticcompass. Its eye is a Creative VideoBlaster II web cam.

TALKING TECH ON KOOLIO’S SPECS

The Koolio website — http://mil.ufl.edu/~brian/Koolio/Koolio.htm

From the page above, you can go to a section for the press where you will find videos and information about Koolio.

The RASTA company website — www.rastarobotics.com with other projects by Kevin and Brian.

RESOURCES

Geerhead.qxd 1/3/2005 3:25 PM Page 79

Page 80: Servo Magazine 02 2005

means. Koolio could well follow in the footsteps of Roomba, servinghomeowners and fitting seamlesslyinto their lifestyles.

Koolio could go into the ad business, starring in commercials forcanned and bottled beverage compa-nies. He could also be distributed commercially as the new mobile Coke, Pepsi, or other beveragemachine that comes to you instead ofwaiting down the hall or in the break

room for you to come to it.

Hello Class, My NameIs Professor Koolio

What can we learn from theKoolio project? Lesson one — modular-ity: By taking a look at the larger project and breaking it up into proposed modules or perhaps components that can be easily concep-tualized, understood, designed, and

produced, you keep the largerproject much simpler.

By verifying the success ofeach individual module, youassure the success of thewhole. If something goeswrong, you know which module to deal with and youonly have to deal with thatmodule, often simply byreplacing it. This kind ofapproach enables direct andlogical troubleshooting anddebugging.

Lesson two — practicemakes ... Koolio: Koolio wasthe result of putting an education in engineering into practice. Getting yourhands dirty and actually con-structing a project based onyour new-found knowledge,teaches you the practicalapplications of what you havelearned.

AdaptationsKoolio can serve schools, homes,

offices, factory workers — you name it. As long as he doesn’t face the challenge of climbing stairs or similarobstacles, he’s good to go. Kooliokeeps you from being inconvenienced,waiting on you day and night as no realbutler could do.

Koolio may someday be used toserve those who are sick or disabled, as well. SV

80 SERVO 02.2005

GEERHEAD

Koolio is racing down the hall to answersomeone’s call. Kind of reminds you of

Batman answering the Bat Signal, exceptthat Batman wasn’t outfitted with a

Cisco wireless card.It’s bottoms up as we get a shot from thefloor to the ceiling of Koolio and creators.

Book learning only goes so far.You get an introduction to some-thing, but you don’t necessarilybecome consumed by it. When youbuild your own robot, you are invest-ing yourself with the goal of success.

By getting involved, you learnwhy analog technologies are stillimportant, why circuits, electronics,power, resistors, capacitors, andinductors still matter. You learn whyit’s important to know computer science, digital logic, and the gambit

of electrical engineering.Every roboticist will commit

errors now and then; what counts isfinding and correcting the source ofthose errors. The MachineIntelligence Lab at the University ofFlorida provides a great deal ofhands-on experience for its students.It’s highly recommended that seriousroboticists find a club or engineeringlab they can be a part of to get thethrill of that hands-on activity in aproject they can relate to.

WHAT YOU GET FROM GETTING INVOLVED

Brian Pietrodangelo went on

to at least two additional projects

after Koolio — an autonomous

submarine called the Subjugator —

www.mil.ufl.edu/subjugator/ and

an independent contract for a

doctor in Tallahassee, FL.

Having graduated from the

University of Florida, Brian intends

to go to graduate school.

ABOUT THE INVENTOR

Geerhead.qxd 1/4/2005 12:51 PM Page 80

Page 81: Servo Magazine 02 2005

We Compete Because We’reProgrammed to Compete — and

That’s a Good Thing!

Alot of people ask me why I put onrobot events. Most presume it’s

to make money. (The sad truth is that Iknow of no event that actually makesmoney; it’s a question of how muchmoney an organizer can afford to lose.)Event organizers put on robot eventsbecause they love robots. Certainly,that isn’t the only reason, though. No,most of us put on robot events becausewe love people — especially kids.

When it comes down to it, thepeople who enter their creations atrobot events do it because of an internaldrive. Robot builders are pre-programmed to want to come withtheir robots. Like geese flying south forthe winter, we are driven by internalprogramming. This programmingcomes down to three basic points.

CompetitionIt’s more than the governing

philosophy of capitalism and sports; it’spart of what makes us human — andergo, one of the things that separatesus from robots. One reason that I don’tthink robots will take over the world is that they’ll simply never be able to emote on a level which includes that form of competition. They mayfunction on a level of survival, perhaps,but not fear-based survival whichinspires them to compete for spacewith us carbon types. But I digress.

We humans are arrogant crea-tures. We love to show-up the otherguys. If I buy a car, I want my car to befaster than yours. Or I want it to haulmore stuff. Or be more fuel efficient

than yours. Or I want to have gotten abetter deal on it. At work, we all wantto make a bit more than the other guy,work a bit less, and have a bit morepower. It’s part of our competitivenature. Of course, to every rule there isan exception, so I know that not every-one fits into the description above — butthe great majority of humankind does.

What does this have to do withrobots? Darn it, Dave, your topics wander more than a line follower witha bad CDS cell! It has to do with robotcompetitions! Competitions likeTetsujin, for example. The prize moneywas sweet and it was certainly a bigpull in getting people to enter; however,I’d bet that if the prize money hadbeen cut in half — or even by 90 percent — SERVO would have gottenjust as many entries.

Oh, yes, we would have! I talkedto all the competitors. Not one of themsaid that they came “for the money” astheir first answer when asked why theywere there. Oh, it was always numbertwo or number three, but what they all really craved was to be the bestengineer at the show — the smartestones on the block.

As Tetsujin winner Alex Sulkowskiput it, “I often lack a specific, achievablegoal and timeline to motivate me tocomplete my projects. Entering robotcompetitions provides this structure anddirection; in addition, it provides anincentive, knowing that others will bestruggling to solve the same problem.”

I cut my chops building mini sumorobots — the 500 gram ones (1.1pounds, if you haven’t been paying

attention). For the record, my most basicgoal on the first bot I built was to learnPIC programming. However — like agreat many bot builders — I arrogantlypresumed that I could figure out thebasics. My real goal was to build a bettermini sumo than the other ones I saw.

I had to study up on servos andmotors and gears — and learn that(golly!) not all servos are created equally,so I should buy the better ones. Then,I learned that if I doubled the voltage Iput into a servo, I squared the power!Hey! This was neat! Soon, using a fewsimple tricks — and burning out a fewPICs and servos — I had a really goodlittle robot.

While a gift certificate from robotstore.com is a nice benefit, taking firstplace is a far better thing. In addition,there’s nothing more humbling thanspending a couple hundred dollars tofly up to Seattle, only to get creamedby a 12-year-old with his own home-made bot.

That, however, is why robot competitions have become so popular.Most builders want to see how theymeasure up against their peers.

EducationA very close second to beating the

other guy is seeing what everyone elseis doing that’s new. I think that thebest thing that came out ofROBOlympics 2004 was seeing thejaws of US builders drop as they sawRobo-One robots for the first time. You can make that in your garage? Yes, Virginia, do-it-yourself androids

by Dave Calkins

SERVO 02.2005 81

Appetizer.qxd 1/3/2005 1:21 PM Page 81

Page 82: Servo Magazine 02 2005

really do exist.One of my favorite things about

any robot competition is seeing all ofthe new stuff that builders come upwith. Ted Larson and Bob Allen decidedto see if they could top Dean Kamen bybuilding Bender — a self-balancingrobot similar to a Segway, only atabout a 1/100th of the cost. It doesthe same thing as the more expensiveSegway, only they built it themselves.Bob and Ted’s excellent robot was the first of its kind — but now severalpeople have made similar bots (seeFrancisco Lobo’s project in the July2004 issue of SERVO).

I don’t think it would occur to most people to just up and build a self-balancing, two-wheeled vehicle, but —upon seeing Bob and Ted’s — lots ofpeople’s mental light bulbs went off.The joy of education was transferredand our pre-programmed lust for knowl-edge kicked in. Keeping in the spirit ofthe competitive sub-routine, TrevorBlackwell went and built a self-balancingunicycle! Sure, a lot of people wouldcall all of the self-balancers copy-cats,but most of human knowledge is copy-cat data — just creatively re-applied.

“Rubberbands and Bailing Wire”author Jack Buffington likes to competebecause, “it allows me to try out newthings without risking failure on a paidproject.” It also forces him to learn, asit, “sets a deadline for trying out newthings. Without a deadline, I’m just notas motivated.”

Most of the real learning goes onwith the kids, of course, but not alwaysin the way you might think. At a typicalshow, just as many adults are inspiredby the robots that kids design and buildas there are kids being inspired byadults’ robots. Kids have the wonderfulprivilege of not being as programmed

as we adults are. They have a muchcleaner slate and, as such, don’t have tiny subroutines going on in thebacks of their heads, telling them whatcannot be done.

In judging for FIRST LEGO League,I’m always amazed at the robots thatkids build. When I look at some of themore radical designs, I tend to thinkabout how it can’t work. I’ve clearlybeen programmed to restrict myself tocertain designs. However, the kids aregood at hacking my internal softwareand corrupting those old files. They doit by making wild designs that work —things that I would never have thoughtup and things that many older botbuilders would not have tried. Theyalso become the educators, while Ibecome the student.

Social ProgrammingNo matter how geeky the builder

is, we can’t just sit at home. Thefriends of most robot builders thinkthat we’re a little nutty. While they likeplaying with our creations, they justdon’t get the obsession.

“It’s a great way to meet otherbuilders,” says Jack. It’s true; you don’ttend to meet too many robot builderswhile shopping at the local strip mall.

I think half of the friends I talk toregularly are people I’ve met at robotevents. Be it a small club meeting or a world-wide competition likeROBOlympics, events for combat robotsor LEGO Mindstorms bots, the people Imeet at robot events are just moreinteresting and have more to offer thanthe ones I meet at the pub (which isn’tto knock hanging out at the pub — mandoes not live by bots alone). When wehave guests for dinner these days, theytend to be robot builders. It’s not so

that I can schmooze my way into arobotics job, but just because theyseem to have much more in commonwith me and my wife. Our conversa-tions tend to last long into the night aswe discuss the future.

And so it goes at robot events. Thegreatest success of competitions likeROBOlympics and Tetsujin is gettingbuilders from two different robot classesto start talking (say a combat robotbuilder and a Robo-One builder or asumo robot creator and a Mindstormshacker). You’d be amazed at howmuch they start learning from eachother. Heck, they are amazed by howmuch they learn from each other.

Just Do ItYeah, yeah, yeah — I’ve become a

sneaker billboard. But if you’re a robotbuilder and you haven’t gone to a robotcompetition, that needs to change!There is the “Events Calendar“ listing ofrobot events every month in SERVO.Even if you’ve never built a robotbefore, go to a show and get inspired.

Compete against the people there.You can build a better bot! Learn fromthe people who show up. They areyour very best resource for buildingrobots. Meet new people. You alreadyhave something in common!

Whether you go to a local monthlymeeting with five guys showing off ahalf-completed robot or you fly to SanFrancisco, CA, to see ROBOlympics,robot competitions are already in yourdesign. That database between yourears has far too many empty rows. Fillup your personal database and thenput it to use.

And then watch as my mini sumokicks your mini sumo’s batteries to the curb. SV

Advertiser IndexAll Electronics Corp. ....................................63

Anchor Optical Surplus ..............................21

APEC 2005/MicroMouse Contest ..............36

Budget Robotics ...........................................56

CrustCrawler .................................................14

E-Clec-Tech ....................................................15

Electronic Goldmine ....................................49

Hobby Engineering ......................................13

Jameco ..........................................................83

Lemon Studios .............................................22

Lynxmotion, Inc. ...........................................45

Net Media .......................................................2

Parallax, Inc. ...................................Back Cover

PCB123/PCBexpress ......................................3

Pololu Robotics & Electronics ....................44

ROBOBusiness Conference & Expo ............61

ROBOlympics ...............................................77

Robotics Group, Inc. ....................................55

Rogue Robotics ..............................................7

Smithy.............................................................63

Solutions Cubed ...........................................65

Sozbots..........................................................35

Technological Arts .......................................59

Vantec ...........................................................39

Zagros Robotics ...........................................63

82 SERVO 02.2005

Appetizer.qxd 1/3/2005 1:23 PM Page 82

Page 83: Servo Magazine 02 2005

Remember when...

Be sure to visit our new website atwww.Jameco.com/nvb

Jameco@Home—where electronics is still fun!

Remember when......electronics stores were stocked to the rafters

with every component imaginable and there was ALWAYS

a knowledgeable person there to help you?

Think those days are gone?

Well they’re not!

You just need a little Jameco@Home.

Call for a FREE catalog today.

We have the electronic components and knowledgeable

Technical Support people who can help bring back the fun

in your electronics hobbies, inventions, and DIY projects.

®

1-800-455-6119

Circle #32 on the Reader Service Card.

Circle #60 on the Reader Service Card.

CoverInside.qxd 1/4/2005 9:42 PM Page 2

Page 84: Servo Magazine 02 2005

Circle #106 on the Reader Service Card.

Vol. 3 N

o. 2

SERV

OM

AG

AZIN

ER

ECYCLABLE RO

BOT SO

FTWA

RE

February 2005

0 474470 58285

02>U.S. $5.50 CANADA $9.25

Cover.qxd 1/5/2005 4:20 PM Page 84