0 7>
Let your geek shine. Meet Leah Buechley, developer of LilyPad—a sew-able microcontroller—and fellow geek. Leah used SparkFun products and services while she developed her LilyPad prototype. The tools are out there, from LEDs to conduc tive thread, tutorials to affordable PCB fabrication, and of course Leah’s LilyPad. Find the resources you need to let your geek s hine too.
»Sharing Ingenuity S P A R K F U N. C OM
©2008 SparkFun Electronics, Inc. All rights reserved.
Let your geek shine. Meet Leah Buechley, developer of LilyPad—a sew-able microcontroller—and fellow geek. Leah used SparkFun products and services while she developed her LilyPad prototype. The tools are out there, from LEDs to conduc tive thread, tutorials to affordable PCB fabrication, and of course Leah’s LilyPad. Find the resources you need to let your geek s hine too.
»Sharing Ingenuity S P A R K F U N. C OM
©2008 SparkFun Electronics, Inc. All rights reserved.
Free Book with Kit
PAGE 12
Columns 08
Robytes
by Jeff Eckert
Stimulating Robot Tidbits
12
GeerHead
by David Geer
Lewis, the Robot Photographer
16
Ask Mr. Roboto
by Dennis Clark
Your Problems Solved Here
58
Twin Tweaks by Bryce and Evan Woolley
There’s a New Humanoid on the Block
64
Robotics Resources by Gordon McComb
Stocking Up with Surplus Electronics
67
Dif fer ferent ent Bits by Heather Dewey-Hagborg
Random Bits
74
Appetizer by Kym Graner
Dusting Robots
77
Then and Now
by Tom Carroll
Robotics — A Historical Perspective
THE COMBAT ZONE ... Features 28
BUILD REPORT Apollyon
30 MANUFACTURING
s t n e m t r a p e D 4
06 07 22 24 26 70 71 81
High-Performance Drill Motor Modification
Mind/Iron Bio-Feedback Events Calendar Robotics Showcase New Products Robo-Links SERVO Webstore Advertiser’s Index
SERVO 07.2008
32
PARTS IS PARTS Mag Motor Upgrades and Repairs
Events 33 Results and Upcoming Competitions
Robot Profile 31
Billy Bob
07.2008 VOL. 6 NO. 7
Features & Projects 34
CES 2008 Robot Roundup
PAGE 34
by Ted Larson The annual Consumer Electronics Show does not disappoint with its coverage of robotics in the Tech Zone.
39
Encoder Matching by Robert Doerr Scaling and inverting encoder values to fit your particular application.
44
Big Mama Gear Motors by Fred Eady Learn what it takes to design, build, and code a heavy duty DC motor driver module.
50
Loki Crosses the Pond — Part 2 by Alan Marconett This final installment examines the QwikFlash controller board and the software that runs Loki.
PAGE 44
PAGE 39
Magazine (ISSN 1546-0592/CDN Pub Agree#40702530) is published monthly for $24.95 per year by T & L Publications,Inc., 430 Princeland Court, Corona, CA 92879. PERIODICALS POSTAGE PAID AT CORONA, CA AND AT ADDITIONAL ENTRY MAILING OFFICES. POSTMASTER: Send address changes to SERVO Magazine, P.O. Box 15277, North Hollywood, CA 91615 or Station A, P.O. Box 54,Windsor ON N9A 6J5;
[email protected] SERVO
SERVO 07.2008
5
Published Monthly By T & L Publications, Inc. 430 Princeland Court Corona, CA 92879-1300 (951) 371-8497 FAX (951) 371-3052 Webstore Only 1-800-783-4624 www.servomagazine.com
Mind / Iron by Bryan Bergeron, Editor
Small is Big When it comes to robot components, small is big. If you’ve followed the robotics news lately, you know that academic and military R&D communities are busy at work developing robots that mimic – in form and function – small crawling and flying insects. Need to locate survivors in the rubble of a collapsed building? Simply release a swarm of heat-seeking crawling robots that can squeeze through cracks without disrupting the rubble and endangering trapped victims. Need an up-close view of a hostage situation? A swarm of flying microbots with photosensors could provide police with a composite, real-time image of the victims and their captors. Despite ongoing advances in research laboratories, there are numerous challenges that must be overcome before practical autonomous insect swarms can Piezoelectric Squiggle micro motor on polycarbonate mount shown next to a six-pin DIP for size comparison.
become a reality. There are issues of how to provide communications between each insect-sized robot and their human masters, local computation, sensors, power, and of course, powerful, lightweight, controllable micromotors. And there’s the underlying issue of cost. A recent advance in the area of micromotors has been the commercial availability of linear micromotors from New Scale Technologies (www.newscaletech. com). Their series of Squiggle motors fills the void between the microscopic nanomotors and the miniature ser vos and electronic/pneumatic linear actuators popular among robotics enthusiasts. I had the opportunity to evaluate New Scale’s mid-sized offering — the Squiggle SQL-1.8-6 linear motor — shown in the photo. As the name suggests, the motor is a mere 1.8 mm in width. The rectangular motor body is 6 mm long, with a 12 mm axial screw running through its center. The 160 milligram SQL 1.8 is capable of handling a 30 g load when driven by a 400 mW, 40V, 171 kHz pulse. The even smaller SQL 1.5 linear motor can work with a 20 g load. As illustrated in the photo, the electrical connection to the Squiggle motor is via a flex printed circuit strip. With a PC-based control application and USB-to-Squiggle interface, I was able to vary the travel rate from micrometers per second to millimeters per second, with an impressive 0.5 micrometer resolution. Although the relatively fragile motor was glued to a polycarbonate mount
Mind/Iron Continued
6
SERVO 07.2008
Subscriptions Toll Free 1-877-525-2539 Outside US 1-818-487-4545 P.O. Box 15277 North Hollywood, CA 91615
PUBLISHER Larry Lemieux
[email protected] ASSOCIATE PUBLISHER/ VP OF SALES/MARKETING Robin Lemieux
[email protected] EDITOR Bryan Bergeron
[email protected] CONTRIBUTING EDITORS Jeff Eckert Tom Carroll Gordon McComb David Geer Dennis Clark R. Steven Rainwater Fred Eady Kevin Berry Robert Doerr Ted Larson Alan Marconett Kym Graner Bryce Woolley Evan Woolley Heather Dewey-Hagborg Nick Martin Mike Jeffries Bryan Ruddy CIRCULATION DIRECTOR Tracy Kerley
[email protected] MARKETING COORDINATOR WEBSTORE Brian Kirkpatrick
[email protected] WEB CONTENT Michael Kaudze
[email protected] PRODUCTION/GRAPHICS Shannon Lemieux Joe Keungmanivong ADMINISTRATIVE ASSISTANT Debbie Stauffacher
Copyright 2008 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 Magazine assumes no responsibility for the availability or condition of advertised items or for the honesty of the advertiser.The publisher makes no claims for the legality of any item advertised in SERVO. This is the sole responsibility of the advertiser. Advertisers and their agencies agree to indemnify and protect the publisher from any and all claims, action, or expense arising from advertising placed in SERVO. Please send all editorial correspondence, UPS, overnight mail, and artwork to: 430 Princeland Court, Corona, CA 92879.
SchmartBoard Is Looking for Beta Testers New Website will be Social Network for Electronics Enthusiasts
S
Dear SERVO: The “analog” servo block diagram, Figure 5, of the Servo Buddy article in May 2008, is missing the velocity feedback path from the motor to the local pulse generator. Without this damping feedback, the servo will oscillate. After the stretched drive pulse has ended, the motor back EMF is used to modify the next local pulse. In servos that use the NE544 IC, this feedback is from pin 9 to pin 1 via a resistor. For the NJM2611 IC, from pin 11 to pin 15. It is interesting to note that years ago what is now called an analog servo was called a digital servo. Back then, an analog servo required an analog VOLTAGE input. — William J. Kuhnle
chmartBoard is looking for people to beta-test a soon to be opened web space call Solder By Numbers™. The website, which is due to launch in late summer, will be a social network for electronics enthusiasts. SchmartBoard is looking for all levels of testers from professional engineers to novices who have an interest in electronics. They are looking for people from around the world. According to SchmartBoard’s VP of Sales & Marketing, Neal Greenberg, “SchmartBoard is not yet ready to reveal specific details about the website, except that it is web 2.0 for electronics enthusiasts. Solderbynumbers.com will be a place to design and build your electronic circuits while you create a worldwide network of peers. The site will be much more than a social network. It will be a place to collaborate, create, communicate, and learn.” To sign up to be a beta-tester, go to www.solder bynumbers.com.
RESPONSE: While I tried to keep the diagram simple, it might have been good to include that. Thanks for pointing it out. — Jim Stewart
for evaluation purposes, I could easily envision a spider-sized eight-legged walker, powered by 16 skeleton-mounted Squiggles. The size of the peripherals that accompanied the motor — a wall wart power supply, a USB driver card, and a three-foot USB cable — not to mention the desktop PC and software — explains why the robotics shops aren’t offering autonomous robots sporting Squiggle-based grippers and actuators. Even a six-pin DIP dwarfs the Squiggle, much less a PIC or BASIC Stamp. However, the control issue should be partially solved by the time you read this. New Scale has a miniature ASIC driver under development that could form the heart of a Squiggle spider robot. Power issue is another matter. The smallest battery packs that I’ve used are thin-film lithium-polymer cells designed for miniature indoor R/C aircraft. The thin, dime-sized cells power a single-motor aircraft for about five minutes. As such, an autonomous eight-legged Squiggle spider would likely have a lifespan measured in seconds with current battery technology. Even so, in some applications, 20-30 seconds of operation could be worth the cost of a swarm of insect-sized microbots. On the topic of microsensors, with the exception of Hall-effect devices, I haven’t seen any commercial sensor offerings that come close to the level of miniaturization required for an insect-sized microbot. I’d like to have an affordable ultrasonic or IR rangefinder comparable in relative size to the Squiggle. However, consider the
challenge in creating a suitable IR rangefinder with standard components. A typical IR LED alone is about the size of an insect’s head. And the available ultrasound rangefinders require even more volume. Clearly, when it comes to microsensors for autonomous microbots, it’s time for a new generation of SMT devices. Although autonomous microbots made completely of commodity — read affordable and readily available — components may be a few years away, there are myriad applications of micromotors in other areas of robotics. The most obvious applications range from the manipulation of camera optics and R/C mini helicopter control surfaces, to control of microvalves in implantable drug delivery devices to surgical robots. Although I expect to see the first large-scale applications of micromotors in the consumer electronics industry, the medical applications will likely have the most profound effect on quality of life. Consider that current surgical robotics rely on standard-sized motors connected to scalpels and other instruments through cables. Although these robotic systems enable surgeons to operate with greater efficiency and effectiveness than traditional methods, because of the physical arrangement of cables and instruments, the working area is constrained to only a few inches across. The use of micromotors connected directly to instruments would allow for a much larger work area for tele-surgeons, as well as lighter, mechanically simpler surgical robots. Size and weight can be critical factors if the remote patient happens to be an astronaut on Mars, or a critically injured US soldier in a remote area of the world. SV SERVO 07.2008
7
“What you don’t want to build is a million over three years from the fragile, expensive pain in the butt.” Defense Advanced Research Projects The Aurora offering will be based Agency (www.darpa.gov) — is iRobot (www.irobot.com). Under on its “Odysseus” design, which uses solar the grant, the company will develop the LANdroid robot, a portable compower during daylight munications relay device. According hours and stored energy at night. It combines to the contractor, “This robot will be three “constituent small enough that a single dismounted aircraft” in a 500 ft warfighter can carry multiple robots, (150 m), intriguing inexpensive to the point of being Z-wing configuration. disposable, robust enough to allow Boeing is expected to the warfighter to drop and throw field a design based on them into position, and smart enough the existing British-built to autonomously detect and avoid Zephyr high-altitude, obstacles while navigating in the long-endurance UAV, urban environment.” from partner QinetiQ The objective is to enable Aurora’s Odysseus design: A possible (www.qinetiq.com). networking in urban areas where configuration of the Vulture UAV. Photo courtesy of Aurora Flight Sciences. Lockheed Martin is still buildings and other pesky objects mum on the subject. can block wireless operations. In On a more celestial level, DARPA The competitors have 12 months operation, each of the little guys will is also funding a competition to to come up with their initial designs wander around until it finds a good develop an unmanned aerial vehicle for DARPA review. Phase two will end spot to function as a node and then that will shatter endurance records. with a three-month flight test of a join the rest of the swarm to form The bird will draw 5 kW of power, subscale demonstrator, and the final the network. If one is destroyed, the carry a 1,000 lb (450 kg) payload, phase will require a 12-month test of others will adjust their positions to stay aloft for at least five years, and a full-scale vehicle. keep the system up and running. remain in its assigned airspace 99 percent of the time while fighting winds encountered at operating Mini Network Bots New Touch Technology altitudes, reportedly ranging from 60,000 to 90,000 ft (18,000 to Also pulling down government One of the perennial problems in 27,000 m). The goal is to provide funding — in this case, up to $3 robotics is improving the machine’s long-term intelligence, surveillance, reconnaissance, and communication missions over locations of interest. Contractors for phase one are Aurora Flight Sciences (www.aurora. aero), Boeing (www.boeing.com), and Lockheed Martin (www.lock heedmartin.com ). A variety of propulsion approaches — including solar and internal combustion — will be considered; however, nuclear and lighter-than-air designs have been ruled out. The winning design must comply with space — not aviation — industry standards, because only a “pseudo-satellite” will handle the demanding requirements. A superviSneak peak at what the LANdroid robot will look like. Photo courtesy of DARPA. sory engineer at NASA observed,
The Vulture Seldom Comes Home to Roost
8
SERVO 07.2008
event’s Vienna-based creator (www.robo exotica.com), “Until recently, no attempts had been made to publicly discuss the role of cocktail robotics as an index for the integration of technological innovations into the Artist’s concept of the “ScratchBot” human Lebenswelt employing the BIOTACT sensor. Photo courtesy of the BIOTACT project. [environment], or to document the sense of touch, and what could be a increasing occurrence of radical better way to solve it than to learn hedonism in man-machine from our touchy-feely friend, the rat? communication.” Imagine that. But you can stop worrying, because Enter BIOTACT (BIOmimetic Technology for vibrissal ACtive Touch, www. “RoboExotica is an attempt to fill this vacuum.” biotact.org ), a project funded by the European Union and involving nine RoboExotica generally consists research groups in seven countries. of a series of events (exhibition, The goal is to emulate how such conference, workshops, music, and mammals as rats and Etruscan shrews film presentations) held at various can rapidly sweep their whiskers locations in Vienna. But this year, back and forth to gather information sometime after the December 4th about their surroundings. Thus, a bot kickoff in Austria, it will be presented fitted with hundreds of whisker-like in San Francisco, as well, “thus sensors may be able to seek, identify, and track fast-moving target objects, even in poorly lit places where machine vision doesn’t get you anywhere. The challenge is to develop new biomimetic computational methods and technologies that enable the technology. But the consortium has been granted four years and $11.6 million to do it, so the odds look good.
Showcase of Robotenders It’s beginning to look like the Germanic tribes have a curious fetish about linking robotics with such ostensibly unrelated fields as sociology, philosophy, and art (see last month’s Robytes). In this vein, the upcoming 10th anniversary of the RoboExotica conference recently came to light. According to the
A contestant from RoboExotica 2007. Photo courtesy of Roboexotica.com.
facilitating the already existing exchange of ideas between the West Coast’s very much alive technology/ art scene and the RoboExotica mother ship in Vienna.” Unfortunately, the US incarnation will not include the annual cocktail robot awards, where you can enter a machine in one of five categories: serving cocktails, mixing cocktails, bartending conversation, smoking culture, and other achievements in the sector of cocktail culture. To participate, you’ll have to show up at the Rote Bar/Volkstheater Wien (www.volkstheater.at/rotebar .html). The program is still under development, so check the website from time to time for details.
Bot Assists Endoscopy
The EndoAssist robotic manipulator. Photo courtesy of Prosurgics.
This month’s device for taunting the squeamish is EndoAssist, a robotic endoscope manipulator offered by Prosurgics Ltd. Used in invasive thoracic and abdominal surgery, it is particularly useful for ardiothoracic, urological, bariatric, ob/gyn, and general surgery. Perhaps the most interesting feature is that the surgeon controls camera angles simply by moving his head. Glance left, and the camera moves left, and so on. You
SERVO 07.2008
9
can also pan, zoom, or modify the view in any direction. For a video demonstration that may affect your ability to keep lunch down, visit www.prosurgics.com/prosurgics_ endoassist.htm.
Uribot Tends Kobe Airport Finally, the strangest application of robotics of late would be Dasubee, a bot designed specifically to clean urinals. One is already operating in the Kobe, Japan airport. An astute observer will note that it resembles an elephant. Designer Susumu Kanai revealed that this design was inspired by the pachyderm’s trunk, which resembles the powerful water cannon employed by the bot. The ears are handles, the eyes are the start and stop buttons, and its little yellow hat is the filler cap for the 13 gal (50 l)
tank. Reportedly, using specially developed antibacterial detergent, Dasubee can shine up a fouled privy in only 10 seconds. If you’re still reluctant to buy one, consider that Kanai has included “a vacuum function to breathe in a scraper and the water of the floor to be able to wash the dirt scattered to the floor together on the function side.” (Something may have been lost in the translation.) You can pick one up for only one million yen (about $9,500). SV
Dasubee, the urinal bot and its proud operator. Photo courtesy of Impress Watch Corp.
STEER WINNING ROBOTS WITHOUT SERVOS!
P
erform proportional speed, direction, and steering with only two Radio/Control channels for vehicles using two separate brush-type electric motors mounted right and left with our mixing RDFR dual speed control . Used in many successful competitive robots. Single joystick operation: up goes straight ahead, down is reverse. Pure right or lef t twirls vehicle as motors turn opposite directions. In between stick positions completely proportional. Plugs in like a servo to your Futaba, JR, Hitec, or similar radio. Compatible with gyro steering stabilization. Various volt and amp sizes available. The RDFR47E 55V 75A per motor unit pictured above. ww w.van te c. co m
Order at (888) 929-5055
10
SERVO 07.2008
by David Geer
Contact the author at
[email protected]
Lewis, the Robot Photographer At first brush, a robot that snaps people’s pictures might not imbue the mind with a novel image. But, a photographer that sets its subjects at ease, circumvents their shy and self-conscious natures and related facial reactions, and captures the essence of the subject unawares, now that’s a wonder to see! Full side view of Lewis.
W
hen Lewis the Robot Photographer first enters a crowded room, it gets attention. But, once people have adjusted to its roaming around, looking here and there, they forget all about it. After all, it’s just a machine, another object in their environment. Lewis’ ability to blend in keeps it from creating the kind of apprehension that comes with a live photographer who roams around snapping candid pictures of people (as a wedding photographer might do, for example). Because Lewis captures people at ease, it can take a much higher quality of photos — no blinking, phony smiles, or stiff or awkward poses. Because Lewis recognizes faces and quickly snaps only the best photos, it takes many more quality pictures in the same period at gatherings, functions, and on special occasions.
Lewis separates real faces from things that may look like faces to the robot eye. Lewis eliminates anything that is too big, too low, or the wrong shape. Anything left is assumed to be a face. Lewis can take front-on and side angle pictures of people. It continually scans images for the criteria that predict a face or group of faces. Once it has detected a suitable image, it adjusts the camera to take a quality photo, moving it into position via a series of zooming, tilting, and panning. The robot uses object avoidance technology to guide itself around objects and people, and maintains its position within the mass of subjects by recognizing a given object and centering itself in the group based on the position of that object.
Looking for Faces
How does Lewis form pictures of faces? By following rules. One such rule is the rule of thirds. The rule of thirds says that if you split a picture into thirds, first horizontally, then also vertically, the primary point of visual interest in the photo should be where the lines cross. Lewis makes human faces the points of greatest interest, placing them at these cross points.
Lewis starts by scanning the room for pairs of what appear to be legs. This way, he can identify people and then look up to find and identify their faces. Then, Lewis uses facerecognition technology that identifies parts of images with lots of skin tones grouped closely together.
12
SERVO 07.2008
Forming Pictures
GEERHEAD Photographers try to avoid empty space in their photos. This helps ensure that photos contain as much relevant visual information as possible. Lewis weighs the rule of thirds and the rule around empty space one against the other whenever they conflict, to take the best pictures. Lewis can also think for himself when taking photos. He is free to break the rules altogether and take feedback about his images. He uses this information to learn which rules to break and when in order to deliver great photos based on a sort of photographic instinct.
Live Test Researchers tested the Lewis robot photographer on a group of 5,000 subjects over a period of 40 hours. Lewis took 3,000 pictures in that period. During this 40 hour run, people (guests at a large technology event) either ignored the robot completely or tried to interact with it. Because the robot wasn’t instilled with the ability to interact, people quickly dispensed with it and began socializing with other people in the crowd. Because people ignored the robot, they relaxed and acted naturally, enabling the robot to take candid, natural pictures.
Sharing a more whimsical moment with Lewis are members of the Media and Machines Lab (from left): Assistant Professor William Smart; Assistant Professor Cindy Grimm (seated): two of the lab’s founders, Shannon Lieberg, Engineering Class of ‘04 and research assistant Michael Dixon, B.S./M.A. ‘03; and Nik Melchior, a fifth year B.S./M.S. student in computer science and engineering. Members are showing off the “playful props” used by Lewis in the lab.
it there for? In this version of the robot it made a noise, sounding an alarm or signal when it had taken a picture. However, the sound wasn’t loud enough for most people to hear. If the signal were louder, this would communicate to people in the robot’s proximity that it had just taken a picture. This would form some level of communication between the robot and those people, and provide some simple basis for interaction. The robot had no way of telling people to hold still or say cheese. It took four seconds for the robot to line up shots, in which time people might Lewis close-up head shot with camera.
hold still to get their picture taken, or they might move around. After the robot’s test run, people suggested that the robot actually say cheese or show a picture of a “birdie” (as in, look at the birdie) to signal that it was about to take a picture. People waiting in front of the robot hoping to have their pictures taken were often disappointed when the robot was navigating, getting its bearings, or homing in on a landmark instead of taking pictures at that particular moment. However, the Lewis has worked photographing at a real live wedding reception.
Results Among other things, researchers determined that the robot should have a sort of bi-modal capability. If someone is trying to interact with it, it should stop what it is doing and interact with those people, taking their pictures where possible. If no one is trying to interact with the robot, it should blend into the background and continue to take candid shots. This version of the robot is only capable of blending in. So, the robot will ignore people who want to interact with it or who specifically look to have their picture taken. People will be more likely to interact with the robot on some level if they know what it is up to. What’s SERVO 07.2008
13
GEERHEAD
Here, Nik Melchior (left), a fifth year B.S./M.S. student in computer science and engineering, helps create the programming framework that allows others to command Lewis. Shannon Lieberg (center) of the Engineering class of ‘04, works Lewis’ controls with Assistant Professor Bill Smart.
robot was programmed to take frequent pictures of human faces even when it may not have had the opportunity to focus in for a good picture. To better interact with subjects, the robot should have the ability to communicate which mode or “state” it is in to the subjects. So, if the robot is available to interact, it can communicate that, and so on.
Full frontal view of Lewis.
Photographic subjects expected the robot to respond when waved at, like a human being would. However, the robot didn’t have this capacity either. When the robot did seem to react — because it turned toward someone by sheer coincidence when someone had waved at it, for example — people thought this meant it was more intelligent than it actually was.
In particular, when the camera pointed in their direction coincidentally in response to trying to hail the robot, this was mistaken for eye contact. Lewis seemed intelligent to people when he did what appeared to be a double take. Because the robot face detection code was not optimized, the camera panned past the faces and beyond by the time the software determined it had detected a face. The camera then returned to focus on the face for the picture. This apparent “double take” humanized the robot in the eyes of on-lookers, attracting people to interact with the robot. Likewise, other robot behaviors made the robot appear not so smart, even though these behaviors were quite intelligent for a robot in what they accomplished. One such behavior was looking at the wall (pointing its camera toward the wall) or moving along a wall in order to aid in its navigation. While the robot was trying to get its bearings, it appeared not to “see” anyone around it, and so looked dumb.
Conclusion Continued research based on Lewis should address whether Lewis truly functions in two separate modes, whether the level of sophistication of the people interacting with Lewis has an impact, and whether the robot or the people around it should drive its interaction. SV RESOURCES Lewis, the Robot Photographer www.cs.wustl.edu/MediaAnd Machines/Lewis The Media and Machines Lab http://mm.cse.wustl.edu/about/ index.html Washington University in St. Louis www.engineering.wustl.edu
14
SERVO 07.2008
New breed of robots could soon wander Antarctica By GREG BLUESTEIN, Associated Press Writer obotic rovers have patrolled deep space and the deepest seas, but scientists are still struggling to create drones that can overcome the multiple challenges of exploring Antarctica. Georgia Tech researchers think the SnoMote — a small robot designed like a snowmobile — will be able to deal with the nasty weather and with slippery terrain that constantly cracks and shifts. They envision dozens of SnoMotes roving Antarctica's vast expanses to add to data already collected by satellites and a handful of weather stations and sensors. Ayanna Howard, an associate professor at Georgia Tech in Atlanta, has worked for two years under a NASA grant to perfect the two-foot-long robots. Her initial designs with spider-like legs proved too cumbersome to navigate snowbanks. So, she and her colleagues leaned on others' designs, outfitting a snowmobile designed for kids with sensors, gauges, and cameras, and then programming it.
R
Spend a summer day exploring the mechanical marvels along San Francisco's North Shore! See giant running steam engines, turn of the century automata, mechanical computers, an eight foot high mechanical planetarium, and more. You'll be able to map your own route for the event and spend as much time at each location as you'd like. You can walk, bicycle, or use public transport for Mechanicrawl; maps, routes, and additional info are listed under Map Your Crawl on the website. For all the details, go to
She developed a program that lets the SnoMotes negotiate with each other and “bid” on which site to investigate, allowing them to decide for themselves how to dole out their assignments. The next challenge, though, was to come up with navigation for the rovers. Other probes tend to use distinguishing characteristics like rocks to chart their paths. But such features can be hard to come by in vast icy expanses. On a field trip to a Colorado glacier, Howard's team discovered they could use microscopic fissures in the ice and snowbanks to guide their way. “If you can come up with a way to classify these uniquely, you can come up with a way to navigate,” she said. Simulations so far have proved her team's formula effective, but plenty of challenges await when the robot is put to the test on the glaciers of Alaska. With Penn State University researcher Derrick Lampkin, Howard has designed a shell that weighs 60 to 70 pounds, can withstand harsh winters, and eventually could include heaters to keep computers and wiring running in the cold. Lampkin said his goal is to develop a "scale-adaptable, autonomous, mobile climate-monitoring network." The researchers hope the robots will ultimately cost around $10,000, relatively cheap for governments, researchers, and others seeking to document changing conditions in the world's most remote places. The more the better: Howard said in order for scientists to say with certainty how climate change is affecting the ice, they need plenty of accurate data points to create climate models. She envisions a field of 40 to 50 of the SnoMotes wandering icy plains, a small army gathering data to shed light on global warming and other quandaries without breaking the bank. “The whole concept is: How do you do this in the most affordable way?” she said.
HE8EJIFH;<;H>?J;9)0' .EW2OBOT3ERVOS
>_j[Y Ej^[h8hWdZ
+656*
+656*
+657*
6SHHGVHF 7RUTXHR]LQ
6SHHGVHF 7RUTXHR]LQ
6SHHGVHF 7RUTXHR]LQ
6WHHO*HDUV
6WHHO*HDUV
7LWDQLXP
$//63(&,),&$7,216$792/76
7KHUHVXOWVRIDQLQIRUPDOSROOWDNHQUHFHQWO\DWWKH)LUVW $QQXDO:RUOG'RPLQDWLRQ6\PSRVLXPDUHQRZLQ5RERWV SUHIHU+LWHFVHUYRVRYHURWKHUVHUYREUDQGV7KH\NQRZWKHZLGH VHOHFWLRQRI+LWHFDQDORJDQGGLJLWDOVHUYRVSURYLGHWKHPZLWKWKHSRZHUDQGGHSHQG DELOLW\QHHGHGWRHYHQWXDOO\WDNHRYHUWKH:RUOG0DNH\RXUURERWKDSS\XVH+LWHFVHUYRV 3DLQH6WUHHW_3RZD\_&DOLIRUQLD___ZZZKLWHFUFGFRP SERVO 07.2008
15
N E W Our resident expert on all things robotic is merely an email away.
[email protected]
Tap into the sum of all human knowledge and get your questions answered here! From software algorithms to material selection, Mr. Roboto strives to meet you where you are — and what more would you expect from a complex service droid?
by
Dennis Clark . Every once in a while there is a question floated
Q
around in my local robotics group that (I think) is such an epiphany (read: slap forehead) that I think it deserves a wider audience. This first question is one of this nature: Does anyone have any recommendations for an inexpensive DC-DC converter that has 11-14 VDC in, 5 VDC out (up to 3-5 amps)? I need a heftier supply for the lowlevel control system on my robot. Currently, I’ve got a 12V, 12 Ah lead-acid battery with a 5V-1A converter, and I’m reaching the limit of the converter when I add my sonars and IRs ... later, I would prefer an off-the-shelf solution. — Daniel Herrington . My first thought was the TI PT78ST105, which is a
A
1.5 amp 5V switching regulator that works with up to 38V. This nifty part has the same pin-out as the venerable 7805 regulator and is way more efficient. Another suggestion was the TI PTN78020 which has similar input voltage maximums and a 6 amp output with high efficiency since it too is a switching DC/DC converter. However, this part has lots more pins; it still needs no external components. These parts are easily found at places like Mouser, pricing depends upon various options. As good though, as these solutions are, they are not “off-the-shelf”
Figure 1. CC BEC.
16
SERVO 07.2008
and would need a circuit board to use. Don Clay put forward the solution of using a BEC that the R/C airplane hobby crowd commonly uses on electric aircraft that use large battery voltages. This is a very cool idea because it can be connected to the robot’s main battery and will efficiently give the needed 5V in a small, self-contained unit, and it already has easily usable cabling. The one that Daniel selected was the Castle Creations CC BEC which sells for about $22 at good ol’ HobbyTown USA ( www.hobby town.com); see Figure 1. This device is very useful because it can be set to output voltages from 4.8V to 9V by using the Castle USB link adapter (not included). In case you were wondering, BEC stands for Battery Eliminator Circuit. In the “old days,” electric R/C cars had a battery for the motor and another for the R/C electronics. The BEC “eliminated” one of those batteries. . I want to send commands to my robot using an
Q
IR remote. I don’t want to build another IR remote; I want to use one of the bazillions that I have lying around the house. How do I use these? How can I decode their output? — George S. . Oh boy, I feel a marathon answer
A
coming up! I’m not going to go into huge detail about every kind of IR remote out there — there are a ton of web pages that you can Google and find those kinds of details. I’ll provide a selection of them at the end of this answer for those curious though. I did not find a lot of pages that connected the dots between the various formats and how to write a program to read them, either. So, in this answer I’ll provide the nitty gritty details of how the most popular IR codes are created and provide some PIC code that allows you to decode them. First, the ugly details ...there are many, MANY different
IR encoding schemes out there. Wikipedia tells us that there are literally hundreds of IR protocols! Fortunately for us, there are three that are by far the most common: SONY SIRC, NEC, and Phillips RC-5. If you pick up any odd remote at your house, it will most likely be using the SONY or NEC formats. Let’s discuss each of the “big three.”
SONY SIRC Format First off, here are a couple of links that discuss this format. There is a lot of useful information in these; I disagree with a few things that they say (more on that later), but since some of the data that I used to write my code came from these links, most of what they say is accurate: www.hifi-remote.com/infrared/IR-PWM.shtml This site gives a lot of information on how to read the universal IR remote entries that you use to program your universal remotes. The author calls this “PWM,” or pulse width modulation. It is more accurately called “PPM,” or pulse position modulation, rather like R/C radio communications and what we deal with when controlling hobby servos. www.edcheung.com/automa/sircs.htm This site gives some hints on how to write code to send IR signals. Not what I was looking for, but you might be interested in this if you wanted to have a robot wander into your TV room and take over control of the TV set!
Description
ON Time
OFF Time
Lead In
2.4 ms
0.6 ms
Logic 1
1.2 ms
0.6 ms
Logic 0
0.6 ms
0.6 ms
Table 1.
SONY timing values.
Significant Bit is first and the Most Significant Bit (MSB) is last. The packet format includes some kind of a Lead Out as well, but it is really just a guarantee of some time spacing before the next packet is sent. Don’t bother to look for it since its length depends upon the data just sent; it doesn’t seem to be consistent (see Packet 1). When you code for this protocol, you need to remember to assemble the bytes by putting the bits in reverse order! Remember, they are LSB first. When you press a button on a SONY remote, it will simply repeat the command packet every 45 ms for as long as you hold the button. Some buttons on my remotes would only send a command once when you let up off of the button, but the rest just kept repeating endlessly.
NEC Format I found useful information on the NEC format here: www.hifi-remote.com/infrared/IR-PWM.shtml and here: www.mcselec.com/index.php?option=com_content& task=view&id=223&Itemid=57
The SONY format has three timing values that we are interested in, shown in Table 1. The Lead In is the header before the data that tells us that the code is coming. Everyone says this is to set up the AGC (automatic gain The NEC format is a bit different. It includes some error control) in the receiver, but quite frankly, if it didn’t look checking and has a different way of dealing with repeating different from the rest of the transmission how could we packets. The NEC protocol sends a Lead In, 32 bits of data, tell that a new command was coming? The rest of the data and a Lead Out. Since we can count on the Lead In and 32 is an asynchronous data stream of 1s and 0s like the serial bits of data, don’t bother to look for the Lead Out here data in RS-232, but coming in over modulated IR radiation either. The NEC format sends its data LSB first like SONY, instead of a pair of wires. When I say “On,” I mean that the IR carrier is detected. An “Off” means that there is no IR ON Time OFF Time Description detected by the sensor. Lead In 9 ms 4.5 ms The actual SONY IR command can come in three Logic 1 0.56 ms 1.68 ms variations: 12 bits, 15 bits, and 20 bits. In every variation, we first have the Lead In header, then we have a seven-bit Logic 0 0.56 ms 0.56 ms command. Next, in the 12-bit protocol we have a five-bit Repeat 9 ms 2.25 ms Device ID. The Device ID tells us what is being controlled, for instance, a TV or a DVD. In the 15-bit format, the Table 2. NEC timing values. Device Code is eight bits; in the 20-bit code, we have a five-bit 12 Bit Code PACKET 1 [Lead In] [0 | 1 | 2 | 3 | 4 | 5 | 6] [0 | 1 | 2 | 3 | 4] Device ID and then an eight-bit Command Device ID Extended Command byte. All 15 Bit Code [Lead In] [ 0 | 1 | 2 | 3 | 4 | 5 | 6] [0 | 1 | 2 | 3 | 4 | 5 | 6 | 7] of my remotes were either Command Device ID 12-bit or 15-bit. All of the 20 Bit Code [Lead In] [0 | 1 | 2 | 3 | 4 | 5 | 6] [0 | 1 | 2 | 3 | 4] [0 | 1 | 2 | 3 | 4 | 5 | 6 | 7] codes come in LSB first. This Command Device ID Extended Command means that the Least [Lead In] [0 | 1 | 2 | 3 | 4 | 5 | 6| 7] [0 | 1 | 2 | 3 | 4 | 5 | 6| 7] [0 | 1 | 2 | 3 | 4 | 5 | 6| 7] [0 | 1 | 2 | 3 | 4 | 5 | 6| 7] [Lead Out] Device ID Command PACKET 2 ~Device ID ~Command SERVO 07.2008
17
can be found here: www.hifi-remote.com/infrared/IR-bi-phase.shtml and here: http://home1.stofanet.dk/hvaba/fprc5rx/index.html
Figure 2. Bi-Phase encoding. but there the similarity ends. The packet format looks like that in Packet 2. By ~Device ID and ~Command, I mean that it is inverted, or 1’s complement of its respective Device ID and Command. To check for a proper reception, all you need to do is AND the byte with its respective complement; if it comes up all zeros, then you have a good reception. When you hold down a button on the NEC remote, it does not send out the same command over and over; it sends out a special signal called the Repeat Code. The NEC protocol has four timing values that we care about, and one we don’t (the Lead Out). Table 2 shows the ones that we pay attention to.
Phillips RC-5 Format Some useful information on the Phillips RC-5 format
Figure 3. RC-5 packet.
The last of the big three formats that I’m going to talk about is the Phillips RC-5 protocol. Rather than using PPM encoding like SONY and NEC, the RC-5 format uses Bi-Phase encoding. This means that the transition from a logic ‘1’ to a logic ‘0’ and vice-versa is shown by a change in the bit phase. If you are like most of us, your eyes just glazed over at that description. This is one time that a picture is pretty much needed to explain what I mean (see Figure 2). Note that it isn’t the timing that shows what the bit is, but rather the phase of the timing. But how — you ask — do you know what a ‘1’ is and what a ‘0’ is? You know because the bit stream of RC-5 starts out with two 1 bits and then a toggle bit, which on the first press of the button is a 0. Figure 3 shows how a transmission is formatted. An RC-5 packet consists of the preamble of 1 1 0, then a five-bit address and then a six-bit control. RC-5 packets are encoded with the MSB (Most Significant Bit) first. Because you know that the first bit is a 1, then any bit transition from that point onward you can track to know what the current bit is — a 1 or a 0. Figure 3 may look a little odd because I put both same and switch phases in every bit cell except for the start bits. Just to make it more confusing though, I’ve read that the start bits can be either 1 1 or 1 0. I hope not; it’d make it hard to figure out the 1 startup. The RC-5 protocol will repeat the button press every 113.8 ms, but every packet after the first one will have the Toggle bit toggled differently than the last start bit.
How to Decode IR Transmissions Okay, now that the explanations are over with, how Part C1
Figure 4. IR detector schematic.
C2-C4
Description 110 μF 25V capacitor .1 μF 25V capacitor
R1
10K 1/4W 5%
R2
2.2K 1/4W 5%
R3
1K 1/4W 5%
D1
Green LED
S1
N.O. button
U1
PIC16F688 DIP
U2
7805 regulator
U3
PNA4602 IR demodulator
J1
Power connector
J2
Four-pin male .1” connector
J3
RJ-11 six-pin connector
Table 3. IR detector parts list. 18
SERVO 07.2008
can we use the IR transmissions from our remotes in our robots? To see what is going on, I built a special IR decoder board that has a Panasonic PNA4602 (38 kHz) IR demodulator, a PIC16F688, a power plug, regulator, programming header (Microchip ICD2 six-pin type) and a plug for the Acroname RS-232 converter board. Figure 4 shows the schematic and Figure 5 is a photo of the finished board with everything plugged in. This board was wired together with a bunch of wire that I had lying around, so it isn’t very sensitive to how you put it together. I just wanted an experimenter board that would show me the IR codes and allow me to experiment with decoding the IR transmissions. Different remotes use different modulation frequencies, but the Sharp PNA4602 will work with frequencies between 36 kHz and 40 kHz just fine. I chose the PIC16F688 because it had an interrupt line, a hardware USART, two timers, and an internal RC oscillator that runs at 8 MHz, all in a 14-pin package. These were all of the hardware interfaces that I needed. Unfortunately, for some reason Microchip requires some kind of dongle to debug this chip which I didn’t have, so I debugged using “printf” statements in the code. The board isn’t particularly sensitive to the components that you can use. My previous list just came from my parts bins. The power connector was a barrel socket that fit the various wall warts that I had lying around. I chose the pin out of the RS-232 connector to match the Acroname Serial Interface Connector that you can get from www. junun.org/MarkIII for about $10. Finally, the programming connector is chosen to fit the cable on my Microchip ICD2 so that I can just plug in and program the board without constantly taking the part out of a programmer board and plugging it back into my test board. If your programmer allows In Circuit Serial Programming (ICSP), then get a connector that matches its cable. Figure 5 shows what my board looks like. I put little rubber feet on the bottom to make it extra spiffy looking. I put a small three-pin socket on my board so that I could swap around IR demodulators that have the same pin-out as the Panasonic units, should I so desire. Now that we understand the formats and we have a board to look at the signals, how can we decode them? The answer is software, of course. I like to use C as my programming language, but the logic that I use here can be ported to any compiler language that you feel comfortable with. I should qualify that statement — any compiler that allows interrupts to be used is required. In this case, my compiler of choice is the CCS C compiler for the Microchip 14-bit cores (the PIC16Fnnn series.) I am not going to go into the gory details about how to program a PIC; whole books have been written on that subject and that isn’t my intent with this column. However, you can benefit from my line of reasoning for doing things how I did them and move these procedures to your compiler or even your other microcontroller if you wish. I’m only going to show SONY and NEC decoding in my code. This is because I don’t have any RC-5 remotes; all of mine were SONY and NEC formats. My test code has two sections in it. The first is the
set-up of the interrupt routine that will capture the times between pulses by measuring between falling edges on the INT line. When the IR transmitter is On, this will be detected by the PNA4602 and it will drop its output low. This is why I chose falling edges; the output of the device is normally high, or Off. Before I go into my logic for detecting pulses and parsing them out, let’s get an idea of how I set the PIC up to look for these transmissions. To do that, let’s look at how to initialize this PIC. The code snippet below shows how I set up the timers: //Turn off comparator setup_comparator(NC_NC_NC_NC); //We will be doing interrupts setup_timer_0(RTCC_INTERNAL | RTCC_DIV_128); //16ms timer setup_timer_1(T1_INTERNAL | T1_DIV_BY_4); //Gives 131ms max timeout ext_int_edge(H_TO_L); //IR IRQ on falling edge
CCS does a good job of hiding the ugly details of the hardware from you, but you still need to read your data sheets to understand what they are hiding! Here we turn off the comparators because these pesky things default to on in the PIC and will get in the way of those I/O lines. We’re going to use TMR0 to time our pulses because it is an eight-bit timer and we don’t want all that much resolution in our times. This “slop” allows us to quickly check a bit time and save it away; the coarseness of the measurement allows us to read remotes that are close, but not perfect to the specified times. We know that the pulses in SONY and NEC are between 1.2 ms and 13.5 ms (see Tables 1 and 2 again) so we want this timer to have a maximum time before it rolls over that is near that maximum time. Since our PIC is running on its internal 8 MHz clock (which is divided by four internally), we know that if we use the prescaler on TMR0 at divide by 128, we will have a maximum time of: (1/(2MHz/128))*256 = 16.384 ms
Figure 5. IR detector board and Acroname serial connector.
SERVO 07.2008
19
That is pretty close to 13.5 ms. Why are we using TMR1? When we start saving times to measure for our data bits, we need some way to stop looking if the signal is interrupted, otherwise we’ll just appear to “hang” and do nothing. TMR1 will be set to values that are just a little larger than the inter-packet repeat rate. For NEC, this is 108 ms; for SONY, it is 45 ms. TMR1 is a 16-bit timer and it only has four prescales to choose from, so I took the one that got me close to 108 ms. Finally, I set the INT interrupt to trigger on a high-to-low transition for my measurements. Here is the code for the actual interrupt service routine:
I can hear the groaning now! I’ve used PIC assembly language! In CCS C, the compiler flag “#int_global” means that CCS will not handle the saving of registers that need to be saved during an ISR call. This means that we need to do it. Really, the only reasonable way to do this is with some simple assembly code. This function needs to be FAST and we do that by keeping it lean. I combine this lean ISR with the definitions at the top of the program that looks like this:
#int_global void isr(void) /* * Lets handle all ISR save/recovery functions, the default isn’t lean enough for * an ISR that is highly time critical. */ { #asm //store current state of processor MOVWF save_w SWAPF status,W MOVWF save_status SWAPF FSR,W MOVWF save_FSR BCF status,5 //Set to page 0 for SFR’s BCF status,6 #endasm
#locate save_w=0x7f unsigned char save_status; #locate save_status=0x7e unsigned char save_FSR; #locate save_FSR=0x7d unsigned char wBits=0;
//We only have two interrupts, so if it isn’t this one, it’s the other. if (bit_test(PIR1,0)) //Timer1 overflow IRQ { bits[wBits++] = 255; //timed out bit_clear(PIR1,0); //Clear TMR1 int flag bit_clear(T1CON,0); //Turn TMR1 off until... } if (bit_test(INTCON,1)) //CCP1 capture IRQ { bits[wBits++] = TMR0; //save the pulse time bit_clear(INTCON,1); //clear external //interrupt flag TMR1H = t1h; //reset the timeout TMR1L = t1l; bit_set(T1CON,0); //turn TMR1 back on so //we can time out TMR0 = 0; //clear out the timer } if (wBits == MAXBIT)
//rollover the bit //buffer
wBits=0; #asm // restore processor and return from interrupt SWAPF save_FSR,W MOVWF FSR SWAPF save_status,W MOVWF status SWAPF save_w,F SWAPF save_w,W #endasm }
20
SERVO 07.2008
unsigned char save_w;
#locate wBits = 0x7c
//These next 3 bytes //are saved on interrupt
//To make access to //these variables fast //Keep them in common //memory for ISR use
unsigned char t1h; #locate t1h = 0x7b unsigned char t1l; #locate t1l = 0x7a /* * Give me direct access to several SFR’s that CCS doesn’t handle the way I want. */ #byte TXREG = 0x15 #byte T1CON = 0x10 #byte INTCON = 0x0B #byte FSR = 0x04 #byte status = 0x0 #byte TMR1L = 0x0E #byte TMR1H = 0x0F #byte PIR1 = 0x0C #byte TMR0 = 0x01
Those confusing compiler directives tell the compiler to put certain variables into “access RAM” that is available in all data banks. This means that I don’t have to waste time switching banks to save our timing measurements or our saved registers. Make sure you look this up in the CCS manual. You don’t have to do this in other micros that don’t use banked data memory. Now look at the ISR from above. When we get an interrupt from INT, we record the value in the TMR0 register in the next available data slot in our ring buffer (called ring because it rolls over to 0 when it reaches the end of the “ring”). If we time out on TMR1, then we stuff a 255 into the buffer telling the decoding routine that we timed out and we should ditch the entire set of numbers and wait for the next start to be detected. The second part of the program will decode the times saved in the buffer and turn them into 1s and 0s. It uses its own pointer into the ring buffer and knows when to look for a value when the read pointer is different from the write pointer. I’ve put lots of comments into this code, so I’m not going to go over it line-by-line. Here is what the bit decoding routine looks like:
unsigned char DecodeBit(unsigned char time) /* * This will determine if the bit is a 0 or a 1, * by whichever standard is in being used. * Returns a 1 if a logic 1 bit, 0 otherwise. */ { unsigned char ret = 0; unsigned char val = 0; val = time;
//Can be used to “fuzzy” //the time for rounding
if (whichOne == NEC) { if ((val <= NEC_ONE+FUZZY) && (val >= NEC_ONE-FUZZY)) ret = 1; else if ((val <= NEC_ZERO+FUZZY) && (val >= NEC_ZERO-FUZZY)) ret = 0; } else if (whichOne == SONY) { if ((val <= SONY_ONE+FUZZY) && (val >= SONY_ONE-FUZZY)) ret = 1; else if ((val <= SONY_ZERO+FUZZY) && (val >= SONY_ZERO-FUZZY)) ret = 0; } return ret; }
There is more magic in DecodeCode() that shows how to recognize the start of a transmission and how to end one. This little routine above simply shows the decoding of a single data bit. Notice the + and – FUZZY settings. IR specs allow for about a 10% slop in the standard times. This FUZZY setting gives us that. You can experiment with how large you want that FUZZY to be since it is a #define at the top of the program. I’ve found that a setting of 2 works well. My code will “auto” detect NEC code if you hold the button down. This is because NEC uses the repeat code frame that is distinct from any other transmission. You don’t have to do that if you don’t want to, and you’ll need to reset the PIC to get it to pay attention to SONY codes again regardless. I have two modes of operation that can be selected by the setting of the TEST define. If this is set to 1, then the program will only print out the times. This is useful for when you are trying to understand a new format. If TEST is set to anything else, then the program will decode either SONY or NEC, and print out the device and control codes when they are received. The entire program source can be found on the SERVO website www.servomagazine.com). It is called IRdecoder.c.
Figure 6. A selection of IR remotes.
Conclusion Figure 6 shows my collection of IR remotes that I used to test my program. I found interesting departures from the established standards in some of them; no doubt you will, too. I’ve given you a powerful tool that you can use to discover IR codes and a basic template that you can use to embed the ability to control your robot using a common household device: the IR remote. Have fun and be creative. If you have any questions about this program or how I “figured it all out,” send your questions to roboto@servo magazine.com — I’m happy to answer! SV NEWS FLASH! At the last possible moment I discovered this site. It is an excellent compendium of various IR remote formats: www.rhoads.nu/bjorn/hp48/remote.
SERVO 07.2008
21
Send updates, new listings, corrections, complaints, and suggestions to:
[email protected] or FAX 972-404-0269
Know of any robot competitions I’ve missed? Is your local school or robot group planning a contest? Send an email to
[email protected] and tell me about it. Be sure to include the date and location of your contest. If you have a website with contest info, send along the URL as well, so we can tell everyone else about it. For last-minute updates and changes, you can always find the most recent version of the Robot Competition FAQ at Robots.net: http://robots.net/rcfaq.html
14-18 K’NEX K*bot World Championships Las Vegas, NV This competition includes events for two-wheel drive autonomous K*bots, four-wheel drive autonomous K*bots, and the remote control Cyber K*bot Division. www.livingjungle.com
22-25 FIRA Robot World Cup Shinan Software Park, Qingdao, China This competition has events for every kind of robot soccer imaginable, ranging from the humanoid robot league down to the tiny Khepera robot league. www.fira.net
— R. Steven Rainwater
7-11
Africa Championship Robotics Competition Pretoria, South Africa Students from various countries and continents will compete in several robot challenge events. www.nydt.org/home.asp?pid=963
8-10
European Micro Air Vehicle Competition Research Airport, Braunschweig, Germany Tiny, autonomous flying robots compete for prizes. Every year, these things get smaller and smaller. www.mav08.org
8-11
Botball National Tournament Norman, OK Educational robot contest for middle and high school students designed to use science, technology, engineering, and math to solve real world problems. www.botball.org
26
RoboBombeiro Polytechnic Institute of Guarda, Guarda, Portugal Autonomous fire-fighting robot contest. http://robobombeiro.ipg.pt
28
AUVS International Aerial Robotics Competition Fort Benning, GA Autonomous flying robots complete missions that include dropping sub-vehicles and gathering information. This event runs through August 1st. http://avdil.gtri.gatech.edu/AUVS/IARC LaunchPoint.html
29
AUVS International Underwater Robotics Competition Space and Naval Warfare System Center, San Diego, CA In this competition, autonomous underwater robots built by university students must complete an underwater course. This event runs through August 3rd. www.auvsi.org/competitions/water.cfm
TBA
RoboCup Robot Soccer World Cup Suzhou, China Soccer Simulation — teams demo and test their robots; Small-size Robot Soccer — F180 robots play soccer; Mid-size Robot Soccer — larger robots play soccer; Sony Legged Robot Soccer — legged
13-17 AAAI Mobile Robot Competition Chicago, IL This year’s competition will take the form of exhibits that demonstrate either robot creativity or mobility and manipulation. Expect to see robots that dance, paint, play musical instruments, and much more. www.aaai.org/Conferences/conferences. php
22 SERVO 07.2008
robots play soccer; RoboCup Junior — small robots play soccer; Humanoid Soccer — humanoid robots play soccer; Rescue Robots — NIST Standard Rescue Robot Test Field; RoboCup@Home — real world robot event. http://www.robocup.org
TBA
War-Bots Xtreme Saskatoon Saskatchewan, Canada “Robots” (RC vehicles) attempt to destroy each other. http://www.warbotsxtreme.com
23-24 Motodrone AFO Competition Finowfurt, German Autonomous Flying Objects (AFOs) compete in several areas including the ability to hover in changing wind conditions, stable flight between points, capturing photos of targets, recovering from free fall, and automated take off and landing. www.motodrone.de
29
DragonCon Robot Battles Atlanta, GA Remote-controlled and autonomous robots fight it out at the DragonCon science fic tion convention. www.dragoncon.org
Extreme Robot Speed Control! 14V - 50V - Dual 80A H-bridges - 150 A+ Peak! n d er i Adjustable current limiting w e Temperature limiting S i d 6 6 6 6 6 6
$399
DPRG Robot Talent Show The Science Place, Dallas, TX Autonomous robots demonstrate their talents. www.dprg.org/competitions
$29.99 Scorpion Mini 6 6
6 6 6
6
Robot Fighting League National Minneapolis, MN “Robots” (RC vehicles) attempt to destroy each other. www.botleague.com
6 6 6
6 6 6
Dual 13A H-bridge 45APeak! 5V - 24V 2.7“ x 1.6” x 0.5”
6
Closed-loop control of two motors Full PID position/velocity loop Trapezoidal path generator Windows GUI for all features 5 0 Giant Servo Mode! 2 $ C source for routines provided PIC18F6722 CPU See www.embeddedelectronics.net
H-bridges: Use with Dalf or with your Micro/Stamp 9 1 2 $
Simple-H
OSMC 6 6
6
Robots at Play City Square, Odense, Denmark Robots compete to demonstrate playfulness and interactivity.
6
2.5A (6A pk) H-bridge 5V - 18V 1.25“ x 0.5” x 0.25”
6
TBA
Scorpion XL
Scorpion HX Dual 2.5A (6A pk) H-bridges Plus 12A fwd-only channel 5V - 18V 1.6“ x 1.6” x 0.5”
Introducing Dalf 6
6
TBA
$119.99
$79.99
6
TBA
6
Three R/C inputs - serial option Many mixing options - Flipped Bot Input Rugged extruded Aluminum case 4.25" x 3.23" x 1.1”
6
Monster power! 14-50V 160A! 3.15”x4.5”x1.5” 3 wire interface
6 6 6
$79 M AD E
www.robotpower.com
THE
6-28V 25 A! 2.25”x2.5”x0.5” 3 wire interface current & temp protection
IN
USA
Phone: 253-843-2504 s
[email protected] SERVO 07.2008
23
DEVELOPERS IN ROBOTICS TECHNOLOGY FOR USE IN SPACE EXPLORATION RECEIVE 2008 IEEE ROBOTICS AND AUTOMATION AWARD Contributions to Autonomous Robotic Operations Result in Significant Data Collection from Mars EEE (Institute of Electrical and Electronics Engineers) has named Paul Backes, Eric T. Baumgartner, and Larry Matthies recipients of its 2008 Robotics and Automation Award. The three are being recognized for their contributions to different robotics technologies used in space flight systems including the successful Mars Exploration Rover (MER) mission rovers Spirit and Opportunity, which to this day are still functioning on the surface of Mars. The IEEE is the world’s leading professional association for the advancement of technology. The award, sponsored by the IEEE Robotics and Automation Society, recognizes Backes, Baumgartner, and Matthies for contributions to robotics enabling effective autonomous operations of science investigations under extreme conditions on the planet Mars. The award was presented to the three on May 23, 2008 at the IEEE International Conference on Robotics and Automation (ICRA) in Pasadena, CA. The works of Backes (distributed and remote operations), Baumgartner (manipulator control), and Matthies (navigation systems) have advanced robotic technology, particularly rover operations, and made possible the scientific exploration of Mars. MER is the first long-term mobile autonomous robotic exploration in an unknown space environment. An IEEE member, Backes is the technical group supervisor of the Mobility and Manipulation group in the Mobility and Robotic Systems section at the Jet Propulsion Laboratory of the California Institute
I
24
SERVO 07.2008
of Technology in Pasadena. He conceived and led the development of an interface system to allow scientists and engineers to collaborate in generating activity sequences, which was used as the primary science planning tool in the 2003 MER mission. The interface also enables the public to view mission data and simulate their own activity sequences. Backes holds seven patents, has won several awards, and has published numerous book chapters, articles, and papers. He was associate editor of the IEEE Robotics and Automation Society Magazine from 1993 to 1998. Baumgartner contributed to the MER project as the lead systems, test, and operations engineer for the MER Instrument Positioning System. This system was responsible for the robotic deployment and placement of four in-situ — meaning “in place” — instruments onto the Martian surface through the use of a five degree-of-freedom robotic arm. Presently, Baumgartner is the dean of the T. J. Smull College of Engineering at Ohio Northern University in Ada. He has published numerous papers in the area of mobile robotics and vision-guided manipulation and has received several awards for his efforts on the MER project. Matthies’ work on autonomous navigation of robotic ground and air vehicles led to the development of algorithms for descent motion estimation, visual odometry, and real-time 3D perception with stereo vision. These capabilities were incorporated into the MER mission, providing landers with the ability to estimate horizontal velocity and rovers with the ability to detect obstacles and measure slip. His work can be found in terrestrial applications including off-road autonomous navigation and robotic vision systems. An associate member of the IEEE, Matthies is an adjunct professor at the University of Southern California and a member of the editorial boards of the Autonomous Robots Journal and the Journal of Field Robotics. He has received several awards, holds two patents, and is widely published.
u t B l o w O l S p e c i a $9. 95! WWW.SERVOMAGAZINE.COM
7KH(VFDSH 5RERW¶VEXLOWLQ PLFURSURFHVVRU HQDEOHVLWWR ³WKLQN´RQLWVRZQ J .65 H U L Q G
O G L U H X 6 R T U H 7KHURERWIURJPRYHVIRUZDUG
ZKHQLWGHWHFWVVRXQGDQG UHSHDWVVWDUWPRYHIRUZDUG! VWRS!OHIWWXUQ!VWRS!ULJKW WXUQ!VWRS.65
PP:KLWH ZDWHUFOHDU /('9 PFG $% VHFRQGYRLFHUHFRUGHUSOD\EDFN PRGXOH7KHHOHFWUHWPLFURSKRQHLVRQWKH ERDUG2QHEXWWRQUHFRUGVWKHRWKHUEXWWRQLV PRPHQWDULO\SUHVVHGWRUHSOD\WKHPHVVDJH SUHDVVHPEOHG$ 7KH9HOOHPDQ3HUVRQDO6FRSH LVQRWDJUDSKLFDOPXOWLPHWHU EXWDFRPSOHWHSRUWDEOH RVFLOORVFRSHDWWKHVL]HDQG FRVWRIDJRRGPXOWLPHWHU +36$146. V D Q G V 7 K R X R Q L W H P V P R U H H W L V H E R X U Z
THOUSANDS OF ELECTRONIC PA R T S A N D S U P P L I E S VISIT OUR ONLINE STORE AT
www.allelectronics.com WALL TRANSFORMERS, ALARMS, FUSES, CABLE TIES, RELAYS, OPTO ELECTRONICS, KNOBS, VIDEO ACCESSORIES, SIRENS, SOLDER ACCESSORIES, MOTORS, DIODES, HEAT SINKS, CAPACITORS, CHOKES, TOOLS, FASTENERS, TERMINAL STRIPS, CRIMP CONNECTORS, L.E.D.S., DISPLAYS, FANS, BREADBOARDS, RESISTORS, SOLAR CELLS, BUZZERS, BATTERIES, MAGNETS, CAMERAS, DC-DC CONVERTERS, HEADPHONES, LAMPS, PANEL METERS, SWITCHES, SPEAKERS, PELTIER DEVICES, and much more....
ORDER TOLL FREE
1-800-826-5432 Ask for our FREE 96 page catalog SERVO 07.2008
25
New Products
CONTROLLERS & PROCESSORS
Baby Orangutan B-168 Robot Controller
P
ololu announces the release of the Baby Orangutan B-168 robot controller, the latest addition to Pololu’s line of Orangutan robot controllers. The compact module has dimensions of 1.2” x 0.7”, and it can be configured to fit in a solderless breadboard or a 24-pin dual in-line package (DIP) socket. For applications with low I/O usage, the Baby Orangutan B-168 board can also be configured with pins on just one side of the module for use as a single in-line package (SIP). The diminutive size of the Baby Orangutan B-168 makes it well suited for primary control of miniature robots or for auxiliary control on larger robots. The Baby Orangutan B-168 is based on an Atmel ATmega168 microcontroller running at 20 MHz with 16 KB of Flash program memory and 1 KB data memory. The use of the ATmega168 microcontroller makes the Baby Orangutan B-168 compatible with the popular Arduino development platform. Free C and C++ development tools and libraries are also available. Integrated motor control sets the Orangutan family of controllers apart from other small microcontroller boards, and the Baby Orangutan B-168 features dual high-performance, MOSFET-based H-bridges to deliver up to 1A per channel over the 5-13.5V operating range. With hardware-based ultrasonic PWM generation, two independent, bidirectional DC motors can be controlled symmetrically and without any processor overhead. The unit price is $29.95. For further information, please contact:
Pololu Corporation
6000 S. Eastern Ave. Suite 12-D Las Vegas, NV 89119 Tel: 877•7•POLOLU or 702•262•6648 Fax: 702•262•6894 Email:
[email protected] Website: www.pololu.com
INTERFACE
PC Windows USB Interface for OWI-535 Robotic Arm he robotic arm interface kit available from Images connects OWI’s 535 Robotic Arm Edge™ to a personal
T 26
SERVO 07.2008
computer (IBM PC or compatible). The interface connects to the PC’s USB port. The software for the interface permits real time control and contains a built-in interactive script writer. A user may write a script that contains up to 99 individual robotic arm functions (including pauses) into a single script file. Script files may be replayed automatically for demonstrating computer controlled automation and animatronics. The Robotic Arm PC Interface creates a fun way of learning and experimenting with computer automation and animatronics. The USB OWI-535 Interface (assembled and tested) costs $99.95; the USB OWI-535 Interface Kit (requires soldering and assembly) is $84.95. The Interface Kit Includes: • Windows 2000/XP/Vista program • Printed circuit board for easy construction • All components
For further information, please contact:
Images Scientific Instruments
Website: www.imagesco.com
MECHANICS
Motor Mount and Wheel Kit
I
t’s time to give your robot the mobility and style it deserves with the new Motor Mount and Wheel Kit with Position Controller from Parallax. Powerful 12 VDC, 150 RPM motors are combined with precision machined 6061 aluminum hardware to provide enough power, strength, and beauty to make other robots jealous.
Conveniently positioned screw holes in the bearing block make mounting this kit a breeze, and the included six inch pneumatic rubber tires perform well on a variety of smooth or rugged terrains. The kit includes two position controllers which use a quadrature encoder system to reliably track the speed and position of each wheel with 36 positions/rotation resolution and report the data on command via a 19.2 kbps serial bus. The position controllers can also be interfaced with HB-25 motor controllers (sold separately) to automatically provide userdefinable smooth speed ramping and accurate position control, which frees up the main processor to handle more important tasks. The entire Motor Mount and Wheel Kit (#27971) is a value at $279.95. For further information, please contact:
Parallax, Inc.
Matrix Multimedia
Website: www.matrixmultimedia.co.uk
TOOLS & TEST EQUIPMENT
Four-Channel Digital Battery Test System
Website: www.parallax.com
SOFTWARE
Flowcode for ARM Microcontrollers atrix has recently launched a new version of their popular graphical programming language for microcontrollers — ‘Flowcode for ARM microcontrollers.’ Now, 32-bit ARM microcontrollers are available for the same price as eight bit micros but offer massive advantages to developers: low power, more I/O lines, several times more ROM and RAM than a typical eight bit micro, full floating point and maths libraries, and a massive increase in processing speed and power. This new version of Flowcode provides engineers and developers access to all of these features of the ARM based on Atmel’s popular range of AT91 microcontrollers. Flowcode for ARM is also backwards compatible with Flowcode for PICmicro® microcontrollers and AVR® microcontrollers which
M
provides an easy migration route to 32 bit power. ARM hardware development tools, based on the Matrix’s E-blocks range, are also available. A fully functional demonstration version is available on the Matrix website. For further information, please contact:
he Cadex C8000 is an advanced battery test system capable of performing complex lifecycle tests. These tests may include discharging a battery with GSM, CDMA, or other pulses of choice. Replicate battery runtime of a power tool, digital camera, or computing device by first capturing the current profile and then applying the load on the test battery for verification. The C8000 can also test the function of a Li-ion charger, verify battery safety circuits, and read SMBus registers. Automated programs assure safe charging and correct discharge terminations; custom programs provide for user-defined settings. Each of four independent channels delivers up to 10A and 36V, with 0.1% FSR. Total power is 400W on charge and 320W on discharge. The Cadex C8000 runs as a stand-alone unit or with PC-BatteryLab™ software. For further information, please contact:
T
Cadex Electronics
Website: www.cadex.com/c8
Show Us What You’ve Got! Is your product innovative, less expensive, more functional, or just plain cool? If you have a new product that you would like us to run in our New Products section, please email a short description (300-500 words) and a photo of your product to:
[email protected] SERVO 07.2008
27
Featured This Month: Features 28 BUILD REPORT: Apollyon
BUILD REP
by Mike Jeffries
Apollyon
30 MANUFACTURING: High-Performance Drill Motor Modification by Bryan Ruddy
32 PARTS IS PARTS: Mag Motor Upgrades and Repairs by Nick Martin
Events 33 Apri/May 2008 Results and Jul/Aug 2008 Upcoming Events
ROBOT PROFILE – Top Ranked Robot This Month: 31 Billy Bob
28
by Kevin Berry
SERVO 07.2008
RT
●
by Mike Jeffries
IHobbyweight, robot with the designed this 12 pound,
purpose of cramming as much power as I could into the smallest FIGURE 1
box possible. It’s low, it’s fast, and it’ll just keep slamming its face into your spinning weapon until something breaks. The horns on top allow it to take its opponents into the wall of the arena while wearing them like a polished metal hat. Apollyon won its debut tournament this past December with a 3-1 record. FIGURE 2
FIGURE 3
FIGURE 5
FIGURE 4
FIGURE 6
Parts List ITEM
QTY
PRICE
• Victor 883 speed controller • GB42 gearbox • Mini-EV motor • 18V 1,650 mAh NiMH battery pack • Spektrum DX6 with BR6000 receiver • 3” Colson wheel with hub ( www.cncbotparts.com) • GWS elevator/aileron mixer • S-BEC Super BEC 5V
2 2 2
$139.99 $85.99 (no longer available) $8.99 $62.50 $199.99 $25.00 (no longer available)
1 2
$14.99 $46.99 (being replaced with receiver battery pack for future events) • MS-05 power switch 1 $48.00 • 45A powerpole connectors $1.39/set • #8 ring terminals $1.99/25 • Deans Wet Noodle Wire — 12 awg $1.25/ft • Raw metal, nuts, and bolts ( www.mcmaster.com and www.onlinemetals.com) • Wood and plumbing pieces for battery mount — local hardware store • Machining ( www.teamwhyachi.com) FIGURE 7
Figure 1 is a CAD model of Apollyon drawn in SolidWorks. Some minor changes were made, but most of the parts are almost identical to the ones in the drawing, for example, the side and internal frame rails, as well as the horns that are used to catch other robots. The horns are steel and the rest of the frame is 6061 aluminum (see Figure 2). The sides of the frame are lined up to show the profile of the chassis, shown in Figure 3. The holes in the top, front, and bottom of the plate are tapped to allow armor to be bolted directly to them. Figure 4 shows the chassis with the baseplate, drive motors, and internal portion of the front armor installed. Figure 5 shows a mostly assembled Apollyon sitting inside the chassis of my 60 lb robot Ruiner. In Figure 6, Apollyon has been painted, the front steel wedge has
NOTE: All items are from www.robotmarketplace.com unless noted otherwise.
been mounted, and the robot is almost ready for competition. Take a look at Figure 7. You’ll see an internal shot of Apollyon the night before the “Wreck the Halls” event in Greensboro, NC. This shows the layout of the electrical components and the battery mount. The piece of PVC pipe in the back left of the robot serves as a power distribution block and battery mount. Figure 8 shows Apollyon at Wreck the Halls being prepared for the first match of the competition. Apollyon won the 12 lb class with a 3-1 record (see Figure 9). The damage was all cosmetic and easily repaired. The shaft collar on the visible axel was torn off in combat. A new front wedge is being designed to reduce impacts on the chassis. SV
FIGURE 8
FIGURE 9
SERVO 07.2008
29
MANUFACTURING High-Performance Drill Motor Modification ● PHOTO 1. The 36-volt DeWalt DC900KL contains a gearmotor rated for 750 watts of power and is capable of a bone-crushing 200 foot-pounds of stall torque in low gear. On paper, this gearmotor should be capable of moving a 200 pound robot at about five miles per hour in a 4WD configuration.
by Bryan Ruddy
C
ordless drills are among the richest sources of affordable gearmotors for the robotics hobbyist; from inexpensive, low-power imports (such as the drills offered by Harbor Freight) to high-performance, namebrand drills (particularly DeWalt). Unfortunately, drill gearmotors lack convenient mounting features, often have minimal bearings, and generally contain slip clutches, making them unsuitable for use in robotic drive and mobility applications without modifications. While there are commercially-available modification kits for some drill gearmotors, most motors must be modified by the hobbyist. The photos here document my modifications to DeWalt’s newest and most powerful drill motor. SV
PHOTO 4. As shown on the left, the first-stage ring gear (part #628002-00) is free to rotate as part of the clutch mechanism. To lock this gear in place, we can machine it down to a square, as shown on the right. The modified gear presses into the motor mount.
PHOTO 6. The stock gearbox output has an overrunning clutch to prevent back-driving. Since this can cause the output to lock up under some conditions, it must be disabled by removing the five pins and outer ring.
PHOTO 2. The gearbox (part #629059-00) and motor (part #639521-00) are shown without the drill casing. They are mounted to the casing by the small plastic tabs where the motor and gearbox meet. To mount the gearmotor securely to a robot, we will make a metal replacement for the stock plastic gearcase.
PHOTO 3. The original motor mount is shown on the left, with its twist-lock interface to the gearbox. An alternative mount — machined from a block of magnesium — is shown on the right. Long bolts will be used to assemble the motor mount to the new gearcase.
30
SERVO 07.2008
PHOTO 5. The DC900KL uses a three-speed gearbox — for robotics use, the gears must be secured for a single speed. The stock gearcase (top) uses a set of molded-in teeth to keep the ring gears (bottom) from turning when engaged; these have been duplicated in the magnesium gearcase (right).
PHOTO 7. The gearbox output (left) uses a simple double-D shaft geometry, duplicated in the hardened, high-strength shaft on the right. The step in shaft diameter allows the new gearbox to be protected from impacts by a bronze thrust bearing.
PHOTO 8. The completed gearcase, with motor and gearbox parts installed, is shown here. The parts were made on CNC equipment, but could be made manually with slight simplifications. The motor, gearbox, and spare ring gears are available from www.dewaltservicenet. com, at a total cost of $110 per motor-gearbox assembly.
ROBOT PR
FILE
TOP RANKED ROBOT THIS MONTH ●
by Kevin Berry
Billy Bob – Currently Ranked #1
Top Ranked Combat Bots History Score
Ranking
Weight Class
Bot
Win/Loss
Weight Class
Bot
Win/Loss
150 grams
VD
26/7
150 grams
Micro Drive
7/1
1 pound
Dark Pounder
44/5
1 pound
Dark Pounder
23/3
1 kg
Roadbug
27/10
1 kg
Roadbug
11/4
3 pounds
3pd
48/21
3 pounds
Limblifter
12/1
6 pounds
G.I.R.
17/2
6 pounds
G.I.R.
11/2
12 pounds
Solaris
42/12
12 pounds S ur gic al S tr ike
17 /7
15 pounds
Humdinger
26/4
15 pounds
Humdinger
26/4
30 pounds
Totally Offensive
43/13
30 pounds
Billy Bob
12/4
30 (sport)
Bounty Hunter
9/1
30 (sport)
Bounty Hunter
9/1
60 pounds
Wedge of Doom
43/5
60 pounds
Texas Heat
11/4
53/15
120 pounds
Touro
43/12
220 pounds Sewer Snake
3 9/ 15
340 pounds
Ziggy
3/0
390 pounds
MidEvil
3/0
120 pounds Devil's Plunger 220 pounds
Sewer Snake
340 pounds S HO VE LH EAD 390 pounds
MidEvil
28/9
History Score is calculated by perfomance perfomance at all events known to BotRank
Current Ranking is calculated by performance at all known events, using data from the last 18 months
Rankings as of May 10, 2008
illy Bob has competed in House B of NERC 2006, Motorama 2007, RoboGames 2007, Franklin Institute
●
2007, and Motorama 2008. Details are:
●
●
10/0 11/5
Historical Ranking: #9 Weight Class: 30 lb Featherweight Team: Benson Labs Builder: Brian Benson Location: Winchendon, Massachusetts
BotRank Data Total Fights Lifetime History 16 Current Record 16 Events 5
Drive batteries — 21.6 volt A123 battery pack Weapon — Custom S7 tool steel single tooth blade at 8,000 RPM Weapon power — 24 volt NiCd 2,400 mAh battery pack ●
Frame — 2024 milled aluminum frame
Weapon motor — Axi 5330 at 24 volts ●
Drive — Two AstroFlight 940s with Team Whyachi gearboxes ●
Losses 4 4
Radio system — Spectrum DX6
Future plans — Four-wheel drive version ●
Configuration — Vertical Spinner
●
●
Wins 12 12
Design philosophy — Balance the drive, weapon, and armor with smart engineering, and make it cool! ●
Builders bragging opportunity — Billy Bob went undefeated at its first event. SV ●
Weapon ESC — Castle Creations Phoenix HV85 ●
●
Wheels — Two 3.5” Colsons
Configuration — Two wheel drive in the rear ●
●
Drive ESC — Two IFI Victor 883s
● Armor —
Rubber shock mounted steel and a rear titanium wedge, along with various attachments for other types of bots
All fight statistics are courtesy of BotRank (www.botrank.com ) as of May 10, 2008. Event attendance data is courtesy of BotRank and The Builder’s Database (www.buildersdb.com) as of May 10, 2008.
SERVO 07.2008
31
PARTS IS PARTS: Mag Mot r Upgrades and Repairs ●
by Nick Martin
f you rely on the Satcom Mag motor to deliver a deadly blow or a punishing push to your robotic opponent, you will want to follow these simple tips for improved reliability and performance.
I
loose, but losing a brush cap during an event can be a disaster. If your motors get particularly hot, you might need high temperature Kapton tape, however I have never had a problem with the cheap stuff.
Tape the Brush Covers
Replace the Case Screws (beginner)
The quickest tip is to place electrical tape over the four brush covers (see Figure 1). They don’t often come FIGURE 1. Taped brush covers and the timing marks.
The long case screws supplied by Satcom are 10-32 by 3” stainless steel with Phillips drive heads. These are not up to heavy combat duty and should be replaced. I use hex socket cap screws, McMaster-Carr part #91251A360, for this; they can be tightened more than the original screws and the threads are better formed (Figure 2). The heads of these screws are sometimes
too tall for the counterbores in the front of the motor, so start by grinding the heads down by about .016” (0.4 mm). Grinding the heads down also puts a small burr around the 5/32” hex socket, making it a tight fit on your hex driver. Use the driver to wiggle the screw about until it starts to thread into a hole; after the first screw, this becomes very easy. I like to apply a slathering of Loctite 243 to make sure the screws stay put. NOTE: If you have a newer four screw motor, one screw is only 2-3/4” long; you will need to cut one of the replacement screws down to fit.
Replace the Mounting Screws The tiny 8-32 face mounting screws always look inadequate to me; if you are mounting the motor with these screws, I recommend up-sizing them to around 12-24 or M6. Start by removing the front plate of the Mag motor, leaving the armature and case in place.
FIGURE 3. Aligning the mounting holes with a tapered pin. (Insert: Which screw size would YOU trust?)
FIGURE 2. Replacement case screws. (Insert: The replacements have far stronger heads.)
32
SERVO 07.2008
Position the front plate accurately on your drill press using a tapered pin made from the shank of an old drill (see Figure 3). This will keep the new mounting points accurately in position; important if you have a pre-made gearbox to fit. Drill each of the mounting holes out to fit your preferred screw size; 5 mm for M6 and #17 for 12-24 sized screws. Tap the new holes and take extra care to remove all the swarf from the inside of the plate; you don’t want conductive chips falling into the armature! Re-assemble the motor as detailed in previous tips; if
you combine this tip with the stronger case screw tip, you will have one tough motor.
Neutral Timing Mag motors can be timed slightly advanced or retarded, although I find that advanced timing makes hardly any difference so I leave them neutrally timed. If you want to experiment or need to adjust the timing after repairs, here is the quick way to do it. Mark a line along the case so it meets the rear end bell, as shown in Figure 1. With the case screws loosened enough to
just turn the case, rotate the case left until the screws touch a magnet. Mark the position of your line on the rim of the endbell. Now rotate the case left until the screws stop on the opposite magnets. Mark this position on the endbell rim. The marks on the rim represent the extremes of forward and reverse timing; draw a line midway between your two extremes and this is your neutral timing position — too easy! SV
You can contact Nick via his build thread at www.robowars.org/forum/viewtopic.php ?t=74&start=0.
EVENTS Results and Upcoming Events Results Apr 14 – May 12, 2008
Miami Beach, FL. One hundred thirty-five bots were entered.
H
oaming Robots presented Fenton Manor 2008 on May 4th in Stoke On Trent, England.
ORD Spring 2008 was held in Brecksville, OH on April 19th. Twentyfive bots were registered.
R
Upcoming Events for July-August 2008
otunda Rumble was held at the D R Mall Of America in Minneapolis, MN on April 25th. Twenty-seven bots were registered.
S
mackdown in Sactown IV was held on April 27th in Sacramento, CA. Eight bots were registered.
B
otsIQ: The Competition 2008 was held April 30th–May 4th in
T
he North East Robotics Club will present House of Benson – Barnyard Brawl in Winchendon, MA, on July 26th. Thirty-six bots were registered at press time. For more details, go to www.nerc.us.
. W. Robots will present Pennsylvania Bot Blast 2008 in Bloomsburg, PA on July 12th. Seventeen bots were registered at press time. For more details, go to www.dwrobots. com/tournament.html. ar-Bots Xtreme W will present WBX-V “Taking the Fifth” on July 26th in Saskatoon, Saskatchewan, Canada. Nineteen bots were registered at press time. For more details, go to www.war botsxtreme.com.
R
oaming Robots will present Guildford 2008 in Guildford, England on June 15th, and UK Champs 08/RAF Fairford in Gloucestershire, England on July 12th and 13th. For more details, go to www.roamingrobots.co.uk . oboCore will present Winter R Challenge 4th Edition in Amparo, Sao Paulo, Brazil on July 26th–27th.
SV
SERVO 07.2008
33
CES 2008 Robot Roundup by Ted Larson
Photo 1
A
s usual, in the second week of January, over 100,000 technology lovers converged on Las Vegas for the 41st annual Consumer Electronics Show (CES). The show went on from 8 AM to 5 PM for four days, and even then, it was almost impossible to see everything. CES took up 1.8 million square feet of trade show space, spanning all of the major convention centers in Las Vegas. So much walking is involved for the attendees, you can easily blow out your feet unless you are wearing running shoes.
34
SERVO 07.2008
Just about every electronic consumer device is represented at CES ... ... including car audio, home audio, cell phones, DVD players, laptops, digital photo and video recorders, and of course, massive plasma TVs. There was a 150 inch TV at the Panasonic booth that was the talk of the show. Imagine a TV as big as a queen-sized bed hanging on your wall? Seems like one would have to reinforce the wall just to keep it from falling down. Most of the booths that are technology specific are organized into Tech Zones, such as USB, ZigBee, Blu-ray Disc, HDMI, Mobile Internet and WiMAX, IPv6, Sustainable Technologies,
CES 2008 Robot Roundup and finally, Robotics. With just a few exceptions, most of the robots and robot companies were on display in the Robotics Tech Zone or in nearby booths. The biggest exhibitor in the Robotics Tech Zone this year was WowWee (www.wowwee.com). Every year they seem to have many innovative, new designs and this year was no exception. The most noteworthy items they brought out were the Femisapien, Tribot, and Rovio. Femisapien is a female counterpart for the popular Robosapien. She dances, poses, and with her 9x degrees of freedom is capable of 56 interactive functions. They had a nice demo with three of them line-dancing together (Photo 1). She has a learning mode where you can pose her and learn sequences for playback, which seems like endless fun. I thought the best feature of all was that when brought in proximity to a Robosapien, she is the boss and tells him what to do (sounds a bit like my wife). With an MSRP of $99, I can see her ending up on the desks of many geeks for fun and show. Tribot (Photo 2) certainly received the most attention out of the WowWee group, with the T V crews swarming around him to get some footage of him doing his demo. I was really surprised at how much personality he had when they switched him on. He has animated ears and a pop-top head, and goes on and on about how great it is that you rescued him from his packaging when you turn him on for the first time. He has an omni-wheel, holonomic drive system which seems to be a new theme for WowWee robots. Several of their newer products are now sportin g omni-wheels, including Rovio. Rovio is a WiFi capable,
“The biggest exhibitor in the Robotics Tech Zone this year was WowWee ...” omni-wheeled robot with a camera and navigation capabilities. It can be tele-operated over the Internet, with live streaming video of what it sees. The notable and unique technology item here is that it is using the Evolution Robotics (www.evolution.com) Northstar 2.0 system for navigation. Northstar is like “micro-GPS” for a robot. It uses constellations of infrared energy beamed onto the ceiling from a fixed point to determine its location within a room. Rovio is the first use of this technology in a low-cost, consumer package and it is quite impressive. One can set waypoints for Rovio within the room and it easily find its way back to them, even if the robot is picked up and moved. At a retail price of $299, it is quite amazing that all this technology can be packed into such a cool little robot. Since I am on the topic of indoor positioning, it is a good time to mention the booth of Hagisonic. Hagisonic (www.hagisonic.com) is a Korean sensor manufacturer which makes an indoor positioning system for robots called StarGazer. StarGazer analyzes the image of an infrared ray which is reflected from a passive landmark with a unique ID, mounted on the ceiling. From this landmark, it is able to
Photo 2
determine its repetitive position down to 2 cm of accuracy. The technology is similar to that of Evolution Robotics Northstar system, although Evolution does not n eed to stick anything to the ceiling. StarGazer is currently manufactured as a module you can simply mount in a robot, place the IR projectors in the room with the passive landmarks, and you are ready to go. They had a nice demonstration of two little robots navigating around on the floor, avoiding obstacles, and mapping their positions (Photo 3). Meccano showed their new additions to the Spykee (www.spykeeworld.com) robot line-up. All the Meccano robots are being sold under the ERECTOR brand as a robot
Photo 3
SERVO 07.2008
35
CES 2008 Robot Roundup Photo 4
Erector set. The four new robots in the line are Spykee Cell, Spykee Miss, Spykee Vox, and Spykee Micro, three of which are designed to cradle your iPod, and allow it to be voice controlled and give it some personality (Photo 4). Spykee Cell can be controlled from your cell phone via Bluetooth and is targeted at both boys and girls. Spykee Miss is an emotional electronic friend targeted at girls that gives you advice when you ask her a question. Spykee Vox is also voice controlled, an interactive friend, and can be either a hero or a villain. It is targeted primarily at boys. Spykee Micro is a small, little remote controlled robot that looks similar to its larger counterparts, but is primarily just for driving around and making noise. Again, all the robots are kits — in the spirit of the ERECTOR brand — and some are easier to assemble than others. When we were packing up at the end of the show, the Meccano people were looking to lighten their load for their trip home, so they gave us
several Spykee Micro kits. I brought two assembled units home, and had great fun with my four-year-old daughter having robot races in the hallway with them. About 50 feet from the Robotics Tech Zone was the iRobot booth. Among all the consumer robots they showed, the two that were the standouts were the iRobot Looj Gutter Cleaning Robot (Photo 5) and the new iRobot Roomba 500. The Looj has piqued my interest ever since it was announced, although I had never seen one in person before. I have heard many rumors about what it can and cannot do, so I thought I would ask the tough questions, and see if I could clear some things up. In a nutshell, the Looj is a remote controlled robot that is designed to be put in a gutter and run up and down to dislodge any debris, using a rotating rubber agitator. The idea is you climb up the ladder to the corner of your house, put the Looj in the gutter, and run it up each gutter section, thus minimizing
Photo 5
Photo 6
36
SERVO 07.2008
CES 2008 Robot Roundup the number of times you have to go up and down the ladder. They had a nice little demo with a piece of roof, a gutter mounted to it that was filled with plastic leaves, and they would drive the Looj down it and it would throw the leaves all over the aisle in front of their booth (Photo 6). It was great fun to see it go. After asking many questions, I came up with all the things it cannot do, to dispel any myth making. It cannot climb the downspout, you cannot just throw it up on the roof and let it do the rest, it cannot go around the corners in your gutters, it is not compatible with ancient gutters, with weird dimensions, and it won’t do the job all by itself while you sit down on your lawn with a glass of lemonade. What it can do, it does very well, and is quite amazing. Its paddle is capable of blasting through all kinds of gunk in your gutters, like pine needles, twigs, and sludge. If your gutters are a standard 2-1/4” size, it is capable of driving underneath the straps that hold the gutter to the house, so you can clean long sections. If your house was perfectly square, you would only need to ascend and descend the ladder four times, thus minimizing your risk of life and limb by falling off the ladder. It is certainly better than the old method of climbing up there with gloves and a plastic scoop, and at only $99 for the base unit, it is cheaper than most lawn and garden appliances. The iRobot Roomba 500 Series (Photo 7) was there, driving around a little test carpet that anyone could scatter all kinds of debris on, and it would happily slurp it up. Every time I see a new version of the Roomba I think, okay, what now, seen this before, ho-hum. However, this one has some great new features that would make me upgrade. It has anti-tangle technology, that detects if it sucked up a carpet fringe or an electrical cord, and automatically backs it out of the beater-brush before continuing along and restarting to clean. It has upgraded bump switches which give it a lighter touch to keep it from scuffing the baseboard or furniture. Also, it has a new Virtual Wall, called a Lighthouse, that the robot interacts with to allow it to be contained to one room until the room is clean, which then allows it to move onto the next room and so on, and so on. So, one robot can clean multiple rooms, and know when it has completed them all. At $349, it is in line with the pricing of previous Roomba robots, and offers significant improvements without a significant increase in price. Roboware (www.roboware. com.hk ) had a booth in the Tech Zone, where they were showing off an impressive looking, three wheeled, holonomic drive humanoid named E3 (Photo 8). I guess 2008 is the year for holonomic drive humanoids?!?! Roboware was founded by Mike Kim, who previously was one of the researches on the Canadarm space
Photo 7
robot on ISS, was part of the Hubble Telescope rescue project, and has contributed to some WowWee projects such as RSMedia, Elvis, and RSG products. According to Mike, E3 stands for Education, Entertainment, and Emotion, which makes it a platform much like a video game. E3 can express its emotion through motions (head, arms, body, wheel), light, and multi-media with customized content. It has five login modes: Baby, Teen, House-Keeper, Single, and Silver. Each mode has its own unique and updatable personality according to the user’s age. E3 has WiFi built in so it can be controlled remotely via the Internet and through its ad-hoc networking capabilities can be voice controlled, or stream or playback live video. It is even capable of doing Sykpe teleconferencing. E3 has a big 5” LCD mounted in his chest and runs Windows Mobile edition, so he can do many PDA-type functions, as well. The retail price range of E3 will be between $1,500-$2,000 and he will be available in the US around November of this year. Robotis (www.robotis.com) returned to CES again this
Photo 8
Photo 9
SERVO 07.2008
37
CES 2008 Robot Roundup year with yet more new things to show, such as an updated version of their Bioloid ( www. bioloid.com) educational robot kit, their Dynamixel high-performance servo line, as well as their new URIA Robot (Photo 9). The Dynamixel servos are designed specifically for robotic actuator applications, and are networked together using a communications bus such as RS-485 or TTL signaling. They are powerful, metal geared servos with torque up to 64 kg-cm. The Bioloid kits (as well as URIA) are constructed from these servos. URIA stands for Ubiquitous Robotic Information Assistant, and is designed as a research Photo 10 platform for working with humanoids. It has a fully embedded PC onboard, running Windows XP, with peripherals such as USB, LAN, Camera, VGA, WiFi, and a microphone. He has a nice big LCD in his chest so you can see what is going on with the PC. Other interesting peripherals include a Passive Infrared Sensor (PIR) and a six-axis gyro for measuring motion. The robot stands 22 inches tall and weighs about 12 pounds. In comparison to most of the Robo-One type humanoids, he is really, really big. They didn’t give exact pricing on this monster humanoid, but they were quite specific that it is designed for researchers and not the hobbyist. With all the servos and PC onboard, I don’t Photo 11
imagine he is going to be inexpensive. OLogic was there with plenty of interesting robots to show (www.ologicinc.com). OLogic is an outsourced research and development company with a focus on robotics, that I co-founded with Bob Allen. Of course, we brought out some balancing robots to demonstrate our capabilities to design difficult control systems. On the first day of the show, we realized we could place one on top of another and do a Las Vegas acrobatic act, in true Vegas style (Photo 10). Needless to say, it always attracted a crowd and the TV people whenever we stacked them up. Dean Kamen, the inventor of many things including the Segway, came by and we were able to snap some photos of us with Dean and the balancing robots (Photo 11). NPC Robotics (www.npcrobotics.com) commissioned OLogic to build a robot to demonstrate a device they have been reselling, called a Ribbon Lift (Photo 12). A Ribbon Lift is a device that takes three stainless steel ribbons rolled up on a spool like a tape measure, uses a motor to unwind them, and stitchs them together into a self-assembling, triangular shaped pole. Since we just finished the robot before CES, we brought it out to show off. The robot is appropriately named “Giraffe” due to its long neck it can extend. The lift mounted in the robot is capable of raising a 50 pound load to 15 feet, and can collapse down into a spool eight inches high by 20 inches in diameter. It is quite amazing to see it unfurl, and some people commented that it seemed like magic, like Ali-Babba’s magic rope trick. We mounted a WiFi camera on the top and had it feeding a big plasma display to demonstrate its use for surveillance applications. We are looking forward to building some robots using the larger version of the Ribbon Lift that can lift a 500 pound load 25 feet in the air. Two robots I missed at CES this year, but heard about, were robots that showed up for just one day to make a cameo appearance in the Robotics Trends booth ( www. roboticstrends.com). They were Pleo (www.pleoworld. com) the Camarasaurus, made by UGOBE, and Zeno the Revolutionary Robotic Friend by Hanson Robotics (www. zenosworld.com). It was a bummer I missed them both, but there was so much to see, and certainly Photo 12 one couldn’t see it all. Hopefully, I will be able to catch up with them both next year. SV Ted Larson is the CEO of OLogic, Inc., and an active member in the Home Brew Robotics Club of Silicon Valley. OLogic is an embedded systems research and development company with a focus on robotics. OLogic is currently working with clients across a wide spectrum of application domains such as consumer electronics, toys, medical products, and education (www.ologic inc.com).
38
SERVO 07.2008
by Robert Doerr
One of the joys of the robotics hobby is mastering the art of interfacing. A lot of the parts are already in front of us and we just need to make them work together. Recently, I ran into a problem with a pair of quadrature encoders for the drive train on one of my robots. The encoders themselves worked fine and were generating perfect quadrature outputs. However, they were sending out data faster than the controller could handle at higher speeds. As a result, the encoder readings were worthless and could not be trusted. etting a valid lower resolution reading of the encoder is certainly better than high resolution unreliable data. I needed to know how far the motors really moved but didn’t necessarily need to know with as high of a resolution as the encoders were providing. So, the task at hand was a way to lower the resolution enough so that I could always count on the readings and help keep track of the movements. A bit of encoder resolution may be lost but it should still be close enough for this particular project. o
t
P
I was watching the encoder counts while running some robot drive motors. During the initial bench testing, the motors weren’t running at full speed and the results I saw were just as expected. However, things got interesting when I started ramping up the speed. A very peculiar thing started happening. The encoder counts started to rise as expected but as the motors sped up,
the counts started going backwards! As it sped up some more, it counted forward again. This cycle continued back and forth a bit and then the counts were completely erratic. It appears that the encoder was exceeding the polling time used by the controller and would start missing pulses at higher speeds. Obviously, the encoders were not matched up well with the controller. I’ve seen this happen with my robot drive base and also when I was using some salvaged encoders from HP scanners and DeskJet printers. Whenever you see symptoms like this, it should throw up a red flag and make you take a look to see if this may be the problem.
Encoder processor board (component side).
Encoder processor board (solder side).
SERVO 07.2008
39
o
C
t
There are a few different methods of fixing this problem. In a nutshell, we just need to reduce the number of transitions of the encoder per revolution. Obviously, the encoder itself could be swapped out with a lower resolution one. If feasible, it may be possible to replace just the encoder disk with one that has a fewer number of holes. Another option is to change the physical placement of the encoder within the drive train. When it is directly attached to the armature of the motor, it may send out too many pulses. If it was moved downstream to the wheels themselves or at some point in the gear train, it would slow down the speed of the encoder. It will still be sending the same number of pulses per revolution of the encoder but it will be rotating slower so we get the effect we’re after. Instead of altering the mechanics of the encoder — which isn’t always an option — we can look into electronic means of scaling the values. At first, I considered making something up with standard logic ICs but an easier and more flexible option was to use a small microcontroller to help match up the readings. Whatever method is selected, we would like the encoder to supply as high as possible a resolution without sending them too fast for the controller to handle. t
t
R
I’ve run into this problem with other encoders and controllers. I wanted a flexible solution so I decided to use a small microcontroller to scale the encoder readings. This ended up being an excellent solution that can be used for other projects, as well. I selected an SX28 processor and wrote all the code in SX/B. This development went really fast. I started building the encoder scaling board one evening and had a working prototype with the core functionality the next day. Everything is handled by the Encoder assembly on robot base.
single SX28 chip which costs under $3. A few more features were then added and the code cleaned up to make it more presentable. One of the extra features is the ability to allow a host controller to change the scaling factor on the fly. Since it will accept commands via serial connection, I also added a resonator for the clock timing to ensure the serial communications would be reliable. This microcontroller will be installed in between the existing encoder and the controller. This way, it can monitor the encoder, condition the signal, and output a virtual encoder signal to the host controller. E
Many of you already know how tachometers and quadrature encoders work, but for those who don’t, here is a quick review. A tachometer signal only has one signal and therefore only provides speed information and not any directional information. It will only tell how fast something moved but not any details about the direction of travel. It can be used to get an estimate on distance traveled as long as the direction is known ahead of time. However, a problem can come up if the tachometer stops at a transition (edge). If there are any vibrations, it can toggle state back and forth and mistakenly give the impression that it is moving. It is more suited to regulate the speed of a motor where distance /direction are not important; just the speed is critical. Adding a second channel makes all the difference! A quadrature sensor will have two signals 90 degrees out of phase. These two signals are commonly referred to as Channel A and Channel B. With these, both position and direction can be determined. The direction is determined by comparing if Channel A is leading Channel B or if Channel B leads Channel A. The distance can be computed by keeping track of the counts and factoring in the direction of movement. Velocity can be calculated by counting the number of pulses per second. I’ve seen some references to encoders that state: “If A leads B, for example, the disk is rotating in a clockwise direction. If B leads A, then the disk is rotating in a counter-clockwise direction.” That may be true for some encoders, but needs to be verified for the particular encoder being used. I prefer to just think of them as two channels of information and look at which one is leading, then match that to the actual direction of how it is installed in the robot. The clockwise/ counter-clockwise description isn’t something that lends itself well to straight quadrature encoders, so keeping it generic works out well. After all, it shouldn’t matter if it is clockwise/counter-clockwise, right/left, up/down, forward/back, etc. The important part is that two distinct directions can be determined; the rest is relative. Look at the examples of output from quadrature encoder, through a few cycles. Chan A Chan B
40
SERVO 07.2008
1
0 1 1 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 1 1 0 0 1 1
Schematic of encoder processor board.
Notice that if you follow the chart from lef t to right and then from right to left you’ll see that one channel will lead the other and that is what can be used to determine direction. t
E
S
W
Using a microcontroller really makes this solution flexible. As a starting point for this program, I used the example in the SX/B help file for reading an encoder and displaying it on a set of seven-segment displays. Since no display is involved, all code relating to the display was removed. The remaining code to watch an encoder became the basis to build upon. Instead of just incrementing and decrementing a counter for the encoder, we just need to keep track of a small count which ends up being the number we’re scaling the encoder value by. This will then be used to walk up and down the virtual Channel A and Channel B of our scaled encoder output. Whenever we rollover our count of the scale factor, we then update (either up or down) the count of our virtual encoder on the output. Upon start-up, the program does a bit of housekeeping. It will check the status of four DIP switches to get the initial scaling factor. If the scaling factor is 0, then no encoder processing occurs and nothing gets passed to the host. It made sense because micros don’t like dividing by zero. This can be useful, more for troubleshooting, though. If the scaling factor is 1, then we end up just passing the
values from the encoder to host as they are. After all, any number divided by 1 is the same number. For any other value (2-15), the encoder reading will be scaled by that amount. In other words, if we have a DIP switch setting of 3, then it takes three transitions of the real encoder to make one transition of our virtual one on the output of the SX28. A setting of 15 means it would require 15 transitions of the real encoder to make one transition of our virtual one. The scaling factor goes like this: DIP Switch 0 1 2-15
Description Encoders off Encoders passed as-is to host Encoder scaled down by number specified
There are also two DIP switches used to specify the direction of the encoders. This is useful if the encoder is going in the wrong direction. Instead of swapping any of the wiring for Channels A and B, the DIP switch for that encoder can be flipped to correct the direction. This feature was easy to implement and makes this an even more flexible gadget. All of the heavy lifting is done in the ISR (interrupt service routine). The main program looks for commands coming in from the serial port to either change the scaling factor or reset it to the ones specified by the DIP switches. When looking at the source code in the ISR, we can focus on half of it since the code for the second encoder is exactly the same with the exception of the pins used to watch the encoder and the output pins of the virtual one. SERVO 07.2008
41
L
I
t
I
The initial ISR code deals with receiving serial data in the background and buffering it. After that code is done, the first thing that is checked is the scaling factor. If the scaling factor is 0, then nothing needs to be done and we just exit the ISR. Otherwise, we call the code to check and process the encoders. There are a couple of important points here. First, whenever you put code within an ISR routine you must make sure there is enough time to execute the code. It must all run within the ISR interval allocated to the ISR routine. If you have too many instructions in there, you’ll have to find ways to optimize your code or make the interval longer so that you can execute more instructions in the ISR. In the program presented here, it may seem odd to see a GOSUB within the ISR. The code that is called still executes within the ISR but needs to be moved to another bank of memory due to the way SX/B structures the compiled program. By moving things around, it resolved an SX/B error on Pass 2. “Address xxx is not within lower half of memory page.” I’ve had good results with SX/B so far, and when errors like this crop up they can often be resolved by re-organizing some of your program. The code to process the encoder starts out by reading the current value of the encoder port and masking off the bits so that the current states of Channel A and Channel B on the first encoder are used. Then, this value is XOR’d with the previous encoder state. If there is no change in state, then the value will be zero and we end up dropping down to check the next encoder. If there was a change of state, then we need to figure out what the direction of the change was. This is again accomplished with our friendly XOR instruction. In this case, we shift over the old state by one bit before performing the XOR. We just need to compare bit 0 of one channel to bit 1 of the other. It doesn’t matter which one you use as the base, as long as you understand that using the opposite set of bits will switch the direction of the encoder. In the original program, it would see if the result from the XOR operation was 1 which would specify to decrement the counter. A 0 would then mean the counter should be incremented. Instead of using a hard coded value, it compares High resolution encoder disk.
42
SERVO 07.2008
the XOR’d value with a DIP switch. This way, if the encoder is going the wrong way, a flip of a switch will correct it! No wiring changes or coding changes will be required. Y
C
F
Whenever we decrement our counter so it rolls over or increment it past our scaling factor, we need to update our virtual encoder values on the output. When I did this, it was late and I just updated a simple counter from 0-3 and sent that value out as the scaled value. When I tested it, the encoder output would only change by one up or down but that was it. Upon looking at the code, I realized what I had done. I forgot about counting funny. At least that is what my kids would say. Instead of counting 0, 1, 2, 3, the proper count was more like 0, 1, 3, 2, etc. This was due to the gray encoding where only one bit can change status at a time. This was easily fixed by using my counter as the index for a LOOKUP command. This would then take the value that was looked up and present that at the output. This results in the correct gray code as the output for our virtual encoder. The processing of the second encoder is identical. It starts out slightly different, however, because the second encoder is on a different set of pins. To accommodate that, it has a slightly different mask of %00001100 to isolate the two bits we need. Those two bits are then shifted right two bits which will put them in the proper position so all the calculations are the same as for the first encoder. The result is then presented to the host controller on a separate set of pins for the second virtual encoder. E
Whenever I have leftover pins available on a microcontroller, I always seem to find a use for them. One of the features I wanted to add is the ability to alter the scaling factor on the fly. To accommodate this, one pin is used to receive serial data from the host controller. The command structure follows the AppMod style for compatibility with other modules. The header is “!ES” for Encoder Scaler followed by an address 0-3 and then the command. The address must match those selected by a pair of jumpers connected to HP encoder assembly. RC6 and RC7. If the address doesn’t match, it will ignore the command and wait until something is directed toward it. The exception is an address of 255 which would broadcast out to all the modules of this type, regardless of their configured address. At the moment, there are only two commands supported. The command “S” is a scale value followed by a binary number 0-63. Anything higher than this gets limited to the highest scaling factor
of 63. This new scale value overrides whatever value was used at start-up from the DIP switches. This is useful if a higher scaling factor is needed than what’s available on the DIP switch or for changing the scaling factor on the fly. The “R” command will reset scale value to the one specified by the DIP switch setting. In a future version, a couple more commands may be added to Dual I/R sensor with linear encoder. return a version number to the host and also one for returning the current scaling factor.
R RobotWorkshop (Author’s website) www.robotworkshop.com SX28 series processors Offers free software development tools like SX/B www.parallax.com Online user forum for the SX series of microcontrollers http://forums.parallax.com/forums/ Wikipedia article on encoders http://en.wikipedia.org/wiki/Rotary_encoder National Instruments article on encoders http://zone.ni.com/devzone/cda/tut/p/id/4763
this encoder processor to help address a problem with the data from a set of encoders. With the addition of this encoder scaling processor, some encoders can now be used for controlled closed loop movements at any speed. This allows the encoders and host controller to work well together. There are multiple ways of accomplishing the same goals and using a microcontroller made sense for this particular project. Keep those robots alive! SV
Adding an extra microcontroller to offload tasks can help make the overall programming of the robot easier by letting the main controller focus on higher level tasks. They are also useful to handle odd interfacing and protocol issues that come up. One example is the speech translation device covered in the December ‘07 issue of SERVO. Another is
s o r s n e S
Robert Doerr can be reached via email at
[email protected].
r e t e x i s r o m 3 - A c e l e 5 A c 9 . 9
R Q T c e t a n 4 9 e f l e c r $ 3 . R s o n S e
C o M o t n t r o r o l l e r s
$ 1
9 5 4 . 1 $
y r r a g ! A o r s i n e n s - s e n S e c e o r l i n n a c t t f e f l e G r e a R R Q T
Solder Paste Stencils Use our low-cost solder paste stencils to quickly assemble your surface-mount designs.
From $25
Robot Controllers dual H-bridge trimmer pot (on ADC7)
voltage regulator power LED (green) red user LED (on PD1) ATmega48/168 microcontroller
programming connector 20 MHz clock
Baby Orangutan B-48 and B-168
TReX Jr Dual Motor Controller: Instantly switches between radio control (RC) or analog voltage and asynchronous serial (RS-232 or TTL), plus a multitude of additional features. $59.95
Custom Laser Cutting From $25
starting at $24.95
Find out more at www.pololu.com or by calling 1-877-7-POLOLU.
Cut your own custom chassis, front panels, and more! SERVO 07.2008
43
by Fred Eady
There are times when a standard hobby servo just won’t do the job. The same goes for small DC motors. Sometimes parts of aluminum humans require a bit more torque than servos and low-load DC motors can provide. In these cases, a hefty DC motor fills the bill. However, a meaty DC motor needs a beefy DC motor driver.
Fortunately, there is inexpensive and easy to use DC motor driver technology that is available to us that will drive heavy iron.
T
his month, we’ll pull together what it takes to design, build, and code a heavy duty DC motor driver module. First, we’ll look at the electrical theory behind the DC motor driver electronics. Then, we’ll build up the DC motor driver module’s “intelligence” and meld it with the DC motor driver’s “brawn.” If all of that passes the smoke test, we’ll code a simple RS-232 interface, which will allow you to control the big DC motor with simple serial commands. The DC motor driver IC of choice for this project is the Allegro MicroSystems A3959. The A3959 is a DMOS FullBridge PWM Motor Driver IC. Before we begin our DC motor driver IC walk-thru, let’s take a look at the problem at hand.
The BDPG-60-110’s maximum diameter at the motor cylinder is 2.36 inches. The BDPG-60-110’s name tells much of its story. All of the planetary gear motors in the BDPG-60-110-24V-3000R326’s class share the same part number including the “R.” The numbers that follow the R provide us with more information about the planetary gearmotor. The R326 is the most powerful gearmotor in the bunch as it can provide 4,166 ounce-inches of continuous torque. The BDPG-60-110 can peak at twice the amount of continuous torque. The 326 also tells us what the gear ratio is. In our case, the BDPG-60-110-24V-3000-R326 has a gear ratio of 326:1. At 326:1, the BDPG-60-110 rotates its shaft at a brisk 9.2 RPM unloaded. If you work the gearmotor, the shaft rotation will Big Mama Gearmotor fall to a loaded value of 7.7 RPM. Those RPM figures may The behemoth you see in Photo 1 is an Anaheim seem too low to perform any real work. However, when Automation BDPG-60-110-24Vyou add external gearing to the 3000-R326 DC brush planetary BDPG-60-110, I can assure you gearmotor. This motor is really that heavy loads will move about not a “problem.” It’s actually our relatively quickly. The 3000 project design point. The BDPGnumber in the BDPG-60-110’s 60-110 weighs in at four pounds, part number is the speed of the 10 ounces. From shaft to tail, the motor before the gearbox. BDPG-60-110-24V-3000-R326 I initially gave you the measures in at 8.08 inches. The BDPG-60-110-24V-3000-R326’s planetary gear section is 2.65 dimensions in terms of inches. inches in length while the shaft However, in reality the BDPG-60adds 1.10 inches to the overall 110 likes to be described PHOTO 1. This is one heavy duty motor all packed up in length. The actual motor cylinder metrically. The body diameter is a relatively tiny package. comes in at 4.33 inches in length. called out in the part number as
44
SERVO 07.2008
60 mm. The motor cylinder length is also part of the part number and is specified as 110 mm. The 24V in the part number calls out a 24 VDC gearmotor operating voltage. By the way, BDPG = Brushed DC Planetary Gearmotor. Now that we know all about what our “problem” is, let’s move to the next step and learn about our “problem solver.”
The Allegro MicroSystems A3959 I’m experimenting with the BDPG-60-110-24V-3000-R326 and likewise with the A3959. So, instead of building up a professional printed circuit board (PCB) in the dark, I decided to base the initial tests on official Allegro MicroSystems A3959 electronics. We will be working with the hardware you see in Photo 2. Before I describe the Photo 2 basic circuitry to you, let’s take a close look at the A3959 itself. The A3959 in many ways is a pumped-up A3979. Recall that the A3979 output current is limited to ±2.5 amperes with a maximum motor voltage of +35 VDC. The A3959 doesn’t contain all of the A3979’s internal logic as the A3979 is designed to drive stepper motors. However, the A3959’s power grid is much heftier than the A3979’s. The A3959 is designed to drive DC brush motors at voltages up to +50 VDC. The maximum current capability of the A3959 is ±3.0 amperes. Like the A3979, the A3959 is capable of controlling its attached DC brush motor using pulse width modulation (PWM). And again, like the A3979, the A3959 can be commanded to operate in slow, fast, and mixed current-decay modes. The current-decay modes all work in conjunction with the A3959 internal fixed off-time PWM current-control timing circuitry. I’ve used a bunch of motor control ICs. I’ve also released my share of motor control IC magic smoke. To help avoid the release of the A3959’s magic smoke, its designers have outfitted the A3959 with internal circuit protection. If the A3959 gets a bit too hot under the collar (165° C), it will shut itself down. To avoid hiccupping on and off as it cools off, a bit of hysteresis is built into the thermal shutdown protection. In the course of building custom motor drivers, one also has to build a suitable power supply for the motor and the motor driver electronics.
PHOTO 2. This is a shot of the “brawn” of our DC motor driver. Before we’re done, we’ll add homebrewed intelligence to this picture.
I have also freed the magic smoke of many a power supply component in my years of working with electronics. The A3959 relies on a charge pump to help keep its internal H-bridge conducting and the motor shaft turning. To provide a measure of safety when it comes to the power source, the A3959 monitors the supply voltage and the charge pump voltage for undervoltage conditions. When a problem occurs, the A3959 goes into shutdown and disables the H-bridge drivers. Okay, we’ve read the sticker on the A3959 window. Now, let’s kick the tires and open the trunk and look under the hood. I’ll add some important detail to Figure 1 as we walk around the A3959. Since the A3959 is in a DIP configuration on our A3959 demonstration board, all of our references to its pin locations will be based on the DIP package from here on out. The A3959 SLEEP function is controlled by pin 22. Just because the A3959 handles monstrous motor winding currents doesn’t mean it can’t be included in a low-power application. By driving the A3959 SLEEP pin logically low, we command it to enter SLEEP mode. The majority of the A3959’s internal circuitry including the regulator and charge pump will be disabled while it sleeps. If we choose not to employ SLEEP mode in our application, we must drive the A3959’s SLEEP pin logically high using a 4.7K pullup resistor. To understand the functionality offered by the EXT MODE pin — which happens to be pin 15 of our A3959 —
FIGURE 1. Once you understand what the A3959 is and what it can do for us, this figure doesn’t seem that busy anymore. SERVO 07.2008
45
we must first have a firm grasp on the ENABLE pin. If we wanted to control the speed of a motor, we would feed the PWM speed control signal into pin 10 (ENABLE) of the A3959. When the incoming ENABLE PWM signal swings logically high, the A3959’s selected H-bridge sink and source pair are activated. The H-bridge sink and source pair is selected with the logic level present on the PHASE pin. The A3959 PHASE input is located on pin 3. By driving the PHASE pin logically high or logically low, we select alternate sink and source H-bridge DMOS pairs and dictate the rotational direction of the motor shaft. Driving the ENABLE input logically low will switch off the source driver or both the source and sink driver depending on the logic present at the EXT MODE pin. When the ENABLE pin is at a logically low level, this is called the chopped cycle. The EXT MODE input logic determines the current path during the chopped cycle. For instance, when EXT MODE is driven logically low, the opposite pair of selected drivers will be enabled during the chopped cycle. This is called External Fast Decay Mode. Conversely, when the EXT MODE pin is driven logically high,
External Slow Decay Mode is invoked and both of the sink drivers are activated during the chopped cycle. All of the switching of the H-bridge source and sink drivers generates current spikes. The A3959 contains circuitry to synchronize the activation of the source and sink drivers versus the current drawn through the motor winding. A current spike could erroneously reset the sourceenable latch. To filter out the current spikes, the A3959 simply ignores its motor winding current sensing circuitry for a period of time when the spikes are known to occur. Driving the BLANK pin logically high provides twice the blanking (ignoring) time of driving the BLANK pin logically low. The BLANK timing is set via the A3959’s pin 12. How much BLANK time is twice as much? Well, that all depends on what we hang off of the A3959’s ROSC pin. The datasheet recommends an internal oscillator frequency of 4 MHz. To utilize the services of ROSC, we simply hang a resistor from pin 4 to V DD. Here’s how we come up with the 51K ROSC resistor value you see in Schematic 1 that provides the basis for the 4 MHz clock: SCHEMATIC 1. The PIC18F4620 is underutilized here and that’s a good thing. That leaves you with lots of I/O and memory resources for your motor application.
+5VDC ICSP CONNECTOR
6 5 4
6 5 4
3 2 1
R3 10K
3 2 1
C2 .1uF
VBB LED1
C1 .1uF
R1 100
C8
47uF +
C9 R2 1K
.1uF +5VDC C6
10uF +
R6 51K
U1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+5VDC C3 LED2 .1uF
*MCLR RA0 RA1 RA2 RA3 RA4 RA5 RE0 RE1 RE2 VDD VSS OSC1 OSC2 RC0 RC1 RC2 RC3 RD0 RD1
R7 4.7K
C7 C10 .22uF
RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 VDD VSS RD7 RD6 RD5 RD4 RC7 RC6 RC5 RC4 RD3 RD2
40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21
U2 22 4 3 10 C4 .1uF
12 13 11 15 +5VDC
14
C11 .22uF .22uF 0 4 2 2
9
SLEEP ROSC
B B V
D D V
1 2 P CVREG
PHASE ENABLE BLANK
OUTA OUTB
A3959SB
PFD1 PFD2
SENSE
C12 .22uF 23
MT1 MOTOR DC
16 21
17
MODE D D D D D D N N N N N N G G G G G G
REF
8 9 5 6 7 8 1 1
R4 13K
PIC18F4620
2
P 1 C P V C
C13
R8
.1uF
.1
P1 C5 .1uF
R5 5.6K
5 9 4 8 3 7 2 6 1
U3 2 1 3 20
NOTES: 1.
LED1 AND LED2 - MOUSER 606-4302F5-5V
2.
SP233ACP 20-PIN DIP
T1IN T2IN R1OUT R2OUT
T1OUT T2OUT R1IN R2IN VVC2+ C2+ C2C2VCC
GND GND SP233ACP
46
SERVO 07.2008
5 18 4 19
DB9 FEMALE
12 17 11 15 16 10 +5VDC 7
6 9
C14 .1uF
fOSC = 204 x 10 9 / ROSC 4 MHz = 204 x 10 9 / R OSC ROSC = 204 x 10 9 / 4 MHz ROSC = 51K Applying our clock frequency to the BLANK pin logic level results in the following: When BLANK = 0 t blank = 6/fOSC When BLANK = 1 t blank = 12/fOSC I’ll let you do the BLANK math. Recall that I mentioned earlier that the A3959 used internal fixed off-time PWM current-control timing circuitry. Well, now that we know what the internal oscillator is doing, we can compute the fixed off-time interval. The A3959 is factory set for a fixed off-time of 96 cycles of the internal oscillator. That comes to: Fixed off-time = 96 x (1 / 4 MHz) = 24 μs The PFDx pins control the function fun ction of the A3959’s Internal Current-Control Mode. Those switching spikes we just discussed are detected at the SENSE pin. The SENSE input is responsible for monitoring the motor winding current and feeding that information into the A3959’s internal current sensing/control circuitry. When an overcurrent event is detected at the A3959’s A3959’s SENSE pin (pin 17), the selected internal current-decay method is invoked. The internal currentdecay method is determined by the logic levels of pins 13 and 11, which are PFD1 and PFD2, respectively. We already know what the internal current-decay modes are. So, applying logical low levels to both of the PFDx pins selects slow decay mode. Conversely, Conversely, when both PFDx pins are driven logically high, we have selected fast decay mode. In slow decay mode, both of the A3959 H-bridge sink drivers are turned on for the entire fixed off-time, which we computed as 24 μs. A combination of logic inputs on the PFDx pins provides us with two mixed decay mode selections. Driving PFD1 logically high and PFD2 logically low will invoke fast decay mode for 15% of the fixed fixed off-time with slow decay decay taking up the rest of the fixed off-time interval. Driving PFD1 logically low while driving PFD2 logically high will produce fast decay mode for 48% of the fixed off-time and slow decay mode for the remaining 52% of the fixed of f-time interval. If this all seems a bit too much on the theory side, don’t worry. We’ll have total program control over all of the A3959’s inputs. That way, we can experiment with the logic levels until we find a combination that suits the BDPG-60-110. If you had the opportunity to check out my SERVO A3979 article, you already know about the A3959’s V REG pin and the A3959’ss charge pump as their functionality across devices is A3959’ identical. We need only hang a 0.22 μF capacitor from the VREG pin (pin 23) to ground. The voltage associated with V REG is generated internally and is used to operate the A3959’s H-bridge sink drivers. The charge pump pins, CP1 and CP2,
also require a 0.22 μF capacitor connected between them to assist in the charge pump operation. The charge pump generates a gate supply voltage that is greater than the V BB motor winding supply voltage. The gate supply voltage drives the A3959’s H-bridge source drivers. Another 0.22 μF capacitor is tied from the CP pin to ground to act as a reservoir for the H-bridge source drivers. CP1 and CP2 are represented represente d as pins 2 and 1, respectively, on the A3959 DIP package. CP functionality can be found at pin 24. Access to the motor winding voltage input (V BB) is at pin 20. A3959 load current regulation is a function of the internal fixed off-time PWM control circuit working in conjunc tion with the external sense resistor resistor,, which hangs from the SENSE pin. When the OUT A and OUTB outputs (pins 16 and 21, respectively) are activated, current flows through the motor winding. The motor winding current increases until it reaches a predetermined trip value. The current trip value is a direct product of the value of the external sense resistor and the voltage applied to the VREF pin. The A3959’s sense comparator resets the source-enable latch when the current trip point is reached. As a result, the H-bridge source driver is deactivated. Recall that we use blanking to prevent the source-enable latch from being reset at the wrong time by a current spike. Once the source driver is turned off, the motor winding current recirculates for a time equal to the fixed off-time interval. During the recirculation time, the logic levels at the PFDx pins determine which internal current-decay mode (slow, fast, mixed) is invoked. The current trip value is calculated as follows: ITRIP = VREF / 10RSENSE Let’s calculate the I TRIP value from the values you see in Schematic 1: Using good old Ohm’s Law against the V REF pin: Where VDD = +5 VDC I=E/R I = 5 / 18.6K I = 268.8 μA Voltage at VREF = 268.8 μA x 5.6K = 1.505 Volts ITRIP = 1.505 x (10 x 0.1) = 1.505 amperes We can crank up ITRIP if we want to as our BDPG-60110 can eat 2.2 amperes of current. What we have is fine for now. In the process of computing ITRIP, we covered the only pin of the A3959 we have not yet addressed: V DD. Pin 9 needs to be sourced with +5 VDC. The A3959 DIP package is 24 pins deep. So, that leaves a total of six pins we haven’t covered thus far. We can end our A3959 walk-around right here as the remaining six pins are all GROUND pins. Any internal heat that is generated is dissipated through through pins 6,7,18, and 19, which should be directly attached to a heatsink pad. The circuit for the A3959 motor driver is already laid SERVO 07.2008
47
down for us on the demonstration board. So, let’s build up our A3959 controller.
PICing an A3959 Motor Driver Controller I’ve chosen the PIC18F4620 to perform the A3959 controller duty. If you’ve ever designed with a PIC microcontroller, there’s nothing new for you here. In fact, the PIC controller hardware is so easy, I could simply tell you to look the circuit over in Schematic 1 and be done with it. As you can see in Photo 3, the PIC hardware is so simple, I hand-wired the PIC A3959 controller circuit on a perfboard. I elected to leave the SLEEP pin alone and tie it to an inactive state. I also chose to use the lesser PWM Blank time (6 / f OSC ) by tying the BLANK pin to ground. There are plenty of I/O I/ O pins to spare. So, if you want to experiment with the control lines I’ve chosen to logically tie to a static state, don’t be afraid to hook up the SLEEP and BLANK control lines to the PIC. If you use my existing control line code as an example, you won’t have any problems coding in the extra control lines. The real work involved with building up an A3959 motor driver controller is in the firmware. With that, let’s begin our firmware build by associating the A3959 control pins with their PIC18F4620 counterparts: //******************************************** //**************************** *************************** *********** //* A3959 PIN DEFINITIONS //**************************** //************* ******************************* *************************** *********** #define PFD1 LATB0 #define PFD2 LATB1 #define ENABLE LATB2 #define PHASE LATB3 #define MODE LATB4
The names I’ve assigned to the PIC18F4620 PORTB I/O pins should be very familiar to you. It would be nice if we reduced the complexity of the PFDx selections, as well: #define decay_slow #define decay_mixed_15 #define decay_mixed_48 #define decay_fast
PFD1 PFD2 PFD1 PFD2 PFD1 PFD2 PFD1 PFD2
= = = = = = = =
0; 0; 1; 0; 0; 1; 1; 1;
\ \ \ \
Using C macros to put human-readable names on the PFDx selections will make life a bit easier if you want to experiment with the PDFx settings. The same holds true for the EXT MODE selections as well: #define ext_mode_fast #define ext_mode_slow
MODE = 0 MODE = 1
The reason we are here is to turn the BDPG-60-110 motor shaft. So, it would be fitting fit ting to put together some motion macros: #define CW #define CCW
1 0
#define motion_CW
ENABLE = 1; \ PHASE = CW;
#define motion_CCW
ENABLE = 1; \ PHASE = CCW;
#define motion_HALT
ENABLE = 0;
Note the use of the A3959 ENABLE pin to start and stop the BDPG-60-110-24V-3000-R326. BDPG-60-110-24V-3000-R326. When you run your motor motor,, remember that clockwise and counter-clockwise rotation is determined depending on how you attached the motor leads to the A3959 OUTx pins. These CW and CCW settings worked for me. The PHASE logic swaps the polarity of the OUTx pins. If your CW and CCW directions are opposite of mine here, it’s much easier to simply swap the motor leads than recompile and reload the PIC18F4620. With all of our A3959-to-PIC18F4620 A3959-to-PIC18F4620 definitions and associations complete, we can add this bit of code at the end of our initialization routine: //******************************************** //**************************** *************************** *********** //* INI IN ITI TIAL ALI IZE A3 A395 959 9 MOT MOTOR OR DRI RIV VER HA HARD RDWA WAR RE //**************************** //************* ******************************* *************************** *********** decay_mixe decay _mixed_15 d_15; ; // PFD1 PFD1 = 1 - PFD2 = 0 ext_ ex t_mo mode de_f _fas ast; t; // MO MODE DE = 0 motion_HALT; // ENABLE = 0
PHOTO 3. It doesn’t get much better than this. I’ve taken to powering small PIC projects like this from a PC USB port.
48
SERVO 07.2008
I promised that we would also write some PIC firmware that would allow us to control the BDPG-60-110 through the A3959 controller’s serial port. I have coded up all of the necessary EUSART firmware for the PIC18F4620. You can see what I’ve done with the PIC18F4620’s EUSART by downloading the A3959 driver firmware from the SERVO
website at www.servomagazine.com. Here’s the code that will put the menu up in a terminal emulator window: void show_menu(void) show_menu(void) { cls(); cls(); printf(“%c[2;4H SERVO A3959 MOTOR CONTROL MENU”,esc); printf(“%c[5;7H F - ROTATE CW”,esc); printf(“%c[6;7H R - ROTATE CCW”,esc); printf(“%c[7;7H S - STOP”,esc); }
Entering an F, an R, or an S invokes the main routine code, which is looping continuously: //******************************************** //**************************** *************************** *********** //* // * MAIN MA IN SE SERV RVIC ICE E LO LOOP OP //**************************** //************* ******************************* *************************** *********** show_menu(); do{ do { if(CharInQueue()) { bytein = recvchar(); switch(toupper(bytein)) { case ‘F’: motion_HALT; mdelay1(100); motion_CW; break; case ‘R’: motion_HALT; mdelay1(100); motion_CCW; break; case ‘S’: motion_HALT; break; } } }while(1);
SOURCES Allegro MicroSystems — www.allegromicro.com — www.allegromicro.com A3959 A3959 Demonstration Demonstration Board Microchip — www.microchip.com — www.microchip.com PIC18F4620 HI-TECH Software — www.htsoft.com — www.htsoft.com HI-TECH PICC-18 C Compiler Anaheim Automation — www.anaheimautomation.com — www.anaheimautomation.com BDPG-60-110-24V-3000-R326
motor driver application, be sure to solder the A3959 directly to the PCB. The A3959 tabs need to be soldered to a copper heatsink area provided on the PCB. Give the heatsink area as much of the PCB’s copper as you can. The download package firmware was written using the HI-TECH PICC-18 C compiler and contains lots of goodies you can use in other projects, such as timer manipulation routines, timer interrupt handlers, serial communication routines, and serial communications interrupt handlers. The A3959 is a really robust and easy to use part. I have no doubt you’ll have your aluminum human doing some heavy lifting in no time flat. See you next time! SV Fred Eady can be reached via email at
[email protected].
The CharInQueue() function informs the main routine that a character is waiting in the EUSART’s external buffer. buffer. When a character arrives from the personal computer computer,, we retrieve it from the external buffer and parse it. If the character is an F, we stop the BDPG-60-110-24V-3000-R326, wait for 100 ms and rotate the BDPG-60-110’s shaft in the clockwise direction. An incoming “R” stops the motor, waits for 100 ms, and forces the BDPG-60-110’s motor shaft to rotate in the counterclockwise direction. To stop the motor shaft, we simply drop the ENABLE line to a logical low. That’s all there is to it!
Spinning Out My version of the A3959 motor controller is shown attached to its demonstration board in Photo 4. When you’re ready to put the A3959 to work in a real-world PHOTO 4. You’ll want to build up an A3959 motor driver board without the socket if you plan to run a motor for an extended length of time. It is important to make sure that the A3959 heatsink tabs are soldered to the copper heatsink area. SERVO 07.2008
49
Loki Crosses the Pond — Part 2 by Alan Marconett
In this second part of the Loki project, the QwikFlash controller board and its control softwaRE will be examined. This is a very useful board for all kinds of robotic projects. I have two running bots at this time and another one in the works!
I
n Part 1, we studied Loki’s Loki’s mechanical construction from PCB (printed circuit board) material. The controller board mounts on top of the body. Part 1 also mentioned that I was inspired to build Loki because of his antics in walking and posturing. Another reason I had for building Loki was to investigate subsumption and behaviors. Simply put, behaviors are the actions taken by a bot with given inputs. Loki will avoid an obstacle in its path. Another behavior would be to follow (or avoid) a light source. Subsumption is the inhibiting of one behavior by another. However, more in-depth discussions of behaviors and subsumption are beyond the scope of this article. I do intend to port these ideas as ‘C’ functions into my hexapod (Shelob), as well.
Controller Board Almost any controller board and processor can be used on a robot this size. I had several bare QwikFlash boards on hand I had purchased from the PICbook website. This website (www.picbook.com ) supports the book Embedded Design with the PIC18F452 Microcontroller written by John Peatman. I’m currently using the 18F4620 PIC, although the 18F452 discussed in John’s book can be used, and possibly even an old 16F877, as well (untested and limited). See the CA1.PDF document on the PICbook website websit e for construction, bill of materials, block diagram, and a schematic of this fine board. Note that no hex file or code is planned for the ‘877 chip at present. A hex file is currently available for the ‘4620 PIC implementation.
QwikFlash board populated with LCD (on Shelob).
The Book John’s book on the ‘452 is an excellent tutorial for learning the workings of the 18F452, as well as the 18F4620 I used. And having a board to try out code on is very helpful. Although John’s book uses assembly language to test out the inner workings of the PIC, It is still quite useful for C language developers and experimenters. Microchip thought enough of the book to give out copies of it as prizes for their seminar classes at the recent Embedded Systems Conference. Other prizes were the ICD2 in-circuit debugger and PIC start boards. (Now I have an additional copy to pass along to my oldest son, who is also a hardware engineer and is interested in the PIC.) The QwikFlash board with a ‘4620 PIC runs at 40 MHz, has 64K of Flash, 3986 bytes of RAM, and 1,024 bytes of EEPROM. Plenty of I/O bits, counters, and timers too for our use! To To control control Loki — or any other other small small bot — I added connectors for four R/C servos, two Sharp GP2D12 IR
50
SERVO 07.2008
Loki Crosses the Pond — Part 2 rangefinders, and a Devantech SRF08 ultrasonic rangefinder in the “prototype” area of this board. The QwikFlash controller board has an RS-232 level converter and a built-in DB-9 connector for communications, although I currently use just the TTL
lines for telemetry (via Bluetooth). With it, I run a terminal interface program called T2 on my PC to access Loki’s small monitor program. I used the monitor program to develop Loki’s gaits and postures. There is even an 8x2 character LCD that can be added to the board, although only the board on Shelob has this part. The LCD is not currently used on Loki. The Bluetooth (Blue SMiRF) setup I’m using is from SparkFun, and is great for freeing Loki from wires (it doesn’t take much weight to offbalance a small robot such as this). Otherwise, a lightweight, threeconductor cable can be used for normal RS-232 communications. The QwikFlash board requires 7 to 9 VDC, which I get from a 1,300 mAh 7.2V battery pack I salvaged. A 6V battery pack would be sufficient if you’d like to use a 9V battery for the controller instead. I added three 1N4001 power diodes in series to drop the voltage from the battery pack closer to 6V for the R/C servos I used (servos don’t like too much voltage). A modular RJ11 connector to match the Microchip MPLAB ICD2 in-circuit debugger cable is also on the board. I used the ICD2 to download and develop the code for Loki. MPLAB IDE v7.4 runs the ICD2 and invokes the HI-TECH Software compiler that I used.
LOKI Four-Servo Biped Robot Summary • Cheap walking robot, low cost parts, can be made at home • Loki is inspired by the efforts of David Buckley http://davidbuckley.net/DB/Loki.htm. • Original construction was wood (I later found out) • My Loki is constructed of PCB material to a similar size • Currently using four Futaba S3004 R/C servos, need bigger knee servos • Battery is a salvaged six-cell Ni-MH 7.2V 1,300 mAh pack • Controller board is a $15 (bare) QwikFlash 18F4620 PIC board available from www.picbook.com
• 50 MHz, 64K Flash, 3K RAM, plus EEPROM • Bluetooth wireless for telemetry and monitor control • EEPROM gaits editable over wireless link • PIC programming via ICD2 • Control program written in HI-TECH C, used to develop gaits • Two modes, autonomous and control via a small monitor program • Parser used to decode commands received by monitor • EEPROM commands save, view, and execute steps in sequences • Autonomous control currently consists of simple obstacle avoidance while doing a simple walk • Sensors include two Sharp GP2D12 IR range finders and a SRF08 ultrasonic rangefinder • Body and feet PCB material CAD designed and cut on my CNC’d Sherline mill • Loki’s gait is exaggerated due to the need to clear the toes of the overlapping feet • R/C servos are driven by two timers and interrupts in the PIC • Servo commands set new angle for servo and time to get to new position • Gaits are stored by strings of servo move commands, similar to those of the Lynxmotion SSC32 servo controller • To walk, a simple array of six strings is repeated in an endless loop • More strings allow Loki to make turns • An FSM selects the strings to be used, and changes the string selection upon recognition of an object by a sensor
Controller Board Construction To build the QwikFlash controller board, you can follow the instructions in the CA1.PDF document found on the previously mentioned PICbook web page. Some comments are in order. If you use a Bluetooth module,
Schematic 1. Drawing of Loki sensor, servo, and battery wiring. SERVO 07.2008
51
Loki Crosses the Pond — Part 2 you will not install the U1 MAX232 level converter IC. Also not installed is U2, the MAX522 DAC, as we will be using the I2C interface for our ultrasonic sensor. We don’t need the connector on the bottom of the board, unless you just want it.
the board. A six-position header is used for the Bluetooth connections and a five-position header is used for the ultrasonic rangefinder. These sensors are for the autonomous operation, but you can run Loki without them in the terminal mode. Six resistors are needed. Four of the resistors are in-line to the data pins of the servo connectors, while the remaining two resistors are pull-ups for the I 2C lines. I used a three-position terminal block (optional) to experiment with different batteries. You’ll want to provide a direct path from the battery to the servos to minimize
Add Parts to the Prototype Area To interface to our four servos and two IR sensors, we need to add some three-pin, single row, straight solder tail headers. I used the same header stock used elsewhere on Schematic 2 VDD CON1 Modular connector 1 3 2 4 5 6
For in-circuit debugger
VDD
J1 Jumper for QwikBug
U1 MAX232A
CON2 DB9F connector 3 For QwikBug 2 7 8 5
e g r u a b w e d r D a h s INT2 t p u r INT1 r e t n INT0 I
UART 12 26 RX 11 25 TX 9 CTS* SDO 10 RTS* I P SDI
13 14 8 7
S
SCK 16
VDD C10 ϭ 0.1 F
15 2
CCP1
C11 ϭ 0.1 F
3 4
C2 ϭ 0.1 F
RB0
(RC5) RC4
C T R O P
RC1 RC0
R3 470 ⍀
MCLR
VDD REG1
SERVO 07.2008
VDD
D3
9 V in, 5 V out
52
C16 0.1 F
ϩ C14 F
SW1
(RA5) RA4 A T R O P
C D A
RA3 RA2 RA1
AN0 AN7 1 MCLR 13 OSC1
Yl 10 MHz 14 OSC2 C12 C13 22 pF 22 pF VDD 11 VDD C15 Power R2 ϭ 1 k⍀ D1 LED 12 0.1 F GND VDD
33
24 23
8
U2 Dual 8-bit DAC DIN
OutA 5
Unused 2 SCLK 1 CS 4
OutB 7 3
C8
DACA GND
C7
DACB GND
6 VDD
C6 ϭ 0.1 F
17
C2/CCP1 GND
VDD
AN4
C5 ϩ 33 F
B1/INT1 GND B0/INT0 GND
16
D7 D8
SW2 RESET
H1 Terminal strip at top of board
Protection circuitry
5
*RTS & CTS can be connected to unused PIC18F452 pins to support hardware flow control of serial data transfers.
CON3 Power connector
RC2
RB5 RB4 RB3 RB2 RB1 RB0 RC5 RC4
33
(RC3) 18
6
VDD
Unused
(RC7) (RC6)
CCP2
C3 ϭ 0.1 F
R4 47 k⍀
38 37 36 35 34
P C C
1 C4 ϭ 0.1 F
(RB7) (RB6) RB5 B RB4 T R RB3 O RB2 P RB1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
GND RC3 RE2 VDD RC0 RC1 RC2 RD2
U3 PIC18F452 40 39
VDD MCLR
H2 Expansion header (See Appendix A2)
GND1
32 VDD 31 GND
D T R O P
RE2
R11 ϭ 47 k⍀
15
VDD POT1 5 k⍀ potentiometer
7 6
D2 R8 ϭ 1 k⍀ VDD Alive LED
5
R7 ϭ 1 k⍀
D4
4
R6 ϭ 1 k⍀
D5
3
R5 ϭ 1 k⍀
D6
(RA0) 2
E T R O P
QwikFlash H3 C1/CCP2 instrument input (bottom of board) GND
R12 ϭ 1 k⍀
R1 ϭ 470 ⍀
C9 0.1 F
Left LED Center LED Right LED VDD
C1 ϭ 0.1 F
TMP1 Temperature sensor
10
9 RE1 8 RE0 30 RD7 29 RD6 28 RD5 27 RD4 R13 ϭ 10 k⍀VDD 22 RD3 21 RD2 Unused VDD R9 ϭ 10 k⍀ 20 RD1 R10 ϭ 10 k⍀ 19 RD0
6 E 4 RS 14 B7 13 B6 12 B5 11 B4
LCD1 8 ϫ 2 LCD display "Nibble" interface
E2/AN7 GND 2 3
R14 3.3 k⍀
R15 1 470 ⍀ 5
VDD C17 0.1 F
SW3 Pushbutton switch
RPG1 Rotary pulse generator (24 inc./rev.)
Loki Crosses the Pond — Part 2 noise. Install two or three 1N4001 diodes in series with the Electrical battery if you intend to use the 7.2V higher voltage battery pack. A bypass cap is sometimes needed on the servo The electrical system on Loki is simple. It consists of a battery line. Another possible addition is a seven-pin, battery, switch, battery connector, and wiring. The free double row, straight solder tail header for ends of this wiring are to be terminated in the power the optional LCD display (follow instructions in CA1). An external 16x2 Parts List LCD display could also be used. In this case, you might want to put the ITEM/DESCRIPTION QTY SUPPLIER/PN connector on the top of the PCB. QwikFlash board options • Blank PC board only 1 Micro Designs Inc./QF-QFPCB3.1 Current software does not utilize the • Parts kit for 452 demo board 1 Digi-Key/18F452-KIT-ND LCD display; and the RE0 and RE1 -ORpins were usurped for use by the IR • Unassembled PC board and parts kit 1 Micro Designs Inc./QF-PARTS2 sensors. These PIC pins will need to be • IC MCU Flash 32KX16 40 DIP 1 Digi-Key/PIC18F4620-I/P-ND re-assigned if the LCD is used. Available as programmed part from the author. (un-programmed) The above parts are all added to Additional parts for prototype area of QwikFlash board the prototype area of the QwikFlash • Rectifier GPP 50V 1A DO-41 3 Digi-Key/1N4001DICT board. Wire these per the “Servos and • Conn Header .100” SINGL STR 36 POS 1 Digi-Key/S1011-36-ND Sensors” diagram in Schematic 1. • RES 2.7K ohm 1/4W 5% carbon film 2 Digi-Key/2.7KQBK-ND There are hole positions for four • RES 1.0K ohm 1/4W 5% carbon film 4 Digi-Key/1.0KQBK-ND miniature toggle switches on Loki’s • Qty. 10 5” jumpers and 20 headers 1 SchmartBoard/920-0006-01 body. I’m currently using only one for • Qty. 10 7” jumpers and 20 headers 1 SchmartBoard/920-0007-01 • CST-100 six-position connector receptacle 1 Digi-Key/A19494-ND servo power. There is already a toggle • Crimp CST-100 pins 6 Digi-Key/A19520-ND switch on the QwikFlash board for 5V • Conn 2.1 mm female plug 5.5 mm OUT 1 Digi-Key/CP3-1000-ND power, but it is wired after the 5V regulator chip. Builders might want to Sensors add a switch in the power line to the • Devantech SRF08 ultrasonic rangefinder 1 Super Droid Robots/TS-012-008 QwikFlash board, or for a board that • Sharp GP2D12 IR sensor 2 Lynxmotion/SIR-01 does not have its own power switch.
Cables I used four 4” pre-made “jumper” wires for the ultrasonic rangefinder (cut two blue 8” lengths in half) and six 6” yellow wires for the Bluetooth transceiver. These are available from SchmartBoard (the colors designate the length) and have female pins for .025” posts on either end. (These are great for working on proto boards.) The ultrasonic rangefinder cable will need a CST-100 six-position connector receptacle stuffed with six Crimp CST-100s. A tool is available to crimp the pins, or use a pair of needle-nose pliers to crimp the pin on the wire before inserting them into the connector receptacles. You’ll also want to solder in a five-position, single row, straight solder tail header into the backside of the ultrasonic rangefinder. One of the other standard length jumpers (red) would probably work for the SMiRF, but I wanted a connector body here. As an afterthought, I’d have put one on the ultrasonic sensor cable, as well.
Servos and batteries • HS-475HB (76 oz in) standard servo • 7.2 volt Ni-MH 1600 mAh battery pack • Wiring harness — battery connector • 2.4 - 7.2 VDC Ni-CD and Ni-MH universal smart charger
4 1 1 1
Bluetooth • Bluetooth modem — BlueSMiRF RP-SMA SKU# 1 • Bluetooth USB module SKU# 1 • 2.4 GHz duck antenna RP-SMA SKU# 1 Body parts • 0.25” dia. standoff RND 4-40 .625”L alum • 0.25” dia. standoff RND 4-40 .375”L alum • 4-40 x 1/4” Philips head screws • 4-40 x 5/8” Philips head screws • 4-40 nuts
Lynxmotion/S475HB Lynxmotion/BAT-02 Lynxmotion/WH-01 Lynxmotion/USC-01
SparkFun/WRL-00158 SparkFun/WRL-00150 SparkFun/WRL-00145
8 2 8 2 10
Digi-Key/1839K-ND Digi-Key/2026K-ND
• Approximately 150 sq in. 1/16” double-sided PCB board • PCB copper clad 4.5” X 7” two-side 3 • PCB copper clad 6 X 9” two-side 1
Digi-Key or surplus
• Approximately 25 sq in 0.0625” 5052 (H32) aluminum plate • Servo angle brackets bend up from 2 aluminum plate • IR sensor mount 1/2” x 1/2” x 6” long 1 aluminum angle bend up from aluminum plate -OR• IR sensor mount 1/2” x 1/2” x 6” long 1 aluminum angle
Onlinemetals or surplus
Digi-Key/PC41-C-ND Digi-Key/PC53-ND
SERVO 07.2008
53
Loki Crosses the Pond — Part 2 Front view of Loki (new legs). Sonar and IR sensors.
Top view of Loki (new legs). Sonar and IR sensors.
connector. The red +V wire goes to the center connector; the black -V wire goes to the shell. This connector allows easy disconnect from the controller board. The battery connector can be disconnected to allow connection of the battery charger.
Software Now down to the software issues. I’m an old hand at the C language, and I naturally grabbed my trusty HI-TECH compiler for the job. (Note that any one of several different languages would work.) Although I’m not using one, a boot loader would be a good choice for a ‘bot like this. As mentioned, I use an ICD2 for programming, and have to plug in a modular cable for this. Obviously with a boot loader and wireless connection, no cables would be needed! But don’t dismiss this simple umbilical cord; it is an easy way to get started. In fact, I initially ran my Loki with a battery pack lying on my desk. Having the weight of the battery pack off-loaded allowed me to use some old Futaba S3004 R/C servos I had laying around until I could determine what size servos I needed. The S3004 servos at the knees are too weak to lift up the body of Loki. You could also use the Hitec RCD servos listed here: Hitec HS-645MG 107 oz-in @ 4.8V, 133 oz-in @ 6.0V Hitec HS-475HB 61 oz-in @ 4.8V, 76 oz-in @ 6.0V Note: Futaba 3004 servos rotate the opposite direction to Hitec HS-475HB servos! Be sure you account for this if you change between the servo brands. I’m currently making modifications to the code to accommodate both rotations.
RTOS Loki’s controller program is basically a “baby RTOS” (real time operating system), which means that there are several tasks that run at the same time, managed by an ISR
54
SERVO 07.2008
(interrupt service routine). The ISR is called at a regular interval by a timer interrupt. The ISR generates “system ticks” that initiate various background tasks. Also, several peripherals are supported by an ISR in the background. The USART and A/D converter are examples of this, as are the updates for the R/C servo positions. The I 2C FSM for the ultrasonic rangefinder relies on multiple calls from the scheduler to avoid 2 “blocking” while waiting for I C events. This RTOS is not pre-emptive and only supports a fixed list of tasks; hence, the baby moniker. The current controller program (RTOS) is a bit eclectic in that it has a monitor that accepts commands from a console and also supervises an autonomous mode for when the robot is on its own. I’ve mentioned the monitor command to move the servos; there are also commands to save/view/execute the servo positions stored in EEPROM, and to read the sensors. The current autonomous mode is in its infancy; it’s merely a simple obstacle avoidance behavior for now. More is planned for it in the future.
Parser The heart of the monitor is a simple hacked-together parser to decode commands for Loki. Perhaps the most important command is the R/C ser vo command which takes position parameters for up to four servos (although I’ve planned to allow up to eight servos) at a time. A servo command is a simple string of ASCII characters (like “#0P1200 #1P1500”) ending in a CR (carriage return) in a format similar to that used by SSC (Serial Servo Controllers) such as the Lynxmotion SSC32 servo controller. This is convenient for me, as Shelob — my main hexapod — uses it. Add to the command a parameter for the required time of the move (“T1000”), and we have a means of commanding 1-4 servos to move in what’s called in CNC parlance a “coordinated motion” (all axis motion starts and ends at the same time). This is very convenient for moving the legs of Loki, or any robot, for that matter. Loki currently recognizes the following commands or parameters: • • • • • •
REV ESC #n +Tnn Pnn
Loki revision # sign-on Clear error Servo # Offset of servo position Time Servo position
Loki Crosses the Pond — Part 2 • • • • • • • • • • • •
POnn Cnn Knn R U Z.. I X Y V E A
Servo offset Canned sequence # Continuous canned sequence # Reset (stop) sequence Range request (sonar) Pot update of a servo Range request (IR) Execute step of stored EEPROM sequence Execute (back) step of EEPROM sequence View stored EEPROM steps Save current position into EEPROM step Set address of execution step
Loki can execute either one of the canned sequences, or the EEPROM sequence that’s been saved. I developed the simple six-step gait and turn sequences used by the autonomous mode (and the canned sequences) with the EEPROM commands. Either the ‘Z’ or ‘+/-’ offset commands can be used to position a servo, and then store all servos with the ‘E’ save command.
Sequences and Autonomous Mode The SW3 pushbutton is pressed to start up the autonomous mode of Loki. Loki starts by walking forward, and will take random turns at random intervals. Loki turns away if the IR sensors encounter an obstacle. The forward walk is accomplished by continuously looping through canned sequence #1. A full left turn is really three #3 sequences, and a full right turn is three #5 sequences. Although not very efficient on space, the sequences are “man readable,” and easily cut and pasted into a program or manually sent via a terminal. Wondering what sequences #2, #4, and #6 are? They are backwards gaits of #1, #3, and #5, respectively. Sequence #7 reads the pot to determine position (more on that later), and #8 is a waving posture. To control the transitions between the sequences, a FSM (finite state machine) is used. This FSM is scheduled to run periodically by the main ISR. The FSM can be called the first “behavior” for Loki. I intend to add additional behaviors such as following a light source. These too are implemented as FSMs. All FSMs run in parallel and all are scheduled from the main ISR via the system ticks. This parallel FSM operation allows a new behavior to be easily programmed (that’s the theory). The multiple FSMs will be controlled by subsumption. Loki doesn’t have all that implemented yet, however.
controlled by another FSM. The ultrasonic sensor data read is in inch range readings. The behavior FSM checks these ranges for use in deciding when to make turns and when to stop. If a terminal is connected (either by a direct RS-232 connection or by Bluetooth), the telemetry (actually, just a lot of printf statements) will be available, and the ranges seen by the sensors will be displayed, along with some sequence information.
LEDs The controller board has five LEDs. D1 is the power on LED. D2 is the “heart beat” LED which flashes at a one second rate to indicate that the program is still running. D4 is the message LED that indicates when a command is being received. D5 is the ERROR LED, which gets set when a received command is in error. D6 is the move LED that indicates when a servo move is in progress.
Switches There are three switches on the controller board. SW1 is a miniature toggle switch for +5V. SW2 (small pushbutton) is the reset switch and resets the processor. SW3 (small pushbutton) is the data switch used to initiate autonomous activity. There is also the miniature servo power switch on the body.
Servo Operation The main timer already generates interrupts for the main ISR at the frame rate of the servos (2,500 μs). This rate is also divided down to generate system ticks at a 1/10 second rate for other background tasks. A second timer times the pulse width for each of the four (or eight) servos sequentially. We don’t just suddenly “jump” from one servo position to the next. What we do is “sweep” the servo(s) to Close-up front view of Loki (new legs). Sonar and IR sensors.
Sensors Loki has three sensors currently. The two IR distance sensors (also called proximity sensors or rangefinders) have analog outputs. The processor reads the IR sensors with the A/D and is controlled by interrupts. The IR data is conditioned and results in left and right range values in inches. The ultrasonic sensor is interfaced by I2C and SERVO 07.2008
55
Loki Crosses the Pond — Part 2 the new position over the time period allocated for the move. An increment in position for each ser vo frame is calculated for each servo to be moved. Each frame we increment each servo position as required. The result is a smooth transition of position for the servos. And it all runs in the background! The new positions, of course, come from the servo commands parsed. The code also reads and parses the canned sequences. The action of turning on a servo output line for the time determined by the second timer results in a PWM (pulse width modulated) signal suitable for controlling R/C servos.
Checkout Before powering up Loki, make sure his legs are positioned left foot first and he is standing up. This is the starting position, and all of the canned move sequences both start and stop here. Initially, both the servo and the controller board power switches should be off and the battery disconnected. Remove the PIC chip U3 if installed. It is recommended that the servos and sensors be unplugged at this time. You may now connect the battery and turn on the controller power switch, and observe the LED power indicator come on. Measure +5V on the output terminal of the 5V regulator REG1. Turn the power off and insert the PIC (the end with pin 1 and the little notch faces the three LEDs). When you turn the power back on, you should again observe the LED power indicator come on and still read +5V on the output of the regulator. The “heart beat” LED D2 should be flashing once a second, which indicates that the program is running.
Terminal Tests Power down again and connect either a checked-out Bluetooth module (TTL) with a viable wireless link to the PC or install a MAX232 level converter chip into U1 (any Loki in a posture.
Bluetooth module should be disconnected) and a 1:1 threewire DB9 cable to the PC. Run a suitable terminal emulator program such as T2 or Docklight (even HyperTerminal). Loki expects a 115K baud rate, no parity, and no handshake. Set your terminal software (and Bluetooth if used) accordingly. (Because of the variety of Bluetooth modules available, no detailed description of using the Bluetooth or SmiRF will be given here). Assuming the terminal program is configured properly and the Bluetooth (if used) is operational, then you should observe the sign-on message “Loki 1.0 here!” when the board power is turned on. Insure that you are familiar with Bluetooth before attempting to use it! I suggest you try RS-232 first (I did).
Loopback Tests In case no sign-on message is seen, and assuming you have the proper voltages and the chip(s) in right, you should first check out communications. It is normally easier to start off with a simple RS-232 serial cable known to work. If no message is seen upon power-up of the board, disconnect the RS-232 cable and plug in a loopback plug into the end of the cable instead. You should see your keystrokes echoed through the loopback plug. In the case of Bluetooth, the Tx and Rx jumper leads (blue) can be unplugged from the controller board and connected together with a small piece of .025” header pin. This “loops” the Rx out of the Bluetooth module and right back in. This is a typical way of checking out a terminal program and cabling, and also the Bluetooth. After verifying the communications, standard troubleshooting techniques apply. Check for shorts, grounds, damaged traces, and the like. Pins are easy to bend over on the I C chips. Mind the polarity of the electrolytic caps, LEDs, and diodes.
Loki Here! On your terminal, send the string REV
. is a RETURN keystroke. It is often represented as ‘\r,’ as well. Loki should reply with “Loki 1.0 here!” This is the message also seen on power-up, but it is a good fast test of a valid two-way connection to the terminal. And with Bluetooth, it’s nice to have a quick way to verify that you’ve still got a connection. You are now ready to send some initial servo commands to Loki to test him out. Insure Loki’s legs are positioned with the left foot first. (Loki always puts his left foot forward!) WARNING! Servos can rapidly jump when first turned on. Positioning the feet as mentioned will minimize any undesired jerking motion of the feet upon application of servo power. KEEP YOUR FINGERS CLEAR of Loki’s feet when starting up! I recommend connecting and testing one servo at a
56
SERVO 07.2008
Loki Crosses the Pond — Part 2 time. Driving servos into their mechanical stops can damage them. Proceed cautiously. Also be aware that if the battery discharges too far, erratic servo operation can occur. Turn off the power immediately! Okay, we’ll now power-up Loki’s controller with ONLY servo #0 connected. Next, turn on the servo power, being careful to hold up Loki by the body, and WATCH YOUR FINGERS! Issue the command #0P1600 from the terminal. Servo #0 is the right knee; it should move a little. This is the basic servo command. You should experiment with the servo command to familiarize yourself with it and to check out the other servos, as well. Try some other positions, such as 1800 and 700. Add T1000 to the servo command, or issue it by itself to set the move time at 1,000 ms (default). Try other move times. You’ll find out that the servos have limits assigned to their travel. For example, 700 and 1779 are the limits for servo #0. There are similar limits for the other servos. These limits prevent Loki from kicking himself.
Servo Calibration As mentioned earlier, with the servo horns only allowing rough squaring, we save a calibration value for each centered servo position. The servos can be finely adjusted from a terminal program by setting up your terminal program to send the strings #nP+25 and #nP-25 when buttons are pressed. These buttons can then be used to jog the joint up or down to the required position; ‘n’ is the servo number and the ‘25’ is the amount to move. Change the amount to suit your taste. The goal is to have the feet flat on the table, parallel, and about 1/2” apart. Record the location of all four servos (offsets are 0 at this point). After getting the servos where you want them, the calibration values are sent to Loki’s controller via the command #n PO nn . The servo number is n, and the centered position is nn. All four servo offsets can be sent in one command, if desired. The offset values will be calculated and stored in EEPROM. The centered or “left foot forward” position of Loki’s legs will be normalized to 1500 with the offsets. A position of 0 results in the servo going to sleep (PWM pulses cease).
Sensor Tests With a terminal connected, the U (ultrasonic sensor) and I (IR sensor) commands can be issued from a terminal to conveniently test Loki’s sensors. Note that distances less than about 4” are invalid for the IR sensors. Issuing walk commands with the servo power turned off can also be used to view the range values and various walk sequence states on a continuous basis. After Loki is successful in taking a few walks, the autonomous mode can be tried. Press SW3 to start Loki. Objects should cause Loki to turn. An object too close will cause Loki to shut down.
Other Board Uses I found the QuikFlash board a very useful and convenient board to use. It is also inexpensive and perfect for other small robots. I’m already looking at it for another robotic project. Up to eight servos could easily be accommodated with additional connectors. Although Loki is a legged bot, one could also drive R/C servos modified for continuous rotation and use them to build a small wheeled robot (I’m a leg man, personally.). The navigation portion of the software would be a little different, but the section of the code driving the servos would probably be the same. And don’t forget robotic arms! Just add software.
Loki’s Future This is only the beginning for the controller board and Loki! A custom control board for Loki is envisioned, which would eliminate the need for hand-wiring servo and sensor connectors in the prototype area. On the software side, it is anticipated that more behaviors will be added, and improvements made over the rudimentary “rules” that currently suffice for subsumption. Sequence entry to the EEPROM is at its infancy, to say the least, and currently no fast download of sequences from a terminal is available. SV Loki and author Alan, KM6VV.
Loki’s First Steps Now that we’ve got the servos moving, we can take a little walk! A C1 command will command a single gait cycle, and K1 will initiate a continuous walk. The walk can be stopped by a R command. Note that Loki always finishes out his gait cycle to the lef t foot forward posture. This is to ensure that the feet are in a known position, which minimizes the possibility of Loki getting his feet tangled up. A C3 Partial Right Turn or C5 Partial Left Turn can also be executed. Three will be needed to complete a full 90 degree turn. SERVO 07.2008
57
THIS MONTH: There’s a New Humanoid on the Block
umanoid shaped servo robots are some of the coolest robot kits around. They are generally simple to build, and the finished product is agile and undeniably entertaining. Robots this cool, however, often come ROBOPHILO K IT .
ROBOPHILO T EAM.
58
SERVO 07.2008
with a hefty price tag. We’ve been lucky enough to review two such kits for SERVO so far. The surprising nimble Robonova-1 from Hitec will run you over $1,000, and the versatile Bioloid kit from Robotis comes with a price tag of about $900. These prices likely put these bots out of the reach of many casual hobbyists, which is a shame because they have so much to offer. The construction of these robots is an excellent lesson in shrewd engineering design, and there are numerous competitions that cater to this unique type of bot at events like RoboGames. This month, we have the pleasure of introducing the Robophilo from Robot Brothers, Inc. The Robophilo is pitched as the most affordable of the humanoid servomotor bots, and it certainly makes good on that claim with its scant $400 price tag when compared to its competitors. But does affordability sacrifice quality, or is the Robophilo agile enough to hold its own in a
dance off, kung-fu, or soccer against the Robonova and Bioloid? That’s what we aim to discover.
Like The Six Million Dollar Man With a 99.995% Discount The second half of Robophilo’s cryptic name stands for Programmable Humanoid In Lifelike Operation. If the other servo module humanoids that we’ve gotten our hands on are any indication, this moniker is certainly not an exaggeration of its abilities. But for us to check on that, we first need to build the thing. The Robophilo can be acquired as the pre-built Ready-To-Walk form or in kit form, and we were fortunate enough to get the Robophilo in pieces. The Robophilo kit comes with a CD that contains all of the necessary software and an electronic instruction manual in pdf form. The kit also comes with a rechargeable battery pack and charger. And, in case there was any doubt about whether or not the Robophilo was meant to be treated as a high tech plaything, the instruction manual
There’s a New Humanoid on the Block
declares on its very first page that “Robophilo is not a toy.” It just goes to prove that intellectually intensive and brain stimulating robot projects can be so fun that there might be some confusion, so we’re glad that the distinction has been made. The Robophilo instruction manual gives the directions on how to build the bot with clear text and helpful 3D illustrations of the step-by-step assembly. The pictures are very nice, but the detail on the page, the background watermark, and the length of the manual (78 pages!) discouraged us from printing it out. Following along on the computer, however, proved to be easy enough. The brackets for the arms and legs of the Robophilo are certainly reminiscent of those used on the Robonova and Bioloid, and this tried and true design works just as well on the Robophilo. These parts are made out of lightweight plastic instead of metal as one of the money saving measures on the kit, but the quality of the parts do not appear to suffer for the sake of economy. One thing that the Robophilo has that its competitors do not is its own set of tools. This simply consists of a crosshead and a hex head screwdriver, but one hugely helpful detail about the crosshead screwdriver is that it is magnetized. This proves to be invaluable when dealing with so many tiny screws. Other aspects of the Robophilo kit that set it apart from it contemporaries are the inclusions of silicone grease and rubber o-rings — the robot’s substitute for synovial fluid, if you will. The Robophilo also uses some smaller servomotors in conjunc tion with some small metal push bars for the movement of the head and waist. An unfortunate distinction is that a very small number of steps demand the judicious use of some super glue, which is not included in the kit. But by planning ahead and having some super glue at the ready, this minor detail shouldn’t mess up your building flow. One problem that we encountered with the Robophilo construction was with the actual casings of the
P HILO MOTION C REATOR.
servomotors. The casings, like most others for various servos, have little tabs on the side with holes for mounting. We figured that the Robophilo made use of these tabs, but we were mistaken. The illustrations in the instruction manual and the pictures of completed Robophilos on the box show servo casings sans tabs, so we had to chop them off. Perhaps this was a manufacturing oversight that will be corrected for future kits, but the tabbed casings
are only a minor setback that we easily corrected after some quick surgery with a hacksaw. Other than that, the Robophilo went together relatively easily. All of the plastic parts have part numbers directly on them for reference, and all screws and other bits are stored in conveniently labeled bags (except for the fact that some of our bags were labeled in Chinese, the parts were very easy to keep organized). At the end of most steps, rough tuning is
ROBOPHILO F INE T UNING .
SERVO 07.2008
59
T
.
ROBOPHILO M ANUAL.
done for the ser vomotors by hooking them into the PCB (printed circuit board). The kit does include a battery pack, and the tuning is a nice way to become familiar with the PCB before the more daunting task of wiring up the entire robot.
Final Touches and Fine Tuning Once the Robophilo is given all of its limbs, there are only a few fine touches before it is finished. One of them is to wire it up, ROBOPHILO REMOTE . which is made very straight-
forward by helpful diagrams in the instruction manual. The mess of wires can be cleaned up with some wire sleeves included in the kit. The penultimate step of building the Robophilo is to do the fine tuning for all of the servos, which is a laborious and time-consuming process. The major money-saving measure employed in the design of the Robophilo is in the servos, and the tradeoff for achieving a low cost becomes clear during the fine tuning process. The Robophilo servos are cheap analog servos that lack the torque of the servos in the Robonova and Bioloid, and are also more difficult to tune. Thankfully, the tuning process is more tedious than difficult and the quality of your experience will most likely depend on how perfect you insist the tuning to be. Tuning basically consists of entering various positions for the servos and then adjusting the offset and range of motion in the Robophilo’s fine tuning editor. With 20 servos to tune, this can turn into a time-consuming affair. During the tuning process is also when the instructions recommend to connect the pushbars for the left and right leg movement and head turning into the servos. The pushbar is easy to insert into the large servo horn for the waist movement, but the other servo horns have holes that are simply too small for the pushbars. After vigorously pressing the pushbars into place, we were able to attach everything, but ROBOPHILO PCB.
60
SERVO 07.2008
nonetheless it was a vexing setback. During our fine tuning of the Robophilo we witnessed something disturbing and tragic. We were editing the range of motion on the right leg, and then the Robophilo’s arm began to quiver. We checked to see that nothing was blocking it, but the quivering only got worse. Then, the entire robot started to convulse as its LED started to dim. It was a tragic thing, watching the Robophilo run out of batteries before our eyes. The good news is that the battery pack is rechargeable, and the kit comes with a charger. A few hours later, we were ready to press on.
Philo Goes West After what seemed like hours of fine tuning, we were finally ready to finish the robot. The last steps include cleaning up the wires and attaching the final body panels. Unfortunately, halfway through putting on the Robophilo’s ill fitting shoes we ran out of screws! Most robot kits like the Robophilo come with ample numbers of spare screws, and running out was a disappointing surprise. We suppose we could have seen it coming, because several other sizes of screws came in only the exact amount necessary, with no extras left over. Thankfully, we had enough screws to keep the shoes on and the main body panels on. Unfortunately, the body casing for the Robophilo was a big engineering disappointment in that it seemed to sorely underestimate the amount of space needed for the wires to escape. Also, the front panel doesn’t even seem to consider that extra room is required on one side for the small servo that turns the head. The thin plastic is easy to modify, but it is a bit annoying that it has to come to that. Putting the final pieces onto the robot should be a triumphant experience, not the most frustrating of the entire build. Despite the final frustrations, we had finished the bot and there was no denying that it scored high marks in cool factor. As a final touch, the
There’s a New Humanoid on the Block
Robophilo includes a variety of decals to give the bot some pizzazz, and also as a way to tell one Robophilo apart from the other. The Robophilo can be controlled by an infrared remote that bears a stunning resemblance to a TV remote. The rascally robot was even seemingly designed with team sports in mind, because the receiver can be adjusted in such a way so as to operate four Robophilos with four separate remotes and without interference. The Robophilo also has motion and pose editors so users can create their own unique actions. There is even an option to assign the user created motions to buttons on the remote. The Robophilo also has an option for a software upgrade that would allow users to program their own motions in C. We always like to see this kind of versatility in robot kits, but for our purposes we stuck with the easy to use GUI. After all of the frustration and tedium, seeing the Robophilo move around is a well deserved reward. The weaker servos don’t give it quite the agility of the Robonova or the Bioloid, but it still gets around just fine. In a dance-off between the Robophilo and the Robonova the Robonova would be more like the Korean pop star and the Robophilo the late night comedic pundit, but the Robophilo certainly puts up a valiant effort.
ROBOPHILO SERVO. pictures of servomotor androids decked out in makeshift jerseys kicking around tiny soccer balls. Sometimes these events are referred to as “Huro” events (RoboGames even features a HuroCup), which we can only guess is a playful portmanteau of the words human and robot. By the time of this printing, RoboGames will have already taken place in June, but it always seems like a great way to analyze the versatility and effectiveness of a robot is in the context of a competition. The Robophilo, Robonova, and Bioloid all easily pass the height and weight requirements for three-onthree soccer and for the variety of events that make up the HuroCup. The main constraints on these events are height, weight, and footprint dimensions. The wide open HuroCup allows robots that are up to 150 cm
ROBOPHILO T ORSO ( TOGETHER ).
ROBOPHILO T ORSO ( APART ). tall and 30 kg, so our three androids easily make the cut. Another three-onthree soccer event, however, seems to only cater to the smaller and lighter Robonova with a height limit of a mere 30 cm and a weight restriction of 600 g. The HuroCup still offers a plethora of events for intrepid roboticists. The mission of the HuroCup is actually quite high minded. According to the Laws of the HuroCup, “The goal of the HuroCup league is to encourage research in practical, autonomous, highly mobile, flexible, and versatile robotic platforms.” That may sound like a lot of work and a daunting task, but the thrill of competition and exciting variety of events are sure to make it as much a pursuit of fun as one of progress. Track and field style events like
ROBOPHILO W ORK .
Rock’em Sock’em Huros By now, we had accumulated three different “androids” as they seem to be referred to in the competitive robotics community, and three seems to be the magic number for a number of events. The classic team sport of competitive robotics is soccer, and a quick online search of humanoid soccer will return numerous SERVO 07.2008
61
T
.
ROBOPHILO F INISHED.
the Forward-Backward Dash and the Marathon test the limits of bipedal mobility, and events like Weight Lifting and the Lift and Carry stress balance and strength. The Robonova seems like a popular choice for these events, but we think the hefty Bioloid could also be a strong competitor. Without modification, the Robophilo would face an uphill climb (Stair Climbing is actually another android event held at RoboGames). The catch about all of these events is that the Huros have to be autonomous. In that case, the Bioloid might look like a better option because of the sophisticated sensors that each and every Dynamixel servo ROBOPHILO H ANGER.
62
SERVO 07.2008
module is equipped with. But one shouldn’t count out the Robophilo either — its PCB has numerous open ports for additional servos and sensors, and with the C upgrade it proves to be a formidable autonomous competitor. The epic RoboGames also include a number of remote controlled humanoid robot events. The remote control events include Kung-Fu, Golf, and even Taiko Drumming. Our three humanoids fit the bill as far as height and weight restrictions for these events, and at first glance the Robophilo might seem like a better contender for these events than the Bioloid. The reason for this is that the Bioloid is the only one of the three that does not come with a remote control, but an extra receiver module can be added to make it controllable by radio frequency. The impressive sensor arrays on each of the Dynamixel modules give it more than enough autonomous capabilities to compensate for this inconvenience, but such upgrades would likely be a burden on a lot of hobbyists that have already grappled with the steep price tag. The Robophilo, on the other hand, comes with a remote and is ready to go — it even comes with some preprogrammed karate chops, and the motion editor would be a great way to add some more Kung-Fu moves. Such physically demanding events like Kung-Fu and Taiko Drumming would necessitate robust robots, and once again we think the Robophilo would be up to scratch. The Robophilo miraculously seems to be free of one of the major concerns we’ve had about the Bioloid and especially the Robonova — loose screws. Perhaps it’s due to the pitfalls of mass production or loose tolerances, but the screws that hold the Robophilo together certainly seem determined to stay put from our own clumsy cross threads or some other mystical mechanism. The fine metal threads of the Robonova’s sleek metal frame may have made the initial
construction a breeze, but the screws seem to come out as easily as they go in. It’s nothing a little Lock-Tite wouldn’t fix, but it’s also nice to know that the Robophilo probably wouldn’t lose an arm in the middle of a golf swing.
The Price of a Low Price Overall, the Robophilo is a bit of a Curate’s Egg — good in some parts and bad in others. The troublesome servo casings, the ill fitting servo horns and body panels, the weak and unruly servos, and the shortage of screws are all quite irksome. Even the seemingly neat addition of a hanger is a mixed bag. Unlike our other two androids, the Robophilo comes with its own hanger for storage or display. The hanger is a nice idea and refreshingly simple to put together, but it is not very stable and we had to add our own extra base to it so it wouldn’t topple over. The hanger looks like a gallows, where an unruly Robophilo could be justly put to death for criminal frustration. Actually, that would be hyperbolic, because the Robophilo is not significantly more tedious to build than any other servomotor humanoid, but these numerous small details worked together to somewhat tarnish our opinion of the robot. To make sure we weren’t crazy, we searched for other reviews of the Robophilo to see if our sentiment was widespread or a fluke. Searching for other commentary on the Robophilo online returned a number of glowing reviews that seemed somewhat incongruent with our experience. Then we noticed that most of these reviews were for the Ready-To-Walk version of the Robophilo, which clocks in at $100 more than the kit version for a grand total of $499. This is still significantly less than other humanoid robot kits, and for tinkerers that are short on time or money it might be a decent option. Even so, other reviewers also noted the weak analog servos that were the big money saving item. They did, however, also tout the expandability of the kit as a way to
There’s a New Humanoid on the Block
W
For more information, go to: www.robophilo.com www.robogames.net
overcome these problems. We couldn’t agree more, and the Robophilo folks are also hard at work at improving their product. We think that getting a humanoid robot out there at such a low price is an admirable accomplishment that shouldn’t be overshadowed by a few missing screws. The Robophilo still has a number of great plusses in addition to its affordability. The nice tools, handy hanger (once stabilized), intuitive motion editor, stylish remote with numerous channels, and expandability all make for an impressive robot. The HuroCup Laws even mention how there is a drive to get more competitors involved in Huro events, and we think that the Robophilo will
ROBOPHILO SOCCER.
certainly help in that department. It may not be as stylish as the Robonova or as versatile as the Bioloid, but the Robophilo is accessible. The tradeoffs made for affordability can easily be
overcome with later upgrades and some ingenuity, but the Robophilo and Robot Brothers should be applauded for their sincere effort to democratize humanoid robotics. SV
SERVO 07.2008
63
Tune in each month for a heads-up on where to get all of your “robotics resources” for the best prices!
Stocking Up With Surplus Electronics J
ust because one person doesn’t want it doesn’t mean it isn’t valuable. That’s the case with surplus. Simply put, surplus is excess stock for resale. Sometimes it’s used, sometimes it’s new. Occasionally, it’s worthless junk, but very often, surplus has a beneficial use to someone, somewhere. And just as importantly, surplus means the item isn’t being thrown away in the trash, so it’s not clogging up a land fill. Why bother with surplus? For starters, it usually costs less, often a lot less — there are exceptions, such as rare or antique items, but we’re not talking about that kind of stuff here. The downside to surplus is limited selection and quantity. You may not find exactly what you’re looking for, so you have to be prepared to improvise. And don’t expect unlimited supplies of an item. Surplus is often one-of-a-kind, or at least restricted quantity. You can find just about anything at surplus — cars, jet engines, elevator parts, you name it. But the kind we’re most interested in this time around is surplus electronics and related gear — ICs, resistors, capacitors, small motors, jacks and plugs, and just about everything else you might need for the average robot.
Where to Go for Surplus The Internet — and by extension, mail order–is an ideal playground for
64
SERVO 07.2008
surplus shopping. We’ll get to mail order buying in a moment, but before logging into your PC, consider any local surplus stores in your area. Don’t have any? You’d be surprised at what’s out there. Look in the Yellow Pages under the heading of Electronics. Sometimes you’ll find what you’re looking for under a Surplus heading, but these tend to be military/camping surplus outfitters, rather than electronics surplus. Referrals are a great way to find out-of-the-way businesses. If you attend a local robotics or other user’s group, ask members where they like to shop. And when you find one store, ask the sales clerks if they know of others in the area that might be of interest to you. Most are willing to point you to the competition, since in the surplus world, if one store doesn’t have it, another one might. Customers are gladly shared among the area stores. Local thrift outlets are another good source for surplus. Many have sections devoted to old electronics such as T Vs, VCRs, and radios. You’ll need to do your own dismantling to get at the parts, but for many, that’s half the fun! Some thrift stores test their electronic goods and charge more if they are working; for cannibalizing surplus parts you won’t care if they’re working or not, so just go for the cheapest you can find. Odds are, even if your area supports just a couple of nearby retail surplus stores, you’ll probably rely
mostly on mail order to get what you need. Many of the better online stores are listed in the Sources section that follows, but don’t forget to use your favorite Internet search tool to find more. Google, Yahoo!, MSN, or other web search engines let you find items of interest from among the millions of websites throughout the world. Add the keyword “surplus” to the search terms to help narrow the hits you get. Keep in mind that the Internet – and all mail order – is world wide. You may find some retail stores that are not located in your country. Many businesses ship internationally, but not all do so, and the added shipping costs can all but negate the cost savings of surplus. Read the fine print of the website to determine if the company will ship to your country, and note any specific payment requirements. If a check or money order is accepted, the denomination usually must be in the company’s native currency. Many surplus electronics outlets sell a mixed bag of new and surplus wares. In fact, it’s often difficult to know what’s new or prime products, and what is surplus. These stores sell new products in order to keep a stable inventory. What this means is that the store may be able to re-order some of the product, but not others. Remember that most surplus is a “get it while you can” commodity. Once it’s sold, it’s sold, and the stores
move on to the next item. Should you need a larger quantity of a particular part, inquire to see if additional quantities are available, and whether it is a standard stocked item or limited availability surplus.
What to Stock Up On Because the availability of surplus comes and goes, you will want to take advantage of a product offering while you still can. But that involves buying things you may not need at the moment — which could end up being not needed ever! It’s prudent to exercise caution in ordering surplus merchandise that you have no immediate plans for. I like to limit nonessential purchases to a certain dollar amount per month or per quarter. I often use surplus to refill depleted inventory. This includes basic items such as wire and switches. For project-specific purchases – such as motors and gears – I will refrain from buying these until I need them. Yes, this does mean sometimes losing out on a great opportunity, but if you’re not careful it’s easy to over-buy, and end up with a garage full of components you may never use. This has happened to me, and I ended up donating several hundred pounds of unused inventory to some local robot user groups and schools. As surplus electronics often involves small parts, it is advantageous to organize your inventory so that you can find what you need quickly. Plastic divider drawers sold at home improvement stores are a good option. For odd-size items, I use heavy duty self-sealing plastic bags, and write down the contents using a thick felt marker. I then put the filled bags in shoe boxes. It only takes a moment to sift through the bags to find just the part I need. Of course, the real benefit of shopping the electronics surplus outlets is the savings on things you need right now. When you start a new project, get into the habit of checking the surplus traders first. That way, you’ll save money where you
can. Be realistic in your expectations and be prepared to deviate from your original project plans to suit the materials on sale at the time. For example, if your robot calls for 2-1/2” diameter wheels, but you’ve found a great deal on 2-3/4” ones that can save you money, consider changing the specifications to accommodate the different wheel size.
Sources Following are numerous online outlets that offer electronics surplus, either exclusively or as part of a broader selection. Several have printed catalogs for offline review, but bear in mind that because surplus product comes and goes, you’ll always want to check the company’s website for the latest deals. Bear in mind that many other types of online resellers such as robotics specialty stores carry surplus electronics. These aren’t listed for the sake of space constraints. The moral: It pays to study the Web catalogs of your favorite online retailer to be sure you’re finding all the best deals.
A-2-Z Solutions, Inc. www.a2z-solutions.com A-2-Z Solutions carries new and surplus electronics. Mostly computer equipment (PCs, monitors, scanners, and so forth). Online sales with Web catalog.
AE Associates, Inc. www.ae4electronicparts.com AE Associates carries new and used electronics, including switches, connectors, electronic components (resistors, capacitors, diodes, transistors, etc.), and test equipment. Searchable database. Also sells a small number of compact black and white and color video cameras. Local store in Van Nuys, CA; online sales with Web catalog.
All Electronics Corp. www.allelectronics.com All Electronics is one of the primary sources in the United States
for new and used robotics components. Prices and selection are good. Walk-in stores in the Los Angeles area. Product line includes motors, switches, discrete components, semiconductors, LEDs, infrared and CdS sensors, batteries, LCDs, kits, and much more. Specifications sheet for many products are available on the website. Online store, Web catalog, and printed catalog.
Alltronics www.alltronics.com New and surplus merchandise. Among their product line useful in robotics are DC and stepper motors, stepper motor controllers, power MOSFETs, small CCD video cameras, and tools. Online sales with Web catalog.
American Science & Surplus www.sciplus.com AS&S sells surplus of all types, including some you’d normally find in an Army/Navy surplus store. But they also carry motors, gears, batteries, switches, and some electronics.
APEX Electronics www.apexelectronic.com Military and industrial surplus, with a major emphasis on wire of all types and sizes. Huge selection, but the retail store is not well organized, in my opinion. Limited online sales (only some components listed on the site).
Apex Jr. www.apexjr.com Surplus electronics and mechanicals. General electronics, transformers, and “movie props.” Online store with Web catalog.
Ax-Man Surplus www.ax-man.com Local (St. Paul, Fridley, and St. Louis Park, MN) electronic and mechanical surplus.
B.G. Micro www.bgmicro.com B.G. Micro is a haven for the SERVO 07.2008
65
electronics tinkerer and robotics enthusiast. Much of the stock is surplus, so it comes and goes, but while it’s being offered, it has a good price attached to it. Online sales through Web catalog; printed catalog available.
more. Online sales with Web catalog.
BMI Surplus www.bmius.com
Electronix Express www.elexp.com
Electronic surplus, much of it high-end industrial or scientific; opticals, laser. Online sales with Web catalog.
New and surplus electronics, including passive components, motors, relays, and more. Online sales with Web catalog.
Electronic Surplus, Inc. www.electronicsurplus.com Electronic Surplus has a wide selection of test equipment and electronics parts.
motors is fairly small, but they make up for it with a wide selection of other common (and some not-socommon) products.
MECI — Mendelson’s Liquidation Outlet www.meci.com Surplus electronics, motors, and even a special section for combat robot parts — large motors, batteries, that sort of thing. Online sales with Web catalog.
Quickar Electronics www.quickar.com
Brigar Electronics brigarelectronics.com
Excess Solutions www.excess-solutions.com
Handy selection of electronic components, including unique sensors, construction hardware, and motors, along with the usual transistors, resistors, etc. Online sales with Web catalog.
Surplus electronics. Local store and online sales.
Quickar carries surplus electronics and tools. Online sales with Web catalog.
Fair Radio Sales www.fairradio.com
Skycraft Parts & Surplus, Inc. www.skycraftsurplus.com
Though specializing in surplus for ham radio, Fair Radio also offers plenty of general electronics and test equipment. Online sales with Web catalog. A printed catalog is available.
Skycraft Parts & Surplus, Inc., is a “surplus mall” offering power supplies, transistors, relays, ICs, wire, cable, heat shrink, transformers, motors, fiber optics, test equipment, resistors, diodes, and more. Local store in Florida, plus online sales with Web catalog.
CTR Surplus www.ctrsurplus.com Surplus electrical, including motors, test equipment, and power supplies. Online sales with Web catalog.
Electro Mavin www.mavin.com
Gateway Electronics, Inc. www.gatewayelex.com
Electro Mavin carries electronic components, motors, batteries, optics, and test equipment. Online sales with Web catalog; retail store in Los Angeles area.
Gateway Electronics is a general electronics mail order and retailer. Among their products are passive and active components, motors, electronic kits, gadgets, books, and tools. Some of their goods are new; others are surplus.
Electronic Dimensions www.el-dim.com
Hosfelt Electronics www.hosfelt.com
Electronic Dimensions carries military and industrial surplus, electronics, radio receivers, transmitters and parts, electron tubes, test equipment, and ham gear. Retail store in Washington state, and online sales with Web catalog.
General electronics. New and surplus.
Electronic Goldmine www.goldmine-elec.com Electronics Goldmine carries new and used electronic components (LEDs, potentiometers, resistors, heatsinks, transistors, etc.), robot items, electronic project kits, and
66
SERVO 07.2008
HSC Electronic Supply www.halted.com Online mail order sales, with walk-in retail stores in northern CA. Halted offers a mix of computer and electronics surplus.
Marlin P. Jones & Assoc., Inc. www.mpja.com MPJA sells both new and surplus electronic and mechanical products. Their assortment of items such as
Timeline, Inc. www.timeline-inc.com Surplus of all kinds: electronic, computer peripheral, laser, motors, LCDs, and more. Online sales with Web catalog.
Unicorn Electronics www.unicornelectronics.com Unicorn Electronics has a large selection of electronic components, including passives, transistors, logic ICs, relays, and more. Online sales with Web catalog.
Weird Stuff Warehouse www.weirdstuff.com Weird Stuff Warehouse sells surplus, including electronics. Retail store in Sunnyvale, CA. SV CONTACT THE AUTHOR Gordon McComb can be reached via email at [email protected]
DIFFERENT BITS by Heather Dewey-Hagborg
RANDOM BITS Throughout this column, we have relied on the idea of randomness to seed all of our unconventional computing experiments. In this month’s article, we will take a brief detour from code and hardware to examine just what the concept of “random” actually means, how our microcontroller is implementing it, how this differs from a computer, and some schemes for creating “true” random number generators. irst, a little history. The concept of chance appears in most ancient cultures, dating back at least as far as the ancient Egyptians use of the “talus,” an early predecessor to the die. Fashioned from the knuckle or heel bone of a hoofed animal, the talus had four possible outcomes. It has been found alongside tomb illustrations and scoreboards in Egyptian sites lending support to the idea that playing dice and gambling were popular pastimes. In the words of Ian Hacking, a historian of probability, “It is hard to find a place where people use no randomizers yet theories of frequency, betting, randomness, and probability appear only recently. No one knows why.” An intriguing mystery! And indeed it is not until 1654 that what we know as probability today began to take shape. French nobleman Chevalier de Mere had a gambling problem. He wanted to know if it would be profitable to bet that double-sixes would appear at least once in a set of 24 dice throws. Luckily for him, he was a friend of one of the most brilliant mathematicians of his day, Blaise Pascal. De Mere posed the problem to Pascal and the theory of probability emerged from the ensuing correspondence between Pascal and his good friend Pierre de Fermat, another brilliant mathematician. What Fermat and Pascal realized is what we all learned in grammar school — that with each throw of the dice, each possible outcome is equally likely. The possibility of throwing a six is therefore 1/6. They further realized that probabilities could be multiplied, and the probability of throwing two sixes was 1/6 x 1/6 = 1/36. The probability,
F
therefore, of throwing two sixes in 24 throws is 1/36 x 1/36 x 1/36 … 24 times or 0.4914. So it was not advisable for Chevaler de Mere to bet on throwing two sixes within 24 throws after all, and probability theory was born! So what does any of this probability stuff have to do with random number generation? Games of chance are, as Hacking called them “randomizers.” They are a way of abdicating responsibility for decision-making to the world of probabilities. In turn, results returned from such activities are random outcomes. At any given moment of the game, you cannot predict with certainty which number will appear next. And a set of random outcomes produces a sequence of random numbers containing no repeating patterns — a sequence which Algorithmic Information Theory would call uncompressable.
AIT and Compressibility As Gregory Chaitin, founder of algorithmic information theory describes it, compression occurs if data can be reproduced by a computer program with a smaller number of bits than the original data contains. In other words, if I have a data set of 500 one-byte measurements, the data contains 500 * 8 = 4,000 bits. If I can find a repeating pattern in that data, I can simplify it by creating a simpler symbol to represent each repeating subset of the sequence. I can then code an algorithm to process the input string and replace the symbols based on a key. In this way, I can shrink the size of the data itself without losing any of the original informa tion. SERVO 07.2008
67
DIFFERENT BITS Example: Original dataset 70, 15, 111, 32, 56, 70, 15, 70, 15, 7, 1, 3, 5, 20, 67, 54, 42, 29, 113, 7, 1, 3, 5 Compressed dataset a, 111, 32, 56, a, a, b, 20, 67, 54, 42, 29, 113, b Key a = 70, 15 b = 7, 1, 3, 5 The more you can compress the data, the more patterned or predictable it is, the less information it contains, and the less random the sequence of numbers is. By contrast, if the data cannot be compressed at all, “if the smallest program for calculating it is just as large as it is ... then the data is lawless, unstructured, patternless, not amenable to scientific study, incomprehensible. In a word, random, irreducible!” (Chaitin, p. 64) So randomness is equivalent to information. The more information a sequence contains, the more difficult it is to compress, and the closer it is to randomness. In this light, white noise becomes pure information and a perfect source — in addition to games of chance — for generating random sequences. Anywhere noise is present, for example, radio waves and the atmosphere, we can tap into it to extract random sets of numbers.
Radioactivity Something that we thankfully have rare occasion to contemplate, radiation is an excellent source of random numbers. Radioactivity can be defined as “The spontaneous emission of radiation from the nucleus of an unstable atom. As a result of this emission, the radioactive atom is converted, or decays, into an atom of a different element that might or might not be radioactive.” (Defined by the Radiation Emergency Assistance Center.) For our purposes, this means that given an unstable atom, there is no way of predicting when it will lose its extra nucleon resulting in the radioactive decay. By proxy, if you have multiple radioactive atoms, there is also no way of predicting the interval between decays, and it is exactly this combination of random periods that can be used to generate random strings of binar y. So, we know that randomness comes from dice throws, card games, coin tosses, noise, and radioactive decay, and I think we can safely bet that our computers are not striking up a game of cards each time we request a
FOR YOUR INFO For more details on radioactive decay as a source of randomness, check out Hotbits, a company that supplies random number sequences sourced from radioactive behavior via the Internet; www.fourmilab.ch/hotbits/.
68
SERVO 07.2008
random number, so how do they do it?
rand() and srand() Most likely, if you are reading this magazine you have also done at least a little programming and have encountered some version of the rand() function or random class. Almost every contemporary computer language and platform has had some variant of this, from microcontroller C to Java to Python. These functions generate what are known as pseudo-random sequences of numbers. Why pseudo-random? Well, for one thing, the random number generator in your computer is actually just an equation. Most computer languages (including C and Java) contain a version of the classic algorithm, the linear congruential generator , as the source behind rand(). A linear congruential generator works by computing each successive random number from the previous, starting with a seed, X 0. The seed is generally what you supply to the algorithm by calling srand(seed_value) before requesting a number from rand(). Here is the formula: Xn+1 = (aXn + c) mod m where Xn is the output set of random numbers m is the modulus value a is the multiplier value c is the increment value and X0 is the initial seed value (ex. supplied by srand) In Ansi C, for example, m = 2 32, a = 1103515245, and c = 12345. The number returned by the rand function is actually drawn from only bits 30:16 of the output result of the function. Similarly, Java uses the linear congruential generator with an a value of 25,214,903,917 and a c value of 11.
Problems One of the defining characteristics of pseudo-random number generators is that given the same seed, they will always produce exactly the same series of numbers as output. This is very useful when you need a sequence of data that appears random and is the same each time, for example, in rendering computer graphics, but it is an annoyance for most of the applications we have implemented in this column. The other problem with linear congruential generators is that they are not terribly random. The longest random sequence it is possible to generate is the length of the chosen modulus value (2 32 in C) before it begins to repeat from the beginning; a characteristic referred to as the period of the generator. Additionally, it has a characteristic called serial correlation which means that there are predictable patterns in the data. To return to our discussion of algorithmic information theory above, this means that the data could be compressed; it is not 100% random. In comparison, the Python programming language uses
DIFFERENT BITS a different random number generating algorithm known as the Mersenne Twister. This algorithm has been proven to generate significantly more random data (the period is 219937 – 1), but it requires more memory for implementation and is therefore not suitable for microcontroller or space intensive implementations.
What About Microcontrollers? CCS (www.ccsinfo.com) reports their rand function to be the following: unsigned int16 rand(void) { _Randseed = _Randseed * 1103515245 + 12345; return ((unsigned int16)(_Randseed >> 16) % RAND_MAX); }
This is clearly derived from the ANSI C example we looked at above, as you will recognize the linear congruential function, simply separated into two steps. Notice also that the a and c values are identical to the ones above, and the only difference between the two functions is that in the CCS version, m is the user defined value RAND_MAX rather than 232. Note that this makes explicit the relationship between the maximum period of the random number generator RAND_MAX and the modulus value m. (Hitec did not respond to my query about their random number generation technique, but it is probably safe to assume it is similar.)
A Better rand() If you have read some of the examples from earlier installments of this column (neural networks, genetic algorithms), you have undoubtedly noticed plentiful use of the rand() function. And if you have actually implemented any of these examples, you have also noticed that the methods used to seed the PIC random number generator are less than satisfactorily random. I will conclude this month’s column by briefly explaining some possible methods for generating better random seeds on the PIC and providing some links to more details. CCS recommends measuring the time in microseconds between power up and the first user keypress, and then using the least significant bits of that measurement. In terms of code, this involves using a hardware timer to generate interrupts and counting the number of intervals between device initialization and the user’s keypress. An example of this is available on the CCS website at www.ccsinfo.com/ content.php?page=compexamples#seconds . Their suggested workaround solution for when user input is not possible is saving an initial seed in EEPROM and then incrementing it each time the processor is reset, and saving the new value in place of the old. CCS has read and write EEPROM functions available for doing exactly this; see
their EX_EXTEE.C example for more details. Other possible solutions for getting a good random sequence on a microcontroller involve either developing hardware specific to this task, or connecting to the Internet and querying a site like Hotbits (mentioned previously) or random.org. If you do want to build your own dedicated random number generating hardware, there are a few tried and true methods. The first makes use of the principle that a reverse-biased PN junction generates completely unpredictable output known as “avalanche noise.” Lots of details about making a random number generator using this technique, as well as interfacing it to the PIC, are available online from Rob Seward’s art project ‘Consciousness field generator’ at http://robseward.com/ itp/adv_tech/random_generator/ . The basic idea is to sample the weak avalanche noise signal and amplify it dramatically. This value is then sampled by a microcontroller either by sampling the time interval between spikes or simply choosing a constant sampling rate and accumulating 1s and 0s each iteration. Because succeeding bits may be more correlated than is desirable, different unbiasing techniques exist. One popular technique called the Von Neumann method samples two bits at a time, discards them if they are equal, and keeps the first one if they are different. Another method known as the XOR corrector samples two sets of pairs of bits and then performs an XOR operation on them and uses the output. More information on the PN junction technique is available at www.cryogenius.com/hardware/rng/ . Another method for hardware random number generation makes use of the radioactivity method described earlier. The basic premise is to use a Geiger-Müeller tube to count instances of individual atom’s decay in a given isotope. Again, the time interval between decays can be used, or a fixed sampling period can be established and the number of decays per unit of time can be counted. A detailed description of this idea is available on Bernd Ulmann’s blog at www.vaxman.de/projects/rng/ rng.html. Finally, if you can’t do the user keypress, EEPROM, or external hardware techniques, you can try sampling a floating pin on the analog-to-digital converter of your PIC, and accumulating the least significant bit each sample. To maximize your randomness on this technique, test out one
SUGGESTIONS FOR FURTHER READING • Gregory Chaitin: Meta Math! • Ian Hacking: The Emergence of Probability: A Philosophical Study of Early Ideas about Probability, Induction, and Statistical Inference • Peter J. Bentley: The Book of Numbers: The Secret of Numbers and How they Changed the World SERVO 07.2008
69
DIFFERENT BITS of the unbiasing techniques just mentioned. To close on a completely random note, I will leave you with a fun example of a very early musical piece that took advantage of true random number generation. In 1787, Mozart composed a set of instructions for a ‘musical dice game’ — a method of using consecutive dice throws to generate a minuet! Lots more information about this and a
computer generated version are available online at http://sunsite.univie.ac.at/Mozart/dice/. SV
CONTACT THE AUTHOR Heather Dewey-Hagborg can be con tacted via email at [email protected]
CONTROLLERS & ROBOT KITS t – SENSORS – DISPLAYS T ! S C O W L O
Free Expert Technical Support 1 (800) 985-AWIT
LOW COST
c e n n o C o t y s a Professional E
L O W C O S T !
www.c-stamp.com SW Dev. Tools
For the finest in robots, parts, and services, go to www.servomagazine.com Electronic Parts & Supplies Since 1967
70
SERVO 07.2008
and click on Robo-Links.
The SERVO Webstore Attention
Subscribers ask about your discount on prices marked with an *
L o o o o k W h k a t ’ s N e w
SERVO Magazine Bundles
Published by T & L Publications, Inc.
Save $10 off the normal per bundle price!! Now you can get one year’s worth of all your favorite articles from SERVO Magazine in a convenient bundle of print copies. Available for years 04, 05, 06, and 07.
$57
FIRST Robots: Rack 'N' Roll Behind the Design by Vince Wilczynski / Stephanie Slezycki The second annual book highlighting the creativity and process behind 30 winning robot designs from the 18th annual international FIRST Robotics Competition. The FIRST organization, founded by Dean Kamen (inventor of the Segway), promotes education in the sciences, technology, and engineering in collaboration with sponsors including Motorola, Xerox, NASA, Delphi, General Motors, and other companies invested in science education. $39.95
Build Your Own Humanoid Robots by Karl Williams GREAT 'DROIDS, INDEED! This unique guide to sophisticated robotics projects brings humanoid robot construction home to the hobbyist. Written by a well-known figure in the robotics community, Build Your Own Humanoid Robots provides step-by-step directions for six exciting projects, each costing less than $300. Together, they form the essential ingredients for making your own humanoid robot. $24.95*
Robot Builder’s Cookbook by Owen Bishop This is a book for first-time robot builders, advanced builders wanting to know more about programming robots, and students in further and higher education tackling microcontrollerbased practical work. They will all find this book a unique and exciting source of projects, ideas, and techniques to be combined into a wide range of fascinating robots. $29.95
Mechanisms and Mechanical Devices Sourcebook by Neil Sclater / Nicholas Chironis The fourth edition of this inventioninspiring engineering resource covers the past, present, and future of mechanisms and mechanical devices. You’ll find drawings and descriptions of more than 2,000 components that have proven themselves over time and can be incorporated into the very latest mechanical, electromechanical, and mechatronic products and systems. Overviews of robotics, rapid prototyping, MEMS, and nanotechnology, along with tutorial chapters on the basics of mechanisms and motion control, will bring you up-to-speed quickly on these cutting-edge topics. $89.95
Forbidden LEGO by Ulrik Pilegaard / Mike Dooley Build the Models Your Parents Warned You Against. Forbidden LEGO introduces you to the type of freestyle building that LEGOs master builders do for fun in the back room. Using LEGO bricks in combination with common household materials (from rubber bands and glue to plastic spoons and ping-pong balls) along with some very un orthodox building techniques, you’ll learn to create working models that LEGO would never endorse. $24.95
Robotics Demystified by Edwin Wise YOU DON'T NEED ARTIFICIAL INTELLIGENCE TO LEARN ROBOTICS! Now anyone with an interest in robotics can gain a deeper understanding — without formal training, unlimited time, or a genius IQ. In Robotics Demystified , expert robot builder and author Edwin Wise provides an effective and totally painless way to learn about the technologies used to build robots! $19.95
We accept VISA, MC, AMEX, and DISCOVER Prices do not include shipping and may be subject to change.
SERVO 07.2008
71
To order call 1-800-783-4624 Robot Builder’s Sourcebook by Gordon McComb Fascinated by the world of robotics but don’t know how to tap into the incredible amount of information available on the subject? Clueless as to locating specific information on robotics? Want the names, addresses, phone numbers, and websites of companies that can supply the exact part, plan, kit, building material, programming language, operating system, computer system, or publication you’ve been searching for? Turn to Robot Builder’s Sourcebook — a unique clearinghouse of information that will open 2,500+ new doors and spark almost as many new ideas. $24.95
Oil prices getting to you, too?! Stay home, read a book. The online store @ www.ser v omagazine .com
CNC Robotics
Linux Robotics
by Geoff Williams
by D. Jay Newman
CNC Robotics gives you step-by-step, illustrated directions for designing, constructing, and testing a fully functional CNC robot that saves you 80 percent of the price of an off-the-shelf bot — and that can be customized to suit your purposes exactly, because you designed it. Written by an accomplished workshop bot designer/builder, this book gives you everything you need. $34.95
The Amateur Scientist 3.0 The Complete Collection
If you want your robot to have more brains than microcontrollers can deliver — if you want a truly intelligent, high-capability robot — everything you need is right here. Linux Robotics gives you stepby-step directions for “Zeppo,” a super-smart, single-boardpowered robot that can be built by any hobbyist. You also get complete instructions for incorporating Linux single boards into your own unique robotic designs. No programming experience is required. This book includes access to all the downloadable programs you need.
by Bright Science, LLC There are 1,000 projects on this CD , not to mention the additional technical info and bonus features. It doesn’t matter if you’re a complete novice looking to do their first science fair project or a super tech-head gadget freak; there are enough projects on the single CD-ROM to keep you and 50 of your friends busy for a lifetime! $26.99
$34.95
F R E E ! w i t h a n ye p u r c h a s 0 0 o v e r $e -1 in
! N E W Robot Programmer's Bonanza
P hon n l y ! order s o
by John Blankenship, Samuel Mishal
SERVO Magazine
The first hands-on programming guide for today's robot hobbyist! Get ready to reach into your programming toolbox and control a robot like never before! Robot Programmer's Bonanza is the one-stop guide for everyone from robot novices to advanced hobbyists who are ready to go beyond just building robots and start programming them to perform useful tasks.
$29.95
72
SERVO 07.2008
T-Shirts From HomoSapien to RoboSapien
For men and women
Before R2D2 there was R1D1
Get your very own limited-edition SERVO Magazine T-shirt. Shirts come in sizes S, M, L, and are available in either black or white. All shirts are 100% preshrunk cotton.
Limited time offer. Call 1-800-783-4624.
Or order online www.servomagazine.com BACK ROOM SPECIALS
123 Robotics Experiments for the Evil Genius by Myke Predko
S AVE 10% plus GET FREE US SHIPPING!
The LEGO Mindstorms NXT Idea Book
Bionics for the Evil Genius by Newton C. Braga THE EVIL GENIUS TACKLES BIONICS! Step into the future -- (or the past, if you have a touch of Dr. Frankenstein in your soul) -- with these 25 incredibly cool bionic experiments! Demonstrating how life forms can be enhanced, combined, manipulated, and measured with electronic and mechanical components, these inexpensive projects from internationally renowned electronics guru Newton Braga provide hours of fun and learning.
$24.95 Sale Price $ 22.95
and
If you enjoy tinkering in your workshop and have a fascination for robotics, you’ll have hours of fun working through the 123 experiments found in this innovative project book. More than just an enjoyable way to spend time, these exciting experiments also provide a solid grounding in robotics, electronics, and programming. Each experiment builds on the skills acquired in those before it so you develop a hands-on, nuts-and-bolts understanding of robotics. Sale $22.95
Building Robots with LEGO Mindstorms NXT
The Definitive Guide to Building Java Robots
Fuel Cell Projects for the Evil Genius
by Scott Preston
by Gavin D J Harper
The Definitive Guide to Building Java Robots is for educators, students, hobbyists, and startups looking for Java/hardware interaction. This book shows you how to use your PC to build N E W ! robots, and how you can interface with a microcontroller to do the basics. You’ll learn to design your robot to navigate, see, speak, recognize your face, listen to you, and build maps. $55.95 Sale Price $ 47.95
FUEL YOUR EVIL URGES WHILE YOU BUILD GREEN ENERGY PROJECTS ! Go green as you amass power! Fuel Cell Projects for the Evil Genius broadens your knowledge of this important, rapidly developing technology and shows you how to build practical, environmentally conscious projects using the three most popular and widely accessible fuel cells!
$24.95 Sale Price $ 22.95
PROJECTS H Racer video clips can be found in the on-line store product descriptions!!
An inexpensive circuit you can build to control a servo without a microcontroller!
For more information, please check out your May 2008 issue or go to our website @ www.servomagazine.com Subscriber’s Price Non-Subscriber’s Price
With this kit, you now can see and feel the future of energy generation in your own hands! Recently named as one of the Best Inventions of 2006 by Time Magazine , the H-racer is now the best selling fuel cell product in the world. The H-racer is a micro-version of what engineers and scientists have been dreaming about for real cars: combining hydrogen with oxygen to generate a DC current to power an electric motor. Unlike a gas-powered car engine, the only byproducts of this electrochemical process are electricity, heat, and pure water. With the H-racer, you can witness the power of new energy technology in the palm of your hand. Horizon has created this unique, patented miniature fuel-cell car and hydrogen refueling station. All you need to do is add water. Only $115.00 plus S/H
SERVO 07.2008
73
Dusting Robots One Woman’s View of Life With an Electronics Hobbyist by Kym Graner
When you were five, 10, or even 15 years old, what did you want to be when you grew up? I’m betting those career aspirations changed with your interests until you eventually became whatever you are today. Maybe you wanted to be a fireman-superhero-doctor, or maybe a veterinarian-cheerleader-cop. I wanted to be a mom. From the time I was about 12, I knew that was the job for me. Nothing showy, nothing extremely technical or requiring decades of schooling. I just loved kids, cooking, crafts, and the outdoors. I couldn’t think of anything better than being a stay-at-home mom.
B
y the time I graduated high school, I had already met the love of my life, Vern, and was well on my way to my career goal. We got married in our early 20s and, although I had a “day job,” I embraced my home life in my free time. Fastforward 10 years and enter our first child, Nic. Finally! The time to stay home and hone my mothering skills Nic as a baby (left). Nic now (right).
74
SERVO 07.2008
had arrived. I had picked up some techie skills through my job, but didn’t really anticipate ever needing them again, except for working on our home network or fixing my sister’s computer. Then came reality. A mere two months after our son was born, Vern and I decided to open a small ISP and network services company. My marginal techie skills took a quick ramp up to being a full-
fledged Novell CNA with a strong A+ skill set. My husband was (and is) an excellent network engineer. As he designed and installed networks, I would assist and then go on to administer, repair, and upgrade as needed. Our son became accustomed to a wide range of environments as he traveled with me to customer sites and enchanted everyone there. After the business settled into more ISP and less network services, child number two was on her way and I once again attempted the stay-at-home thing. But my quiet Suzy Homemaker world was not going to stay that way for long. By then, my husband’s electronics interests had branched out to include the Halloween world. Let me explain: My husband is a prolific designer of devices. He has developed the Robo Spin-Art machine, the Ponginator, Therepings, Ping Pong Printer, Sonar Station, a talking skull in a coffin, a 20-foot wide “venomous” spider, and so much more. The ideas he has still on the drawing board have the same potential for eye-catching
Sami as a baby (left). Sami now (right).
fun that the ones already living in the outside world possess. He’s always been like this — inventing things since he was in grade school. He really can't help it. Many of these creations came together in 2005 to make an awesome Halloween Haunt that the neighborhood still talks about. Unfortunately, it was made at the expense of my one beautifully decorated room — the dining room. My vintage cherry Queen Anne dining set, hutch, and my grandmother's antique desk had to take shelter in my bedroom. The stained glass chandelier was removed, black plastic sheeting was stapled onto my gorgeous crimson walls, and voilá! One scary spider’s lair was created. Like I said, it was fab — award-winning, even! But just last weekend, I found another staple in the ceiling, holding just a scrap of spider webbing. The accoutrement that currently grace my dining room include two human-sized robots/ sculptures, the coffin guy, Bob — who, at roughly six feet in height — is also human-sized, a Stargate Defender machine, a trashcan zombie, and an evil spider-controlled robot. My living room set includes a former motorized wheelchair base, turned mobile platform for an in-process “boogie bot,” one of the Robo Spin-Art machines, and a supply of ping pong balls for the Ping Pong Printer. Rather than reflecting my daydreaming interest in a Better Homes & Gardens living space, our house now sports a look that was once described by a friend as looking like Godzilla swallowed a RadioShack and then threw up. There’s a part of me that wishes my home could revert to the “normal” decorator dream it started
to become. But then I look at all the fun we’ve had making and showing off these things, teaching our children to design and build, and getting to meet like-minded people, and it makes the “clutter” worth the sacrifice. SV
Exclusively at Jameco… The Lowest Prices… Guaranteed! Save 3% to 5%
Save 15%-25%
Save 30% or more!
Looking to save on thousands of Name Brand components? Jameco offers these popular products for 3% to 5% below market price, and we guarantee it!
Save more when a specific manufacturer is not required. Major Brand semi’s are sourced from 5-6 specific major manufacturers, plus we also offer Jameco Brand and Generic passives for even greater savings.
Looking for killer deals? Jameco buyers often find Factory Overruns from some of the industry’s biggest names. That means savings of 30% and more to you!
3 Levels of Choice 3 Levels of Savings
Other Jameco Advantages:
We offer over 300 Major Manufacturers 99% of catalog products ship the same day. Lowest prices guaranteed, or we pay 10%. Order 24 hours a day, 7 days a week
www.Jameco.com Or call 800-831-4242 anytime SEMICONDUCTORS
•
PASSIVES
•
INTERCONNECTS
•
ELECTROMECHANICAL
•
POWER
SERVO 07.2008
75
76
SERVO 07.2008
d n a
ROBOTICS — A HISTORICAL PERSPECTIVE b
O
ver the years, I have written about advances in all types of robot designs, robot technology, and various robotic subsystems in this column. In each article, I have tried to cover advances in the science of robotics and have covered the history of a part of robotics in a specific way. I have never tried to examine the way that we humans have viewed these creations of ours as they have slowly taken over many parts of our lives. I have often wondered just what mindset developed in people’s thought processes as the science of robotics took a certain turn. We, as robot experimenters and hobbyists, certainly view robotics in a way different from the average person. We don’t just sit back and read about how they weld and paint our cars in far away factories. We build our own or buy ready-built robots or robot kits so we can see the technology at work, first hand. As a society, robotics is now changing our lives in ways we never imagined.
The ‘20s to the ‘50s — The First Visions of Robots in Our Society The idea of a non-human humanoid in our society has been around for thousands of years. Most of these mythical creatures were not particularly nice to us. A hundred years ago, the very word robot did not exist as Czech playwright Karel
y
T
o
m
Capek had yet to write his 1920 play, RUR, which stood for Rossum’s Universal Robots. The Czech word, robota meant ‘serf,’ ‘drudgery,’ or ‘laborer’ in Czech — a person who does hard work. Karel attributes his brother, Josef, as the inventor of the word robot, though he first suggested the word roboti. It was changed to robot for the play. The term robotics was later derived from a mix of robot and electronics or mechanics (there are those who steadfastly stand by each of the two words that are attached to robot). Robots were always thought of as anthropomorphic or ‘man formed’ in the plays and movies of a century ago. The earliest robots of man’s imagination were machines to be feared. Maria from the film Metropolis was anything but an agreeable creature. The many stories of Isaac Asimov (Figure 1) from the 1940s on brought a semblance of ‘man-like’ to these machines. They walked on two legs as nobody had a clue in those days just how difficult it was to have a machine balance while walking. Asimov had enough technical knowledge to realize that the electronics of his day were not sufficient for a robot’s brain, so he envisioned the ‘positronic brain’ in his robot tales as the mystical power behind his creations. There was no way he could have imagined the cheap Flash drives that we use today that contain billions of transistors as memory cells. Transistors were still years in the future so electronics relied
C
a
r
r
o
l
l
THE THREE LAWS OF ROBOTICS First Law :
A robot may not injure a human, or, through inaction, allow a human being to come to harm. Second Law :
A robot must obey the orders given it by human beings except where such orders would conflict with the First Law. Third Law :
A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
on the lowly vacuum tube. Asimov’s robots were also a bit kinder to mankind. In later years, his ‘Three Laws of Robotics’ have had a great impact on all levels and types of robots including the design and manufacturing of industrial robots — the only robots FIGURE 1. The Late Dr. Isaac Asimov.
SERVO 07.2008
77
when asked to handle items many times. The media touted these times as the ‘Robotics Age’ and a magazine was actually published in the ‘80s with that same name. FIGURE 2. Joe FIGURE 3. Unimate Robot. “The ‘steel collar’ Engelberger. Photo worker has courtesy of Industry Week. arrived!” touted the headlines. of the ‘60s with sufficient power to Industries welcomed these injure a human being. machines as workers who never tired, never asked for a raise, and never got sick. Human factory workers first The ‘60s and ‘70s — looked at these intruders with a jaded Robots Arise from eye, worried that their jobs were at Fiction to Reality stake. Soon, they saw their dirty, repetitive, and dangerous jobs being When George Devol received his replaced by the machines and their patent on universal automation for job status being elevated to robot ‘programmable transfer of articles in operator or robot repairman. Workers a factory’ and later met young Joe were happy and management even Engelberger in 1954 (Figure 2), happier. The robot tide rapidly spread Unimation was born and so was the overseas, primarily to Japan. The first industrial robot — nothing at all world was now accepting robots like the walking creatures of film and in society. literature. This was the first pivotal The presence of ‘the Three Laws’ point in the history of robotics. Robots did not prevent Robert Williams, a were now real and useful tools to worker in a Ford Motor Company humanity. These two men were plant in Flat Rock, MI, from being thinking only of ways to automate killed by a robot in early 1979. He felt manufacturing processes, not to that the robot was operating a bit too replace people in their jobs. slow and was retrieving a part from a The original Unimate robot had a bin when the robot’s arm struck him single arm extending out of a turret, in the head, killing him instantly. A much like a military tank gun (Figure massive structure moving at high 3). However, despite the lack of speed can be very dangerous. No, the human form, the robot was here to robot wasn’t acting in anger that a stay as the first Unimate toiled away human was taking his job back, but a in a General Motor’s plant in New jury awarded Williams’ family $10 Jersey. ‘Robots’ became the new tools million from the robot’s manufacturer. that made American industry the envy Two years later, a Japanese worker, of the world. Kenji Urada, was killed in a Kawasaki Factory robots started out plant when a robot that he thought handling parts and soon were spot he had turned off, pushed him into a welding and spray painting cars on grinding machine. assembly lines. Robots always seem Throughout the ‘60s, the vast extremely powerful to the average majority of the world’s robots were person but few realize that a typical the industrial variety. Talented industrial robot can actually only experimenters built some machines handle a small payload. What they are in their garage workshops and capable of doing is moving this small universities allowed a few grad stupayload quickly and precisely and dents to craft a robot or two for a many times; thus the need for a thesis project, but the word ‘robot’ to massive structure. Humans quickly tire most people meant the machines in
78
SERVO 07.2008
car factories. Newsreels and magazines showed images of rows of mechanical servants snaking their lanky arms into car frames, sparks or paint mist spewing onto the floor. Robot ‘intelligence’ — if that word applied at all — usually meant an expensive mini-computer or maybe a mainframe in another room, linked to the robot by a bi-directional RF or wired link. Sensors were almost non-existent on industrial robots. Expensive cameras and factory automation devices served as sensors for university experimental robots. Large drum memories held crude programs for the robots, but, hey, they worked, and more and more were being installed in factories around the US and the world. You could ask a kid on the street in those years, “What is a robot?” He might, at first, say it was Tobor The Great from the movie of the same name. You could then ask, “No, what is a real robot?” He would then describe the rows of robots in a car factory, as would any adult of those times. Others might mention the unmanned Surveyor or Viking lunar landers, or the space probes sent across the solar system to explore our planetary system. Some might even recall the ‘hot cell’ teleoperators at Oak Ridge, TN that handled radioactive materials by remote control. All will agree that robots are now real creations of man.
The ‘80s — Japan Becomes the Leader in Robotics The US can take pride in many innovations in robotics but it is Japan that has taken the lead in implementation of robotic technology. In the beginning, virtually all of the robot manufacturers were based in the US but today’s list of the top companies are all Japanese based. There are still a few innovative US, Canadian, and European robot companies but most of the original US companies were either bought out by their Asian competition or went out of business. Japan also has the greatest
number of industrial robots installed in their factories; a good reason they are one of the world’s top manufacturing powers. By the end of 2005, Japan had over 373,000 industrial robots in place in factories, with the US in a distant second place with 131,000. Sweden, Germany, Korea, Canada, and other countries were soon installing robots and even manufacturing their own. The UP400RN robot in Figure 4 is made by Motoman, the North American name for the Japanese parent company, Yaskawa. This company has a line of over 250 different robots for all types of industries, not at all untypical for modern robot manufacturers. The proverbial ‘yanking the rug from under North American robot manufacturers’ was the second pivotal point in the history of robotics. Actually, the rug wasn’t yanked; it was handed over.
The ‘Robot Revolution’ Begins in the ‘80s Applications soon spread from just material handling, spot welding, and painting to more sophisticated operations such as vision-aided pick and place systems. The SCARA (selective compliance assembly robot arm) soon became the most popular robot configuration when it was first used in 1978 in small assembly operations such as electronic circuit board ‘parts insertion.’ Gantry x-y-z axis robots were developed to handle large and small parts. AGVs (automated guided vehicle) took a departure from fixed base robots and moved about factory floors carrying parts, guided by invisible paths on the floor or by other means. Surveillance and security robots silently guarded factory and office floors. Robot applications were spreading outside of the typical factory floor to many new uses. The Robotic Industries Association (RIA) and the Robotics International of the Society of Manufacturing Engineers (RI/SME) were in their heyday in the mid-1980s with thousands of members attending the many industry
shows around the country. The world’s industries touted all these new applications for robotic technology as the Robot Revolution.
Service Robot — a New Category A new tide of interest in robotics began to develop. With varieties of robots spilling over into all aspects of life in the early ‘80s, it was natural for the large electronic kit maker, Heath, to design a robot kit for the experimenter and hobbyist (Figure 5). The Hero 1 was an instant hit, and a later Hero Jr. and the more sophisticated Hero 2000 rounded out the line. With Heath long since out of business, for those who are interested, Robert Doerr at www.robots wanted.com has many Hero parts and whole robots to sell. Bob also handles the equally famous RB5X robot that cost a whopping $2,295 in 1984 (Figure 6). Nolan Bushnell of Atari fame started a company called Androbot and began selling his ready-built TOPO and BOB robots in early 1983, or as he stated — “the year 1 AB,” for the first year of AndroBot, or After Bob, as others have said. Universities and community colleges began to offer courses in robotics for the budding roboticist — a new buzz word that began to make the rounds in the late ‘80s. I’m assuming that the word was derived from robotic and scientist. As the science of robotics comprises so many diverse technologies, robotics
FIGURE 4. Motoman UP400RN by Yaskawa.
students found their special interests within mechanical engineering, electrical engineering, computer science, physics, computer engineering, and other technical fields such as chemistry and optics. Once the dominate force in robotics, industrial installations took a back seat to newer applications. Robot technology had now spread out from the factory floor to teleoperators for remote manipulation, mobile military robots, and remotely-operated vehicles for under the sea, on the ground, and in the air. Medical applications were replacing the surgeon, floors were being cleaned by robots, and medicines delivered by robot couriers in hospitals. Robots snaked their way through pipes for inspection, crawled up the sides of buildings to clean windows, delivered food to tables in restaurants, and entertained us in our homes. FIGURE 6. RB5X.
FIGURE 5. Hero Robot.
SERVO 07.2008
79
need “man” in the loop to accomplish something intelligently. It is this seemingly intelligent appearance of robots that appeals to a new breed of robot enthusiasts — those with strictly computer science or AI backgrounds. Once called gear heads for their mechanical bent, the new generation of robot experimenter now has at his or her disposal all types of sophisticated microcontrollers, sensors, vision systems, and navigation methods to create some ‘killer’ robots. FIGURE 7. Furby.
Entrepreneurs searched for different ways to use this new technology.
Interest in Robotics from the ‘90s to the Present is Phenomenal Robot experimenters have long been interested in robotics as a means of using a machine to do something physical, in that it either investigated its environment by roving about or it actually made changes to the environment. With the advent of affordable microprocessors and microcontrollers, robots can now operate on their own. These autonomous robots do not FIGURE 8. Aibo.
80
SERVO 07.2008
Sophisticated Robots Become Available to Everyone Gone are the old robot kit companies as new hobby robot manufacturers step up to the plate. LEGO — the maker of the plastic block sets for kids — develops some amazingly unique and powerful robot kits with their Mindstorms series. Robot Sumo moves from Japan and becomes popular in the US and the world. Dean Kamen, inventor of the Segway Personal Transporter of 2001, had interests in robotics back in 1989 when he founded FIRST (For Inspiration and Recognition of Science and Technology), a robotics competition that in 2008 had over 37,000 high school students in robotics teams across the nation. A recent article in Electronic Design magazine indicated that students in the FIRST competition were more likely to attend college and were likely to be interested in engineering fields, were more community oriented, and aspired to post-graduate studies. Does this mean students who entered the competitions were then inspired to go into robotics and engineering, or that FIRST naturally attracted the type of student who would have gone this route, anyway? Robots have always appealed to children, and the child in all of us. Tiger Toys brought forth the extremely popular Furby in 1998 — a
small, furry robot animal reminiscent of the characters in the Gremlins movie (Figure 7). This talking and somewhat moving creature sold over 40 million units. Sony, the huge electronics manufacturer first produced its robot dog (and cat) named Aibo in 1999. Many people wondered just who would shell out $1,500 to $2,000 for a plastic dog but almost 200,000 did until Sony ceased production in early 2006. It is rumored that they will bring out a new model this year called the Aibo PS to be controlled by their latest PlayStation (Figure 8). History will show that these introductions of sophisticated robot toys were an important turning point in robotics and its acceptance with non-technical people. CrustCrawler, Lynxmotion, Parallax, and many other companies advertising in SERVO now supply or make some amazing robots or robot components for robot experimenters. The average person has no clue how these creations of ours work, so our various clubs have arranged exhibitions for the public. Robothon was one of the larger robotics expositions developed and presented by the Seattle Robotics Society at the Seattle Center — home of the Space Needle. For years, Robothon introduced thousands to the exciting science and hobby of robot building and robot competition. This year, it will not be held, not because there is not interest for such events but because leadership of the Robothon has kept it alive for so many years that burnout has occurred. The same applies to the Portland Robotics Society’s popular PDXBot and other group’s events around the country. However, others such as the big San Francisco RoboGames and the Dallas group’s contests are still packing ‘em in. The leadership of these events has seen a gradual lessening in the attendance of these exhibitions, unfortunately. Possibly the downturn in our economy is making money a bit tight for expensive hobbies. Maybe the rest of society has become so used to robots vacuuming our floors and entertaining us that a
demonstration of a championship Robo-Magellan or a 20-servo humanoid walker brings a bored “ho hum” from the average bystander. Do they really want a full-size Honda Asimo as a servant in their homes? Does this hiccup in interest signify another turn in the history of robotics? Possibly. Have we failed as robotics enthusiasts? No way! The history of any technology has always gone through these cycles of interest and acceptance. The steam engine was a marvel until it drove trains, ships, and factories everywhere. The common light bulb that lit the world as the marvel of a century ago, is so commonplace that it is ignored today, soon to be replaced by LED lamps. The amazing $2,000 cell phone of two decades ago is now given away and is in the hands of most school children.
Yet, the March 27th edition of Electronic Design had a picture of Star Wars’ C-3PO on the cover with the article title under it stating: “The Droid War: Cost, Lack of Industry Focus Clouds Robotics Future.” The article actually paints a rosier picture of the state of robotics in the actual essay, with an emphasis of LEGO’s Mindstorms NXT robotics kit and National Instrument’s LabVIEW software package. So, you see, there are always multiple sides to any historical subject, whether a part of the Civil War or the subject at hand we all love so much. It just depends on your point of view and what particular facet of
robotics interests you most. Outside of the usual timelines, every “history of robotics/robots” that I Google always seems to have a different slant on the subject. I would very much appreciate some of you readers of SERVO to email me with your feelings about the future trends of robotics, for it is you who will ultimately change the directions of experimental robotics with your purchases, designs, exhibition attendance, and comments at meetings and on the web. SV Tom Carroll can be reached via email at [email protected].
The Robot Revolution The recent April 21st edition of U.S. News and World Report had an article entitled ‘The Robot Revolution May Finally be Here.’ I’m thinking, “They’re saying this again, after 20 years?” The article went on to mention that iRobot has sold almost three million Roombas — the vast majority of the new helper robot category. “Personal robots emerged as a mainstream product last Christmas, with Sharper Image’s catalog featuring a “Shop for Bots” section, says Philip Solis of market tracker ABI Research,” as written in U.S. News.
Looking for a GIFT or maybe just something special for yourself? Check out our website and take a look at all our other robotic items for sale!
Advertiser Index All Electronics Corp. .........................25, 70
Jameco ..................................................... .75
Robot Craft .............................................. .70
AP Circuits/e-pcb.com ........................... .10 Lorax Works ....................................... .25, 70 AWIT ......................................................... .70 Lynxmotion, Inc. ...................................... .11
Robot Power ........................................... .23
Boca Bearings ................................... .23, 70 CipherLinx Technologies .........................70 CrustCrawler ............................................ .82 Electronics123 ......................................... .25 Endurance Robotics ............................... .70
Maxbotix .................................................. .70 Mini Robotics .................................... .63, 70 Net Media ................................................. 83 Parallax, Inc. ...............................Back Cover PCB Pool ............................................. .21, 70
RobotShop, Inc. ................................ .70, 76 Skycraft Surplus ....................................... .25 Solarbotics/HVW .................................... .14 solderbynumbers.com ........................... .25 Sparkfun Electronics ................................. .2
Pololu Robotics & Electronics ..........43, 70
Technological Arts .................................. .70
Hitec ......................................................... .15 Rabbit, A Digi International Brand ............3
Vantec ...................................................... .10
Images Co. ............................................... .70
Weird Stuff Warehouse .......................... .25
RoadNarrows Robotics .......................... .24
SERVO 07.2008 81