Circle #60 on the Reader Service Card.
Circle #81 on the Reader Service Card.
Departments
Columns
Publisher’s Info
Mind/Iron
Bio-Feedback
Rubberbands
Robotics Showcase
GeerHead
Events Calendar
Menagerie
SERVO Bookstore
Brain Matrix
New Products
Ask Mr. Roboto
Advertiser’s Index
Robytes Robotics Resources Appetizer
Take a Sneak Peek!
Check out our new column dedicated to hacking robots to do things they were never designed to do — but can! Twin Tweaks Witness the ups and downs involved in transforming a four-legged walker into a biped.
SERVO Magazine (ISSN 1546-0592/CDN Pub Agree#40702530) is published monthly
for $24.95 per year by T & L Publications, Inc., 430 Pri Prince ncelan land d Cou Court, rt, Cor Corona ona,, CA 928 92879. 79. APPLICATION TO MAIL AT PERIODICALS POSTAGE RATE IS PENDING AT CORONA,
See what the st ylish ylish RSs ear r ing! RSs are w ea e ar
CA AND AT ADDITIONAL ENTRY MAILING OFFICES. POSTMASTER: Send address changes
Coming 2.2005
to SERVO SERVO Magazine, 430 Princeland Princeland Court, Cou rt, Cor Corona ona,, CA 92 92879 879-1 -1300 300 or Station A, P.O. Box 54,Windsor ON N9A 6J5.
[email protected]
4
SERVO 1.2005
SERVO
1.2005 VOL. 3 NO. 1
Features & Projects
17
BEAM Robotics, Part 4: Seeking the Light by Thomas Gray and Wolfgang Goerlich
23
Hack-a-Sapien: Sci Fi Becomes Reality by Jamie Samans
29
Hack-a-Sapien Contest Winners
31
Bot Brain Basics by Kerry Barlow
39
Navigating Robo-Magellan by Daryl Sandberg and Larry Geib
43
Virtual Vir tual Robotics Robotics by Thomas Braunl, Andreas Koestler, and Axel Waggershauser
51
IR Remotes for Your Robot by Karl Williams
SERVO 1.2005
5
Published Monthly By The TechTrax Group — A Division Of T & L Publication Publications, s, Inc. 430 Princeland Court Corona, Corona, CA 92879-1300 92879-1300
(951) 371-8497 FAX (951) 371-3052
www.servomagazine.com
Mind / Iron
Subscription Order ONLY Line 1-800-783-4624
by Dan Danknick
There are some things we were not meant to know. Fortunately — in the area of robotics — this is not the case. Each year brings new advances in the art, borne on the back of previous accomplishments. Some of these achievements are incremental and some are major shifts in current design paradigms. Either way, things move forward. In the past year and a half of interviewing various robot protagonists, interacting with robot clubs, and observing the research money that companies spend, I have made some predictions of the hot topics for 2005. Active sensors: In the December, 2003 issue of SERVO, we published a project on an active sonar mapper. I wonder how many of you built this and integrated it into your room-exploring robot? It's easier to learn about your environment if you send out a known pulse and then measure the return signal, inferring environmental features from how it is modified. We need more research in this area — and that is why many large companies are working on such devices. As Guy Marsden's project demonstrated, the typical robot hobbyist can also jump in. Locomotion gaits: Not every robot rolls on wheels — some walk. When constructing a walker, the builder needs to implement a gait or sequence in which the legs move to affect motion. Consider a horse: it walks, trots and gallops — three different gaits, each uniquely suited for a different application. As walking robots gain in popularity, the two-, four-, six-, and eight-legged machines will necessarily require different gaits. In the September 2004 issue of Nuts & Volts , author Mike Keesling demonstrated a number of different gaits for the hexapod in his
column. Which is best? A clearer definition of this question leads us to the answer. Better power supplies: Better battery technologies allow longer run times and more complex behavior by providing energy for more motors and sensors. This increases the overall functionality of robots and extends the "design cap" of projects. You should be taking advantage of the hot new batteries as much as you take advantage of new R/C servos and advanced math routines on CPU boards. Better competitions: From the start of the “Mind/Iron” column, I've encouraged robot clubs to move on to more clever competitions. Some have stepped up to the plate with ribbon climbing and SRS' Robo-Magellan. This trend will continue as the excitement of tackling new challenges continues to spur builders. Ultimately, that's the future of 2005 in our avocation — staring down challenges with good designs. We are up to our ears in cheap CPU processing, low cost sensors, low weight frame materials, and the like. It's time to step into the game and make robots that solve new problems. I know my words would fall flat if I didn't also take up that challenge and that's why this is my last “Mind/Iron” in SERVO. I've accepted an engineering position at a top-notch R&D company, where I'll be designing and building robots to solve some of the big problems we face in the world. It's a tall order, but it's what all my years in the field have given me — the ideal toolkit for the task. I encourage you all to make the most of what you know and use it as best you can. As mathematician René Descartes said, "It is not enough to have a good mind. The main thing is to use it well." SV
PUBLISHER Larry Lemieux
[email protected] ASSOCIATE PUBLISHER/ VP OF SALES/MARKETING SALES/MARKETING Robin Lemieux
[email protected] MANAGING/TECHNICAL EDITOR Dan Danknick
[email protected] ASSOCIATE EDITOR/ PRODUCTION MANAGER Alexandra Lindstrom
[email protected] CIRCULATION DIRECTOR Mary Descaro
[email protected] WEB CONTENT/STORE Michael Kaudze
[email protected] PRODUCTION/GRAPHICS Shannon Lemieux COVER ART Michele Durant STAFF Kristin Rutz Dawn Saladino INTERN Mandy Garcia OUR PET ROBOTS Guido Mifune Copyright 2005 by T & L Publications, 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 SERVO. 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 claims,, action, action, or expense expense arising arising from from SERVO. Please advertising placed in SERVO. Please send send all all subscr subscript iption ion orders orders,, corre correspo sponde ndence nce,, UPS, UPS, overnight overnight mail, and artwork to: 430 Princeland Court, Corona, Corona, CA 92879.
6 SERVO 1.2005
Dear SERVO, You folks have been terrific in providing copies of SERVO for our students in BEST ROBOTICS. Thank you so much for that!!! Robert Steele Steele via Internet Dear SERVO, The Tetsujin exosuits in the December 2004 issue are incredible! How can I find out more about them? Tony Schnyder via Internet Dear Tony, We promised you “ongoing Tetsujin coverage” and we’ll deliver! Keep reading over the next few months and you’ll find in-depth articles about the suits, the builders, and the motivation behind Tetsujin Tetsujin 2004. Editorial Dept. Dear SERVO, In the December 2004 issue of SERVO “Robotics Resources” article by Gordon McComb on Metalworking 101 on welding and other metal fusing techniques, he incorrectly states that 110 volt welders are, "limited to welding fairly thin sheets of metal — down to about 12 or 14 gauge." I happen to own a Millermatic 135 MIG welder that plugs into a standard 110 V wall socket. You can easily weld up to 1/8" stock with it and — if you're good — 3/16". The importance of him missing this fact is that a 110 V MIG welder is a versatile and powerful tool for the
home hobbyist. It is inexpensive, easy to operate, and produces high quality welds for steel or aluminum. 220 V MIG welders are much more expensive and are more for commercial applications. You can also get a low end AC stick welder like a Sears "buzz box," but they require a 220 V plug (I don't recommend the 110 V). The advantage of stick welders over MIG is they can weld through rust and paint, in addition to their ability to weld thicker metals. The disadvantage of stick welders is they require a lot more skill than a MIG does to produce a good bead. If you're going to weld clean metal surfaces, go with MIG. Also I have two more suggestions for your readers: 1. Get a good book on welding. One such book is New Lessons in Arc Welding by The Lincoln Electric Company. It's only $10.00 and can be ordered from their website: https:// ssl.lincolnelectric.com/lincoln/apdi rect/item.asp?prodnum=L 2. Welding requires lots of practice. Take a class before you buy a welder. Many regional technical schools offer welding classes at night. At these classes, you get hands-on experience with many types of welders. You will learn how to weld and get a good idea of which welder is best for you. Tony Rea via Internet
What kinda bot do you got? Do you think your bot is cooler than what you see here every month? Prove it! Earn bragging rights by having your creation highlighted in our Menagerie section! Send us a high res picture of your robot with a brief description and we’ll make mak e you famous. famous. Sort of.
[email protected] Circle #109 on the Reader Service Card.
7
by Jack Buffington
Putting on a Display: Spicing Up Your Robot With an Alphanumeric LCD
ne of the most frustrating things about working with microcontrollers is that they don’t have a nice display like standard equipment, like your desktop computer does. In fact, most of the time, all that you will have available is a couple of LEDs to look at to try to determine what is going on inside of it. Figure 1. Pin functions for the LCD module.
Sometimes, you will have a free serial port available that you can send data to a terminal program, but — if your robot is mobile — you will inevitably want it to roam freely so a serial link isn’t a great option. This month’s column will show you how to connect to an inexpensive alphanumeric LCD display that uses the HD44780 driver chip hooked up to a PIC processor so that you can have text-based feedback from your electronics, wherever your robot may be. The HD44780 chip is capable of driving LCD displays of up to two lines of 40 characters. For this column, an LCD that has four lines of 20 characters each was chosen. This particular LCD accomplishes this by splitting each line of 40 characters into two lines of 20 characters. If you are interested in working along with this column, you can find the exact module used here at www. 153640P.. At $9.95 each, mpja.com The part number is 153640P you really can’t beat the price! The LCD module that is used in this column has 11 I/O pins. This is standard for modules using the HD44780. Figure 1 shows the pin functions for the module used here. You can communicate with it by using eight of the I/O lines in parallel to send bytes of data or you can discard four of them and use a four-bit interface instead. Here, we’ll use the eight-bit interface. Although
RESOURCES I/D
S
Result
0
0
Move Movess the the curs cursor or to the the lef leftt aft after er a cha charracte acterr is is dis displ pla ayed. ed.
0
1
Curs Cursor or sta stays at the the sam same e loc locat atio ion. n. Line Line shif shifts ts to the the rig right ht..
1
0
Move Movess the the curs cursor or to the the rig right ht afte afterr a char haracte acterr is is dis displ pla ayed. ed.
1
1
Curs Cursor or sta stays at the the sam same e loc locat atio ion. n. Line Line shif shifts ts to the the lef left. t.
Figure 2. I/D and S truth table.
8
SERVO 01.2005
www.ccsinfo.com Sells the C compiler for PIC processors used in this column www.microchip.com Manufacturer of the PIC microcontroller www.mpja.com Sells the LCD module used in this article
Rubberbands and Bailing Wire it is wasteful of I/O pins on a microprocessor, it makes the source code more readable. If you were to choose to use the four-bit interface, you would simply send the same commands as shown here, except that you would send the high nibble of the byte that you wanted to send and then follow it with the low nibble. There are three other pins that are exclusively inputs. These are E, RS, an d R/W. E is the line that you use to signal to the chip that you are sending it data. Data is loaded into the chip on the falling edge of E. RS is the register select line. You can choose between sending commands that change how the display driver acts or sending data that is written to one of the display driver’s registers using this pin. R/W selects between read and write. For the most part, you will be writing data to the driver more often than you will be reading it. Still, the option is there, so — if you happened to be a hot-shot programmer who was running low on RAM — you could command the display to turn off and use its internal registers to store up to 88 bytes of RAM! The HD44780 has just a few commands that you need to know (see Table 1).
TECH TIDBIT Do you use a lot of LEDs in your projects? With most LEDs, you need to have a resistor in series in order to keep the current through the LED below a certain threshold. It is a pain to wire up all of those resistors. A simple solution that lets you avoid this problem is to use an LED that has an integrated resistor.
Connecting the Display to Your Electronics In this column, a PIC16F870 is being used, but — if you happen to be using a different processor — the connections will be essentially the same. You will need an eight-bit I/O port and three other pins for the E, RS, and R/W outputs. Figure 3 shows how you would connect the display to your circuit. For this display, there is a connection labeled VO. By adjusting the voltage supplied to this pin, you can adjust the display’s contrast. In practice, it turned out that simply connecting this pin to ground
Table 1 RS
R/W
Data
Comments
0
0
00110000
Allows you to clear the display. display. It also moves the cursor back to the first character of the first line.
0
0
00000010
Will move the cursor back to the first character of the first line, but will not clear the display.
0
0
000001 I/D S
Allows you to set the way that the LCD display responds to new characters that it receives. The I/D bit allows you to specify whether you want the character position to increment or decrement when you send it a character. character. The S bit allows you to specify if the whole line should shift or if the cursor should move. Figure Figure 2 describes how the display will act based on the I/D and S bits.
0
0
001 DL DL N F 00 00
Allows you to set in information about the LC LCD that the controller ch chip is connected to and how you want to communicate with it. DL lets you choose between (1) an eight-bit interface or (0) a four-bit interface. N lets you set the number of lines that the LCD can display. A 0 represents one line while a 1 represents two lines. The F bit lets you specify either (1) a 5 x 8 pixel character or (0) a 5 x 10 pixel character. Most likely, the LCD display that you will be using will have a 5 x 8 character.
0
0
01DDDDDD
Lets you set the character generator address. Substitute the Ds for the address that you want. The HD44780 allows you to specify eight custom characters, characters, if you want. Their bitmaps are stored in the character generator RAM.
0
0
1DDDDDDD
Lets you set the display da data address. Th The di display data R AM holds the text or or characters that you want to be displayed on the screen. This data is the character codes and not the actual bitmaps for the characters.
0
1
BF DD DDDDDDD
This command switches the display’s input pins to outputs for as long as the E line is held high and then makes them inputs again when the E line is brought low again. While these lines are outputs, the BF bit tells you when the display is busy executing the last command. If it is high, the display is busy and you shouldn’t send other commands to it until it is done. The remaining
outputs indicate the location of the address counter. This is how you could retrieve the character codes of what is displayed on the screen.
SERVO 01.2005
9
Rubberbands and Bailing Wire
Table 2 Steps • Wait at least 15 milliseconds after power-up
before doing anything. • Send 00 00110000 by placing this data on the output lines and then raising and then lowering the E line. • Wait at least 4.1 milliseconds. • Send the same command by raising the E line and lowering it again. • Wait more than 100 microseconds. • Once again, send the same command by raising the E line and then lowering it. • Send the function set command. • Wait for the command to finish by checking the Busy flag or by simply waiting long enough. • Send the Display command. • Wait for that command to execute. • Send the cursor movement command. • Wait for that command to execute.
RS —
R/W —
Data —
0
0
00110000
— —
— —
— —
— —
— —
— —
0 —
0 —
001 DL N F 00 —
0 — 0
0 — 0
00001DCB — 000001 I/D S
Figure 3. Connections between a PIC and the LCD module.
10
SERVO 01.2005
provided the best contrast. The higher the applied applied voltage voltage,, the dimmer dimmer the display was.
Making the Magic Happen Before you can start to use the display, you will have to initialize the HD44780 driver chip. You will have to send a number of commands. For each command, you will place your data on the eight-bit port and the RS and R/W lines, raise the E line, and then lower it again after a shor t delay. Initialization can be done by following Table 2. Your display should be initialized now and you could go ahead and start sending ASCII character codes to be displayed. If you are using a one or two line by 40-character display, then everything will work as expected and the lines will break as they should. The display used in this column broke each line up into two lines of 20 characters, so you have to be careful that you don’t send more than 20 characters in a row or else the cursor will likely jump to a place where you don’t want it. Figure 5 shows the map for the display used here. As you can see, when the cursor hits the end of the first line, it will jump to the beginning of the third line and — after it reaches the end of the third line, it will go to the second — then the fourth. That’s not quite intuitive. I’ll show you how to more easily deal with that a little later. For now, let’s look at how to send characters to the display. Figure 6 shows a chunk of C code that lets you do this. When sending any command to the display, the procedure is to set up all of your output pins and then raise the E line. Although it
Rubberbands and Bailing Wire isn’t covered in the documentation, it appears to be necessary to wait a few microseconds to let the data settle before lowering the E line again. After that, you will need to wait until the display has processed that command. This is what the lcdBusy() routine is doing. Figure 7 shows the lcdBusy() code, which will delay until a character or command has been processed. You now have the ability to draw characters to the LCD. Let’s take a look at the issue of the lines being jumbled and how you can specify where on the display you would like to draw a character. Figure 8 shows code that will work for the display being used in this column. You may need to adjust the algorithm to match the display that you end up using. Now, you have the ability to draw any character anywhere on the screen, but it can be a little tedious to write the code to do it. This final example will show how — by using the printf() statement — you can reduce what would be a long series of statements into just one line. Every compiler works differently, but the CCS C compiler for the PIC allows you to specify a routine that takes eight-bit variables as the receiver of the data from a printf() statement. This drastically simplifies the task of writing to the display and allows you to do things like printf(lcdPutChar,”Button presses:%u”,presses); where you want to display numeric data.
Dotting the I’s and Crossing the T’s
void lcdInit(int1 showCursor) {// gets the display driver chip ready to display characters delay_ms(16); output_low(E); output_low(RS); output_low(RW); portB = 0b00110000; output_high(E); delay_us(20); output_low(E); delay_ms(5); output_high(E); delay_us(20); output_low(E); delay_us(110); output_high(E); delay_us(20); output_low(E); delay_us(50); portB = 0b00111000; delay_us(20); output_high(E); delay_us(50);
// 8 bit bit operation, 2 lines, 5x8 character
output_low(E); if(showCursor) // send command for how the cursor acts portB = 0b00001111; else portB = 0b00001100; delay_us(20); output_high(E); delay_us(50); output_low(E); portB= 0b00000110; 0b00000110; delay_us(20); output_high(E); delay_us(50); }
// move cursor to right, don’t don’t shift
Figure 4. How to initialize the LCD using C code. display. Figure 5. Map of the LCD’s display.
Throughout the code presented here, you will see statements like output_high(E);. If you were to use this code in a program, you would want to stick the statements at the beginning of your code (see Figure 10). Figure 6. How to send a character to be displayed.
void lcdPutChar(int8 theChar) { output_high(RS); output_low(RW); output_high(E); portB = theChar; delay_us(20); output_low(E); lcdBusy(); } SERVO 01.2005
11
Rubberbands and Bailing Wire TECH TIDBIT Wires are a major source of failure in electronic projects. Wires tend to break off right where they are soldered to your circuit board. It is always best to try to reduce the number of wires that will be necessary, but for wires that you absolutely need, here is a trick that will keep them from breaking: Lay your wire against the board after it has been soldered. Using some E-6000 glue — which can be bought at many craft, hobby, and hardware hardw are stores stores — put a dab of glue over over where the wire comes out of the board. E-6000 takes a while to dry, but — when it does — it is like hard rubber. Attaching the wire to the board in this way makes it so that any wiggling of the wire happens at a point where there is insulation on the wire, which significantly increases the longevity of the conductor inside.
void lcdBusy() {// delays until LCD indicates that it is not busy set_tris_b(0b11111111); // make LCD pins all inputs output_low(RS); output_high(RW); output_high(E); delay_us(10); // give the display some time to output while(input(BUSY)) {// do nothing } output_low(E); set_tris_b(0b00000000); // make LCD pins all outputs delay_cycles(2); } Figure 7. Code that waits until the display is done processing the last command.
program will run on or maybe because you need to use a peripheral that has its pins currently tied up by something else in your program. If you didn’t use the #define statement, then you would have to go through your code and manually change every Using #defines is a good way to program because it reference to that pin. allows you to quickly rearrange your I/O connections if you Adding an alphanumeric display to your project has need to. This can a certain cool factor to it, as well as an immediately useful Figure 9. The first 10 lines and the be handy if you ability to instantly get feedback about what your robot is printf statement do the same thing. are switching the doing internally. internally. processor that your Overall, this is a relatively easy part to add to your robot LcdPutChar(‘L’); and is well worth the effort. LcdPutChar(‘C’); LcdPutChar(‘D’); Figure 10. #define statements for the Next month’s column will cover LcdPutChar(‘s’); various LCD pins. some more advanced things that you can LcdPutChar(‘ ’); do with an LCD display that should be LcdPutChar(‘r’); #define E PIN_C0 // enable immediately useful to you — such as creatLcdPutChar(‘u’); #define RW PIN_C1 // read/write LcdPutChar(‘l’); ing your own characters, drawing bar #define RS PIN_C2 // register LcdPutChar(‘e’); graphs and sliders, and then using one select LcdPutChar(‘!’); #define busy PIN_B7 // busy flag of the bar graphs to give you visual feedfrom LCD back about your robot’s battery’s voltage. printf(lcdPutChar, “LCDs rule!”); SV
Figure 8. Code to move the cursor to where you want it.
void lcdMoveTo(int8 line, int8 character) {// move to the position on the display that was specified int8 position; if(line == 2 || line == 4) // If you want the second or fourth line position = 0b11000000; // on the the LCD, select the second line in else // the driver’s memory. position = 0b10000000; if(lin if(line e == 3 || || line line == 4) 4) // If you want want the the third third or or fourth fourth line line position += 20; // on the LCD, add 20 because these lines posi positi tio on += += ch charac aract ter; er; // are are act actua uall lly y th the se second cond hal halfs of the the output_low(RS); // driver’s two lines. output_low(RW); portB = position; output_high(E); delay_us(20); output_low(E); lcdBusy(); }
12
SERVO 01.2005
Figure 11. Although not robotic, this is a fun application that uses an LCD.
Earn an Associate Degree from HOME! Cleveland Cleveland Institute of Electronics • Electronics & Computer Training Programs • Nationally Accredited • Affordable Tuition / Military Militar y Tuition Assistance
Cleveland Institute of Electronics offers distance learning programs that will prepare you for rewarding careers in Electronics Engineering or Computer Technology - even if you have no experience! experience! CIE's courses allow you to learn new technology at your own pace, in your own home, without disrupting your present job or lifestyle.
CIE’s Distance Learning Programs • Electro Electronic nicss Associa Associate te Degree Degree • Comput Computer er Assoc Associat iate e Degree Degree • Basic Basic Elect Electron ronics ics with with Lab • Advanced Advanced Electronic Electronicss Trouble Troubleshootin shooting g with Lab • Electronics Electronics Technolo Technology gy with FCC FCC Preparation Preparation
No prior experience is needed and you can do all your training at home with full f ull instructor support, extensive learning labs and on-line exams.
• PC Trou Troubl blesh eshoo ooti ting ng
They're fast, convenient, affordable affordable and quickly becoming the new way to earn an accredited degree.
• COMI COMING NG SOON SOON!! Industrial Electronics with PLC Technology Technology
Send for your FREE CIE course catalog and take the first step toward building a successful career in electronics and computer technology. You’ll You’ll find it has many rewards!
Call (800) 243-6446 or visit
• Compute omputerr Netwo Networki rking ng • Wirel Wireless ess Technol echnology ogy
Cleveland Institute of Electronics 1776 E. 17th St, Cleveland, OH 44114
www.cie-wc.edu for a FREE Career Catalog! Catalog !
CD ROM & Certificate Training Training - CIE Bookstore Introduction to Multimeters
Introduction to Compute Computers rs
Soldering Course with Lab
2 meters • 4 lessons • 13 experiments 02-069 (Pictured) cert .......... $195
9 lessons • certificate 01-IN01 ......................... ...................................... ............. $195
3 lessons • lab • video 01-SD01 (cert) ......................... ......................... $195
FCC License Prep Course
Basic Electronics Course
PC Board Design with Lab
19 FCC prep lessons on CD ROM. 01-FCC01 (cert) ................... ................... $49.95
39 lessons • 2 labs • 53 exercises 03-Introb (cert) ....................... ....................... $225
4 lessons • lab • CD ROM 02-261 (cert) ........................... ............................. $195
Fiber Optics Course with Lab
Oscilloscope Course
Intro to Information Systems
2 lessons • Lab • Video • Certificate 01-FB02 ......................... ..................................... ............ $175
7 learning topics • video 01-SCP01 (cert) ......................... ......................... $95
9 lessons • certificate 01-CET111 .......................... ................................ ...... $195
FREE CIE BOOKSTORE CATALOG • www.ciebookstore.com • (800) 321-2155 Circle #82 on the Reader Service Card.
SERVO 01.2005
13
by David Geer
[email protected]
Mini metal muscle and brilliant minds appear together in this shot of the Mine Miner and its designers: (L to R) Dat Truong, project sponsor Carl V. Nelson, Edoardo Biancheri, Dan Hake, and Landon Unninayar.
Tiny, but Mighty! Small Bot Saves Lives by Marking Land Mines!
Uncle Sam and Others Are Looking for a Few Good Robots ast spring, four students at Johns Hopkins (JH, Mechanical Engineering Department) completed a robot that can travel, locate metal objects, see, and spray paint. What’s the big deal? With these capabilities, it becomes a plausible solution for detecting and marking deadly land mines that are waiting underground in far away battle
L
14
SERVO 01.2005
zones around the world. The bots, which can be built for under $1,000.00 a piece (in production), traverse the grassy or jagged terra firma found in war zones like little two-part tanks. A metal detector — to be replaced by top-notch sensors developed at JH — locates suspected land mines. The robot’s camera eye sends
back pictures of the target, which can be manually spray painted from the controller and later neutralized. The little mine detective is in the welcome hands of explosive detection scientists. They are using it as the * All All photos are courtesy of Will Kirk. *
GEERHEAD model for an effective, inexpensive solution to help circumvent the 24,000 mine deaths and maimings that occur each year. (Over 100 million mines from as far back as WWII surround the globe, still undetected and fully capable of the job they were initially planted for.) for.)
Land Mine Detection, Project Inception
Rugged bot mine detective finds its prey — a metal target that represents a land mine — in a test demonstration.
The story began when John Hopkins physicist Carl Nelson presented the student engineers turned robotics team with a problem. He had created these great new sensors targeted at detecting land mines, but he needed an appropriate contraption to get the sensors through the brush, rocks, and sand to the mines. The students were tasked with creating a mini-off-roadingall-terrain robot that could get to the mines without being blown up itself.
Robot Dud On its maiden test run, the minedetecting bot looked more like one of its exploding adversaries than a proponent of protection. protectio n. When the student roboticis roboticists ts first attempted to run the rascal via the joystick, they got no movement and a load of melted connectors. They found out that their supplier had shipped the wrong motors; the
current demanded by the ones they did get was beyond the capacity of the connectors. The team ended up scrapping those motors and finding new motor and gearbox pairs.
Robot Racer With the “front vehicle” — more on that later — ready to go, the team tried again. The new, high torque drill motors worked perfectly. The bot zoomed around the lab, navigating all terrains — including people’s toes. The bot’s operator had the vehicle spin brodies like a racecar. The mini-tank-like vehicle could spin in place at 60 RPMs. The vehicle was detailed with an inverted cow catcher up front to move obstacles out of its camera’s path. The robot’s design was dictated by the requirement that it not set off the land
This effective controller guides the robot and receives video from its camera eye, sounding the alarm when a metal object — possibly a mine — has been detected.
mines. The paint used to mark the spot where each mine is located is a very light and, yet, a very easily recognized The eyes have it as the robot camera enables the operator to have a glimpse of everything the bot itself sees.
CONSTRUCTION The mine-detecting robot looks like two robot tanks — one towing the other. The front vehicle moves the bot by means of its two cordless power drill motors, which are powered by a sealed lead-acid battery. This front vehicle is topped off with a color video camera, which lets the bot’s operator see what it sees. The rear vehicle carries the metal detection coil that is used at this experimental phase to detect the land mines (in this case, metal objects that are surrogates for the mines themselves). This detection device was scavenged from a common consumer treasure hunting
product; it will be replaced by Professor Nelson’s specialized mine-seeking sensors in the funded research research phase. The rear vehicle also carries the paint and paint nozzle for marking mine locations. At this point, the mechanism can only house enough paint to mark about 40 mines before it needs a refill — but that’s still four times the minimum requirement for the project. Keeping a Safe Distance
A joystick controller steers the bot from up to 500 feet away. The video
feed can be received from up to 100 feet away. The controller video screen can display real time images of what the bot sees. When the bot detects metal, an alarm — a beep — sounds in the operator’s headset. The operator must throw a switch on the controller to mark the place where the metal detector reacted. The bot was constructed using plastic and other non-metal parts in order to save on weight, costs, and false positives from the bot detecting itself instead of the mines. The two part front and rear vehicle design spreads out the robot’s weight so that it is less likely to set off a mine. SERVO 01.2005
15
GEERHEAD
The controller can steer the robot while operators steer clear, up to 500 feet away. Video transmissions reach out up to 100 feet from the bot’s camera.
RESOURCES Low-res versions of pics in this article and more at: www.jhu.edu/news_info/news/ home04/jun04/mines.html and www.jhu.edu/news_info/news/ home04/jun04/mines2.html Robotic Mine Detector, Project Video at: www.jhu.edu/news_info/news/ audio-video/mediamines.html Johns Hopkins Department of Mechanical Engineering at: www.me.jhu.edu
Tank-like Tank-like treads enable mobility through tall grass, rugged terrain, and any place mines may be laying in wait for their next victims.
shade of yellow.
constraints they had to work with.
Finishing Touches
Lessons Learned
The young roboticists wanted their machine to look as cool as it ran. The students chose an all-black construction and appearance (where possible). They worked diligently to cut and attach black acrylic sheets on the back where there were still some clear panels showing. The roboticists also machined all the applicable parts themselves. The four shared in the cutting, drilling, gluing, sanding, mounting, and CNC programming for the project. Maintaining this added project control gave them an edge in creating exactly what they wanted within the time
The type of laser cutter that Johns Hopkins made available for the mechanical engineering class and the Polycarbonate that was being used did not mix. The combination created chlorine gas. One of the young engineers discovered the hard way how easy it is to have drill bits break on you and have the pieces come flying at you, hitting you in the forehead. The roboticists also suggest that anyone engaging in similar projects test, break, rebuild, test, break, rebuild, and repeat until not broken; this is the best way to find your path to a solution. SV
TIDBITS Yes, the four robotics engineers in this story have names; all but one have graduated now. Landon Unninayar, Dan Hake, and Dat Truong were seniors working on this project before gradua tion. Edoardo Biancheri planned to have completed his undergraduate studies in December ‘04, with a double major in mechanical engineering and economics. These young men were tasked with building this successful bot project for under $8,000.00; they did the job with about $5,000.00 and believe it could be mass produced for under $1,000.00 — less the cost of better sensing. Professor Nelson will soon have demonstrated demonstrated this
16
SERVO 01.2005
prototype to US Army funding sponsors to establish how an inexpensive minedetecting bot could help prevent death and dismemberment from land mines around the globe. Challenges
Building a life saving bot is not a goal without its obstacles. The biggest one the crew reported was making a pressurized paint sprayer out of almost 100 percent plastic materials. The requirement included being able to mark at least 10 mines before the sprayer went empty. There are no commercial sprayers
that meet all the specs they needed to meet. So, the team set out to design and test their own. They started by looking at both Polycarbonate and soda bottles. Ultimately, a Polycarbonate bottle was found that would fit all constraints. The only remaining spec was the pressure test. How did they test it? They filled it with water, suited it up with gas fittings, and pumped it up with a bike pump until it started to leak. At first, leaks came from the pipe fittings. Then, those leaks were fixed and the cap broke off the bottle and shot out about 60 psi of water. Once they dealt with the weaknesses in the cap, the paint container was complete.
by Thomas Gray and J. Wolfgang Goerlich
T
his is the final article in “BEAM Robotics Step-by-Step.“ During this series, we have touched on some of the central themes in the BEAM (Biology, Electronics, Aesthetics, and Mechanics) design philosophy: • Keep it simple; minimize everything from cost to par t count to power consumption. • Use basic circuits to simulate biological nervous systems and pattern generators. We designed this final robot to illustrate these ideas while tossing in a couple more BEAM bits.
Walking and Tumbling
Turbot is upside down. A Turbot can maneuver in much the same way as a walker can. It can turn on the spot, climb up and over obstacles, and traverse rough terrain, yet it only requires two motors. Since motors cost a lot and draw a lot of power, fewer motors mean lower cost and longer battery life. Also, the mechanics of a Turbot are simpler than those of a walker and do not require much balancing or tweaking in order to work properly. Simple and low power, cheap and versatile — classic BEAM!
Step 1: What’s Nu? The Nu (pronounced “new”) Neuron looks like a Nv Neuron with its resistor and capacitor mixed up. See Figure 1 for a side-by-side comparison. There’s nothing to it, but — as with so many BEAM circuits — the resulting change in behavior exceeds the minor part change. When we say that the Nv Neuron is “nervous,” we are being a bit cheeky. The Nv Neuron is an edgy neuron, trigger happy, and all the other silly puns. The Nv Neuron immediately sends an output pulse when an input impulse comes in. There’s no waiting around — the Nv Neuron fires immediately, holds the output for a time, and then
At one time or another, every every kid has spent an afternoon poking and prodding insects. It is amazing how bugs move around, handling rough environments. Walking robots — especially quadrupeds and hexapods — can handle rough terrain better than wheeled or tracked vehicles. However, However, while there have been great improvements in walking robots, they still lag far behind the tough-shelled bugs! One particularly tough problem faced by walking robots — whether they are BEAM or microprocessor driven — is what to Figure 1 . Comparison of the Nv and the Nu Neuron. do when they fall over. A unique type of BEAM robot called the Turbot has no problem being inverted because it spends half its time upside down! A Turbot moves by flipping itself using rotating flagella instead of legs. A Turbot doesn’t exactly walk; it scoots and tumbles. It’s a bit tricky to give a Turbot directionality (having it head toward a light, for example) because — every time the bot flips over — the motors are effectively reversed and a different side will be facing the light. What we will need, then, is a circuit to decide which way to go (“Which way is brighter?”) and another circuit (“Which way is up?”) to invert the decision when the
SERVO 01.2005
17
BEAM BEA M Robotics Robotics Step Step by Step — Par Partt 4 Figure 2 shows the schematic for a single Nu. The first part of this circuit is the Process Initialization Circuit from the first article in this series. We have also added an indicator LED to show what’s going on. Breadboard this circuit (Figure 3) and try different resistors and capacitors. Be sure to try the circuit without the 100K (1K in the photo) pull-down resistor. Add an Nv to trigger the Nu or take the first Nu to another neuron and see how they work in chains. Play and have fun. Uh, we mean experiment and gather data. Figure 2 . Nu with indicator LED and PIC.
shuts down. down. The time period is determined by the Nv’s RC Time Constant. Again, this sets the time in seconds equal to the resistance in megohms times the ca pacitance in microfarads. T=RxC 4.7 seconds = 1 M x 4.7
µF
The Nu or “Neural” Neuron waits a bit before deciding to switch. It receives a high input signal, waits around for a time period (again determined by its capacitor and resistor), then turns on and stays on until the input goes low again. If the Nu does not receive a low reset signal to its bias point, it will stay active. Basically, you are charging a capacitor through a resistor. The capacitor takes time to charge up — again determined by the RC constant. When the capacitor’s charge passes the ’240 switching threshold, the inverter will flip and send a low pulse. The Nu is said to be active. When the Nu input changes to Gnd, the inverter flips back to high and the Nu is inactive. breadboard. A 4.7 mF electrolytic Figure 3 . The Nu on the breadboard. capacitor (watch polarity) and a 1M resistor give a delay of about 5 seconds.
Step 2: Muxing Around Often, it is helpful to be able to reverse a Nu or Nv output, in order to change the motion of a robot. To To do this, we will use a gadget called an Inverting Multiplexor or IMx (pronounced “eye-mux” or just mux) that can be built with one half of a 74xx240. For our Turbot, this means that we can stick the entire circuit on a single IC c hip, keeping the parts count down and keeping life simple. In Figure 4, Enable (A) is the enable line, which is normally held high (off) in this case by the 100K resistor, but can be sent low (turned on) by a push-button switch. Input (B) normally comes from some neuron output; the 470 Ω resistor holds the input high through the LED. If A is high, then the inverter is turned off; the signal (B) is passed through R1 to the Output (C) via the output LED. In this case, C is the same as B and both LEDs glow. Push the button to set A to low, though, and the inverter turns on. Since the resistance of the inverter is less than R1, the inverted signal takes this path and the output is the opposite of B. The input LED remains on, but the output LED goes out. The IMx acts as an Exclusive Or (XOR) gate. Some BEAM robots will use an XOR chip to get the same results. The Solarbotics Scout Walker, for example, uses two gates on a 4030B quad-XOR chip.
Step 3: Putting the Pieces Together Figure 5 shows the Tumbler schematic. If you study the photos, you’ll see indicator LEDs that have been left off the schematic for simplicity. However, previous articles have shown where these LEDs go and you are welcome to add them to your project. The diagram shows a 74HC240 for power efficiency, but a 74AC240 works just as well.
A LITTLE BIT OF INFO Mark Tilden built the first Turbot after being inspired by Alan Turing’s state machines (Turbot = TURing + roBOT). A couple of his delightful solar-powered Turbots are shown in Figure 10 (photo courtesy of Solarbotics, Ltd.).
18
SERVO 01.2005
Tumbling Turbots Pace-maker:
A Bicore, which we looked at briefly last month, sets the pace for the Tumbler. The grounded Bicore is an oscillator that sends regular pulses. The timing of these pulses is based on the RC constant of the Nvs. If the resistors and caps are well matched, the Bicore will have a 50:50 cycle. Remember that the two outputs of a Bicore are complementary: when one half of the Bicore is positive, the other side is negative, and then they switch. The optimal timing of your bicore will depend on your motors. Wolf used 6.8 µF caps, a 3M resistor for the tumble phase (RX), and 1M for the reset phase (RY) with his Solarbotics GM3s. Tom used 0.22 µF caps and 10M resistors on a prototype (not illustrated) that used video lens motors from BGMicro. Different timing will give different results and much of the fun is in training your own bot to give its best performance. The output of Nv(2,18) is fed to the bottom of a reverse-biased photodiode voltage divider, used in the first article of this series (August 2004 issue of SERVO, page 10). This PD divider determines whether the top or the bottom side is brighter. Running the photodiode divider from the pacemaker instead of from ground means it is turned on only when needed. The output of Nv(4,16) runs to the decision circuit that determines whether the left side or the right side is brighter. Again, it is turned on only when needed. This gives us a Turbot that repeatedly ponders two deep, existential questions: “Which way is up?” and “Which side is brighter?” AI, BEAM style.
Figure 4 . Inverting Multiplexor (IMx).
becomes active (goes low). Now, things start to get interesting. The high pulse from Nv(4,16) is fed to the Nu decisionFigure 5 . Tumbler Turbot schematic.
Decision:
A Nu, as we saw earlier, needs a high input signal to activate. When Nv(4, 16) is active, it sends a low signal to the Nus. Nothing happens. At this time, Nv(2, 18) will be inactive because only one Nv in a Bicore can be active at a time. The Nv sends a high signal to the photodiode voltage divider. Since both sides of the voltage divider are high, the mid-point is high and the signal sent to the IMx is also high. Again, nothing happens. After a while, Nv(4, 16) times out (goes high) and Nv(2, 18) SERVO 01.2005
19
BEAM BEA M Robotics Robotics Step Step by Step — Par Partt 4 like an inhibitory neuron. Whichever Nu decides to fire first is the only one that can fire during the current Bicore cycle.
FP PP PP
XOR IMx:
PP
At the same time that the Nus are deciding which side is PP FP brighter, the Turbot is deciding which side is up. We are driving the $OOKROHVGLD PP FP enable line using the same Photodiode setup used in the Bare Bones Photovore. Two reversebiased photodiodes form a voltage divider at roughly Vcc/2. More FP light on one photodiode raises or lowers the output voltage of the PP divider. In the Tumbling Turbot, this output is fed to the enable pin of FP Bank B. FP Nv(2,18) connects to the ground side of this voltage divider. FP When Nv(2,18) is inactive, the Figure 6 . The chassis plan. Use Sintra or PVC. divider is high and the IMx is disabled. The divider is grounded makers via the LDR. The brighter LDR with the lower when Nv(2,18) is active. The IMx’s state depends upon which resistance will have the shorter delay, so it will turn on (go Photodiode is receiving more light. The Turbot can then make low) first. A diode feeds this low signal to the bias point of the “Which way is up?” decision. the opposite Nu, immediately turning it off. This ensures that When the Turbot is right side up, we want the Nus to only one motor is affected. directly drive the appropriate motor. The bottom PD will be Let’s say the right CdS is brighter. brighter. Nu(8,12) will have the dark and the top will be light, so the enable gate will be high. shorter delay. It will fire first, its output will go low, and: The IMx will not be triggered. The active Nu input is passed right on to its motor drive transistor, turning the Turbot to a) It kills the pulse in Nu(6,14). one side. b) It passes a low pulse to the IMx. When the Turbot is upside down, we want the Nus to c) It remains low until the Nu is reset when the Bicore switches. drive the opposite motor. The top PD will be dark and the d) Only the motor connected to this Nu will run. bottom light so the enable gate is pulled low. The IMx triggers and inverts the Nu inputs. This means that the active Touching back on biomimicry, this cross-wired design is Nu signal is turned off and the motor on that side will not Figure 7 . Assembling the Tumbler: autopsy photo.
20
SERVO 01.2005
Figure 8 . Photo of Tom’s prototype.
Tumbling Turbots run; on the opposite side, the inac tive Nu signal is reversed so that its motor does run.
Step 4: Building the Tumbler Check out Wolfgang’s take on the tumbling Turbot. He’s used Sintra for the top and bottom shells (like a turtle) and wire ties to hold down the motors at an angle of about 120 degrees, as shown in Figure 8. (You can try anything from 90 to 180 degrees. Different angles give different patterns of movement). He has also added some non-skid rubber matting so the shell grips the floor during tumbling. The batteries and perfboard are neatly tucked inside. The flagella are brass welding rods (try old coat hangers — they’re easy to get!) held to the motor shaft with European-style terminal blocks removed from their plastic casings. A little heat shrink tubing on the ends of the flagella (one flagellum, two flagella, isn’t he a clever fella?) keeps them from scratching the floor, walls, or domestic livestock as they flail around.
A LITTLE BIT OF INFO Check these websites for more BEAM projects and information. Photographs of Mark Tilden’s Turbots: www.solarbotics.net/gallery/Turbots Solarbotics BEP Turbot: www.solarbotics.com/resour www.solarbotics.com/resources/static/bep/bep5 ces/static/bep/bep5_turbot.php _turbot.php
ABOUT THE AUTHORS Tom and Wolfgang connected online at http://groups. yahoo.com/group/beam/ and hope someday to meet face- to-face for coffee and conversation or perhaps a friendly mini sumo match.
Figure 9 . Photos of Wolf’s finished robot.
Grant McKee’s Turbots: http://grant.solarbotics.net/Turbots.htm Brett Hemes’ Solar-powered Turbot: http://breadboard.solarbotics.net/misc_03.html
Circle #118 on the Reader Service Card.
SERVO 01.2005
21
BEAM BEA M Robotics Robotics Step Step by Step — Par Partt 3 will flop its way into a pool of light. Be patient and swap the motor connections until you get it right.
Conclusion
Turbots, ts, courtesy of Solarbotics. Figure 10 . Mark Tilden’s Turbo
When you build your Tumbler, it may take a few tries to get the motors hooked up properly. You’ve got a one-in-four chance of hitting it the first time. What you want is a bot that
In this series of four articles on BEAM, we aimed to give you an introduction to the simplicity-within-complexity simplicity-within-complexity of this approach to robotics and a chance to create some fascinating little robots with relatively simple circuitry. If you have tried these projects and enjoyed them, experimented with them and extended them, or developed an interest in going deeper and learning more, then we’ve succeeded. succeeded. As Tom signs all his BEAM posts, “Keep BEAMing and dreaming.” SV
PARTS LIST Electronics
74HC240 (74AC240 in a pinch)
Texas Instruments SN74HC240N Fairchild MM74HC240N
Photodiodes Asst. LEDs
Siemens SFH 205f wide field Red, green, or yellow LEDs (We use standard LEDs on the breadboard and tiny LEDs in construction.) 4- 470 Ω, if desired, for indicator LEDs and a few in the 1M – 10M range Assorted, 0.1 µF to 6.8 µF range If electrolytic or tantalum caps are used, observe polarity. Any of various types should work. Try for a matched pair. 2N2907 or 2N3906, for example
Resistors Capacitors
CdS Photoresistor PNP Transistors Diodes Perfboard
Two small signal diodes, e.g., 1N914 or 1N4148 Perfboard or project board
Digi-Key 296-4305-5-ND Solarbotics 74HC240 Solarbotics 74AC240 Solarbotics IR1 Digi-Key 350-1347-1-ND Digi-Key 350-1348-1-ND Solarbotics TLED See text for details See text for details
Solarbotics CDS RS 276-2032 or RS276-2034 Solarbotics TR2907 or TR3906 RS 276-1122 or 276-1620 Solarbotics D1 Solarbotics BEP BB1 RS 276-0050 or RS 276-1395
Mechanics
Motors 6 V Power
Two matched hobby gear motors Two A A A batter y packs or one four-A A A batter y pack (You can use four- A A, if you wish. The A A As are lighter and smaller.)
Power Switch
SPST toggle power switch Use a slide switch, if you prefer. Euro-style terminal blocks (get the smallest ones)
Flagellum Connectors
Solarbotics GM3 RS 27-411 includes switch RS 27-413 x 2 RS 27-398 x 2 Solarbotics BHoldAAA x 2 RS 275-325 Solarbotics SWT2 RS 274-679
Misc.
Breadboard Body Wire ties Flagella Heat shrink tubing
22 SERVO 01.2005
Generic solderless breadboard and ties Use 3 mm Sintra or any suitable material Brass welding rod or old coat hanger Or rubber tubing / model aircraft fuel tubing
Solarbotics Any hardware store
n
his
landmark 1984 novel, receives audio from my PC (or any RoboSapien PC source), an upgraded stereo speaker Neuromancer , William Gibson wrote of Control Set-up a space station — he called it a “cluster” system, and an onboard stereo amplifier. — known as Zion. One of the characterUsing commercially available software istics of Zion that always interested interested me and a USB infrared transceiver, I have The PC control scheme I made for was its omnipresent music. Gibson also designed and implemented a RoboSapien uses MainLobby software writes that his protagonist, Case, customizable PC control interface. from Cinemar. The central, circular conboarded Zion and, “gradually became The result is an audio visual “rover” trol button cluster controls movement aware of the music that pulsed that can be controlled via PC and over and leaning. The identical circular conconstantly through the cluster. It was the Internet from a remote desktop. I trol button clusters in the top corners called dub, a sensuous mosaic cooked can connect to the robot from control each arm (up, down, in, out, from vast libraries of digitized pop.” anywhere and walk him around the macros for all the way up, all the way I first read Neuromancer in the late house to check on the surroundings. down, all the way in, all the way out, 1980s when I was in college and was Of course, I mainly use him and his and arm reset). Three small buttons also discovering Jamaican dub — spacey, hi-fi stereo backpack to fill my own run along the inside curve and are effects-laden instrumental versions of space station with “Zion dub.” macro buttons that can be assigned to reggae songs. To me, it was the perfect soundtrack for My dogs despise RoboSapien, especially since Here’s the 1 watt mono amplifier that I used I use it to keep tabs on them when I am away in the early stages of the project. For the Gibson’s futuristic vision. I was from the house! This image is captured from final project, I used a circuit based on the hooked and, today, my collecRoboSapiens’ own camera. stereo Phillips TDA7053A. tion of Jamaican dub records numbers in the thousands. What always intrigued me was how to make this music omnipresent ... until I thought up this RoboSapien hack.
The Hack My RoboSapien hack has several different components: audio, video, and control. I have outfitted the robot with a wireless camera, a radio frequency receiver that SERVO 01.2005
23
M
Hack-a-Sapien
Contest Contest Winner Winner
IR sensor. After you plug in the USB-UIRT for the first time, make sure to install the latest drivers. Girder is Windows automation software that is very popular with the HTPC crowd. It can be complicated and has a steep learning learni ng curve, but — in terms terms of depth of control and raw power — it is the best thing out there by far. We are going to use it primarily prima rily to learn, organize, and store the IR commands from the Here’s the early prototype of the RF receiver RoboSapien remote and then exewith a RadioShack mini amplifier/speaker. Great backpack, horrible sound quality. cute them by pressing a button in the MainLobby interface. whatever I have programmed in Girder. As stated, another extremely useful Unlike the RoboSapien, Girder places feature of Girder is the ability to no limit on the number of steps you program macros (called “multigroups” can put in a macro. in Girder) with unlimited amounts of The following is a detailed “how steps. We are really only using a fraction to” on setting up a skinned PC interface of the software’s capabilities; you can to control RoboSapien using the also use Girder to control your PC via IR USB-UIRT IR transceiver, Girder, and remote, to send and receive serial MainLobby. This information was commands, and a million other things. originally published by me in the MainLobby is made by a company forums at RoboSapien.tk called Cinemar and is designed to be I used the USB-UIRT as my IR transan HTPC (home theater PC) front ceiver. I don’t think it is the cheapest end. It allows you to create a custom option, but I had an extra one laying graphical user interface (GUI) with around. The creator, Jon Rhees, hand buttons that you can set up to launch makes them and provides excellent programs, execute files, trigger events support; the device is also pretty much in Girder to send IR commands, and so custom made to work with Girder. If on. It is entirely skin-able, so the sky is you are just going to use it with the the limit in terms of graphics and the RoboSapien, the base model will do; design is accomplished via an easy however, if you also want to use it to drop-and-drag interface. learn IR from a lot of stereo and home For this project, I am using the trial theater components, you need to get version of MainLobby and I just used the version with the additional 56 kHz buttons and a background from the included libraries. It will be fun to design RoboSapienThe wireless camera installed in chest cavity. cavity. If you weren’t looking for it, you probably wouldn’t notice themed setups. ML Server is it. Of course, the fact that you are being followed by a robot would probably make you suspicious.
24
SERVO 01.2005
the MainLobby application used to interact with Girder Girder.. Set-up: So how do we get all these pieces setup and communicating with each other? The first thing is to make sure that the USB-UIRT, Girder, ML Server, and MainLobby are all installed and running on your PC.
Girder Set-up and Configuration: Go to File -> Settings -> Plug-ins tab and make sure that the “Internet Event Server” and “USB-UIRT driver” plug-ins are installed (checked). Also make sure that the “Auto Enable Input device” box is checked. Click “apply” and then click “OK.” You should now be back at the main Girder screen and the light in the bottom right corner should be green (this means the plug-ins are enabled and operational). If it is not green, try going to File and choose “Enable Input Device(s)” or hit F9. Now that the plug-ins are set up, let’s teach Girder a RoboSapien command. Go to File -> New. In the large, white area on the left, right click and choose “Add command.” A folder named “New” and a command named “New” will be created. Select these and right click to rename them. The folder is what’s called a “group” and is used to organize commands. Let’s rename it as “arm commands” and use it to store all of RoboSapien’s individual arm movements. Select the command, right click, and rename it “R arm in.” While it is still selected, look in the top right and select “Internet Event Server.” Click on the learn button and enter an event string — for example, “rarmin.” Notice that there is a new item underneath the The ZT-802 mini wireless camera. command called an “Event String.” This is the command that Mainlobby will send to trigger Girder to send out the appropriate appro priate IR command. Click “OK.” Now, make sure the “R arm in” command is still selected and, in the bottom right, choose the “Plug-ins” tab. Select the “USB-UIRT driver” in the list and then click on “Settings.”
M
A USB-UIRT driver window will pop up; click on the “Learn ...” button. Another window will now come up and await the IR signal. Take RoboSapien’s remote and point it at your USB-UIRT then continue pressing the right arm up button until it learns the command and returns you to the USB-UIRT driver window.. I know that the instructions in window the window say to HOLD the button on the remote, but RoboSapien’s IR isn’t a constant signal (it is a burst), so you might have to hit the “Accept Burst” button if it will not fully learn. Now that you are back at the USBUIRT driver window, point the USB-UIRT at RoboSapien and hit the “Test” button to make sure that the command was learned successfully. If not, relearn it. Also pay attention to the “Repeat” box. You will want to set this to 1 in most cases, so that Girder only sends the command once — unless you want it to send the IR command multiple times. For example, I have commands setup to move the arm all the way up, all the way down, all the way out, and all the way in; these utilize the repeat function. Congratulations! You have taught Girder the first RoboSapien command. Repeat the above steps for each command on the remote and organize them in groups as you see fit. One other thing worth mentioning in Girder is “multigroups.” These are macros; you can take any girder command you have created, right click on it to copy, and then paste it into multigroups. String together unlimited commands, but keep in mind that you might have to mess around with some more advanced settings to get the timing right when using RoboSapien’s combination or attitude moves. Don’t forget to add an event string for them so you can call them from MainLobby. Once you have your IR commands learned into Girder, save your file, and then click File-> close window to send Girder into your system tray t ray..
Hack-a-Sapien Hack-a-Sapien
Contest Contest Winner
up Windows Explorer and find the file gireventlib.dllll (it should be in the folder gireventlib.d C:\Program Files\girder) and copy it to your C:\Windows\system32 folder. Alternatively, you can add the file to your path. Select Option on MLServer and choose hide to send ML Server to the system tray. MainLobby Set-up and Configuration: With MainLobby open, go to the top of the screen to bring up the menu. Select options and hit the “Girder” button at the left. Setup both the Girder.exe location and the Internet Event Server (ieventc.exe) location on your hard drive. They should both be in the main Girder directory. direc tory. Click on the “Scene” button on the left. Notice that this is where you choose your background skin, any animated effects, and so on. Click the “OK” button in the bottom right to exit the Options screen. Now, move your mouse to the top menu bar and choose design mode. Click “Add” to add a button; any button shape will do for now. You can load custom buttons of your own or hit the “Library” button to choose from those included with MainLobby. Once you see the button appear on your background, you can drag and drop it wherever you like. Hit the “Edit” mode button in the top menu bar and click on the button you just created. A screen with tons of options will open up. Here, you can customize your button. In the “MLServeCmd” area at the bottom, click on the “A” button. A new window will pop up. From the drop The wireless camera installation from the inside.
RoboSapien with the RF receiver PCB prior to installing it inside his back cavity.
down list in the “MLServeCmd” Panel, choose “MLGirder.” This will populate the following statement in the box: “MLServeCmd.MLGirder|.” Add the Event String you created in Girder for a particular RoboSapien command to the end of this statement. Using the command we created earlier, the box would read “MLServeCmd.MLGirder|rarmin. “MLServeCmd.MLGirder|rarmin.”” You can now test it via the test button to make sure it works or press “OK” and test it from the button’s properties panel. Click “OK” when finished. You should now be able to choose “Launch” from the top menu bar, click on the button you created, and make RoboSapien bring his right arm in. Repeat the above steps in MainLobby for each button you wish to create.
The RadioShack mini amplifier/speaker gutted. Oddly, it made me hungry for doughnuts.
ML Server Set-up and Configuration: Open up ML Server and make sure that “MLGirder” is listed in the plug-ins at the bottom. Open SERVO 01.2005
25
M
Hack-a-Sapien
Contest Contest Winner Winner
from my PC. This ties in nicely with the PC control scheme. I gutted an inexpensive set of Emerson EHP1000 wireless (RF) headphones. Initially, I just stuck the circuit board in the little slot behind RoboSapien’s head. I did not want to make a more permanent decision until I could install a camera. This allowed me to transmit sounds played on my PC to the RoboSapien speaker. MainLobby lets you assign multiple events to each control button, so I can press one button in the MainLobby GUI and it will send an IR command to RoboSapien and play an MP3 file. With the wireless set up, it plays this sound through RoboSapien’s speaker. RoboSapien now says whatever The finished RF receiver hack. The project box MP3 I send to him, plays music, includes a stereo amplifier, batteries for the cametc. era and the amplifier, an on/off toggle for the amp with LED indicator, indicator, volume control, and The possibilities are interestinputs for both Robosapien’s native voice (mono) ing. You could set up separate and the RF receiver output (stereo). The toggle control schemes for and indicator LED behind the head are for the RF receiver, which is concealed in his back cavity. RoboSapien with separate sounds. For example, with a themed GUI created in RoboSapien RF Sound custom MainLobby, you could create a football Mod RoboSapien, programmed to dance, The next step in my Zion replicaplay the fight song of your favorite tion with RoboSapien was to develop a team, cuss at the refs, cheer for individmodified sound system. The original ual players, whatever you want. concept was to use the RF receiver Once I got into this hack, I found from a set of wireless headphones so that I had a real problem with amplifithat RoboSapien could play MP3 music cation — more specifically, the lack of files and, for that matter, any sound it. I am a total newbie when it comes to electronics, so — when I hooked this up — I basically RoboSapien at night with his new lighting system. just plugged the RF transmitter into the headphone jack on my PC speakers and hooked up the RoboSapien speaker to the wires that were used for one of the headphone speakers. The volume was adequate through the RoboSapien speaker (slightly lower than the default RoboSapien voice) if I have the volume turned all the way up on my PC. To solve solve this this proble problem, m, I added a 1 W amplifier
26
SERVO 01.2005
that works like a charm. Now, there was more than enough volume, but I realized that the speaker was subpar. The solution was found in a set of 10-year-old, unamplified Sony Walkman speakers I had laying around. The speakers are each 8 Ω, 0.2 W, so I wired them in series. This made a real improvement in the sound quality. The new problem was that the speakers are pretty big — 2.5” by 3/4” thick — plus a 9 V battery and two AAA batteries in the mix, the the amplifier amplifier PCB, and the RF headset PCB. Obviously, I needed to house all this hardware in some sort of a backpack/project box. Building the project box was an issue. All of the boxes at RadioShack were either too big or too small. I tried a plastic box that housed a set of hobby knives. I liked the size, but it was too shallow for all the boards and batteries. While searching, I came across a decent little mini amplifier/speaker. amplifier/speaker. It’s a nice little package — about the size of a handheld transistor radio. It’s 200 mW and drives a 16 Ω, 0.5 W speaker — a perfect robot backpack. Using a couple of lids from tin espresso boxes, I rigged up an enclosure for the RF amplifier and the AA battery pack. I then Velcro ed it all together and attached it to RoboSapien’s back. It’s very secure and it works pretty well. I needed to shield his upper body motors; they caused some interference. I’m still not really very happy with this mod; although it works as intended, it’s just okay. Once I had decided that I needed to house all of the RF equipment and improved speakers “off site” from RoboSapien, I wired up a toggle switch on the robot’s back that turns off his internal speaker. I found I was missing his “caveman talk” — which I found quite strange. I ran a set of wires out of RoboSapien to hook up his internal sounds with the external setup, although I am not really sure now that they are needed. I left them because I figure any backpack arrangement will end up blocking his internal speaker. speaker. Now, the Sony speaker system sounds fantastic and plays both the RF receiver input (in stereo) and RoboSapien’s native voice (in mono).
M
It’s pretty much the coolest MP3 boombox ever! At this point, there are still a few loose ends that need to be tied down: •I am using industrial strength Velcro to hold the speakers on RoboSapien and the project box on the speakers. It is pretty heavy. I will need to come up with a better solution to attach it — maybe bolts or pegs of some sort. • The weight of the speaker system slows down RoboSapien’s walking speed. This isn’t such a bad thing, as it helps to stabilize him and make the wireless camera feed less jittery. • The amplifier eats through batteries pretty quickly. • I need to make longer patch cables so that the entire “backpack” can be removed once RoboSapien reaches his destination. I made them a little too short.
RoboSapien Camera Mod Next, I decided to install a miniature wireless camera in my RoboSapien. Thanks go to RoboSapien.tk for the initial idea. Some people have installed a similar camera into the robot’s head. This is great, since the head turns when you raise and lower the arms and you can pan the camera around. Getting the glued head assembly apart is extremely difficult, so I went for the easier solution: I installed it into RoboSapien’s roomy chest cavity. For this project, I used a small “ZT-802” type RF mini camera. They are easily found on www.eBay.com It will transmit both audio and video. The actual camera is about the size of a sugar cube and fits very nicely in RoboSapien’s chest cavity. The receiver has composite (RCA style) outputs that you can plug into a TV or a tuner card in your computer. I build HTPCs as a hobby and swear by the Hauppauge WinTV PVR-250. It works great with this mod, since it provides the ability to record the audio and video (or snapshots) on your PC.
Hack-a-Sapien Hack-a-Sapien
Contest Contest Winner
Before you start cutting up RoboSapien, though, it is a good idea to test the camera to not only make sure it works, but to make sure you are happy with the quality and with the set-up. Plugging it into a TV or VCR probably isn’t as much fun as plugging it into a PC that can control RoboSapien and record the images. The camera lens is 0.5”, so that’s the hole size we need to drill in RoboSapien’s chest. He’ll I see London, I see France, France, I see RoboSapiens’ headlamp underpants! probably have nightmares about the drill for a long time to come. I tried using smaller Finally, I felt it was the most aesthetically holes, but the result wasn’t as good as pleasing place for the camera. letting the entire lens come through Here are a few notes on drilling the RoboSapien shell. It also looks the hole: Make sure you take your time nicest when the camera lens is flush and go slow; once the hole is there, with the robot’s chest. you can’t easily fix it. I started with a I chose the center location in his 1/8” drill bit and drilled in the center chest for several reasons. One, it is the point on his chest, right where his spot where his chest cavity is widest. “cleavage” meets his black “throat Also, it is the furthest point away from piece.” Once this hole was made and his arm and waist motors, so interfercleaned up with a hobby knife, I moved ence is kept to a minimum. I didn’t even to a 1/4” drill bit; I enlarged it and need to shield his motors. This spot is again smoothed the edges with a also one of the more stable points on hobby knife. the RoboSapien and — since it is dead Finally, it was time for the big center — it shouldn’t affect his balance. daddy — the 1/2” drill bit. This made a
Circle #114 on the Reader Service Card.
SERVO 01.2005
27
M
Hack-a-Sapien
Contest Contest Winner Winner
done. If you have other mods that are taking up space in the chest cavity, you may need to secure the battery cable connector inside; it’s pretty bulky, but I just let mine lay where it wanted. One thing this mod showed me was that there is a ton of space inside the chest cavity. The MainLobby configuration menu.
mess because the plastic is so thin (comparatively) and required a lot of the old “in and out” with the drill to smooth the hole. It also required quite a bit of sculpting with the hobby knife to get the edges nice and smooth. Once the hole is made, you will need to fit the camera and make any adjustments to the hole. There is no place to attach the camera and I don’t really think it would be a smart idea to hot glue it onto the chest shell where the lens goes through. The threaded lens screws in and out of the camera body to focus and gluing would eliminate its ability to do this. I used a small piece of wood to attach the camera to the robot’s chest shell. I used a spongy sanding block to make it nice and smooth and — more importantly — to get exactly the right size and shape. Note that you will need to angle the camera upward slightly, unless you want RoboSapien to film only shoes. A custom sanded piece of wood is perfect in this regard. Make sure you
28
SERVO 01.2005
fit it exactly how you want it before you even plug in your hot glue gun. Apply the hot glue to the piece of wood and press the camera into place. This makes it much easier to install. I glued the apparatus to the center support peg. I left the antenna for the camera inside the chest cavity. Once the camera is attached att ached to RoboSapien’s shell, hook it all up to make sure it still works and that the position, angle, and so on are to your liking. The next step is to elongate the cables for the battery. I simply snipped off the original battery snap from the connector — leaving the wires intact — and then used a RadioShack 9 V snap. This gave me 3” or 4” of wire, which was plenty. I also drilled a small hole in RoboSapien’s back shell to feed the wires out of. If you are going to do this, make sure you feed the wires before you connect them. I used Velcro to connect the actual battery to the robot. Put it all back together and you are
Lights, Camera, Action As I mentioned, the main problem with the mini cam is how much light it needs. I knew that adding some lighting would help alleviate this problem, so — when I came across a Coleman LED headlamp for $10.00 — I convinced my wife that it would be great for camping (which we haven’t done in three years). Anyway, I had planned on gutting it, but it turns out that it fit pretty well right out of the blister pack in the form of “headlamp underpants” on RoboSapien. I like the design, as it’s just one piece. I’ve seen a lot of headlamps that have a separate pack for the batteries. I still need to test how well it works with the camera in terms of upping the light levels, especially during daylight indoors. Now, I have my ever-present Zionstyle dub, in addition to remote control via PC and a video link, all thanks to this RoboSapien RoboSapien hack. And there’s there’s still room for more mods ... SV
Many cool and unique hacks were submitted to the contest, but ultimately the winners were the ones who submitted complete hacks that took the Robosapien out of the realm of "toy" and into that of "tool." The decisions were hard, but I think you'll enjoy my selections, which will be featured this month month and next. next. — Editor
Dan
Official Results: 11 ss tt P P ll aa cc ee -- JJ aa m m ii ee SS aa m m aa n n ss 22 n nd d P P ll aa cc ee -- H H ee n n rr yy P P f f ii ss tt ee rr
Circle #132 on the Reader Service Card.
SERVO 01.2005
29
Send us a high-res picture of your robot with a few descriptive sentences and we'll make you famous. Well, mostly mostly..
[email protected]
Hero Pat Pat Stake Stakem, m, Laurel, Laurel, MD
The HERO was based on a Motorola Motorola M6808 eight-bit CPU CPU and had a Polaroid range finder, light and sound sensors, and voice synthesis. The manipulator arm was a popular option. I built one unit and borrowed the other machine from a research lab for some co-ordination experiments. Upper left: Let's think about this — the Hero-1 on the left uses the teaching pendant of the other Hero-1 robot ... Middle left: Two Hero-1 robots solder a connection on a Hero-JR. I built the Hero on the right and the JR. Lower left: Here's a good use for the little fellows. Lower right: The Hero-1 on the left uses a pencil to operate the hex keypad keypad of the other Hero-1.
30
SERVO 1.2005
— BY KERRY BARLOW —
Rfor the perfect robot. The most obvious decisions are
obot designers face many challenges in their quest
microprocessor type, wheel configuration, sensor modes, prices of hardware, and software design. The list can be endless and daunting. One of the first decisions we all must face is the choice of microprocessor. microprocessor. In my latest robot, I have chosen the Basic Micro Atom 24pin as the brains of my creation (Figure 1). I chose the Atom primarily for its basic programming language and its compatibility with many thousands of pre-existing program examples in the communi-
ty. The Atom comes in many variants — 24-pin, 28-pin, and 40-pin. In addition, there are Atom Pro microprocessors with extended capabilities above and beyond what the Atom has. The Atom 24 is pin compatible with the Parallax BS2. Basic Micro is a small company, so they put their effort into designing new hardware and features for their product line. A person will not find quite as much software support as they would from a larger company, such as Parallax, but the extra hardware capabilities of the Basic Micro products make up for some lack of support. Basic Micro does have excellent forums for their products. These forums cover both hardware and software examples. For those readers who have not been to the Basic Micro site recently, please
SERVO 01.2005
31
THE ATOM 24-PIN MICROPROCESSOR
FIGURE 1
FIGURE 2
allow me to list some of the many features of this chip and then I will go into further detail of how I implemented many of these features on my robot. 14K contiguous program space no bank switching necessary • 368 bytes user RAM • 256 bytes user EEPROM • 33K instructions/second • Three hardware timers • Two hardware PWM • A/D three channels of hardware A/D • Interrupts Interrupts,, both hardware and software driven • 32-bit math integer and floating point • NTSC video display generation • I2C bus • LCD commands • Servo direct control software command • In circuit debugger line by line execution as debugger runs. • Oscilloscope • DTMFOUT output DTMF signals on PIN • DTMFOUT2 two-pin DTMF, DTMF, higher quality signal • HCAPTURE capture internal timer value based on external event • HCOMPARE set pin when timer value equals compare value • IF .. THEN .. ELSEIF .. ELSE .. ENDIF conditional statements • LCDREAD reads RAM on LCD • LCDWRITE send text to an LCD • OWIN receive data from one-wire device • OWOUT send data to one-wire device • PAUSE delay (1 mSec resolution) • PAUSEUS delay (within 1 µs resolution) • PAUSECLK delay based on internal hardware timer
• PEEK ... POKE read /write specific RAM location • PULSIN measure pulse width (10 µs resolution) • SPMOTOR control any stepper motor • XIN X-10 input • XOUT X-10 output
The Atom 24pin, as stated, is pin compatible with the BS2. For the additional A/D channels, Basic Micro has special pads underneath the chip that a user may solder wires onto (see Figure 2). Once a user does this, the A/D channels will be active. To view the wires attached, see Figure 3. The 28-pin version of the Atom has these additional A/D lines already brought out to pins on the chip. The 40-pin version has additional I/O channels. Soldering wires to the tiny lands under the chip is not an easy task. There is a walk through provided by Basic Micro and I certainly advise reading this thoroughly before attempting the task. If you are designing from scratch, I advise you to purchase the 28-pin version of the Atom and save yourself some grief. I, myself, have done the conversion; using a low wattage soldering iron, panavise, and reading glasses, it can be done. The Atom software code is 99% compatible with the BS2; however, there are some small differences that should be noted. Please review the sidebar for a list of differences I have seen while programming the Atom.
Choosing the Microprocessor
I specifically chose the Atom for its A/D capability, the large program space, Basic language, and its interrupt capability. While working with the Atom and designing my robot, I found many more features that have made life much easier. For my latest robot, I wanted all the bells and whistles I could design within my budget. I wanted to stay with the Basic program language. I had used many BS2 Stamp products in the past and was happy with the language; however, I was always running into the dreaded out-ofmemory problem. I was never happy with the idea of bank switching. To me, it just confuses an already difficult situation. situation. In addition, addition, RAM space was was always always tight in my programs and — even if I learned how to bank switch switch — I still would would be running running out of RAM space. I also had run into problems on my previous robots where a subroutine may be active and the robot is traveling forward and hits an obstacle before the main loop can process either a bumper switch or an I/R sensor. I was hoping that a hardware interrupt interrupt could solve this problem for me. I also had always wanted A/D capabilities. This can be done externally, externally, but then the p rocessor has to run through a software routine to read input. Hardware A/D FIGURE 3 would be a much more worthwhile item to have.
32
SERVO 01.2005
THE ATOM 24-PIN MICROPROCESSOR
Memory Space One of the biggest reasons I chose the Atom was its contiguous memory space. The Atom has a 14K program space. Simply put, all you need to do is write your program — no more worries about bank switching or running out of memory space. I could not possibly have fit everything I am doing inside the 2K memory space of a different processor. Consider the robot program I will be discussing (available on the SERVO website or my own — see Resources). At this time, there are 200 bytes of RAM free and 4K of program space still free; 656 program lines show as being compiled. This is non-optimized code. On my own working version of the program, there are many lines of old subroutines still left in my program only because I have the space and it is easier to leave them in for testing purposes. I have never had any worries about RAM space, as I did with the BS2. I have variables declared that I am not even using. The program on the SERVO website is cleaned up and the unused code has been removed, but I simply wish to say that variable and program space is so large that I n ever even worried about it. The Atom does not have as much user EEPROM available as a BS2. There are 256 bytes of EEPROM for data storage. If you need more storage for something like a data logger, then you will have to use an external memory system. The simplest method for this is to use an I 2C bus based EEPROM memory chip. For my robotics work, I have never needed to actually store memory, but I can imagine a person who would want to map a location to memory. In this case, I do recommend using external memory. The internal RAM of 368 bytes for variable and array space is quite large. Even with 35 variables and two arrays in my program, I still have 200 bytes of variable space free in the Atom! Variables can be bit, nibble, byte, word, and long. These are defined as Bit Nib Byte Word Long
0 0 0 0 0
hardware to use. The Atom has two PWMs available. The first is on pin 9, which is selected by setting a value of 1. The second is on pin 10 and is selected selec ted by using a value of 0 for CCPx. Period is a variable or constant from 0 to 16,383 that specifies the period of the pulse width in CLK cycles. Duty is a variable or con stant from 0 to 16,383 that specifies the duty cycle of the pulse width. ENABLEPIN con 9 TrackLow: HPWM 1,9890,8000 : Return ‘81% Duty Return TrackMed: HPWM 1,9890,9000 : Return ‘90% Duty Return TrackHigh HPWM 1,9890,9890 : Return ‘99% Duty Return
IF .. THEN .. ELSEIF .. ELSE .. ENDIF The Atom uses standard syntax for its IF decision statements. There are two ways in which IF ... THEN can be used. The first tests a condition and, if that condition is true, goto or gosub to a point in the program specified by an address label.
or 1 to 15 to 255 to 65535 to 4,294,967,295
As you can see, the Atom gives a programmer great versatility in defining a variable, thereby freeing up that much more more RAM space. space.
Hardware PWM The HPWM command outputs a user-specified Pulse signal on either of two channels. Both channels may run independently at different duty cycles, if you wish. Hardware PWM is much more useful than software generated PWM. The Atom will continue processing your program at the same time it is generating PWM signals. HPWM CCPx, Period, Duty CCPx
is a variable or constant of 0 or 1 that specifies the PWM Circle #122 on the Reader Service Card.
33
THE ATOM 24-PIN MICROPROCESSOR
FIGURE 4
FIGURE 5
If range <=130 then gosub OBJECT The second use of the If ... Then can conditionally execute a group of statements following the THEN. The statements must be followed by Elseif or Else with an Endif. If Ldist <=10 then Lflag = 8 Endif
Incircuit Debugger I have used the ICD and found it to be a valuable asset in debugging my programs. I can watch my variables changing on the fly or watch the flow of my program code line-by-line. It is documented that timing dependent code may not work properly with the ICD. In my case, I found that
the SRF04 sonar would not output values properly to the ICD. To get around this, you can send the SRF04 output to a terminal window and display the data in this manner inside the ICD. The Atom ICD has several commands. Here are some of them: Animate The animate button will animate the displayed program line-by-line, as it is executed on the target device. Run The run button will start program execution on the target once the connection is established. Reset Reset is used to restart the program currently running on the target device. Pause The pause button will pause program execution. Step Into The step button allows you to step through the current running program, line-by-line.
THE ATOM The Atom is 99% compatible with the BS2; however, there are a few minor differences. Basic Micro has a list of differences between the Atom and a BS2 in their documentation, as well. Debug code is different than with a BS2; primarily, the Atom needs the command placed i nside brackets. brackets. debug [DEC val02, 13]
Reserved variable names include: smp, swap, sound, int, dt, skip. N9600 is used for serial output to a LCD display within the Atom: serout 1,n9600,[“START”] You do not need to declare n9600 as you did with a BS2. An Atom may not be used on a Board of Education unless you remove the capacitors on the serial programming lines of the BOE. Servo commands are are much simpler to use with the Atom. I have found a quicker way to program the Atom. This is not documented by Basic Micro, but it works well for me. The Atom IDE will do a WRITE command to the chip and then do a few VERIFY commands to determine if the Atom was programmed properly. I have found that I can cancel the IDE program command at the end of the WRITE function and disregard the VERIFY functions. The Atom will work fine. I have been doing this for years without any problems. I also have found that you do not even have to do a full WRITE of 100%. If you have a short program, progr am, WRITE may be canceled at 25% or 50% and the Atom will work fine.
34
SERVO 01.2005
Step Over This allows the program to step over a routine, mainly a gosub and/or for .. next loop. Step Out Step out will allow you to step out of a gosub routine. This allows you to skip any gosub in your program and go to the next line after the routine. Run To Cursor Using the run to cursor function will allow the program to run until the cursor is reached. Show Variables If clicked, the variable button will open a small new window that displays all the current variables used in the current program and the current values in HEX, decimal, binary, and floating point. Show SFRs SFRs stands for Special Function Registers. These are the registers built into the PICmicro MCU on the Atom. Show Ram If clicked, clicked, the RAM button button will open a small window window that displays all the the RAM values in the Atom.
THE ATOM 24-PIN MICROPROCESSOR
Show Gosub Stack Displays the gosub stack. This indicates where a program is in a gosub routine.
FIGURE 6
Oscilloscope Inside the Atom IDE there is a built-in oscilloscope tool. The oscilloscope supports two basic kinds of data plots. Y/time is where the Y-axis is the data and the X-axis is time. Note that this is not real time. It is actually the time between when the data points are received. So, if you are only sending a data point once a second, that’s when the Y-axis will be updated. I have not personally used the oscilloscope yet. There is documentation on the Atom website (see Resources) describing its full use.
The Robot My robot has been in its design phase for many years now, mainly due to a busy work schedule. It would take too much space to go through all the iterations and design changes. I feel, however, that it would be beneficial for the reader to know of some of the worst problems I have had, in addition to why I changed my plans and some of the hardware on the robot. On this robot, I specifically did not want any mechanical bumper switches. Bumper switches are fine and 100 % reliable, but an animal in nature does not really use them and I did not want them on the robot, either. I had used servo motor-driven motor-driven drive wheels with a trailing caster previously and they work fine, but a trailing caster would occasionally cause problems, either catching on a carpet or catching while backing up. With this in mind, I chose a dual track design (Figure 4). It also was thought that edge-mounted I/R sensors would be good as a final last-ditch obstacle detection system. See Figure 5 for a close-up of the edge sensors. The Atom hardware interrupt was to play a major part in the edge detection circuitry. I will go into more detail on interrupts in Part 2 of this article. You will notice two circuit boards on the robot. The lower board has the Atom, Atom, H-bridge driver, and the 555 timer for I/R and A/D connections connections (Figure (Figure 6). The upper board contains a LCD, 4052 multiplexor, and inputs for the three CDS cells (Figure 7). I’ll also explain the 4052 multiplexor hardware and software in further detail in the next installment of this article.
The Construction Design must turn into hardware at some point, so I chose a toy tracked power shovel as the main drive unit. I was quite happy with the track drive unit for indoor use. Motor control was achieved by the use of an SN754410
FIGURE 7
H-bridge motor control chip. I wanted motor speed control and had plans for Pulse Width W idth Modulation (PWM). The Atom will provide hardware-based PWM. This offloads much of the necessary overhead of software-driven PWM. At this time, I have not used the PWM feature except as a test program. I found that my robot runs at an adequate speed using full battery voltage and I did not need any reason for speed reduction at this time. The H-bridge driver to the SN754410 has been detailed many times in previous articles, as have the I/R transmitters using a 555-frequency generator. For an example of the
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. 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. www.vantec.com
Order at (888) 929-5055 SERVO 01.2005
35
THE ATOM 24-PIN MICROPROCESSOR
FIGURE 8
schematic of the I/R transmitter, review review Figure 8.
Sensors Sonar Four SRF04 sonar sensors mounted on the front and sides of the robot provide main object detection. These sonar sensors are tied together using the 4052 multiplexor; look for more details on the 4052 next month. I/R Ranged Secondary object detection is performed by a GP2D02 IR range finder inside a small project box that is mounted on top of a standard hobby servo. I can rotate this head to find the largest openings around the robot. I/R Static Interrupt-driven edge sensors are a third and final detector. detector. On the front of the robot, I have transistor pairs and two sensors at each corner. On the rear, I have two sensors
and transmitters aft facing. All transmitters are tied in parallel and so are the receivers. I am using the Parallax IR receiver modules. These output a digital LOW or 0 state if an object is detected. All receivers are tied to the Atom’s interrupt hardware pin (pin 0). No matter where the Atom may be in its main loop, if a detection occurs, the hardware pin will immediately stop the program and branch to a special subroutine. In this subroutine, a user may do anything desired. I chose to stop all motors, back up, and then search for a large area to drive into. Again, I shall go into more detail on interrupts in Part 2. CDS Light Sensor I also have CDS light sensors mounted on the robot. One sensor is mounted inside the rotating head and one is mounted on either side of the robot. At this time, I only implement the light sensor inside the rotating head. I use this light sensor to prevent the robot from driving under tables. I am currently using the Atom’s A/D circuit connected directly to a standard CDS cell.
Reliability RESOURCES Atom 24, accessories, and supplemental i nfo www.basicmicro.com I/R receiver www.parallax.com/detail.asp?product_id=350-00014 SRF04, PIR sensor, and GP2D02 http://acroname.com SN754410 and CD4052 http://mouser.com/ Program, Atom 24, and Atom Manual 2.2 http://mntnweb.com/hobby/bolo/ SERVO Magazine — code listings www.servomagazine.com
36
SERVO 01.2005
This method has proven to be 95% reliable. I highly recommend mixing sensor types in this way. I have often seen sonar miss an obstacle that an IR sensor will detect and vise versa.
Final Notes I hope this review of the Atom has given you an appetite for a powerful microprocessor that is programmable in the Basic language. So many times in the past, I have found great sounding robots, only to realize they are based on a microprocessor that either requires C code or uses such a convoluted syntax for its Basic that they would nearly require relearning the language. Basic Micro has done a good job of giving us a high power processor wrapped in a high level language. In Part 2, I will go into details of the Atom specific code and how I have used that code in my robot design. SV
THOUSANDS OF ELECTRONIC
Smart Servos
PARTS AND SUPPL IES VISIT OUR ONLINE STORE AT
www.allelectronics.com WALL WALL TRANSFORM TRANSFORMERS, ERS, ALARMS, ALARMS, FUSES, CABLE TIES, RELAYS, OPTO ELECTRONICS, KNOBS, VIDEO ACCESSORIES, SIRENS, SOLDER ACCESSORIES, MOTORS, DIODES, HEAT SINKS, CAPACITORS, CAPACITORS, CHOKES, TOOLS, FASTENERS, TERMINAL STRIPS, STRIPS, CRIMP CONNECTO CONNECTORS, RS, L.E.D.S., DISPLAYS, FANS, BREADBOARDS, BOARDS, RESIST RESISTORS ORS,, 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
Simple serial bus interface –
31 motors on a single link • Position & load readout, overcurre overcurrent nt protecti protection on • Full rotation mode • Modular connections – 11 attachment pieces Robot kits starting at $185 Garage Technologies, Inc. modular robotics, modular electronics
www.Garage-Technologies.com
Robot ics Showcase ics Showca Robotics Showcase
SERVO 01.2005
37