Page 1 8:43 AM 9/4/2008 Cover.qxd
Vol. 6 No. 10
SERVO MAGAZINE
HUMANOID ROBOTS • PROPELLER • STARTER MOTORS • DIGITAL RF DATALINK
Full Page.qxd
7/9/2008
9:57 AM
Page 2
Let your geek shine. Meet Pete Lewis, lead vocalist for the band Storytyme. Pete recently created the RS1000, a new personal monitor system for performing musicians. It was SparkFun’s tutorials, products and PCB service that enabled him to take his idea to market in less than a year. The tools are out there. Find the resources you need to let your geek shine too.
Sharing Ingenuity W W W. S P A R K F U N . C O M
©2008 SparkFun Electronics, Inc. All rights reserved. Hear music from Storytyme at www.storytymeband.com, or check out Pete’s RS1000 at www.rockonaudio.com.
Full Page.qxd
9/3/2008
12:24 PM
Page 3
email:
[email protected]
TOC Oct08.qxd
9/3/2008
1:40 PM
Page 4
Departments
PAGE 78
06 18 19 20 66 67 81
Mind/Iron New Products Robotics Showcase Events Calendar Robo-Links SERVO Webstore Advertiser’s Index
PAGE 26 PAGE 10
Columns
THE COMBAT ZONE ...
08
Features
Robytes by Jeff Eckert
Stimulating Robot Tidbits
10
GeerHead by David Geer
Robot250 Features BigBots
13
Ask Mr. Roboto by Dennis Clark
Your Problems Solved Here
70
BasicBoard Robotics by William Smith
Hardware Serial Port Adapter
73
Robotics Resources by Gordon McComb
22 24 27 31
Appetizer by Camp Peavy
RoboMagellan
78
Then and Now by Tom Carroll
Robots — From Humanoid to Human Status
4
SERVO 10.2008
MANUFACTURING: Combat Robot Drive Systems Building Battery Packs Fit for Combat PARTS IS PARTS: Electronize Speed Controllers
Events 26 32
Getting Kids into Robotics
76
BUILD REPORT: Savage — Part 1
Results and Upcoming Competitions Event Report: Roaming Robots Goes to Qatar
Robot Profile 30
K2
SERVO Magazine (ISSN 1546-0592/CDN Pub Agree#40702530) is published monthly for $24.95 per year by T & L Publications, Inc., 430 Princeland Court, Corona, CA 92879. PERIODICALS POSTAGE PAID AT CORONA, CA AND AT ADDITIONAL ENTRY MAILING OFFICES. POSTMASTER: Send address changes to SERVO Magazine, P.O. Box 15277, North Hollywood, CA 91615 or Station A, P.O. Box 54,Windsor ON N9A 6J5;
[email protected]
TOC Oct08.qxd
9/3/2008
1:42 PM
Page 5
10.2008 VOL. 6 NO. 10
PAGE 56
34
A Digital RF Datalink by Fred Eady When your robots need to communicate, but can’t see each other, short-distance signaling using low-power RF solves the problem.
40
Getting Control With the Propeller: Part 2 by David Carrier Controlling servos.
44
Get a Starter Motor Runnin’ in Your Robot by Steven Schmitt Auto starter motors are often overlooked for use in robot building. However, they make a good choice for power since they are almost always series wound, inexpensive, and readily available.
49
Counting on the Tried and True Schmitt Trigger by Margaret Toebes See how one team at the North Carolina Science Olympiad put this classic circuit to work.
Features & Projects 52
The Pico ITX Johnny 5 Project by Andrew Alter Part 2 covers the concept and implementation of PC-based robotics.
56
RoboGames 2008 by Samuel Coniglio This world class event continues to not disappoint year after year.
60
External Interface for the NXT Robotic Brick by Dennis Bogden Using Robot C software and integrated circuits, you can interface your own sensors and actuators to the NXT brick.
Due to extraterrestrial activity, the “Build the Ultimate Robot” series by Michael Simpson will continue in the November issue. We apologize for any inconvenience. SERVO 10.2008
5
Mind-IronOCT08.qxd
9/3/2008
2:58 PM
Page 6
Published Monthly By T & L Publications, Inc. 430 Princeland Ct., Corona, CA 92879-1300 (951) 371-8497 FAX (951) 371-3052 Webstore Only 1-800-783-4624 www.servomagazine.com Subscriptions Toll Free 1-877-525-2539 Outside US 1-818-487-4545 P.O. Box 15277, N. Hollywood, CA 91615
Mind / Iron by Bryan Bergeron, Editor
Size Matters
hen Parallax announced their new 12 VDC motors with mount, wheels, and position controller, I couldn’t resist picking up a kit ($280). Finally, a ‘standard’ drive system designed for medium-sized mobile robots from the company behind the BASIC Stamp and the Boe-Bot. The verdict? In short, the kit is first-class. Not only are the aluminum components beautifully machined and professionally finished, but the two 12 VDC motors are powerful and the gearing is aggressive — expect about 150 RPM at 1.5A and no load. Furthermore, assembly instructions and example Stamp source code are straightforward and easy to follow. It took me all of 20 minutes for basic assembly, including mounting the quadrature encoder assembly and inflating the pneumatic tires. I paired my motor kit with a pair of the recommended HB-25 controllers ($50 each) from Parallax. The controllers are
W
hefty, with built-in heatsinks and cooling fans, and at less than three ounces, add little to the overall weight of about six pounds for the pair of motors. Is the kit perfect for every robotics application? Of course not — no general-purpose kit could be. For example, the pneumatic 6” tires; while well executed, are overkill for my needs (an indoor balancing bot platform) given their relatively small diameter and inherent stiffness. I replaced the inner tubes with zero maintenance foam tubing. It’s a trick I picked up from working with Traxx wheels. Want a stiffer, more supportive ride? Simply use denser foam inserts in the tires. Another consideration is ground clearance for the motor and motor mount. There’s only about an inch of clearance from the rectangular motor mount to the contact surface. This shouldn’t be a problem if your robot is going to be working on pavement, carpet, or even a mowed lawn. However, if you’re thinking of running your robot down gravel roads and rough terrain, you might want to consider protecting the
SERVO 10.2008
ASSOCIATE PUBLISHER/ VP OF SALES/MARKETING Robin Lemieux
[email protected] EDITOR Bryan Bergeron
[email protected] TECHNICAL EDITOR Dan Danknick
[email protected] CONTRIBUTING EDITORS Jeff Eckert Tom Carroll Gordon McComb David Geer Dennis Clark R. Steven Rainwater Fred Eady Kevin Berry Andrew Alter Dennis Bogden Sam Coniglio Margaret Toebes Steven Schmitt David Carrier James Baker Mike Jeffries Robert Wilburn Paul Reese William Smith Camp Peavy CIRCULATION DIRECTOR Tracy Kerley
[email protected] MARKETING COORDINATOR WEBSTORE Brian Kirkpatrick
[email protected] WEB CONTENT Michael Kaudze
[email protected] PRODUCTION/GRAPHICS Shannon Lemieux Joe Keungmanivong ADMINISTRATIVE ASSISTANT Debbie Stauffacher
Copyright 2008 by T & L Publications, Inc. All Rights Reserved
Mind/Iron Continued
6
PUBLISHER Larry Lemieux
[email protected]
All advertising is subject to publisher’s approval. We are not responsible for mistakes, misprints, or typographical errors. SERVO Magazine assumes no responsibility for the availability or condition of advertised items or for the honesty of the advertiser. The publisher makes no claims for the legality of any item advertised in SERVO.This is the sole responsibility of the advertiser.Advertisers and their agencies agree to indemnify and protect the publisher from any and all claims, action, or expense arising from advertising placed in SERVO. Please send all editorial correspondence, UPS, overnight mail, and artwork to: 430 Princeland Court, Corona, CA 92879.
Mind-IronOCT08.qxd
9/3/2008
2:59 PM
Page 7
motors from accidental impact with a sheet of plastic or even a layer of electrical tape. If you’re thinking of moving from a Boe-Bot or other small mobile robot platform to something based on the Parallax wheel kit, take a moment to consider what’s involved. You’re not simply replacing small, inexpensive, lightweight servos with a heftier, more powerful (and more expensive) drive system; you’ll have to upgrade your entire development infrastructure. For starters, you’ll have to stock up on heavy duty aluminum stock — sheet metal, brackets, and fasteners. I’m not talking about the solid chassis designs used to create heavy-duty battle bots, but stock that’s significantly more substantial than the easily workable aluminum and plastic used with a typical carpet roamer. Then there’s the issue of power. Forget about using a AA battery pack. Instead, think 12V gell cell or — better yet — a pair of six-cell, 7.2V NiMh battery packs sold for R/C vehicles. I’ve had great results with the Dura Trax six-cell, 7.2V, 4.2 Ah pack ($43 each) available from Tower Hobbies (www.towerhobbies.com). While you’re on the Tower Hobbies website, pick up a few sets of two-pin Ultra Plugs by W.S. Deans ($3/set). Try these quick connect, low resistance plugs for your battery connections and you’ll never want to use a Molex connector again. Because of the mixed voltages required — 12 VDC for the Parallax motors or HB-25 motor controllers and 5V/3V for the microcontroller and sensors — you should consider
a high-efficiency DC-DC converter. My favorite is the programmable, three-channel RGi Power Commander (($200), available from CrustCrawler (www.crustcrawler.com). I use it to convert the 14.4 VDC from a pair of NiMh battery packs to 12V, 5V, and 3V, to power the motors, sensors, and Parallax Propeller chip, respectively. Alternatively, you can use separate battery packs and dedicated voltage regulators for each voltage — but this wouldn’t be my first choice because of the additional weight and space requirements. You’ll also have to consider your tools. As noted above, you won’t be working exclusively with easily bendable aluminum, but you’ll have to learn to handle heavy-duty stock. And this means you’ll probably have to upgrade to heavy-duty tools — no more bending the aluminum chassis with needle-nose pliers. Think bench vise and rubber hammer. Given the added expense of a medium-sized robot over something that can fit in your hand, why make the move? For one, you can create something practical — a robot to fetch the paper, move a tray of food from one room to another, or bring your medicines when they’re prescribed, for example. You can also drop a laptop or even a computer motherboard on a medium-sized platform and have carrying capacity to spare. If you do decide to make the move — with or without the Parallax motors — drop me a line and a photo to share with your fellow readers. SV
5 reflectance sensors on underside
battery charger connector
Item #975 $99.95
piezo buzzer
4 AAA batteries (not included)
30:1 micro metal gearmotors
The Pololu 3pi robot is a high-performance, compact mobile platform featuring: * Two metal gearmotors * Five reflectance sensors * 8×2 character LCD * Three user pushbuttons * Buzzer and LEDs
* High-traction silicone tires * Speeds exceeding 3 ft/sec using innovative constantvoltage motor supply
optional power LED
ISP programming connector
All peripherals are connected to an ATmega168 microcontroller running at 20 MHz, with free C-programming push-on/push-off tools, libraries, and support for the Arduino environment. power button reset button
removable 8x2 character LCD user pushbuttons
robot diameter is 3π cm (~3.7 inches)
Find out more at www.pololu.com/3pi or by calling 1-877-7-POLOLU. SERVO 10.2008
7
Robytes.qxd
9/2/2008
3:37 PM
Page 8
Robytes Fecundity Begets Rotundity
charge. Its operating temperature range is -22° to 104°F (-30° to 40°C).
Bot Can Toot Your Flute
The Groundbot mobile robot, revamped for security duties. Photo courtesy of Rotundus.
If you tip over the average robot, all it can do is thrash around helplessly until someone picks it up. But being round and without external appendages, the Groundbot™ from Rotundus (www.rotundus.se) is always upright. It also can move through mud, snow, and sand without getting stuck, and, being hermetically sealed, is pretty much impervious to environmental threats. It’s also tough enough to survive drops of up to 10 ft (3 m). Originally designed to explore the surface of Mercury, Groundbot has been modified for terrestrial chores such as large-area patrol, explosive gas monitoring, and remote inspection. It can be fitted with up to four cameras (up to 360° field of vision), various sensors, night-vision systems, microphones, and speakers. Probably the most interesting feature is the drive mechanism, which basically relies on gravity. A controlled pendulum is held close to the ground when the bot is motionless. By lifting the pendulum, it can be made to roll in any direction. This produces speeds of up to 6 mph (10 kph) and the ability to handle inclines up to 20°. In case you’re interested in the details, Groundbot is 2 ft (0.6 m) in diameter, weighs 55 lb (25 kg), and normally runs six to eight hours on a
8
SERVO 10.2008
Proving that no idea is too silly to endure if it draws government funding, the Anthromorphic Flutist Robot, created by Atsuo Takanishi at Japan’s Waseda University (www.waseda.jp), is now in its fourth incarnation and 18th year of existence. Model WF-4RIV (Waseda Flutist no. 4 Refined IV), features 41 degrees of freedom that have “enhanced its performance with more natural notes and smoother transitions between notes.” Specifically, the lips and tonguing mechanisms have been redesigned to be more like the corresponding human organs. Oh, sure, there are the usual academic rationalizations: “Clarifying the human motor control while playing the flute from an engineering point of view ... Enabling the communication with humans at the emotional level of perception ... Proposing novel applications of humanoid robots ...” and so on. But imagine spending 18 years of your life on this thing. For a
by Jeff Eckert demonstration, see www.youtube. com/watch?v=lYDW2A5-Cbw. Reportedly, work has begun on a saxophone-playing version, so maybe by 2026 Takanishi will come up with something as amazing as, for example, the Welte Orchestrion. First demonstrated in 1862, it weighs in at 1,500 lb, operates from music rolls, and drives 50+ pipes, bass, and snare drums, and a triangle. To hear one, visit www.asapackermansion.com/ orchestrion.html.
Saved by the Bear At the other end of the utility spectrum is the Battlefield ExtractionAssist Robot (BEAR), developed by Vecna Technologies (www.vecna.com), a self-funded company created in 1998 and operated by alumni from MIT, Harvard, Stanford, Yale, Princeton, Berkeley, CMU, and other assorted institutions. Still in the prototype stage, BEAR is envisioned as a marriage of three elements: a powerful hydraulic upper body, an agile mobility platform with independent sets of tracked “legs,” and
The Waseda Flutist No. 4 vs. the Welte Orchestrion.
Robytes.qxd
9/3/2008
1:06 PM
Page 9
Robytes
Vecna’s BEAR robot as employed on the battlefield. Photo courtesy of US Army.
“dynamic balancing behavior” (DBB). DBB is how the robot hopes to balance itself on the balls of its “ankles.” In fact, the production model should be able to remain upright whether balancing on its ankles, knees, or hips. It has already demonstrated the ability to pick up a realistically weighted human dummy and carry it around for 50 minutes without a break. According to Vecna, the purpose of the bear head is to comfort soldiers who might be put off by the otherwise “grotesque” appearance of the machine.
New Robotics Conference If you’re working on robotics at
Announcing the Gears
the design level, you may be interested in the upcoming IEEE International Conference on Technologies for Practical Robot Applications (TePRA). It’s a new conference “aimed at catalyzing the development of enabling technologies and encouraging their adoption by robot designers.” It’s intended to be a cross between a dry academic conference and an industrial trade show, so you get an emphasis on practical applications coupled with technical presentations aimed at future applications. The stated goals are “to expose robot designers to new enabling tools, techniques, and technologies” and “to expose tool, technique, and technology developers to the needs of robot designers.” The event is scheduled for November 10th and 11th at the Holiday Inn Select Hotel, Woburn, MA. For details, visit www.ieee robot-tepra.org.
Dragonfly V. 3 In July, the Delft University of Technology (www.tudelft.nl) introduced the third version of its artificial dragonfly, the DelFly Micro micro air vehicle (MAV). Weighing only 3 g and
The DelFly Micro MAV. Photo courtesy of Delft U.
with a wingspan of only 10 cm, it flies by flapping its wings like an insect. The remote-controlled device is intended to be used someday for observation flights in dangerous or difficult to reach areas, and it already can be equipped with a tiny 0.5 g camera that transmits TV-quality images to a ground station. Given that it can fly continuously for only about 3 min (at 5 m/s), it obviously isn’t ready for commercial production. But Micro is just a stepping stone to the planned DelFly Nano (5 cm, 1 g), which will be able to move independently using image recognition software, hover like a hummingbird, and even fly backwards. SV
Heavy Metal Robot Kit
Designed for Students and Professionals L Heavy Metal is engineered for rigors of daily use in classrooms,
Supports 200 lbs of standing weight!
summer camps, workshops, labs . . . even combat robots! L Assembles quickly using fasteners of same size/pitch and
threaded inserts. 10" wheel base, heavy gauge aluminum, 4-wheel drive, 3" rubber wheels, 3/8" axles, flanged bronze bearings, #25 pitch steel chain and sprockets. All drive components are keyed and broached. L Competition all-metal gearhead motors, gearbox rated at 500 oz-in of continuous torque. Heavy Metal accepts off-the-shelf engineering parts, plus components and control systems from GEARS IDS, FIRST* and VEX Robotics* kits. Heavy Metal 1 Kit includes chassis, motors, drive system, and wheels for $499.00.
Contact Mark Newby
[email protected] s WWWGEARSEDSCOM
Lb for Lb the World's Toughest Robot Chassis
*VEX Robotics is a mark of Innovation First, Inc. and FIRST refers to © US FIRST (Foundation for the Inspiration and Recognition of Science and Technology)
SERVO 10.2008
9
Geerhead.qxd
9/3/2008
9:31 AM
Page 10
by David Geer
Contact the author at
[email protected]
Robot250 Features BigBots Robotic Artwork that Interacts and Responds Robot250 is a city-wide extravaganza of large scale interactive robot art projects, workshops, festivities, events, and film held July 11-27 in Pittsburgh, PA. Sponsored by Carnegie Mellon University, the University of Pittsburgh, and a number of local community groups like the Heinz Endowments, the program features BigBots interactive robot displays with artistic themes.
You’re No. 1 ... Really! Ian Ingram, BigBot curator and creator of the “You’re No. 1” robotic foam hand and finger interpretation atop the Andy Warhol Museum spoke about the BigBots, beginning with his own work (at my request). The nearly seven yards of Pittsburgh black and yellow foam hand and index finger spread the love by reaching out to visitors to say they were no. 1. The hand moved, positioned itself, and pointed at various visitor outposts miles away and throughout the city using dual-axis hydraulics. One axis was a hydraulic motor and one was a hydraulic actuator. The hydraulics gave the hand two degrees of freedom (DOF) of
movement. The first DOF held the hand straight up and twisted it around while the second moved it downward to point it at the outposts or to wave at people. All the action was automated by a small microcontroller, though the original plan was to have kiosks at the outposts with remote triggers to activate the hand and point it in the specific direction of the kiosk that triggered the response. The robotic hand made use of sensing and a limiting switch — a gross encoder — which told the robot when to stop and start its movements. The hand was fitted with a camera that lined up in varying positions equal to a straight line to the different outposts. The PIC microcontroller was The “You’re No. 1” BigBots robotic installation by Ian Ingram is a 20-foot tall robotic black and yellow foam hand and finger like the ones worn by fans of Pittsburgh’s most famous sports team. The maneuvering hydraulic hand appeared on the roof of the Andy Warhol Museum in Pittsburgh as part of the Robot250 Festival, which ran July 11-27, 2008. Ingram, BigBot curator, senior research associate, and artist-in-residence at Carnegie Mellon University, built the big hand, which pointed at passers-by around the city.
10
SERVO 10.2008
brought to life using software created in C programming. The software looks for limit switch hits, making plans for movement between where the hand is and where it needs to go to perform the pointing and waving, according to Ingram. The robot uses a motor to pump fluid to create pressure to activate and manipulate the hydraulics. The hydraulic valves use solenoids and are pushed by external signals from the microcontroller. The structure of the hand is steel weldments with polyurethane foam similar to the hands that people take to sports games.
Semi-autonomous Percussive Devices Communicate Like Crickets The Crickets installation uses a number of interconnected robotic sculptures to imitate the action and reaction of group communication among packs of animals such as dogs or insects. The robots are equipped with wooden knockers controlled by solenoids to tap out their noises. Photos and caption information are courtesy of Carnegie Mellon University.
Geerhead.qxd
9/3/2008
9:34 AM
Page 11
GEERHEAD These robotic wood blocks called “Crickets” tap with wooden knockers in response to neighboring bots that are doing likewise.
Connected by thin wires, each robot communicates to its closest neighbor whether it is silent or drumming up a storm. So, throughout the group the robots set each other off until the whole colony is chirping away or they turn each other off until they are all quiet. Each cricket is controlled by a BASIC Stamp microcontroller and has its own unique sound. Software programming sets the action and reaction in motion. The programming uses a specific set of rules called “The Game of Life” that says when a robot starts knocking, the signal to its neighbor is to start knocking, but when all robots are knocking, one robot must become silent and then the others react in kind one by one until all are silent.
Green Roof Roller Coaster Roof top plants and gardening generally serve the building and environment by providing an added layer of insulation or contributing oxygen. Serving the plants themselves is a matter left unaccounted for, until now. The idea behind the Green Roof Roller Coaster is to set the plants on a continual ride up, around, and down for their own stimulation and amusement. In an attempt to measure their pleasure, the installation uses sensors near the plants to gauge humidity, CO2, vibration, and leaf conductance. While these sensors
interpret the health of the small trees’ environment, this is only loosely and perhaps humorously translated to the degree of entertainment the plants find from their constant motion.
The Look-See Tree A mobile installation that looks like a fallen tree houses five groups of visible robotic animals that move and interact with people as they sense them coming near. The robots are electrically powered and animated using servo motors. They are connected via frameworks of gears and linkage systems and are powered by a hand-cranked electric generator. One robot simulates a fox that paws at the ground. Another group of robots are birds whose chirping resembles cell phones ringing or car alarms sounding off. Still another group are animals collecting garbage from around the city to construct their nests.
The “Green Roof Roller Coaster” BigBots installation is a roller coaster that takes a variety of grasses and other plants for a wild ride above the Children’s Museum of Pittsburgh. The installation uses sensors to measure humidity, CO2, vibration, and leaf conductance in an attempt to determine how the plants respond to riding on a roller coaster.
The Reach Robot Sculpture The Reach robot senses people’s movements and gestures throughout The “Reach” robotic installation in the PPG Place plaza interprets pedestrian movement with a musical response. The creation of artists Grisha Coleman and Frank Broz, Reach consists of strands of fiberglass that create a web across the plaza, a plane in which a LIDAR (LIght Detection And Ranging) system senses movement and triggers musical compositions from famed area African American Jazz composers.
The “Look-See Tree” is a mobile tree sculpture haven for robotic animals and cell phones that behave like animals.
SERVO 10.2008
11
Geerhead.qxd
9/3/2008
9:35 AM
Page 12
GEERHEAD the PPG Place plaza using two LIDAR (LIght Detection And Ranging) technology systems that scan and find ranges or distances between the place of emission of laser light and the position of the person sweeping through. One system aims its lasers across the whole plaza and one scans down from up high, creating a plane they
scan across to determine distance and movement. “It tracks objects (people) as they move through that plane,” says Ingram. The lasers determine people’s positions relative to strands of fiberglass webbing strewn in criss cross fashion across the plaza and 10 feet above it. People who may be “reaching” toward the strands to
stroke them as if they were strings on an instrument will note an audible response. When people’s positions relative to the strings are tracked and captured by the lasers and pressure sensors, this sets off musical compositions reminiscent of famed Pittsburgh area composers, particularly African American Jazz musicians. While the installation and its purpose may be confusing to some, others will realize its purpose as their actions set off the music. Patrons may not only start the music with their gesturing, but also “conduct” the music by interacting repeatedly with the webbing, and so with the laser field. People in different locations in the plaza will activate different musical effects and interludes.
Conclusion Robots 250 and the BigBots installations stir the curious soul to investigate. It’s amazing how robotics have become so much a part of our lives and how closely they intertwine themselves with the most expressive of art forms. It is interesting to see the skill level in robotics assumed by those whose primary endeavor of study is the arts. SV
RESOURCES Robot250 home page http://robot250.org Robot250 events and exhibits http://robot250.org/festival/ index.php Robot250 types of events http://robot250.org/festival/ types/index.php Robot250 BigBots http://robot250.org/festival/ bigbots Robot250 photo gallery http://robot250.org/media/gallery
12
SERVO 10.2008
MrRoboto.qxd
9/2/2008
11:16 AM
Page 13
Our resident expert on all things robotic is merely an email away.
[email protected]
Tap into the sum of all human knowledge and get your questions answered here! From software algorithms to material selection, Mr. Roboto strives to meet you where you are — and what more would you expect from a complex service droid?
by
Dennis Clark
Q
. (In this case, not so much a question, but a request. It was worded so well and completely I felt that it would be disingenuous to simply paraphrase, so I’ll quote and add comments later. I believe in giving credit where credit is due.) I enjoyed your column in the August issue of SERVO. I really like the AVR microcontrollers and the gcc-avr compiler. I wish you would mention a readily available and really pretty simple IDE for the Atmel — Arduino. They’re at http://arduino.cc/. I’ve used this environment in several Introductory Programming classes and it’s been a big hit. It meets several of the criteria that your questioner brought up and it has some cool features that, to me, contrast favorably with the complexity of Eclipse. 1) The Arduino software Integrated Development Environment is portable, and is available for Mac, Linux, and Win32. Basically, it’s a small Java application that allows editing and compiling C/C++ programs and that launches gcc-avr in the background to do the actual cross-compilation. 2) It’s simple — and while that means putting up with some limitations, such as no real debugging — a lack of complexity is also a big plus for beginners. Source code files are easily assembled into “sketches,” which are held in folders on your system. The look is very simple and clean, with no makefiles or projects needed, and without the cascade of panes, options, menus, and buttons that are an unfortunate side effect of Eclipse’s power. 3) There’s a nice library built in. It has functions for easy digital and analog I/O, along with most of the standard C library. It’s all documented on the site. 4) You don’t need a programmer because it can directly upload the compiled program into the chip. This is possible because the chips come with a small bootloader
pre-installed. So when you press the appropriate button in the Arduino IDE, a serial or USB to serial cable carries the generated code into the chip. Then you just press reset and go. Very easy, and this is a feature I appreciate as someone who works a lot with beginning programming students. 5) A number of inexpensive boards are available. Some examples can be found at http://moderndevice.com/ and http://wulfden.org/TheShoppe.shtml. 6) There’s a ton of software and hardware already available for the basic hardware. As an example, www.freeduino. org/ lists hundreds of projects and reusable hardware and software ideas. Anyway, sorry for the long mail, and keep up the good work, I enjoy your column. — Jerry Reed Adjunct Professor of Computer Programming and Applications, Valencia Community College
A
. Thanks Jerry for the kudos and the lead. I had heard of Arduino but thought of it (initially) as only another interpreter chip for a token-based compiler. Little did I realize just how WRONG I was! The Arduino is an open source language built on top of C++ that simplifies the task of writing code for an embedded processor. The Arduino project abstracts the embedded processor to make it a hardware object that can be run on its own or interfaced to the computer to talk to other programs. The obvious computer interface is the Processing language upon which the Arduino language is built. This hardware-oriented language is called Wiring; it simplifies many of the tasks that a beginner would like to do with an embedded processor. Of course, this act of simplifying that programming means that some of the capability of the processor (an Atmel ATMEGA8 or ATMEGA168) is reduced or lost (no interrupts or PWM capability), but for many SERVO 10.2008
13
MrRoboto.qxd
9/2/2008
11:16 AM
Page 14
The Arduino site mentioned above is a good start to learn this environment — which is Java based and runs on any platform that has Java installed. There is even a little interface driver/program named serproxy that comes with the install on the Mac OS X operating system to simplify the interface to another computer program to talk to the Arduino board over a serial port. For more information on the Processing language and Wiring language, see the links http://processing .org/ and http://wiring.org.co/. I’m going to be looking into these resources in the future!
Q
Figure 1. SONAR circuit 1. just looking for learning embedded programming this is a VERY painless way to learn. Arduino boards (or other independent offshoots) are fairly cheap and capable, so the introductory price is also low. Because Arduino is open sourced, you aren’t locked into anyone’s boards at all. Part of the Wiring environment’s IDE includes the ability to turn any ATMEGA8 or ATMEGA168 into an Arduino target; as long as you have a programmer and downloader software that can directly program the ATMEGA part. After you have the bootloader installed, all you need is a serial port connection (Bluetooth, ZigBee, or any other wireless connection will work, as well!) and you’re off and running.
. I have inherited a pile of parts. Among these are five pairs of ultrasonic sensors. At least, that is what I think they are. One is marked on the back with a 40R and the other with a T. I am assuming these are transmitters (T) and receivers (R). There was a slip of paper in the container with 40TR12B written on it. I notice that ultrasonics are usually purchased on circuit boards. Can you help me with a circuit design and some software tips for making these work? Thanks. — Anonymous
A
. The ultrasonic transducers that you have are from Jameco, part number 139492. They are 40 kHz transducers which means that they resonate at 40 kHz, and require a 40 kHz signal to make them work. There are many, MANY sites on the Internet that detail various folks’ circuits to drive these devices. Here are a couple that I like. The one shown in Figure 1 is located at www.e-arsenal. net/robotics/sonar.html and seems a custom fit to your transducers. It uses a MAX232 serial port Figure 2. A PIC controlled SONAR circuit. Used with permission by GenerExe IT. driver to deliver a higher voltage to the transducer to increase the power of the output signal and a common op-amp to sense the returning echo. This circuit, however, requires that you send a 40 kHz signal to the circuit; typically you would use a PWM output to do this and wait for a return echo on the pong line. This circuit details using a PIC16F628 to handle all of the SONAR details and uses a similar but simpler circuit to send and receive SONAR signals (see Figure 2). This
14
SERVO 10.2008
MrRoboto.qxd
9/2/2008
11:17 AM
Page 15
design comes from application note AN101 on the www. Listing 1, I used a PIC18F252 processor to read two R/C generexe.com/id129.htm site and includes a very good channels and convert them into direction and speed values for description of how to write the code that gets the range two motors. I used “tank” steering so that one channel data from a SONAR module. You can use their tools (they controlled one motor and the other channel controlled the have a free download trial) and their PIC compiler IDE is second motor. Rather than use the Input Capture hardware — which I didn’t have available to me — I used a 10 μs interrupt shareware, free for personal use; or get your hints from to look at the signal lines and record the most recent R/C the state machine graphic in the app note document. channel pulse width. Then, a little math was done to The key to getting a good SONAR reading — which convert this value to a direction and PWM speed value for comes up again and again in these discussions — is to wait each motor. This 10 μs interrupt gave me a resolution of until the transmitter stops sending pulses and stops ringing, which the transducer will for some certain period of time after the LISTING 1 transmission signal has stopped being sent to the transducer. If void ISR_High() /* you don’t have an oscilloscope The generic high priority fast interrupt, first we have to set registers to to see when the transducer has get high priority; CCS does not handle this well. (See Init code). This stopped ringing, then you will have operates as a state machine that will ONLY look at one edge of one signal each to experiment with your read delay Time the interrupt occurs. This keeps things moving along fast, and since each Interrupt is 10us later; it takes a total of 40us to read both channels. until you get correct data back. */ There are lots of examples on { the web of SONAR circuits, and switch (chanState) { some of them are really simple. case SET_C1: //Channel A count Experiment and have fun! if (input(PIN_A2) == 1) { TMR0L = 0; chanState++;
Q A
. I would like to control an H-bridge using the PWM signal from an R/C receiver. Can you give me any info about this? — Anonymous . The R/C receiver used in radio controlled aircraft, cars, and such is not really a PWM signal since the duty cycle of the signal isn’t important; the pulse width is, so it is more of a pulse width encoded signal. Regardless, each channel of the receiver will output a pulse of between (about) 1 ms and 2 ms every 20 ms. You can’t use this to directly control your H-bridge, but you can use the width to determine your H-bridge PWM percentage with a little math. The 1.5 ms spot is the neutral or motor off position typically if you have both forward and reverse directions on your motor. You can choose if less than 1.5 ms is forward or backwards. You would then read the pulse width and convert that width to a (let’s say) plus or minus number from 0 to 255. Then you would feed this value to your Hbridge driver code to set the PWM and direction signals to your H-bridge. In the code example shown in
} break; case READ_C1: if (input(PIN_A2) == 0) { ChanA = TMR0L; chanState++; } break; case SET_C2: if (input(PIN_A3) == 1) { TMR0L = 0; chanState++; } break; case READ_C2: if (input(PIN_A3) == 0) { ChanB = TMR0L;; chanState = SET_C1;; } break; }
//Channel B count
//What follows here is just a background clock that I use to handle delays. PIR1bits.TMR1IF = 0; //clear interrupt bit set_timer1(S_10us); //reset timer clock for next interrupt if(PIR2bits.TMR3IF) { t_52ms++; TMR3L=0; TMR3H=0; PIR2bits.TMR3IF=0; }
//This is a simple 52ms clock fo //background timekeeping //inc counter and clear the timer
#asm retfie 1 #endasm }
SERVO 10.2008
15
MrRoboto.qxd
9/2/2008
11:17 AM
Page 16
1 ms/10 μs = 100 counts, which is 50 counts in each direction. I use 1 ms and not 2 ms because the pulse width is actually from 1 ms to 2 ms, which is only a 1 ms pulse range. The actual range is somewhat less because I have a dead zone around the center point so that I can have a stable “off” point event though the pulse width may wander a little when nothing is being moved at the transmitter. This program is written in CCS PCH, for the PIC 16 bit cores like the PIC18F252 micro. Listing 1 is one suggestion for reading R/C receiver pulses accurately even when you aren’t using the pulse capture hardware on your microcontroller. Some explanation may be in order here. For those of you that use the CCS compilers, you may find my interrupt routines unique. I like my interrupt service routines (ISR) to be lean with no baggage. For that reason, I did not use CCS’s interrupt defaults and I set bits and defined ISR locations manually. This is why there is the assembly retfie at the end of the ISR function. Look in the source code files which can be found on the SERVO website at www.servo magazine.com named zombie.zip. The essential
information is that the ISR is called every 10 μs and looks for the start of an R/C servo pulse. If it sees one, then it turns on TMR0 to time the width of the pulse and then the next pass through the ISR looks for the fall of that pulse and records the pulse width. Then, the next pulse is timed. Of course, there is a 10 μs uncertainty about the value, but in practice I’ve found this works just fine. If you look closely at the code, you will see that what I have implemented is a state machine that handles only one pulse at a time — this is the most efficient way to handle arbitrary timing issues if you don’t have hardware that will do it for you. Okay, so how do we translate these newly acquired pulses into PWM and direction values for an H-bridge? Listing 2 shows how it is done for a single motor. The source code has both motors handled, of course, but since both sides are done the same there is no reason to show both as examples. The code in Listing 2 will translate the pulse width from the RC receiver into a PWM and direction for the H-bridge. There are some things you should look for, however. I limit the endpoints of the pulse to eliminate the inherent inequality of the potentiometers in my transmitter where the center LISTING 2 may not be the same for each stick and the endpoints also void MotorA(int chanA) /* may not be the same. This Deals with setting PWM for PWM1 keeps my motors going straight. */ Also, I set a dead band at the { center of the joystick so that signed int speed; unsigned int pwm; some drift in the sticks won’t unsigned int chan; cause motors to creep on. This guarantees that the vehicle will chan = chanA; stop when you tell it to! The if (chan > 154) //Limit my endpoints to be the same for values 112 to 116 represent the //both sticks center, or 1.5 ms pulse width — chan = 154; more or less. One last bit of else if (chan < 74) chan = 74; coding trivia: My H-bridge needs only one bit to set the if (chan == lastChanA) direction, yours may need two return; bits. Just add the other bit into speed = 114 - chan; // positive for forward, negative for reverse the part of the code that sets the direction based upon the if (chan > 112 && chan < 116) // create our deadband sign of the speed value. { pwm=0; I hope that you’ve learned } something here or at least else enjoyed what you have read. { if ((lastChanA > 114 && chan < 114) || (lastChanA < 114 && chan > 114)) I, too, have learned something { this month, and because of setup_ccp1(CCP_OFF); //Here we coast a bit rather than suddenly that I’m going to be checking delay_ms(50); //change motor directions to save wear and out a couple of new program} //tear on the gear train! if (speed < 0) ming environments — the ones output_bit(DIR_1,1); I’ve mentioned above, of else course. As usual, if you have output_bit(DIR_1,0); any questions about things // pwm = (abs(speed)*5)+25; //For 2.44KHz 10% to 90% pwm = (abs(speed)*3); //19KHz 5% to 95% robotic, please drop me a line } at
[email protected] setup_ccp1(CCP_PWM); and I’ll be happy to work on set_pwm1_duty(pwm); lastChanA = chan; it! Until next time, keep on } building those robots! SV
16
SERVO 10.2008
Full Page.qxd
9/3/2008
12:26 PM
Page 17
OCT08NewProd.qxd
9/3/2008
3:20 PM
Page 18
New Products
N E W P RO D U C T S BOOKS Mov’n Up
M
ov’n Up — a new book from Square 1 Electronics — shows assembly language programmers how to easily migrate from Microchip’s 16 series eight-bit microcontrollers to the 18 series devices. The 18 series devices have some features that make them easier to use. Program memory paging is gone, so tables may be of any length and may be located anywhere. Data memory bank selection is simplified. Compare, bit toggle, and set file instructions make writing programs easier. Context saving on interrupt is automatic (sometimes). The newer application peripherals (CAN bus, etc.) are included in the 18 series devices. Mov’n Up will save readers time by providing an explanation of the fundamental differences (vs. 16 series) along with programming examples to make the transition easier. Mov’n Up is available from the publisher ($24.95 plus s&h). For further information, please contact:
Square 1 Electronics
Web: www.sq-1.com
CONTROLLERS & PROCESSORS Powerful, Popular Servo Controller Just Got a Whole Lot Better!
L
ynxmotion has released the new SSC-32 V2 servo controller. The SSC-32 V2 now uses the Atmel Mega168 processor and
18
SERVO 10.2008
includes a 24LC256 EEPROM chip. This new processor makes several new features possible, however, the price has remained at $39.95! Anyone who has used hobby servos in a robot project knows no two servos have the exact same centered position. The V2 has the ability to store servo offsets in its EEPROM. This means after the offsets are entered, the servos will be perfectly aligned when commanded to center. Because the offsets are stored in EEPROM, they will not be lost when power is removed. This standardization makes it easy to share programs with others who have built similar robots. The servo controller now has the ability to store initial startup positions. Whenever the SSC-32 is powered up, the affected servos will be commanded to their own unique initial startup position. Think of this as a Home Position for the robot. A special startup command string (up to 255 characters) can also be stored. The servo controller will execute the stored command on power-up, just as if it had received it from the serial port. The SSC-32 still retains all of the powerful features as before: 32 rock solid servo outputs with 1 μS resolution and 500 μS to 2,500 μS range servo pulses; speed, time, and coordinated (group) servo moves; the ability to read four analog or digital inputs; real time servo position feedback; an ultra slick built-in 12 servo hexapod sequencer; and the ability to utilize spare outputs as high or low drivers. In addition to the new features which are stored on the processor’s EEPROM, the SSC-32 V2 can store 32 Kbytes of Project Sequences on the 24LC256 EEPROM chip. This does require a free firmware update with the general-purpose (GP) firmware. The GP firmware replaces the 12 servo hexapod sequencer with two generalpurpose sequencer engines. Each one can play stored sequences with different speeds and directions. The easiest way to populate the EEPROM chip is to use the Lynxmotion Visual Sequencer program. After the robot is taught its movement sequences, they are exported into the EEPROM chip. As the number of servos grows in a robot project, it only makes sense to offload all of the precise timing and complex algorithms to a dedicated servo controller. The SSC-32 can be instrumental with that. For further information, please contact:
Lynxmotion
Web: www.lynxmotion.com
9/3/2008
3:22 PM
Page 19
TOOLS & TEST EQUIPMENT Prototype Tool for Double-Sided SurfaceMount Assemblies
T
7KH(VFDSH 5RERW¶VEXLOWLQ PLFURSURFHVVRU HQDEOHVLWWR ³WKLQN´RQLWVRZQ .65
6 UH ROGH TX UL LUH QJ G
OCT08NewProd.qxd
7KHURERWIURJPRYHVIRUZDUG ZKHQLWGHWHFWVVRXQGDQG UHSHDWVVWDUWPRYHIRUZDUG !
VWRS!OHIWWXUQ!VWRS!ULJKW WXUQ!VWRS.65
PP:KLWH ZDWHUFOHDU /('9 PFG $%
VHFRQGYRLFHUHFRUGHUSOD\EDFN PRGXOH7KHHOHFWUHWPLFURSKRQHLVRQWKH ERDUG2QHEXWWRQUHFRUGVWKHRWKHUEXWWRQLV PRPHQWDULO\SUHVVHGWRUHSOD\WKHPHVVDJH SUHDVVHPEOHG $
I
ntegrated Ideas & Technologies, Inc., has announced a new prototype assembly tool that allows manufacturers to assemble doublesided surface-mount assemblies right at their desks. Recognizing the need for a complete solution for prototype assembly of these types of boards, IIT has developed the AssemblyPro Fixture. Designed as a tool to complement the IIT Desktop® stencil, the AssemblyPro Fixture enables the user to assemble double-sided surfacemount boards without a screen printer. Machined from durable, high density polyethelyne, the AssemblyPro Fixture features a nested area that holds the board and cutouts in the fixture to accommodate the parts that have been placed on the bottom side. For further information, please contact:
Integrated Ideas & Technology, Inc.
Website: www.integrated ideas.com
Show Us What You’ve Got! Is your product innovative, less expensive, more functional, or just plain cool? If you have a new product that you would like us to run in our New Products section, please email a short description (300-500 words) and a photo of your product to:
[email protected]
7KH9HOOHPDQ3HUVRQDO6FRSH LVQRWDJUDSKLFDOPXOWLPHWHU EXWDFRPSOHWHSRUWDEOH RVFLOORVFRSHDWWKHVL]HDQG FRVWRIDJRRGPXOWLPHWHU +36 $146. QGV 7KRXVD RQ V P PRUHLWH LWH V E H Z RXU
Robotics Showcase
THOUSANDS OF ELECTRONIC
PA R T S A N D S U P P L I E S
VISIT OUR ONLINE STORE AT
www.allelectronics.com WALL TRANSFORMERS, ALARMS, FUSES, CABLE TIES, RELAYS, OPTO ELECTRONICS, KNOBS, VIDEO ACCESSORIES, SIRENS, SOLDER ACCESSORIES, MOTORS, DIODES, HEAT SINKS, CAPACITORS, CHOKES, TOOLS, FASTENERS, TERMINAL STRIPS, CRIMP CONNECTORS, L.E.D.S., DISPLAYS, FANS, BREADBOARDS, RESISTORS, SOLAR CELLS, BUZZERS, BATTERIES, MAGNETS, CAMERAS, DC-DC CONVERTERS, HEADPHONES, LAMPS, PANEL METERS, SWITCHES, SPEAKERS, PELTIER DEVICES, and much more....
O R D E R TO L L F R E E
1-800-826-5432 Ask for our FREE 96 page catalog
SERVO 10.2008
19
Events.qxd
9/3/2008
10:24 AM
Page 20
Send updates, new listings, corrections, complaints, and suggestions to:
[email protected] or FAX 972-404-0269 Know of any robot competitions I’ve missed? Is your local school or robot group planning a contest? Send an email to
[email protected] and tell me about it. Be sure to include the date and location of your contest. If you have a website with contest info, send along the URL as well, so we can tell everyone else about it. For last-minute updates and changes, you can always find the most recent version of the Robot Competition FAQ at Robots.net: http://robots.net/rcfaq.html
Autonomous and remote control. Starting size of 12” x 12” x 12”. Expansion during event okay. Weight limit of 20 lbs. Power source must meet OSHA requirements for indoor use. Awards for 1st, 2nd, and 3rd place, as well as “amusing and arbitrary accomplishments.” www.milehicon.org/critrule.htm
TBA
Cal Games Woodside High School, Woodside, CA Rack and Roll (same as 2007 FIRST event). www.wrrf.org/Events/index.php
TBA
ROBOMO Maze Solving Competition Winfield VFW, St. Louis, MO Maze solving. www.robomo.com
— R. Steven Rainwater
O c tober 2-4
MindSpark College of Engineering, Pune, India MindSpark includes a standard Micromouse event and a competitive pick-and-place event called Dogfight. There’s also a Photoroller event for solar powered bots. www.robotics.mind-spark.org
N ov e m b e r 22
Roaming Robots Grand Final Kent, UK “Robots” (RC vehicles) attempt to destroy each other. www.roamingrobots.co.uk/events_ calendar.htm
24
Hawaii Underwater Robot Challenge Kahanamoku Pool, UoH at Manoa, Honolulu, HI Timed, multitasking tethered mission. www.marinetech.org/rov_competition
TBA
ROBOEXOTICA Museumsquartier, Vienna, Austria Robots are tested on serving cocktails, mixing cocktails, bartending conversation, lighting cigarettes/cigars, and other achievements in electronic cocktail culture. www.roboexotica.org/en/acra.htm
TBA
Canadian National Robot Games Ontario Science Centre, Toronto, Ontario, Canada Mini Sumo (novice, advanced, master), full-size Sumo (autonomous and RC), fire fighting, line following, walker race, photovore, search and rescue, art and innovation. www.robotgames.ca
11-12 The Franklin Cup The Franklin Institute, Philadelphia, PA Remote-control vehicles destroy each other in Philly. www.nerc.us/events/events.html
18-19 Chibotica iHobby Expo, Rosemont, IL Includes a variety of events for autonomous robots such as line following, maze solving, mini Sumo, and more. www.chibots.org/
21-24 Russian Olympiad of Robots Moscow, Russia This competition has something for everyone including autonomous events such as Sumo, fire fighting, line following, and cross country. There are also remote control combat type events. http://intronics.bogorodsk.ru/
24-26 Critter Crunch Hyatt Regency Tech Center, Denver, CO Robot combat — 2 lb and 20 lb event categories.
20
SERVO 10.2008
Full Page.qxd
9/3/2008
12:30 PM
Page 21
SERVO 10.2008
21
CombatZone.qxd
9/3/2008
6:41 AM
Page 22
Featured This Month: Features 22 BUILD REPORT: Savage — Part 1 by James Baker
BUILD REP
24 MANUFACTURING:
Savage — Part 1
Combat Robot Drive Systems by Mike Jeffries
27 Building Battery Packs Fit For Combat by Robert Wilburn and Paul Reese
31 PARTS IS PARTS: Electronize Speed Controllers by James Baker
Events 26 Jul/Aug 2008 Results and Oct/Nov 2008 Upcoming Events
32 EVENT REPORT: Roaming Robots Goes to Qatar as told by Kevin Berry
ROBOT PROFILE – Top Ranked Robot This Month: 30 K2 by Kevin Berry
22
SERVO 10.2008
RT
● by James Baker
O
ver the last five years or so, I have built more robots for other people than for myself, which is really saying something as I have a sizable fleet. When building a robot for someone else, I always listen to their design brief, put together a concept, and build to that design. The robot was never mine in any sense, but a realization of somebody else’s plans. So, oftentimes things fall short of my own engineering ambitions. I am currently building a robot that is very different. Some time ago, I was contacted by a young man named Tom Armitage. He was building his own 30 lb robot and doing really well, but wanted my help with his flipping mechanism. It was not long after our first conversation that he commissioned me to build him a bolt-in, four bar linkage flipper device. I had not gotten much further than the proof of concept test rig when we again discussed
the design, and before I knew it I was providing the pneumatics solution, as well. A few weeks later, Tom bought a speed controller from me and was talking about chassis design. Several more conversation later, and I am now building a complete robot — minus the drive system — on quite a reasonable budget. Time passed quickly, and All main pneumatic components weigh in at just 2.2 lbs.
CombatZone.qxd
9/3/2008
6:42 AM
Page 23
the development of the 600 g CO2 bottle, pressure relief valve, dump valve, 1/2” solenoid valve, and custom-made ram. robot concept was refined over and over. Upgrades and improvements were undertaken, often pre-emptively. The original concept of a simple, low cost robot was all but gone, and the highly advanced design was starting to look like a 30 lb version of a very successful larger robot. Hmmm ... this got us thinking. More The ship’s design feature I was upgrades and design changes were most interested in using for the authorized, and the four cheap drill robot was its armored citadel motors originally planned for the principle. On HMS Warrior, the drive system were replaced with six center of the ship — including gun Team Whyachi TWR15 gear motors deck and steam engines — were and wheels. enclosed in a thick iron box of This, of course, resulted in a armor — an internal chassis that formed the core strength of the controller upgrade and new entire ship’s structure. The rest batteries as we planned to over-volt of the ship basically bolted to this the motors. Since this well known, inner box. For Savage, I wanted to heavier robot was now the basis try out this same idea, so I used a for my robot (named Savage), the chassis milled from a solid billet of owner was contacted and he was 2L97 aluminium alloy from which kind enough to offer his blessing. everything would be mounted. To Now the project continues with compliment this high core strength, renewed enthusiasm to do everybody proud. A number of the armor covering the robot is 8 features in this robot were inspired mm titanium, with some 4 mm by other awesome machines. The titanium and 4 mm Hardox 400 pneumatics system, for example, is wear plate in strategic places. All based on a liquid draw CO2 system the aluminium used for supports, as used successfully in many robots flipping arm, etc., is the same 2L97 on the British Robot Wars TV show. alloy used in the main citadel. My own heavyweight robot ‘Wheely If we think of Savage as a ship, Big Cheese’ uses an almost identical the upper deck is fully enclosed concept on a larger scale. I was also within the chassis citadel and houses inspired by the old British warship, the pneumatic system, flipping arm, HMS Warrior. This ship made batteries, speed controller, and radio everything else on the water system. Below this (beneath the obsolete when it entered service waterline, if you will), sit the six in the 1860s. Whyachi gear motors upon which
Custom-made ram for liquid CO2 use.
the robot runs. The titanium armor extends downwards from the chassis to the floor, protecting the motors and wheels. When designing the flipper, I wanted to ensure that the mechanism was mechanically strong, effective, and an integrated part of the armor of the robot. The pneumatic system that powers it is also very powerful, but I felt I needed to leave options to upgrade later. I built a test rig system with a custom made, aluminium manifold to allow me to experiment with different configurations and components. The ram currently used is a custom design that was of a size specifically chosen to allow the body to be tapped at its base to 1/2” BSP thread. This can then be screwed directly into the solenoid valve, negating the need for fittings. I tested an identical design tapped to 3/4” BSP (as the manifold was made to accept either size) which was significantly more
The test rig with the planned parts.
Lots of machine work has gone into every part.
Aluminium flipper arm components.
SERVO 10.2008
23
CombatZone.qxd
9/3/2008
6:44 AM
Page 24
Aluminium flipper arm components.
An inspirational ship. Some of the design features are used in this robot.
The rear armor plate is missing, showing off the thick titanium armor on top and on the flipper arm.
powerful, but heavier. I also experimented with and without
buffer tanks and with gaseous CO2, but saw no real increase in performance over the simpler direct liquid injection. This may prove to be different in the arena, but the robot will be completed with the lighter, smaller ram and no buffer tank for now. It will be up to Tom as to how it develops. See if you can guess what robot
inspired us so much with this near replica. You may be able to tell from the photos, or maybe you see possible inspiration from several machines. You will have to wait until Part 2 for the reveal, and a full review and performance assessment of the finished machine. I truly hope it does justice to the robot that inspired it. SV
MANUFACTURING: Combat Rob t Drive Systems ● by Mike Jeffries
T
here are many ways to move your robot around the arena floor. From the simplistic two wheel drive robot to the precision crafted complexity of a true walking robot, there are always different methods of movement to consider. When you are choosing a drive system, you have to consider the pros and Apollyon is the classic two wheeled wedge design. It uses the dragging front wedge to get under opponents.
24
SERVO 10.2008
cons of each system that makes sense for your design and determine which one is the best fit. Remember, with proper planning there is no wrong answer.
Two Wheel Drive Two wheel drive robots are as simple as it gets. You’ve got one power source attached to one wheel per side. With only two wheels, there is very little turning resistance which results in a very responsive robot. One problem with two wheel drive robots is that if you don’t have the two sides of the drive system well balanced, it will have some difficulty driving in a straight line at high speeds. Another issue with two wheel drive is that more often than not, part of the
weight of the robot will be balanced over a non-powered component, reducing the robot’s ability to push and accelerate. Two wheel drive robots risk being hung up on uneven floors or arena debris due to the low number of powered contact points. Many two wheel drive robots will have more than two wheels, using the extra wheel or wheels like casters to keep the chassis from dragging on the ground and to help with driving in a straight line. You should choose two wheel drive if: your design needs to have minimal weight in the drive system; it needs one part of the chassis dragging on the ground; or it doesn’t need a lot of pushing power.
Four Wheel Drive Four wheel drive systems are very common in robot combat. All
CombatZone.qxd
9/3/2008
6:45 AM
Page 25
or most of the Doom On You uses its four driven wheels to put a lot of power on the ground and allow it to move around weight of the robot the arena quickly, choosing when and where it hits its opponents. will be on powered wheels, maximizing the pushing power and acceleration of the robot. Four wheel drive robots will have a bit more trouble turning than two Shovelhead uses all six wheels to get the incredible drive power it has on the wheel drive robots ground, allowing it to use both its bulk and wedge as weapons. due to the wheels skidding sideways while the body of the robot turns. A the spacing between them even. Tracked Drive wider wheelbase reduces the effect The wheels themselves have rollers and makes it behave more like a Tracked drives are not very built into them. This provides friction two wheel drive robot. The difficulty common in robot combat due to in the direction the wheel spins turning, however, is balanced by it’s the increased weight and fragility of while having almost no friction increased ablity to drive in a straight the system. Tracks are a large target when moving side to side. Different line. You should choose four wheel on any robot with them. They either combinations of speed controller drive if: your design needs to use have to be well protected or built to commands will allow the robot to handle direct weapon blows to surmove in all the normal directions, the entire weight of your robot for vive well. Track systems have a huge as well as side to side and at odd traction; needs to have powered contact patch and are much less angles. The main disadvantage of ground contact at all corners; or likely to get hung up on anything in this is that the robot will not be able doesn’t need to be as light as the arena. Well-built tracks can be to push as well as if it had solid possible. very effective, but are difficult to wheels and that the movement make and often very complex comspeed is reduced due to wheels Six Plus Wheel Drive pared to wheeled drive systems. You being so heavily angled. You will Robots with six or more wheels should choose tracked drive if your likely need a specialized electrical behave much like four wheel drive design needs maximum ground concontrol mixer or to learn how to robots. They have the same issues program the mixing into your tact or if you are placing style over with turning and the same benefit transmitter to drive an omni wheeled efficiency in your drive train design. to driving in straight lines. One robot effectively. You should choose common variation is to have the omni drive if your design needs to Omni Drive central wheels lower than the front strafe but you don’t want to pay for or rear wheels by 1/8”-1/4” which Omni drives are a simple way or make mecanum wheels. causes the body to rock back and to allow your robot to strafe. forth, essentially becoming a four Strafing is when the robot is able Mecanum Drive wheel drive robot with a relatively to move to the left or the right, wide wheelbase. Six wheel drive essentially driving sideways. Mecanum drive is a variant on increases the number of contact Depending on the number of the standard omni wheel. Instead of points with the arena floor, making wheels — typically either three or the wheels being at angles, the it even harder to be high centered in four — they are normally placed 90 rollers inside the wheel are angled a match. The increased number of or 120 degrees apart to keep wheels also allows the use of Phantasm uses the strafing ability its wheels provide to maneuver wheels with softer treads as each quickly in any direction while still wheel will not wear as fast due to being able to keep the flipping arm pointed at its opponent. the reduced forces on the tread. You should choose six or more wheel drive if your design needs more ground contact than a four wheel drive robot or if you need Jawbreaker Jr. more than four wheels to uses the tracks to put as much pushing properly transmit the power from power behind its low wedge as possible. your motors to the ground.
SERVO 10.2008
25
CombatZone.qxd
9/3/2008
6:46 AM
Page 26
for cam walkers.
Alcoholic Stepfather uses its strafing ability to keep both the flamethrower and thick steel wedge pointed at its opponents.
True Walker
Kung Fu Cow took advantage of the cam walker bonus weight at some events to put a much heavier and more powerful weapon into the arena than would otherwise be possible.
at 45 degrees. The pushing power losses are similar, and the system works best with four wheels. Beyond the wheels — which are often custom made — this system is a very simple way to take a normal four wheel drive robot and give it the ability to strafe. Strafing with mecanum wheels can either be done on the transmitter or with a custom mixing circuit which will need at least three channels to function. You should choose mecanum drive if you want strafing ability while still having your wheels mounted inline.
Cam Walker Cam walkers have their contact
Mechadon was more a piece of art than a fighting robot, but still was able to use its massive weight and sharp feet to crash down on opponents back in the early days of BattleBots.
surfaces mounted to cams, which result in the contact surfaces rising and falling as the shaft rotates. Early in the history of robot combat, this system was allowed to have the full weight bonus given to walking robots, but after a few robots exploited the low weight and high efficiency possible in a system like this, they were ruled to be essentially wheels making them an unpopular choice for drive systems as they are heavier and less efficient than wheels in most applications. You should choose a cam walker if you want form over function, or if the event you are attending gives a weight bonus
True walking robots are not allowed to have a part in continuous rotation resulting in the movement of the robot. With the way the rules are written, walking robots need to have the components starting and stopping during movement to be given the weight bonus. The high complexity of a system like this at the scale of most fighting robots makes them very difficult to build, let alone win with. You should choose a true walker if you care more about making something cool than you do about making something competitive.
Driving the Points Home Each drive system has a good and bad side. In the end, you’re best off choosing the drive system you want and working to minimize the negatives that come with it. Efficiency and power are wonderful things, but the best drive system always has been and always will be the one you want to build. SV
Photos courtesy of BuildersDB (www.buildersdb.com) and the Robot Marketplace (www.robotcombat.com).
EVENTS Results and Upcoming Events Results Jul 13 – Aug 11, 2008
R
oaming Robots held events on July 18th and 19th at Reading and Farnborough, UK.
26
SERVO 10.2008
H
ouse of Benson – Barnyard Brawl was held by North East Robotics Club on July 26th. Twenty-eight bots were registered.
P
ennsylvania Bot Blast 2008 was held by D.W. Robots on July 12th. Thirty-six bots were registered.
Upcoming: Oct-Nov 2008
R
oaming Robots will hold events at Portsmouth on October 4th, and
CombatZone.qxd
9/3/2008
6:48 AM
Page 27
Nottingham, UK on October 25th. Go to www. roamingrob ots.co.uk for more details.
F
ranklin Institute Robot Weekend will be held on October 11th in Philadelphia, PA. Go to www.nerc.us for more details.
Rosemont, IL. Go to www.the crca.org for more details.
2
008 Halloween Robot Terror will be held on October 25th in Gilroy, CA. Go to www.calbugs. com for more details.
R
obots Live will hold events at Reading on October 11th,
M
echa-Mayhem 2008 will be held on October 16th in
London on October 25th, Chester on November 15, and Birmingham on November 22nd. Go to www.robotslive.co.uk for more details.
A
ntweight Benelux Championship will be held by Dutch Robot Games in the Netherlands on November 1st. SV
BUILDING BATTERY PACKS FIT FOR C MBAT! ● by Robert Wilburn and Paul Reese (Team O-Town Robotics; teamotown.com)
I
n the early days of combat robotics, builders were often forced to assemble their own battery packs if they wanted something robust that would tolerate conditions filled with shock, vibration, heavy G-loads, and constant flexing all while operating at very high temperatures. This is no longer the case with numerous venders offering proven off-the-shelf solutions. As vender packs became the norm, we continued to build our own packs using techniques we had learned through trial and error. These techniques can be applied to pack assembly for many uses outside of combat robotics. This guide will cover some of the advantages and disadvantages of existing battery chemistries, as well as describe the step-by-step process we used for pack construction. Following these simple techniques will ensure you make battery packs that are fit for combat! Before we get started, let’s talk about SAFETY. First, realize that a battery is a form of stored energy. Typically, this energy is used in small quantities over long periods of time. However, if this energy is consumed in a very short period of time — say
from a short circuit — conditions may occur that pose a serious safety hazard. A shorted battery may produce enough heat to cause severe burns, may explode, or possibly combust. Before attempting any steps in this process, take the time to familiarize yourself with your tools, work surface, environment, and the fundamentals of battery operation. Extreme care should be taken to never short the cells. This is a fairly simple process and one that just about anyone with the required materials can accomplish (see Parts List).
Nickel-metal Hydride (NiMH) and Nickel-cadmium (NiCd) Chemistries The debate over which of these chemistries is better has endured more than a decade, but suffice it to say each has its advantages and disadvantages. The choice should be based on your application and your research. Factors such as maximum discharge current, series resistance, cycle life, and self discharge are specifications to consider. Generally
speaking, NiMH are the better choice these days. The high current drain advantage NiCds once had has been diminished with advances in NiMH design. Both chemistries have a nominal 1.2V/cell under load. Either chemistry could be used in the following guide. The key here is to do your research before choosing!
Lithium-ion and Lithium Polymer Chemistries Lithium-ion and lithium polymer are much newer and superior battery technologies in terms of
Parts List • Individual cells • Bus bars • Solder and soldering iron with large tip • Shrink tube — high temp variety • A tube of Shoe Goo™ • Stranded copper wire — black and red • Dremel type tool with a small carbide grinding tip • Shrink wrap • Heat gun
SERVO 10.2008
27
CombatZone.qxd
9/3/2008
6:49 AM
Page 28
milliamps or 3.6 amps for one hour before dropping below 1.0 VDC per cell. They will produce much higher current for shorter periods based on their discharge curve specs. Cells vary greatly so discharge curves, as well as other specifications, should be consulted in the manufacturer’s datasheet. Note: The desired pack voltage divided by 1.2 will determine the number of cells needed in your pack. For example, a 12 VDC pack would require 10 cells.
FIGURE 1
their density, volume, and capacity when compared to NiMH and NiCds. However, neither are readily available in “cell form” making building your own packs a greater challenge and one this article will not touch on.
Selecting Your Cells Once you have selected your chemistry (NiMH or NiCd), you will need to choose a specific cell size (AA, Sub-C, C, etc.) based on your application. As a rule of thumb, you will want to get the highest (mAh) capacity cells you can afford. The terms mAh and Ah stand for “milliamp hour” and “amp hour,” respectively. A higher mAh rating means more capacity and longer runtime. The number preceding mAh indicates how much DC current a charged cell will source for one hour. For example, the cells depicted in this article are Sanyo 3600 mAh NiCd C cells. This means that when fully charged, they will source 3,600
Pack Construction — Let’s Begin! Roughing Up the Cell Terminals The first step is a light “roughing up” of the cell terminals which allows for a better solder connection when the bus bars are installed. While this step is optional, it is recommended if your pack(s) will be subject to rough conditions. A Dremel tool with a small carbide bit (see Figure 1) makes quick work of this task. A second option for those without a Dremel is to score a series of crisscrosses into the terminals with the tip of a razor. Installing Cell Isolation Rings Next, remove the factory cell covers with a razor blade. Factory covers cannot withstand high temperatures and will shrink and split exposing the cells in a pack to possible short circuit. To prevent short circuiting, we will install shrink FIGURE 3
FIGURE 2
28
SERVO 10.2008
tube isolation rings which act as physical separators preventing the cells from touching even under rough flexing conditions. Note: The temperature ratings of shrink tube vary, so be sure to investigate before you purchase. You can cut individual rings and shrink them with a heat gun or install a single piece the length of the cell and use a razor to remove the center leaving the two rings (see Figures 2 and 3). Cell Layout The cells need to be arranged in a manner that allows one cell’s (+) terminal to be connected to the next cell’s (-) terminal. These connections are made with bus bars and create a continuous series path from one cell to the next. Each cell in the series string will add 1.2V. The most common shape for packs is two rows with an equal number of cells in each row. Take your time figuring this out before continuing. Highly customized cell layouts can be another advantage of building packs yourself! Bonding the Cells Together Once the cell layout is determined, we are ready to bond the cells together. Bonding adds needed mechanical stability to the pack. A flexible adhesive that is able to withstand high temperatures is needed here. After experimenting with various types, we felt Shoe Goo had the best properties followed by silicone caulk. Shoe-Goo has simply incredible adhesion properties. You will need a fixture to hold the cells. We use a simple jig that clamps the cells between wooden 1x1s screwed to a workbench (see Figure 3). Apply adhesive between the cells and allow to dry, flip the cells and repeat. Now apply adhesive to the two halves to form the
CombatZone.qxd
9/3/2008
6:52 AM
Page 29
FIGURE 4
FIGURE 6
Bus Bar Installation Now that we have our pack shape, we are ready to solder on the bus bars to form a series path from one cell to the next (see Figure 4). Solder flux can help here. Care must be taken to avoid applying heat for too long or else the cell(s) may be damaged. The battery will act as a heatsink drawing heat out of the iron once the solder starts to flow, so use an iron with a large tip. The key is to get the solder flowing and remove the iron as quickly as possible. Lay the bus bar across the terminals and secure it as required to prevent movement. Again, solder quickly!
routing through tight FIGURE 5 spots. Wire usually comes jacketed in PVC or silicone. PVC is tougher and resists cuts and abrasions better while silicone withstands heat and harsh environments better. To install the leads, strip approx 0.25” of insulation back and unwind the exposed strands. Flatten the exposed strands out to form a V-shape as this will increase the surface area allowing for a stronger solder connection. Pre-tinning the wire is a good idea. Solder leads using the same method as the bus bars.
Stranded Wire Basics and Lead Attachment With the bus bars installed, solder the (+) and (-) leads. Consult an American Wire Gauge (AWG) table for the correct size wire based on your system current. Choose black for negative (-) and red for positive (+) connections. (Note that these images show white for positive which is not recommended. At the time of assembly, we ran out of red so the white was later made red with a large sharpie!) Wire types vary but generally speaking the more strands, the more flexible the wire. Deans Wet Noodle™ and Astroflight™ wire are favorites among robot builders. Flexible wire can be important if
Shrink Wrapping the Pack Once the leads are attached, the pack is ready to be shrinkwrapped. Before this is accomplished, secondary insulation such as thin sheets of Teflon (see Figure 5) or high temperature fiberglass tape may be added for extra insulation, if desired. Shrink wrap has a neat ability in that it shrinks radially but not axially. Cut a piece of heat shrink just long enough that it can be folded to cover the ends of the pack. Cut two holes for the leads
pack’s final shape and allow to dry.
to pass through. Slide the pack inside and leads through the holes. Using the heat gun, carefully begin passing the heat over the wrap. Don’t allow the heat to remain in one area too long or you may melt a hole in the wrap (Figure 6). Once the wrap is finished shrinking, you can reheat the ends to soften them and carefully fold them over the ends of the pack with a small block of wood or a plastic spatula. Crimp on your desired connectors and your pack is fit for combat! SV Some assembly required!
SERVO 10.2008
29
CombatZone.qxd
9/3/2008
6:53 AM
Page 30
ROBOT PR
FILE
TOP RANKED ROBOT THIS MONTH ● by Kevin Berry
Top Ranked Combat Bots History Score Weight Class
Bot
Win/Loss Weight Class
Bot
Win/Loss
150 grams
VD
26/7
150 grams
Micro Drive
10/3
1 pound
Dark Pounder
44/5
1 pound
Dark Pounder
23/3
1 kg
Roadbug
27/10
1 kg
Roadbug
11/4
3 pounds
3pd
48/21
3 pounds
Limblifter
12/1
6 pounds
G.I.R.
17/2
6 pounds
G.I.R.
11/2
12 pounds
Solaris
42/12
12 pounds
Surgical Strike
19/7
15 pounds
Humdinger 2
29/2
15 pounds
Humdinger 2
29/2
30 pounds
Helios
31/6
30 pounds
Billy Bob
12/4
30 (sport)
Bounty Hunter
9/1
30 (sport)
Bounty Hunter
9/1
60 pounds
Wedge of Doom
43/5
60 pounds
K2
14/2
120 pounds
Devil's Plunger
53/15
120 pounds
Touro
14/2
220 pounds
Sewer Snake
46/13
220 pounds
Original Sin
12/5
340 pounds
SHOVELHEAD
39/15
340 pounds
Ziggy
6/0
390 pounds
MidEvil
28/9
390 pounds
MidEvil
3/0
History Score is calculated by perfomance at all events known to BotRank
Current Ranking is calculated by performance at all known events, using data from the last 18 months
Rankings as of August 10, 2008
K
2 has competed at RoboGames 2007 and 2008. Details are:
● Overall configuration: Dual vertical disc spinner. ● Drive: Two Team Delta 18V DeWalt motors in low gear; rear wheels are driven and front wheels are slaved via timing belts. ● Wheels: 4” Colsons.
Historical Ranking: #5 Team: Team Velocity Builder(s): Kevin Barker Location: Enumclaw, WA BotRank Data Total Fights Lifetime History 16 Current Record 16 Events 2
● Weapon power: Same as drive. ● Weapon motor: S28-150 Magmotor. ● Weapon controller: Team Whyachi C1 contactor. ● Armor: 1/8” polycarbonate top and 1/8” aluminum base. ● Radio system: Spektrum DX6i.
● Drive batteries: Two 5,000 mAh, 6S lithium-polymer.
● Future plans: Not many upgrades are necessary after RoboGames; the bot functioned quite well. I am working on a solution to keep the brushes from falling out of the drive motors.
● Weapon type: 8” dual spinning discs, with .33” thick titanium hinged wedge.
● Design philosophy: Wedge scoops under opponents and lines them up to be launched by the discs.
● Drive ESC: Two Victor 883s.
30
K2 – Currently Ranked #1
Ranking
SERVO 10.2008
Wins 14 14
Losses 2 2
● Builder’s bragging opportunity: I installed a unique data collection system that I used at the last competition. The EagleTree eLogger and assorted sensors allowed me to monitor the bot’s battery current, voltage, rpm of the spinner, and several temperature sources. This data can help diagnose how the bot is performing, for instance, I noticed the current spikes dropped significantly later in the competition due to the weapon belt being stretched out. SV Photos and information are courtesy of Team Velocity (www.teamvelocityrobotics.com). All fight statistics are courtesy of BotRank (www.botrank.com) as of August 10, 2008. Event attendance data is courtesy of BotRank and The Builder’s Database (www.builders db.com) as of August 10, 2008.
CombatZone.qxd
9/3/2008
6:55 AM
Page 31
PARTS IS PARTS: Electronize Speed C ntrollers ● by James Baker
W
hen first venturing into combat robot building, I, like most, began with RC car speed controllers. It quickly became apparent that even the most highly rated controllers were not robust enough to handle the power demands of the 30 lb class. Several 240 amp race controllers billowed smoke before I finally gave up on RC car technology, and tried out RC boat controllers. Available then in several versions, I took the kit forms and the ready-built forms of several products and began experimenting. Before long, I had a winner. The Electronize brand of speed controllers was by far the most reliable and capable of those tested, and thus began my seven-year relationship with the company. Based in Tamworth, Great Britain, Electronize produces a range of speed controllers for radio controlled use, as well as electronic switchers. I have used several versions of the Electronize speed controller; from the 10 amp self builds, to the 40 amp CPU controlled type. My most common purchase was the FR15 unit. I have bought almost 50 of these in the last five years, and had only two fail under unusually heavy load which was way over the rated specification. Most electronic speed controllers work in basically the same way, with a pulse wave modulation output controlling motors via MOSFET chips. The Electronize is the same,
but does have some features I have not found on other controllers. Firstly, it has a variable frequency selector that allows pulsing of output from 100 Hz to 2,000 Hz, giving the user a choice of running more torque at low speed or greater efficiency a high speed. I make a lot of use of this feature on my corporate robots to aid battery longevity. Secondly, the Electronize controller has a variable output speed selector, which is a fantastically useful tool. For my corporate robots, I often carry 24-volt batteries on board, but set the controller output to seven volts. Using 9.6 volt drill motors for drive, they are still quite impressive in terms of speed and power, but the run time of my robots can be as much as four hours. Should I wish to speed up my robots, a precision screwdriver is all that is needed, and 10 seconds later I can have my bots zooming around at close to 30 mph, easily coping with 40 amp peak currents. No other controller I have found allows me to do this so easily. Seven years after buying my 30 lb bar spinner ‘tantrum’ used the FR15 until 2007.
Electronize controller.
first Electronize speed controller (in 2001), I still use them extensively. Despite most of my combat bots now running the latest in speed controller technology from other manufacturers, my corporate robots will always run the Electronize FR15, as they offer everything I need in terms of voltage and efficiency management, reliability, and value for money. I have run these controllers reliably at up to 90 amps with minimal modification, and have over 800 hours runtime on one corporate robot in particular, having changed out the motors twice, batteries twice, and receiver once, the speed controllers are still the original ones from 2002. SV Visit www.electronize.co.uk for more information. Radio-controlled, full size R2-D2 performed really well on FR15 controllers.
SERVO 10.2008
31
CombatZone.qxd
9/3/2008
6:59 AM
Page 32
ROAMING ROB TS GOES TO QATAR ● as told by Kevin Berry
J
ohn Findlay — head honcho of the United Kingdom’s Roaming Robots — was commissioned to do a show in the Middle Eastern country of Qatar. He graciously provided details and photos to Combat Zone for this article. Roaming Robots — after two years of preparation — hauled a planeload of bots to Doha, the capital of Qatar. Besides their biological support staff, heavyweights Ripper, Envy, Tilly Ewe2, Scorpion, DTK, Mighty Mouse, Velocirippa, and Hammertime went on this jaunt, along with featherweights Pain in the Asp, Pillow Torque, Mini Mighty Mouse, Iron Side, and Rip. The venue was a major shopping center, basically one of the ubiquitous malls similar to those in any country, world-wide. After two continuous days of setup, the arena and display area
The Doha crew.
was ready. Over the next seven nights, between 5 pm and 10 pm the shopping center was echoing with the sound of robots battling! The first night was a bit hectic, John explained. The unrehearsed format not only had featherweights and heavyweights, but there were 12 roboteers to drive robots and run two robot building workshops during each night. As the week continued — with slight changes to the format — it was clear that the robots were a hit with the The Doha pits.
The Doha arena.
32
SERVO 10.2008
The Doha robots.
locals. They hadn’t seen anything like it before, and were blown away with the excitement of the event. Despite being in a tourist mecca, it was a typical life for an event organizer. Apart from a quick morning swim, most time was spent in the shopping center preparing for the show each night. After the event, the workers did find time for some R & R when they headed to a lovely resort by the sea for swimming, jet skis, and quad biking! John specifically mentioned Fahad and Rabi, their two drivers and helpers who were fantastic throughout the week. Whether obtaining more CO2 or taking the crew to a bar for a few drinks, they were always available. John also raved about Marwan, their host and sponsor. Roaming Robots just signed a five year deal for educational work in Singapore, and is in final negotiations for a five-day event early next year in Kuwait. SV
Full Page.qxd
9/3/2008
12:35 PM
Page 33
JOIN THESE LEADING COMPANIES AT 2008 ROBODEVELOPMENT Founding Sponsor
, CONFERENCE&EXPO 08
NOV. 18-19, 2008
Gold Sponsor
SANTA CLARA CONVENTION CENTER
SANTA CLARA, CA
Silver Sponsors
Join the International Technical Design and Development Event for the Personal, Service, & Mobile Robotics Industry
EXCLUSIVE OFFER: USE PRIORITY CODE RDSRV AND
SAVE $300 ON A CONFERENCE PASS
BOSTON ENGINEERING™
WWW.ROBODEVELOPMENT.COM Q 800-305-0634 Q The industry’s most comprehensive conference program covering these critical topics: -
Systems & Systems Engineering Tools & Platforms Enabling Technology Achieving Autonomy Design & Development
Q Valuable networking opportunities that put you in touch with peers, industry experts and up-and-coming talent: - Evening Welcome Reception - Speaker Meet & Greet - Birds-of-a-Feather Discussions Q Exposition floor featuring what’s new and what’s next in robotics design and development
Q Learn from exclusive keynote presentations delivered by world-renowned robotics industry experts: Sebastian Thrun, Winner of the DARPA Grand Challenge; Director, Artificial Intelligence Laboratory, Stanford University
Corporate Sponsors
Maja J. Mataric, Founding Director, USC Center for Robotics and Embedded Systems; Director, USC Robotics Research Lab Jeanne Dietsch, CEO, MobileRobots Inc Michael Bruch, Section Head, Space and Naval Warfare (SPAWAR) Systems Center
Analyst, Association & Academic Co-Sponsors
FOR COMPLETE EVENT DETAILS VISIT WWW.ROBODEVELOPMENT.COM
Media Co-Sponsors
For Information on Sponsorship and Exhibiting Opportunities, contact Ellen Cotton at
[email protected] or 508-663-1500 x240
Listing as of August 30, 2008. For a current list of participating companies, please visit www.robodevelopment.com.
Eady.qxd
9/3/2008
9:06 PM
Page 34
by Fred Eady ire is a wonderful thing. There’s not much that is more reliable than a short piece of stranded or solid copper wire between the ends of an electrical connection. However, there are situations where electrically tying devices together with long runs of wire is impractical. Light does a good job of replacing copper when the conditions are right, but if one needs to move electrons reliably over a relatively long distance there’s no better conductor than the Earth’s magnetic field. Odds are that if you’re not using copper wire to supply power to a device, you’re using that wire to convey a signal. If your signaling environment allows the communicating devices to place their sensors in plain sight of each other and if the signaling environment can bounce light around between the sensors with a minimum of spectral loss, a beam of modulated light is as good as a signal-carrying piece of copper wire. On the other hand, if the devices that wish to communicate can’t visibly see each other or the distance between the devices is large, light may not be the most reliable means of carrying a signal from one device to the other. In this case, short-distance signaling using low-power RF is a better bet.
W
A Smart Data Radio What do you get when you mix a Microchip PIC16F690 microcontroller with a Texas Instruments CC1100 1 GHz transceiver IC and a fingertip full of 0402 PHOTO 1. R3 and R4 are SMT jumpers that determine the baud rate which is set for 19200 bps in this shot. From what I can match up with the PIC’s pinout, R2 and C14 are the MCLR reset circuit, while R5, C11, C12, and X1 form the PIC’s system clock oscillator. Bulk capacitor C1 is guarding the input voltage.
SMT components? The itty-bitty EmbedRF data radio you see in Photo 1. The EmbedRF can replace up to 80 50-foot copper signal wires as it is pinned for four 16-bit analog-todigital (A-to-D) inputs, a digital output, and a digital input. Alternately, you can program the EmbedRF to present two A-to-D inputs, one digital input, and two digital outputs. The EmbedRF’s A-to-D input voltage levels and digital I/O logic levels can be included in the RF transmit stream or completely ignored and replaced with user-defined data. The digital input and one of the digital outputs can be optionally configured as part of a three-wire EUSART-based serial interface (RXD, TXD, and GND). The EmbedRF’s CC1100 transceiver IC dominating the view in Photo 2 is hard-coded to run at 915 MHz in pointto-point or point-to-multipoint modes. All of the A-to-D inputs and the serial interface (RXD and TXD) are tied to the on-board PIC. Data communications between the PIC and the CC1100 is performed using a SPI (Serial Peripheral Interface) data link. The EmbedRF has the ability to transmit a 17-byte packet in intervals of 0.25 to 12.75 seconds. The interval granularity is 50 milliseconds per interval bit. Only 11 of the 17 bytes in the packet are loaded with data that the user can access as the first six bytes of the packet contain the network ID and transmitting device ID. The network ID is hidden during transmission to provide network security. Of the 11 transmitted data bytes, only 10 of the 11 data bytes are user customizable via the EmbedRF’s EUSARTbased serial interface. The last byte in the 17-byte packet is a packet counter byte that is incremented each time a new RF packet is transmitted by a transmit-enabled EmbedRF device. A minimum of two EmbedRF devices are required to form a network. Each EmbedRF network node has the capability of transmitting only, receiving only, or transmitting and receiving. A set of unique device and network IDs allows EmbedRF nodes to selectively communicate with each other. An EmbedRF network node can have a unique transmit device ID and a separate unique receive device ID. Device IDs can range from zero (0x000000) to 16,777,215 (0xFFFFFF). The same 24-bit ID PHOTO 2. The unmarked termination to the right of VDD is the RSET pin, which is tied to the junction of MCLR components R2 and C14 in Photo 1. The antenna is covered by the SN000189 label.
34
SERVO 10.2008
Eady.qxd
9/3/2008
9:14 PM
Page 35
range that applies to the device ID also applies to the network ID. To make establishing communications between nodes easier, the EmbedRF firmware can be commanded to perform an intelligent search. A receiving EmbedRF node can establish a session with the nearest transmitting node or the first transmitting node it hears. The concept of the first transmitting node session is obvious. The EmbedRF nearest transmitting node function is made possible by use of the receiving EmbedRF node’s RSSI (Receive Signal Strength Indicator) value. The larger the RSSI value, the closer the transmitter. The RSSI is presented to the EmbedRF programmer as a byte-wide digital value. Since the PIC16F690 is in charge of the EmbedRF’s operating logic and the data packets are relatively small, it’s only natural that the EmbedRF designers would take advantage of the PIC’s SRAM to buffer data traversing between the PIC and the CC1100. By buffering the transmit and receive packet data, a very useful notification feature is added to the EmbedRF. The EmbedRF can be commanded to notify the external microcontroller when a packet is received into its receive data buffer. Conversely, the EmbedRF provides positive notification feedback to the external microcontroller when a packet is transmitted from its transmit buffer. If receive notification is not required, the EmbedRF can be polled for received packet information. The transmit packet notification is always presented to the external microcontroller. It’s up to the external microcontroller’s firmware to sense and use the transmit notification. When the EmbedRF notify mode is active, received data in the EmbedRF’s receive buffer is immediately transferred to the PIC’s EUSART and transmitted over the EmbedRF’s serial interface. A very nice Windows application called EmbedRF DesktopPro is available from the EmbedRF website. This program is designed to interface an EmbedRF to a PC using an optional USB interface module. This USB interface module captured in Photo 3 is part of the development kit. The EmbedRF is designed to be programmed via its serial interface and put to work as a stand-alone data radio. To that end, the kit also comes with a battery board that plugs into and powers a stand-alone radio module. I just happened to have one of the battery boards and I put the macro lens to it in Photo 4. Unless your mechanical animal has the ability to run Windows and manipulate a PC keyboard, or you simply want to program an EmbedRF module, stick it out there somewhere and never change the configuration. You’ll want to forego the DesktopPro application in favor of a PIC running the home-brewed EmbedRF API (Application Programming Interface) we’re about to code up. We’ll compile our API source code using the HI-TECH PICC C compiler. This compiler allows you to port the EmbedRF API source code to any PIC that you desire. The API code we’ll be assembling is based on the PIC18LF2620 and was constructed using the HI-TECH compiler package.
PHOTO 3. This EmbedRF USB interface supplies power to the EmbedRF module and provides a virtual serial interface to the EmbedRF DesktopPro application.
EmbedRF API Lab Layout The hardware setup is very simple. All you need to do is connect the EmbedRF’s TXD line to your PIC’s USART/EUSART RX pin. The PIC’s TX pin should be tied to the EmbedRF’s RXD line. Since the EmbedRF module comes jumpered for a 19200 bps serial interface, you must set the same baud rate on the PIC. If you must, you can move the EmbedRF’s baud rate jumpers to obtain a different baud rate. The serial interface can alternately be jumpered for 9600, 2400, and 1200 bps. Power your PIC and the EmbedRF with a power supply voltage between 2.0 and 3.6 volts. I powered mine with 3.3 volts. For the purposes of demonstration, I’ll use a second EmbedRF and an EmbedRF USB interface board that are tied to my laptop as the second node in a two-node network. A Microchip REAL ICE (In-Circuit Emulator) will be attached to the PIC18LF2620-controlled EmbedRF module. Using the DesktopPro application on one node and the Microchip REAL ICE on the other node allows for easy, on-the-fly reconfiguration of each of the EmbedRF network nodes. So that you’ll know if I’m talking about the EmbedRF module or the PIC18LF2620, I will always refer to the EmbedRF module and its on-board PIC16F690 as the EmbedRF. Thus, we have one EmbedRF tied to my laptop via the USB interface board and a second EmbedRF tied to the PIC18LF2620 via a EUSART-to-EUSART three-wire serial interface. In the text that follows, the PIC18LF2620 and its associated circuitry will be referred to simply as the PIC. The API code we are about to write runs on the PIC. We will not write any code that “runs” on the EmbedRF’s PIC16F690 microcontroller.
Coding the EmbedRF API The EmbedRF API code package that you will have access to via the SERVO website (www.servomagazine .com) includes all of the functionality that is necessary to support the EmbedRF API function calls. For instance, an interrupt-driven EUSART interface and an interrupt-driven millisecond-interval clock are part of the API package. Keep SERVO 10.2008
35
Eady.qxd
9/3/2008
9:15 PM
Page 36
PHOTO 4. When depressed, the pushbutton allows three volts to flow to the AN1 analog-to-digital input. The idea is to provide some instant gratification when using the EmbedRF DesktopPro application to manipulate an EmbedRF network.
this in mind as we will only cover the EmbedRF API functionality in this discussion. There are certain supporting functions that are common to each API call. Each EmbedRF command consists of a single byte that may be followed by any number of command arguments. Commands and their associated arguments are all transmitted to the EmbedRF module using the API sendchar function, which is part of the API’s interrupt-driven EUSART support code. When a command is transmitted via the EUSART serial interface from the PIC to the EmbedRF, the EmbedRF will process the incoming command byte and its arguments, and return a reply message to the originator of the command. The command originator in our network can be the PIC or the laptop. The EmbedRF command reply will always begin with a byte which has the value of the original command byte value plus 0x20. For instance, to query the EmbedRF firmware version we would issue a command byte of 0x56 over the EUSART serial interface to the EmbedRF. It will reply with 0x76 followed by two bytes of firmware version data. Each API function checks for a valid command reply. If the EmbedRF command reply must be validated by the application, a function return code (frc) is returned to the API function caller. An frc return value of zero indicates that all is well. If an internal API call validation fails, the API function will return a one to the caller. The EmbedRF’s command reply is picked up by the API support code’s interrupt-driven EUSART receive routines. Well-placed calls to the API’s CharInQueue function allows us to determine when valid data is in the API’s receive queue. When the CharInQueue function returns a Boolean TRUE, the recvchar support function is used to retrieve the data from the API receive queue. Each EmbedRF API call takes advantage of the CharInQueue and recvchar API support functions. The EmbedRF API code package contains a packet_rx array to hold the received packet data and a packet_tx array to buffer data that is to be sent to the EmbedRF for transmission. Here’s the layout for the receive array:
36
SERVO 10.2008
char packet_rx[15]; #define xid_hi 0x00 #define xid_mid 0x01 #define xid_lo 0x02 #define rx_0 0x03 #define rx_1 0x04 #define rx_2 0x05 #define rx_3 0x06 #define rx_4 0x07 #define rx_5 0x08 #define rx_6 0x09 #define rx_7 0x0A #define rx_8 0x0B #define rx_9 0x0C #define rx_rssi 0x0D #define rx_ctr 0x0E #define rx_end 0x0F
//transmit device ID
//received signal strength indicator //packet counter
The ID of the device that sent the packet is contained in the first three bytes of the receive packet array. The rx_end byte is not part of the receive packet array and is used to indicate the end of the array’s extent. The best way to explain the use of the rx_end definition is to examine the EmbedRF API call that retrieves a packet from the EmbedRF’s receive buffer: //****************************************************** //* GET RECEIVED DATA FROM EmbedRF //* //* ENTRY - NONE //* //* RETURN - 15 BYTES - RECEIVED DATA IN packet_rx //****************************************************** void get_embedrf_data(void) { char i,embedrf_reply; sendchar(0x47); while(!(CharInQueue())); if(CharInQueue()) embedrf_reply = recvchar(); if(embedrf_reply == 0x67) { for(i=0;i
The get_embedrf_data API call is issued in a polling sequence when the notify feature is disabled. Note the command byte (0x47) and the command reply byte (0x67). Once the command reply is validated, data is transferred from the API receive buffer into the packet_rx array as long as the if statement counter variable i is less than rx_end and the CharInQueue function returns a Boolean TRUE. During the course of testing the API code, I found that I had to pace the issuance of commands to the EmbedRF. The delay_ms function is part of the interrupt-driven clock code that supports the API function calls. You’ll find a 10
Eady.qxd
9/3/2008
9:15 PM
Page 37
millisecond delay_ms pacing call at the end of every API function call. Since transmitting and receiving data is the main objective, let’s look at the API’s transmit buffer array:
These values show up very nicely in the MPLAB IDE Watch window. Here’s a code snippet that is designed to fill in some of the reply data structure’s byte-wide fields: char rc;
char packet_tx[11]; #define ad0_hi #define tx_0 #define ad0_lo #define tx_1 #define ad1_hi #define tx_2 #define ad1_lo #define tx_3 #define ad2_hi #define tx_4 #define ad2_lo #define tx_5 #define ad3_hi #define tx_6 #define ad3_lo #define tx_7 #define tx_8 #define tx_9 #define tx_cmd #define tx_end
0x00 0x00 0x01 0x01 0x02 0x02 0x03 0x03 0x04 0x04 0x05 0x05 0x06 0x06 0x07 0x07 0x08 0x09 0x0A 0x0B
Note that I’ve defined both the user data bytes and the EmbedRF’s native A-to-D inputs in the API transmit packet array. The value of the tx_cmd byte determines if the buffered transmit data should be transmitted immediately by the EmbedRF, buffered for scheduled transmission, or transmitted before receiving. The tx_end serves the same purpose as the rx_end definition. Like rx_end, tx_end is not part of the array data. I found it very helpful to be able to see the device IDs, network ID, version information, intervals, modes, and A-to-D settings while writing and testing the EmbedRF API code. Here’s the data structure I used to get an overall view of the operational parameters: typedef struct char char char char char char char char char
{ ver_maj:8; ver_min:8; tx_interval:8; tx_mode:8; tx_pwr_lvl:8; device_id_aa:8;
//firmware version //transmit interval //transmit-receive mode //transmit power level //device id - transmit //or receive
device_id_bb:8; device_id_cc:8; ad_setting_ww:8; //analog-to-digital port //settings char ad_setting_xx:8; char ad_setting_yy:8; char ad_setting_zz:8; char find_tx_xx:8; //foundtransmitter ID char find_tx_yy:8; char find_tx_zz:8; char rid_xx:8; //pseudo-random device ID char rid_yy:8; char rid_zz:8; char network_mode:8; //network mode } RReply; RReply reply;
#define #define #define
err_led ON OFF
//Notify Mode Options #define notify_off #define notify_on
LATA5 0x00 0x01
0x00 0x01
//Transmit/Receive Mode Configuration Options #define tr_off 0x00 //off - no transmit or //receive #define tr_rcv 0x01 //receive only #define tr_xmit 0x02 //transmit only #define tr_rx 0x03 //receive then transmit #define tr_xr 0x04 //transmit then receive //Network Mode Options #define p_to_p #define p_to_m
0x00 0x01
//point to point //point to multipoint
//Transmit Power Level Configuration Options #define dbm_minus10 0x00 //-10 dbm #define dbm_minus5 0x01 //-5 dbm #define dbm_0 0x02 //0 dbm #define dbm_plus5 0x03 //5 dbm //Analog/Digital Options #define ad_disabled #define ad_enabled #define dig_1 #define dig_0
0x00 0x01 0x02 0x03
//disabled //analog active //digital active logic 1 //digital active logic 0
//this code located in main function err_led = OFF; if(rc = set_notify_mode(notify_on)) err_led = ON; if(rc = set_tx_interval(0x28)) err_led = ON; if(rc = set_tx_rx_mode(tr_rcv)) err_led = ON; if(rc = set_device_id(0x00, 0x00, 0x01, id_rcv)) err_led = ON; if(rc = set_network_id(0x00,0x01,0x02)) err_led = ON; if(rc = set_ad_settings(0x00,0x01,0x02,0x03)) err_led = ON; if(rc = set_network_mode(p_to_p)) err_led = ON; if(rc = set_tx_pwr_lvl(dbm_plus5)) err_led = ON; get_firmware_version(); get_tx_interval(); get_tx_mode(); get_device_id(rx_device); get_ad_settings(); get_network_mode(); get_tx_pwr_lvl();
The reply structure byte-filling code is typical of what your EmbedRF control application will look like. I attached an LED to PORTA5 on my PIC18LF2620 to act as a debug indicator. The variable rc (short for return code) is a global SERVO 10.2008
37
Eady.qxd
9/3/2008
9:16 PM
Page 38
SCREENSHOT 2. You can convey plenty of control and monitor information with 10 bytes. And, you can count on the data you see in this shot as being accurate as the EmbedRF performs an automatic CRC check on each data packet. err_led = ON; if(rc = set_device_id(0x00, 0x00, 0x01, id_rcv)) err_led = ON; if(rc = set_network_id(0x00,0x00,0x00)) err_led = ON; if(rc = set_network_mode(p_to_p)) err_led = ON; find_xmitr(0x00);
SCREENSHOT 1. Let’s see if things match up here. The firmware version is 2.0, which is backed up by the silkscreen legend in Photo 1. The tx_interval value of 0x28 matches our set_tx_interval API call argument. You’ll find every entry in the Watch window to be accurate. Wondering why the network ID value is missing? Two reasons: there is no command to read the network ID and the network ID is hidden for security reasons.
variable that is defined within the API support code. Each if statement in the code snippet is an API function call. If the return code (rc) is equal to zero, there are no detected command entry or reply errors and the err_led = ON statements don’t get executed. The “get” API calls retrieve the results of the if statement API calls and stuff them into the reply data structure. The tasks performed by the API function calls are pretty obvious as they are named for the EmbedRF commands they represent. The only thing you can’t really figure out with what you see in the code snippet is the transmit interval (tx_interval) delay window. However, I did tell you earlier how the transmit interval argument works. Recall that each transmit interval bit represents 50 milliseconds of delay. So, 0x28 equates to 40 decimal, which results in 40 * 50 milliseconds or a two second delay window between transmissions. The MPLAB IDE Watch window shown in Screenshot 1 reveals the results of the EmbedRF API code snippet “get” calls.
Receiving Data Using the EmbedRF API I’ve taken the liberty to use the EmbedRF DesktopPro application to put the EmbedRF attached to the laptop USB interface into transmit-only mode with a transmit device ID of 0xAABBCC (11,189,196 decimal). The network mode is point-to-point and the network ID is 0x000000. Consider this EmbedRF API application receive code snippet: //Find Transmitter Options #define find first 0x00 #define prox_find 0x01
//find first //proximity find
err_led = OFF; if(rc = set_notify_mode(notify_on)) err_led = ON; if(rc = set_tx_rx_mode(tr_rcv))
38
SERVO 10.2008
while(!(CharInQueue())); for(i=0;i
After matching up the PIC’s EmbedRF module receive parameters with those of the laptop’s transmit parameters, the find transmitter API call is invoked. The find transmitter API call will establish a receiving session with the first transmitter it can hear. In our case, that will be the laptop’s EmbedRF. With the notify option active in the PIC’s EmbedRF, as soon as the PIC’s receive buffer is loaded with a valid packet, the EmbedRF will dump the received packet onto the PIC-to-EmbedRF serial interface. The API code’s interrupt-driven EUSART support code will see the incoming data and load it into the API receive buffer. We then transfer the data packet from the API receive buffer to the packet_rx array using the CharInQueue function as a buffer-to-array regulator. Let’s see if the data we received from the laptop’s EmbedRF in Screenshot 2 makes any sense. Recall that the laptop’s EmbedRF was programmed with a device transmit ID of 0xAABBCC. According to Screenshot 2, we captured the transmit device’s ID correctly in the first three bytes of the received data packet. The EmbedRF DesktopPRO application has an option that allows the first data byte to be incremented over time. In our case, I commanded it to increment the first data byte of the packet every four seconds. Thus, the laptop EmbedRF had been transmitting 4 * 0x4D (308) seconds when this data packet was captured by the PIC’s EmbedRF module. The remaining data bytes in the packet are set in sequential fashion as shown in Screenshot 2. The signal strength is represented in byte 13 and the laptop’s EmbedRF packet counter is set for 246 decimal (0xF6). The packet counter value can be used by the application to detect a dropped packet at the receiving end.
Transmitting Data Using the EmbedRF API After using the EmbedRF DesktopPRO application to flip the laptop’s EmbedRF module into a dedicated receiver mode with active notify, I whipped up this transmit
Eady.qxd
9/3/2008
9:45 PM
Page 39
application code snippet: for(i=0;i
Before running the API transmit application, I commanded the laptop EmbedRF to search for the first transmitter it could hear. Kicking off the API transmit application resulted in the EmbedRF DesktopPRO “hearing” the PIC’s EmbedRF and establishing a session with it. The results of the communications session can be picked out of the EmbedRF DesktopPRO window you see in Screenshot 3. According to the API transmit application code snippet, the PIC’s EmbedRF transmit device ID is 0x112233 or 1,122,867 decimal. The PIC’s transmit device ID is verified in Screenshot 3. The 10-byte data packet transmitted by the PIC’s EmbedRF begins with 2 and ends with 11. This is also backed up by the Raw Data Received view in Screenshot 3. We disabled all of the EmbedRF’s A-to-D inputs, so you can ignore the Analog Data Received numbers as they are just the hex values of the data we entered into the data packet. For instance, A/D 0 says it sees 515 counts. That’s because it’s calculating 0x0203 (515 decimal) as an A-to-D reading. The same goes for A/D 1, which is a result of 0x0405 or 1029 decimal.
Sources Saelig — www.saelig.com EmbedRF; EmbedRF Development Kit HI-TECH Software — www.htsoft.com HI-TECH PICC-18 PRO Microchip — www.microchip.com PIC18LF2620; MPLAB IDE; MPLAB REAL ICE
SCREENSHOT 3.
The Hard Work is Done Take a look at the EmbedRF datasheet and you’ll see that there are many more commands than we have discussed here. The good news is that every EmbedRF command has a corresponding API function call; I’ve tested all of them. So, all you have to do is put them together to form your own unique EmbedRF application. To ease your learning curve, I went to great lengths to make sure that the API call arguments closely matched the EmbedRF command descriptions in the EmbedRF datasheet. Integrating the EmbedRF hardware is a nobrainer and with the availability of our home-brewed EmbedRF API, bringing an EmbedRF network online is a walk in the park. I’m sure that you won’t have any trouble coming up with an application for the EmbedRF data radios. See you next time! SV
Make your product wireless - quickly, conveniently, and affordably. EmbedRF is a rapidly-deployed, turn-key, networkable wireless solution for low data rate, ultra low-power analog or digital applications. Avoid lengthy RF development time by using EmbedRF short-range low-power wireless modules in your product design. Notable features: RSSI output – ideal for finding nearest module or position tracking; current levels are CR2032 coin-cell friendly (average current to <12uA Tx/Rx); >0.25s periodicity; unique IDs avoids cross-talk; < 6mS link latency; buffered receive data allows for other system priorities. Full details at www.EmbedRF.com Available from Saelig Company www.saelig.com
[email protected]
SERVO 10.2008
39
Carrier.qxd
9/2/2008
3:34 PM
Page 40
by DAVID CARRIER
GETTING CONTROL WITH THE
Propeller hen designing a product that will sell millions of units, every cent counts, so engineers will often use very creative methods to program a single microcontroller to handle multiple tasks. These tricks can be difficult to comprehend, let alone implement. For one-time projects — especially for hobbyists — programming a second inexpensive microcontroller to perform the task achieves the same results but requires significantly less time. To simplify programming even more, many manufacturers sell controller boards based on microcontrollers that are preprogrammed to perform a single task. Even though the cost of creating an entire circuit board is much higher than the cost of an extra microcontroller, these boards are quicker to set up, are reusable for other projects, and more than pay for themselves in saved time. If multiple controller boards are needed for a single project though, the
W
40
SERVO 10.2008
PART 2: Controlling Servos
costs really do add up, so the best option would be to have one board that performs multiple functions.
Controlling a Servo In last month’s article, Chris Savage discussed the hardware design for the multipurpose controller board shown in Figure 1. The board, based on the Parallax Propeller™ chip, will perform the functions of an R/C servo controller, a stepper motor controller, and a PWM controller. All three motor control signals have specific timing needs, so with a traditional interrupt-based microcontroller it would be difficult to get the timing correct. Because there are eight processors — or cogs — in the Propeller, these tasks can easily FIGURE 1. The Propeller multi-controller board, built by Chris Savage last month.
Carrier.qxd
9/2/2008
3:34 PM
Page 41
be performed at the same time. The Propeller allows Open Source objects or programs designed to perform a specific task to be run in parallel, each occupying its own cog. I will be My employer (Parallax, Inc.), has been selling a servo implementing the first task: R/C servo control. controller: the Parallax Servo Controller or PSC. I could have Rarely a month goes by without an article in SERVO written an article about how to use it, published the Magazine describing the communications needed to control schematic (even though it is freely distributed in the an analog R/C servo, so I will keep the review short. There documentation on the Parallax website) and a through-hole are no official standards on R/C servos, so many aspects of version of the circuit board layout, then sold the processor their operation vary from manufacturer to manufacturer, — preprogrammed with a proprietary servo controller or even for different product lines from the same program — at three times the retail price. This has been manufacturer. R/C servos have three lines: power, ground, done before, but it is a practice I find rather irritating. I did and signal. Most servos will run between 4.8 and 6 volts, not know programmable microcontrollers existed until — as but it is best to check the specifications before powering a student in junior high school — I was building a project an R/C servo; some have a more limited voltage range. described in a magazine to try and teach myself electronics. R/C servos are controlled by pulses read by the signal line. My parents were nice enough to drive me to all of the local If the voltage on the line is greater than half of the voltage electronics stores to pick up the components, but there was that is powering the servo, the signal is considered to be one chip I could not find. The owner of the local surplus a logic high; otherwise, it is a logic low. To control an R/C electronics store kindly explained to me that the author had servo, the signal line starts low, is held to a logic high custom programmed a microcontroller and I would have to for one to two milliseconds (ms), and then it is returned order it. Several years later, I learned how to program low. This process is repeated 40 to 50 times per second. them myself, and I eventually built my career around programming microcontrollers, but I think there is a better The duration of the pulse determines the position that way to introduce others to these devices. the servo will try to hold. Generally, a 1 ms pulse moves it to a 90-degree clockwise position, a 1.5 ms pulse Instead of advertising a preprogrammed chip, I would centers it, and a 2 ms pulse moves it to 90 degrees like to use this article to propose an open-source project counterclockwise. based on the Propeller Multi-Controller board that Chris What is more interesting though, is how an R/C servo Savage introduced last month. The design will be more works. When an R/C servo receives a pulse, it compares powerful than any off-the-shelf servo controllers I have the position of its output shaft to the position the pulse seen, but it will be easy to use and hobbyists will be able to indicates. If the shaft is not at the position it should be, it build it themselves at a low cost. I will post the source code is rotated toward it. The further the shaft needs to rotate, and documentation online, and for the remainder of this the faster it moves. The position sensor physically limits the article I’ll discuss the features that will make it unique. range the output shaft can rotate; usually to a total of Parallax hosts a website called the Propeller Object 180 degrees. By removing an R/C servo’s feedback system Exchange where people can post code they have written and hard-wiring it to think it is always centered, it can also and have it freely distributed under the MIT License. Like be modified for continuous rotation. By sending a center pulse, the modified servo will think it is where it needs to be, and it will not move. When the pulse deviates from center, the servo will try to follow, but without a feedback system, it will never know it moved; it will just keep spinning. The further off-center the pulse indicates, the further away the servo will think it is, Shoulder servo and the faster it will go. The direction the 90° modified servo moves will also follow the Shoulder servo 0° 90° direction indicated by the servo pulse. Because R/C analog servos only move -90 0° 0 sec. 5 sec. when they receive a pulse, they will not -90° move when pulses are not being sent. 0 sec. 5 sec. Elbow servo Without a stream of pulses, they are 90° Elbow servo effectively disabled. There are also digital 90° 0° servos that have internal microcontrollers that process the incoming pulses and 0° -90 directly control the motor. Digital servos 0 sec. 5 sec. -90° have more output power than analog ones, 0 sec. 5 sec. because analog servos do not power the FIGURE 2. The simplest control method FIGURE 3. Moving more than motor between pulses. Because they do not — moving one servo at a time — is one servo at a time is not only rely on the stream of pulses, digital servos slower and may place the robotic arm quicker, it also creates a more in positions that it should not be in. professional look. cannot as easily be disabled. SERVO 10.2008
41
Carrier.qxd
9/2/2008
3:34 PM
Page 42
the GNU General Public License that is used to distribute Linux, the MIT License is an open-source license, but the MIT License does not place any restrictions on when or how software is used, as long as the license is included with it.
A New Design The most basic servo controllers do no more than generate the pulses that control the servos; they have no memory of where a servo has been or where it is going. There are more advanced servo controllers that can move servos from one position to another at a specified speed, or over a specified time, but many advanced movements — especially when servos start and stop while others are moving — are still difficult. The servo controller design I am proposing allows commands to be queued, so that servos can be commanded to begin movement either immediately, after a set pause, or after a specific servo has arrived at its destination. This way, some servos can switch directions while other servos are still moving. For example, let’s consider a robotic arm. The simplest method to control it is to move one servo, poll the servo controller until the movement is completed, then move another servo, as shown in Figure 2. While simple, this method is slow, and it can place the robotic arm in positions that it should not be in. A better method is to move multiple servos simultaneously (shown in Figure 3). This produces smoother-looking movements and the arm will get to its destination sooner. In industrial manufacturing, equipment time can be very expensive so many companies have process engineers that try to create programs to get their products through the manufacturing line as quickly as possible. When a
90°
Servo 0 (waist)
0° -90° 90°
0 sec.
6 sec.
Servo 1 (shoulder)
90°
0 sec.
6 sec.
Servo 2 (elbow)
0° -90° 90°
0 sec.
6 sec.
Servo 3 (wrist)
0° -90°
42
• Move a servo to a position and arrive at a specified time. • Move a servo to a position and travel at a specified speed. • Delay for a specified amount of time. • Wait for a specified servo to arrive at its destination. The first two commands are essentially the same; if a ‘move’ command is specified, the program will always use the arrival time. If the speed is given, it will be internally converted to the arrival time. A series of commands begins with a start byte, contains a series of one or more commands with their respective data, and then ends with a stop byte. To keep the servos in sync, the servo controller will wait until it receives a stop byte, a wait command, or a delay command before it begins moving the servos. The delay command will delay all remaining commands until a specified period of time after the first servo has begun moving. The wait command will delay all remaining commands until a specified servo has reached its destination. There are also commands to enable and disable servos, trim servo positions, read back servo positions, and perform other minor functions. So for our example, we want to have the robotic arm perform a dance by rotating from one side to another while moving up and down and rotating its wrist back and forth. To create a more interesting look, the wrist and the arm will not switch directions at the same time. The servos will start in the following positions: • • • •
Waist (servo 0): -90° Shoulder (servo 1): -67.5° Elbow (servo 2): -22.5° Wrist (servo 3): 0°
To create the movements as graphed out in Figure 4, the following commands must be sent to the servo controller:
0° -90°
robotic arm is in use, the most efficient program can involve different axes (controlled by large-scale servomotors) traveling at different speeds and switching directions at different times. Although hobbyists generally build their robotic arms for entertainment instead of manufacturing, these complex movements create more entertaining demonstrations. In order to create these more advanced servo movements but still be easy to control, the servo controller can process the following commands:
0 sec.
SERVO 10.2008
6 sec.
• • • •
Move Move Move Move
servo servo servo servo
0 1 2 3
to to to to
+90° over six seconds -67.5° over two seconds -22.5° over two seconds -90° over one second
If we stopped here, the waist would start rotating, the arm would lift up, and the wrist would turn to one side. But after one second, the wrist would stop rotating, then a second later, the arm would stop lifting, but it would be another four seconds until the waist finished rotating. To keep the wrist rotating, we need to issue FIGURE 4. Complex servo sequences can be performed with a single set of commands.
Carrier.qxd
9/2/2008
3:35 PM
Page 43
the following commands: • Wait for servo 3 to finish movement • Move servo 3 to +90° over two seconds This will rotate the wrist back as soon as it stops, but the arm will still stop lifting in another second, so we need to tell it to lower as soon as it finishes rising: • Wait for servo 1 to finish movement • Move servo 1 to -22.5° over two seconds • Move servo 2 to -67.5° over two seconds We can then repeat these back and forth movements until the waist reaches its destination:
objects on the Propeller Object Exchange at http://obex. parallax.com/. If you have any questions, ideas, or other points to discuss, please post them in the Propeller Chip forum at http://forums.parallax.com/forums/default. aspx?f=25. With eight processors on the Propeller, there is still plenty of power left for other tasks. Next month, Kevin McCullough will add stepper motor control, and after that Chris Savage will be back with PWM control. This will only be the work of three people, but the best part about opensource projects is that the work is done by the community as a whole. I have more features that I would like to add, but my question is what will you make it do? Post your ideas and additions, and let’s see what develops. SV
• • • •
Wait for servo 3 to finish movement Move servo 3 to -90° over one second Wait for servo 1 to finish movement Move servo 1 to -67.5° over one second • Move servo 2 to -22.5° over one second • Wait for servo 3 to finish movement • Move servo 3 to 0° over one second By programming the servo controller to postpone some commands until others have been completed, all of the timing can be performed internally. As an added benefit, the microcontroller sending the commands does not need to send them as often, and as long as the queue is not depleted, the timing of the servos does not need to be based on when commands are sent. The servo controller firmware, its source code, and a more detailed description of the commands are available from Parallax’s website at www.parallax.com/tabid/666/ Default.aspx. I will also post related
Resources Project Page — www.parallax.com/tabid/666/ Default.aspx Parallax, Inc. — www.parallax.com/ Propeller Object Exchange — http://obex.parallax.com/ Robotics Discussion Forum — http://forums.parallax.com/ forums/default.aspx?f=10 Propeller Support/Discussion Forums — http://forums.parallax. com/forums/default.aspx?f=25
Order Your Web-Enabled Catalog Today! Buying electronic components can be difficult with hundreds of thousands of products to choose from. Jameco solves the problem of finding the products you need with the industry's first and only web-enabled catalog. The Jameco Catalog... Presents our most popular products in a way that makes it easy to compare everything from franchise sourced brands to house brands and factory overruns.
For More Information Call 1-800-731-4242 or Visit www.Jameco.com/News
The Jameco Website... Once you've found the section you like in the catalog, just use the product category web code found on each page to continue your search at Jameco.com where you’ll find more information, more choices, the latest pricing and availability with none of the complications that other websites have. Jameco has everything you would expect from a components distributor, plus a few surprises. Reach for Jameco first.
SERVO 10.2008
43
Schmitt.qxd
9/3/2008
10:12 AM
Page 44
Get a Starter Motor Runnin’ in Your Robot
by Steven Schmitt
A
uto starter motors are often overlooked for use in robot building. Typically, a starter motor can draw 50 to 150 amps with no load and over 1,000 amps under heavy load so they may appear to be difficult to use. Since nearly all are series wound (SW), they can be as good as or better than permanent magnet (PM) motors for powering combat robots. Plus, they are inexpensive and readily available. PHOTO 1
44
SERVO 10.2008
PHOTO 2
Schmitt.qxd
9/3/2008
10:01 AM
Page 45
Get a Starter Motor Runnin’ in Your Robot FIGURE 1
Torque, HP Torque, HP
Torque
HP
HP Torque
RPM
RPM
Permanet Magnet Motor The torque of an SW motor is proportional to the current squared whereas the torque of a PM motor is only proportional to the current. The torque and horsepower curves for the two different types of motors are shown in Figure 1. The torque vs. RPM curve for the PM motor is very linear and the peak horsepower occurs at the midpoint. The torque vs. RPM curve for the SW motor is very non-linear making the horsepower curve nearly flat over a large RPM range. While the PM motor lacks power at both low and high RPM, the SW motor creates high torque at low RPM and has a nearly unlimited high end. PM motors are very compact and have high efficiencies, but only over a small RPM range. For applications where operation is needed over a large RPM range, the SW motor is both more efficient and compact (as long as you have unlimited current for free! -Ed.) A good example of where SW motors dominate is the National Electric Drag Racing Association (NEDRA). Most — if not all — electric powered drag race cars use SW motors. Maniac Mazda does wheelies and over 100 mph in a quarter mile drag race. Starter motors require a FIGURE 2 battery pack with a rating on
Series Wound Motor the order of 500 cold cranking amps or (to be more accurate) the ability to source 500 amps at 10 volts. The Panasonic 1220 SLA battery can power a small starter motor for two or three minutes. The compact starter motors used in autos cannot be over volted in any way. Basically, they are designed for very short duty and after a few minutes of use, get very hot. Running them for five minute matches is the extreme limit. The power output of starters range from 1 to 2 kW.
SERVO 10.2008
45
Schmitt.qxd
9/3/2008
10:02 AM
Page 46
Get a Starter Motor Runnin’ in Your Robot
PHOTO 3
PHOTO 4
It is normal to find similar starters used on different brands of autos. Photo 1 shows a few typical starter motors. The two motors in the upper right side are from late 1980’s Hondas. The larger motor was used in cars like the Accord, while the smaller one came from a Civic. The large motor on the bottom is a Denso starter used on many Toyota models. The two starters on the left are newer style Denso starters from a Toyota and a Corvette. Auto salvage yards can be a good source for used starters. They typically have a core pile waiting to be sold to a buyer for remanufacturing and are usually worth only a few dollars. In my experience, few starters ever wear out. Most often the solenoid goes bad and the relay inside it quits working. For robot use, starter cores are the best value. All starters have the same basic parts: a motor, gear reduction, starter solenoid, and something that is generally called a Bendix. Most of these parts have to be modified or discarded before the starter can be used in a robot. One necessary modification is to make the SW motor reversible. It cannot be reversed by changing the polarity of the input voltage. Instead, the polarity of the field winding has to be inverted relative to the armature winding. This modification will be covered later. Since the Bendix is an over-running clutch that only drives in one direction, it has to be modified to drive in both directions. The final challenge is to attach a drive sprocket of some sort to the starter. For some uses, it may be easier to use the gear that came with the starter and find a flywheel to match it. There are only a few standard PHOTO 6
46
SERVO 10.2008
PHOTO 7
PHOTO 5
gear pitches used for most autos making it easier to find a flywheel or ring gear to match the starter. These modifications will also be addressed later. A starter motor can be modified in a few hours with great results. Driving a robot with PM motors is okay but a robot with SW motors is a totally different experience. The robot will have an awesome hole shot and will feel like it can accelerate forever. I use a simple relay control system and have never investigated using an electronic speed controller (ESC) to control a starter motor. One problem with using an ESC is that only the field winding is controlled by the H-bridge. The simplest solution would be to use relays for the Hbridge and use the ESC to control the current to the motor. The relay control circuit is shown in Figure 2 with a possible PWM modification.
Rewiring the Motor to Make it Reversible Since most starters are similar, these modifications will apply to almost all of them. Photo 2 shows the disassembled Honda starter motor and Photo 3 shows the parts that have to be modified. Starters are four-pole motors equivalent to having two motors in parallel. There are two sets of field windings and two sets of brushes. The power input goes to the two sets of field windings. The fields are connected to two brushes which power the armature. Finally, there are two more brushes connected to ground to complete the circuit. Photos 4 and 5 show the PHOTO 8
Schmitt.qxd
9/3/2008
10:17 AM
Page 47
Get a Starter Motor Runnin’ in Your Robot
PHOTO 9
field and armature and how the two brushes are welded to the field. Note the complete lack of wear on this 1989 starter motor that was removed from a junk car. The modification requires that the field be isolated from the armature so its polarity can be reversed. Photos 6 and 7 show a close-up of the spot welds connecting the field to the brushes and how the welds can be pulled apart. The welds are made by wrapping the stranded wires with copper foil and applying heat and pressure to finish it. The welds are not very strong and the foil can be unwrapped as shown. The next step is to attach wires to the field so that both ends of the field windings are outside the case. Since there is very little room in the case, the connections have to be very compact and neat. Also, solder connections will not hold up to the heat and vibration of the motor. Therefore, only a spot weld or crimp connection will work. For the crimp connection, brass rings made for 3/16” compression fittings can be purchased at any plumbing store. While in use, the motor will get very hot and any plastic tape or plastic wire insulation will fail. High temperature automotive wire with rubber insulation and cloth electrical tape are needed to make the modification. Since the tape has little adhesion, it needs to be secured. Cotton thread works well. Photo 8 shows the wires spliced to the field and routed out of the case. At the top center is the finished connection while the bottom center shows an exposed connection. The 3/16” compression sleeve accommodates the field wire and 8 gauge wire. The next step is to splice wires to the brushes so they PHOTO 12
PHOTO 10
PHOTO 11
can be connected to the H-bridge. Photos 9 and 10 are 8 gauge wires spot-welded to the brushes and the brush holder with all four brushes. The connections to the brushes can be either spot welds or crimps with the 3/16” compression sleeves. In Photo 9, the red wire had plastic insulation which melted during welding, while the black wire was rubber insulated. Once again, the wires are insulated with cloth electrical tape and held in place with thread. Photo 11 demonstrates how the field and brush holder go together and the challenge of fitting it into the tiny space. The end cap for the motor is modified with several deep slots so the new wires can be routed out of the case in the least amount of space as shown in Photo 12. After these electrical modifications are completed, the one-way clutch from the Bendix needs to be disabled. Photo 13 is the Bendix unit and Photo 14 is the Bendix unit disassembled. The one-way clutch has five rollers that lock in one direction and release in the other direction. The modification is to replace the five rollers with five much larger rollers and then grind five slots in the inner shaft to accept the larger rollers. Photos 15, 16, and 17 show the ring gear with three of the five small rollers; the ring gear and shaft with five slots ground into it; and the ring gear with the five large rollers and inner shaft all assembled. (The third photo was taken from the top so the shaft is not very clear.) The completed motor in Photo 18 has two leads from the field windings and one lead from the armature. The case ground is the other connection to the armature. A few unneeded parts have been sawed off the case to make the motor more compact. PHOTO 13
PHOTO 14
SERVO 10.2008
47
Schmitt.qxd
9/3/2008
10:15 AM
Page 48
Get a Starter Motor Runnin’ in Your Robot
PHOTO 15
PHOTO 16
To attach a sprocket to this motor, set screws can be used successfully, however, special care is needed. Four flat spots are ground onto the shaft to accommodate four set screws that are equally placed around the sprocket. To prevent even microscopic movement, everything needs to be epoxied together. This includes the sprocket to the shaft and the set screws to the sprocket. A hose clamp epoxied around the whole assembly provides further support to keep the set screws from loosening. The sprocket collar should be thick enough to allow six or more threads for the set screws. Any less and the set screws will shift around and work loose.
Wrap-Up
PHOTO 17
PHOTO 18
A few hours of work will turn a junk starter motor into a powerful and compact drive motor for a combat robot. Series wound starter motors with modifications to make them reversible and drive in both directions provide excellent low end torque and high speed. SV
Microsoft
Visual Studio
Dyynamixxel SDK
C/C++ Visual Basic C#
EX-106 NEW
164 Encoder EX-106
14.8 84
106
0.182
0.143 155
48
SERVO 10.2008
ToebesF.qxd
9/3/2008
3:12 PM
Page 49
by MARGARET TOEBES (AGE 16)
or this year's Science Olympiad competition held in my home state of North Carolina (www.sciencenc.com), my team was challenged to build an electric vehicle that would go a given distance and then stop. Our first car used a 555 timer circuit, but it did not give u s the accuracy we wanted. To be effective in the state competition, we needed a much better way to actually measure the distance the car went. Since we had built the car using the Vex Robotics kit from Innovation First (www.vexrobotics.com), we decided to use the shaft encoder that was part of the kit. With every revolution of the wheel, the shaft encoder sends 90 pulses which we could count to measure the distance. Next, we designed a counting circuit that would connect to the shaft encoder. For every pulse emitted by the shaft encoder, the counting circuit would count down one from its loaded value. We connected that to a JK flip-flop so that when the counting circuit hit zero it would put out a pulse to the flip-flop causing the circuit to stop, giving power to the motors. While the design was flawless in our own minds, when we tested it out by rotating the shaft encoder ■ FIGURE 1. it did not count down by one Disassembled Vex Shaft Encoder. but rather descended by
Dr. Otto H. Schmitt
F
■ FIGURE 2. LM339 Schmitt Trigger Schematic.
random amounts. After some discussion and tests, we concluded the problem originated with the shaft encoder. We hooked it up to an oscilloscope and observed that the signal it was putting out was not a digital wave like we expected but was an analog one. Because the shaft encoder operates by shining a light through a disk with slits in it (Figure 1), we thought that the output would be binary; one for when light was shining through and another for when it wasn't. What we didn't anticipate was that as the disk rotated there would be points at which some light was shining through but not at the maximum amount, resulting in somewhat of a sine wave. Because our counting circuit was constructed with TTL logic, it did not take kindly to these in-between signals and behaved erratically. To address this problem, we tried several options including a debounce circuit using a 555 timer but SERVO 10.2008
49
ToebesF.qxd
9/3/2008
3:14 PM
Page 50
Formulas V2 = (R123/R2) Vref + (R123/R3)Vcc V’2 = (R123/R2) Vref - (R123/R3)Vcc R1, R2, and R3 represent the three resistors used for the Schmitt trigger. In the equation above, R123 = R1||R2||R3 which really means R1 * R2 * R3 / ( ( R1*R2) + (R1 * R3) + (R2 * R3)). We wanted a V2 trigger voltage around 3V and a V2' of2V. So we plugged that into the equations: ■ FIGURE 3. Board Layout.
ultimately went with the tried and true Schmitt trigger circuit.
Designing the Schmitt Trigger The Schmitt trigger shown in Figure 2 works by comparing the input voltage to a feedback loop from the output so that once it goes high, it stays there until the input falls below the threshold. There are a number of good references for determining the resistor values and http://hyperphysics.phyastr.gsu.edu/hbase/electronic/ schmitt.html#c2 even provides an interactive web page to calculate the resistor values. There are two equations that determine the V2: the voltage it triggers; and V'2 – the voltage at which it will un-trigger. By having the V'2 and not just a trigger voltage, you reduce rapid cycling at the trigger voltage. First, you want to pick your V2 and V'2 and then use the equations to calculate the required value of each resistor. Also, you can go to the website mentioned above and use the resistor and voltage calculator they provide. The catch is it only works if you already know the resistors you want to use and then finds the V2 and V'2 values.
Parts You Will Need With the exception of the Vex parts, all the components required for the Schmitt trigger were easily found at our local RadioShack. The Schmitt trigger does not have many pieces to it and is very easy to assemble after you have worked the equations. Figure 3 shows how Part # we put the Schmitt trigger on a circuit board, 276-170 leaving room for other circuits. You can just as 276-1712 easily plug the parts on to a protoboard. 271-1335 Plugging the encoder into the board presented 271-1325 an obstacle. Since we didn't want to damage the shaft encoder, we used an extension cable which we customized by cutting off the male plug end,
50
SERVO 10.2008
VRef=5V V2=3V V'2=2V V2-V'2=1V V2+V'2=5V V2 = 5 (R123) (1/R2+1/R3) V'2 = 5 (R123) (1/R2-1/R3) V2-V'2=10(R123/R3) R3=10(R123) V2+V'2=10(R123/R2) R2=2 (R123) 1/R123=1/R1 + 1/(2R123) + 1/(10R123) R1 = 2.5(R123) We found that we needed 2.5K, 2.0K, and 10K resistors. Given that, the closest one we had was a 2.2K. We used that for R1 and R2, which gave us a V 2 and V' 2 of 2.75V and 1.76V. Enough with this boring math, let’s build it already!
stripping the ends of the wires, and soldering them to the protoboard. This left the shaft encoder completely unharmed and detachable. Also, the newer shaft encoders in the Vex Robotics kit have two outputs, so it doesn't matter which one you connect to the board.
Project Parts List Description Circuit board LM339 quad comparator (14-pin DIP) 10K ohm 1/4 watt carbon film resistor (five pack) 2.2K ohm 1/4 watt carbon film resistor (five pack)
Source RadioShack RadioShack RadioShack RadioShack
ToebesF.qxd
9/3/2008
3:19 PM
Page 51
up to an oscilloscope and watch both the output of the shaft encoder and the output of the Schmitt trigger. You’ll want to connect to the test points Input and Output in the circuit in Figure 3. As you can see in Figure 4 where we have hooked up the scope to the car, the output from the shaft encoder is on the bottom and is mostly a sine wave while the signal above shows the nicely cleaned up square wave. The only other difference is the square wave is inverted.
Ideas for Future Expansion
■ FIGURE 4. Scoping the Output.
Testing The best way to see that the circuit is working is to hook it
There is not much to improve on the particular application – the Schmitt trigger does what you want and is simple. You could build two circuits for the quadrature version of the shaft encoder and then combine the outputs so that you can tell which direction it is turning ... but that’s a task for another day. SV
HE8EJIFH;<;H>?J;9)0' .EW 2OBOT 3ERVOS >_j[Y Ej^[h8hWdZ
+656*
+656*
+657*
6SHHGVHF 7RUTXHR]LQ 6WHHO*HDUV
6SHHGVHF 7RUTXHR]LQ 6WHHO*HDUV
6SHHGVHF 7RUTXHR]LQ 7LWDQLXP
$//63(&,),&$7,216$792/76
7KHUHVXOWVRIDQLQIRUPDOSROOWDNHQUHFHQWO\DWWKH)LUVW $QQXDO:RUOG'RPLQDWLRQ6\PSRVLXPDUHQRZLQ5RERWV SUHIHU+LWHFVHUYRVRYHURWKHUVHUYREUDQGV7KH\NQRZWKHZLGH VHOHFWLRQRI+LWHFDQDORJDQGGLJLWDOVHUYRVSURYLGHWKHPZLWKWKHSRZHUDQGGHSHQG DELOLW\QHHGHGWRHYHQWXDOO\WDNHRYHUWKH:RUOG0DNH\RXUURERWKDSS\XVH+LWHFVHUYRV 3DLQH6WUHHW_3RZD\_&DOLIRUQLD___ZZZKLWHFUFGFRP
SERVO 10.2008
51
Alter2.qxd
9/3/2008
6:34 AM
Page 52
While I used the Lynxmotion Johnny 5 kit as a platform for my project, the principles, concepts, and even components of this project can be applied to almost any robotics project. This is especially true of this article, as the rapidly shrinking size of ITX-based motherboards and CPUs prove to be perfect controllers for today’s robotics projects.
shows the different models of the ITX motherboard CPUs and a n this series of articles, we will explore comparison of their sizes. While these computers are quite small, my Pico-ITX based Johnny 5 project. they pack more than enough In the first article, I detailed the work horsepower for any modern that went into upgrading and expanding robotics application, as well as a the original kit to make it a more viable wealth of features at your disposal. research platform. In this article, I will dive As my Johnny 5 platform is into the concept and implementation of a bit on the small-to-medium side PC-based robotics. Not only will we for rovers, I chose the VIA EPIA PX10000G Pico-ITX platform to Welcome to the World show how easy an onboard PC is to conserve space and power of PC-based Robotics integrate, but we will begin to explore consumption. This motherboard the many advantages of having that At first glance, some people CPU packs a ton of features given much horsepower locally on your robot. might think that only larger robots how tiny it is, boasting a 1 GHz are capable of housing a fully VIA C7 processor, 1 GB of DDR2 unctioning onboard PC. The ITX platform proves this is a RAM, SATA, IDE, USB 2.0, sound, video, and Ethernet. misconception, as complete PC solutions can be as small as You might be wondering why you would need that kind of the size of a pack of cigarettes and will soon be smaller processing power and features on a personal robot, when than a business card. Depending upon the size of your many times a small microcontroller does the job just fine. robot, you can choose from the Mini-ITX (17 x 17 cm), the First of all, because you can. Given that these computers Nano-ITX (12 x 12 cm), the Pico-ITX (10 x 7.2 cm), and the are getting so small and low in power consumption, even soon to be released Mobile-ITX (7.5 x 4.5 cm). Figure 1 if you won’t use that much power to begin with you’re raising the ceiling almost limitlessly for future expansion. Besides, how cool is it to be able to boast FIGURE 1 that your robot runs Windows or Linux? Furthermore, it allows one to run Microsoft’s Robotic Studio locally on the robot, which has a growing development community and a wealth of robust features. Second, it opens up possibilities for your robot that are usually out of the reach of even the most modern microcontrollers. An onboard PC means you can have vision processing, networking, data logging, speech output and recognition, USB host, multiple com ports, LCD display, and remote telepresence capabilities all
52
SERVO 10.2008
Part 2: PC-based Robotics
I
Alter2.qxd
9/3/2008
6:37 AM
Page 53
contained within a single board. Microcontrollers become daughterboards and parallel processors rather than a primary controller, a simple webcam becomes a machine vision solution, and a speaker and microphone become voice synthesis and recognition. There is also a plethora of readily-available bridgeware such as Phidgets or the Robotics Connection Serializer product line, which allows easy access to various types of I/O ports, sensors, and motor controllers through a comprehensive .NET library API. Lastly, it is a surprisingly low cost solution to implement. Why spend $300-$500 for a high-end development microcontroller when you can spend the same or less for an onboard PC solution? You’re not limited by the programming languages that a controller supports, program space and memory, nor processing capability. You can select the programming language of your choice, write as much code as you could possibly imagine, and virtually never hit a limit as far as processing capability. Welcome to the world of PC-based robotics! The technology is there and readily available, and the positives vastly outweigh the negatives. Microcontrollers as the end all for robotics control are a thing of the past — they should be looked at as complimentary electronics rather than primary controllers. We have the capability of adding much more powerful computing solutions to our robots — it’s just a matter of doing it. I hope to shed some light on just how easy it is.
Robot PC Hardware The concept behind the hardware is simple: Build a self-contained computer and interface it to your robot’s hardware through the use of bridgeware (servo controllers, I/O boards, etc.) using the computer’s available serial ports, network ports, and/or USB host. Software then runs on the PC and issues commands to the hardware components through the bridgeware. Picking a motherboard CPU is the first order of business and really depends upon your budget and the size of your robot. I highly suggest staying within the ITX form factor of motherboard CPUs as they focus on compact size and low power consumption, whereas the ATX form factor is primarily intended for full size desktops and as a result has higher power consumption and larger footprints. Alternatively, if your robot’s base is big enough, laptops and handheld PCs make excellent choices, as well. You do tend to pay a bit more the smaller you go, but the feature set is fairly consistent and more than enough for robotics applications. I prefer the Pico-ITX platform because of the small footprint and low power consumption (approximately 15W under load), and thus I’ll focus on the implementation of that model — although the same practices can be applied to any model. Figure 2 shows a close-up of the Pico-ITX board. When I first purchased the board for my project, only the bare OEM version was available. Wiring the front panel switches and LEDs, building a suitable mount or enclosure, and finding a suitable power supply was left up to me. Now you can purchase a starter kit such as the Artigo,
FIGURE 2
which provides a power supply, front panel, and a nicely designed enclosure, however this does add some size. If you’re going for ultra-compact, your best bet is to build your own mount or enclosure. The Pico-ITX board comes with three stand-offs and #4 mounting holes at each corner of the board. Referencing the spec sheet provided by VIA, I found measurements for the exact spacing and diameter of these mounting holes. A few minutes in Autodesk and I had a very simple mounting frame that would suffice (shown in Figure 3). A generous friend with a Sherman CNC cut out the mounting frame for me from Sintra plastic. I removed the three stand-offs and was left with 4-40 screws mounted on the heatsink sticking out of the bottom of the board where the stand-offs used to be. I attached three 3/4” long 4-40 hex stand-offs to these screws and a single 1/4” long 4-40 socket head screw for the remaining hole to mount the fourth hex stand-off. The other ends were attached to the mounting frame using other four 4-40 socket head screws. This raised the Pico-ITX board off of the mounting frame by 3/4”, allowing enough clearance for power cables and other various wires to run underneath it. It also provided a nice place to mount two microswitches for the power and reset buttons; the pinout for the front FIGURE 3
SERVO 10.2008
53
Alter2.qxd
9/3/2008
6:37 AM
Page 54
solutions are higher in cost.
Mounting, Wiring, and Peripherals
FIGURE 4
FIGURE 5
panel header was found in the board manual. Figures 4 and 5 show the mounting frame attached to the board. Powering an ITX board is made incredibly simple with the PicoPSU product line. Refer to Figure 6 for a look at this unit. These are tiny ATX power supplies built specifically for the enthusiast, in that they take a DC input rather than your standard desktop power supply which runs off of AC. There are a few different flavors which vary in the amount of wattage supplied, as well as their operating DC voltage. All of them end up supplying the standard 20 pin PC PSU power plug, as well as three four-pin Molex connectors for peripherals. I selected the PicoPSU-60-WI 6-26V model, as this gives me some room to play with as far as what types of batteries I can use. I chose a 9.6V 4,200 mAh NiMH rechargeable battery pack for the power source. Powering my Pico-ITX board was as simple as plugging in the PicoPSU, splicing my battery leads into the DC input, and hitting the power button. Given that the Pico-ITX only draws about 15W under load, this should give me almost three hours of run time, not factoring in the hard drive and additional peripherals. I’ve found that with all peripherals and hard drives running, I get about 90 minutes total using my chosen battery. Selecting a hard drive was pretty straightforward. Even the smallest modern drives are around 60-80 gigabytes, which would be more than enough for my application. I chose a 120 GB 2.5” Serial ATA laptop hard drive for its compact size and light weight, and because the interface cable is easy to route at only about .5” wide. Alternatively, there are solid-state hard drives, USB Flash drives, and various Flash media adapters that can be used, though usually these
To mount everything, I did what I always do: very carefully place things completely randomly wherever they seemed to best fit. The 9.6V battery fit perfectly right down the center channel of Johnny 5’s base, and I used hook-andloop tape to mount the PicoPSU right on top of that. The hard drive slid on top of the 9.6V battery and was secured quite nicely by the vertical base stand-offs on either side. Liberal use of some more hook-and-loop did the trick for attaching the mounting frame of the Pico-ITX to the rear of the base. Figure 7 shows the battery and PicoPSU mounted in preparation for installation of the Pico-ITX board. I’m no stranger to wire management — I just prefer the raw look. (That’s my story and I’m sticking to it.) With the power supply and hard drive taken care of, we’re left with a few supporting peripherals to wire in order to have everything needed for a mobile PC solution. I used three USB devices on this robot, which consist of two web cams mounted in the head (explained in the first part of this series), as well as an 802.11g WiFi adapter to allow wireless networking capability. A four port USB dongle comes with the Pico-ITX board, which I mounted towards the front of the base as I was running low on real estate in the back. The board also has a serial port which I used to interface with the SSC-32 servo controller. As the stock dongle supplied with the board was too short and bulky, I decided to make my own. Referencing the manual that came with the board, I made a minimalist cable to connect the three pins (TX, RX, and Ground) from the SSC-32’s serial port to the corresponding serial port headers on the Pico-ITX board. Figure 8 shows the board mounted with everything plugged in.
Conclusion That covers the relatively simple installation of a fully functioning PC to the base of my robot. Previously, the
Parts List ITEM • VIA EPIA PX10000G Pico ITX Motherboard CPU • 1 GB DDR2 667 So-Dimm RAM • 60W PicoPSU 6-26V DC-DC • 120 GB 2.5” Serial ATA Laptop Hard Drive • 802.11g USB WiFi Adapter • 9.6V 4,200 mAh NiMH Battery • Four 3/4” 4-40 Nylon Hex Stand-offs • Five 1/4” 4-40 Socket Head Screws • Black 1/8” Sintra Sheet Plastic • Various 22 gauge Electrical Wire • Two Momentary Pushbutton Switches
54
SERVO 10.2008
SUPPLIER www.logicsupply.com www.logicsupply.com www.logicsupply.com www.amazon.com www.amazon.com http://batteryspace.com www.lynxmotion.com www.lynxmotion.com www.huvrobotics.com www.digikey.com www.digikey.com
FIGURE 6
Alter2.qxd
9/3/2008
6:38 AM
Page 55
FIGURE 7
biggest obstacle to overcome with PC-based robotics was the size of the motherboard, the power draw, and providing the necessary power supply to run it all. With the ITX series of low power consumption motherboards and the miniscule PicoPSU line of power supplies, these obstacles are gone. In next month’s article, I will conclude this series by covering the software that ties all of this hardware together, taking advantage of having the power of an onboard PC at our disposal. We’ll cover installation and trimming of a Windows install for use in robotics, SEQ servo control software, implementing onboard machine vision through Roborealm, wireless networking and remote desktop protocol, and finally conversational AI implementation through text-tospeech and voice recognition. Catch you next month. SV
FIGURE 8
References VIA Pico-ITX Page www.via.com.tw/en/initiatives/spearhead/pico-itx/ Robotics Connection www.roboticsconnection.com Microsoft MSRS http://msdn.microsoft.com/en-us/robotics/default.aspx
SERVO 10.2008
55
Coniglio.qxd
9/2/2008
3:30 PM
Page 56
>> by Samuel Coniglio
E
very year I go to RoboGames (www.robogames.net), I am impressed with the quality and diversity of the robot events and even more impressed by the people who participate. This is the largest event of its kind on the west coast. Located in San Francisco, CA, this is the perfect place for engineering talent and artistic creativity to merge.
Under the shadow of the Golden Gate bridge, jutting out into the beautiful San Francisco Bay, the warehouse piers of the former Fort Mason Army base were converted years ago to host events (www.fortmason.org). For the last five years, the eastern-
most pier has been transformed into a robo-mecca, a celebration of all that is robot. This year’s RoboGames introduced the brand new COMBOTS arena. Designed like a polycarbonate glass house, this new battle arena has a truss-
>> COMBOTS arena.
<< 2008 RoboGames group shot.
56
SERVO 10.2008
Coniglio.qxd
9/2/2008
3:30 PM
Page 57
reinforced roof to avoid sagging, a ventilation system to remove nasty fumes, and some metal I-beam bumpers with teeth! The hinged bumpers at the entrances require an air compressor to lift and open the 100 pound doorways. As promised, double one inch polycarbonate sheets ring the lower half of the arena for extra protection. This house of pain will take on lots of flying shrapnel over the next few years. Also notable is the power of a noisy robot. When Curt Meyers cranks up the lawnmower engine on the “Jaws of Death” — a 340 pound class crab-like behemoth — kids from all over the cavernous Ft. Mason Festival Pavillion stop what they are doing and run to the COMBOT arena. Even from inside the arena, the sound of “Jaws of Death” excites and thrills the entire crowd. A confluence of energies power this event: close proximity to the technical prowess of Silicon Valley, a truly international participation, frank and open collaboration between builders, and energetic volunteer support of the local community ... especially from the radical Burning Man art scene (www.burningman.com). Where else would you see T-shirt wearing geeks mingle with the leather and fur clad burners? It ends up that a lot of burners are closet geeks, and more than a few of them bring their bots to the show. Case in point: the Orb Swarm (http://orbswarm.com). Three beautiful spheres, each about three feet in diameter, rolled around the games in a seemingly random manner, thrilling children and adults. In reality, the bots — created by Michael Prados and a team of robo-burners — are very sophisticated, as well as beautiful moving works of art. Looking through the metal weave pattern of the sphere, you can see a heavy battery pack acting as a reactive ballast. A drive motor spins the shell against the ballast, causing the orb to roll. A steering motor tilts the ballast, allowing the orb to steer. The brains are a 200 MIPS Linux ARM processor with GPS and MEMS accelerometers and yaw rate gyros for navigation and steering. Multi-color LED lights appear to flicker as the orb rolls. Over a dozen random sounds play from speakers attached to the top of the motor. At RoboGames, the swarm was
>> Jaws of Death.
>> Baby and mom watching the Orb Swarm.
>> Last Rites vs R2-D2. Photo courtesy of Chris James.
>> A family stopping to watch R2-D2.
SERVO 10.2008
57
Coniglio.qxd
9/2/2008
3:32 PM
Page 58
>> Bioloid humanoid.
>> Children playing with the OLLO robots.
quietly run by Bluetooth enhanced game controllers, but I was told the goal is to make them run autonomously during this year’s Burning Man Festival, in Black Rock City, NV. In Japan, bot builders are inspired by Astro Boy; in the US, kids are inspired by R2-D2. It was fun to see not one but two artoo units roving around RoboGames. Built by Chris James (www.artoo-detoo.net/) and Gerard Fajardo (www.astromech.net/). They put some serious effort into making the most accurate work on the droids, and the results are beautiful. Complete with sound effects (and a mister?!?), these droids look like they came out of the Lucasfilm warehouse in Marin county, just a few miles
>> Team USA playing Robo Soccer.
58
SERVO 10.2008
away. This is a pure hobby, and Chris just cannot make a cent when he does shows and demonstrations. Although I missed the Friday events, I heard there was a confrontation between Artoo and a couple of combat robots in the COMBOTS arena. Fortunately, the droid escaped unscathed. A new vendor at RoboGames, Robotis, was showcasing not only its Bioloid humanoid robot, but also the new OLLO robots for children. An entire OLLO carnival was on display. These tiny bots are made of bright plastic blocks — not unlike LEGO — and use a new micro-actuator called the Dynamixel BX-2. One green-carpeted section was turned into a playground for kids and adults building the OLLO family of bugs and critters. Outside, the Robo-Magellan teams were getting better at making bots that can find their way around. Using a combination of GPS receivers and sonar, the bots use autonomous navigation and obstacle avoidance over the varied, outdoor terrain of Ft. Mason Park. Robots have three opportunities to navigate from a starting point to an ending point and are scored on time required to complete the course with opportunities to lower the score based on contacting intermediate points. Returning from last year,
>> Robo Soccer goal!
Coniglio.qxd
9/2/2008
3:33 PM
Page 59
>> Mechanical Woman Walking.
For complete RoboGame results/winners, go to www.servomagazine.com and click on the Table of Contents for October to find the link.
the Intrepid made quick work of getting to its destination. Rival team Zippy also did surprisingly well and shared the gold medal. There was a strange incident when one of the bots suddenly veered off course and chased after an unsuspecting dog. After much barking and jumping around, the dog seemed to scare off the bot as it resumed on its way. Robo Soccer was back this year with a large number of Robo-One entries. Contestants came from South Korea, Taiwan, Russia, the UK, Japan, India, >> Artist Liz Mamorsky. Austria, and the US. One notable match was between the US and Austria. The HiTec team, led by RoboGames founder David Calkins, sculpture that uses a counter weight to tighten a spring fought hard to hold off advances from the Austrian team. that causes the arms and legs to “run” in mid air. Much of the time was spent picking up fallen robots. (Why A powerful aspect of the RoboGames event is its do they insist on using astroturf?) A last minute maneuver, all-volunteer crew. These dedicated people — some of and suddenly the orange ball was kicked into the US goal. whom also participate with their own bots — help make Up in the mezzanine area overlooking the games are these games a powerful and cohesive force. Five years is a the art bot displays. Art bots add a unique quality to long time to keep the same group together, and they do it RoboGames. Creativity and fun added to an otherwise dry for the love of the robot. SV technology boost the possibilities of new ideas. Plus, they look cool. For artist Liz Mamorsky, this was her first robot >> Titanium sparks. event. Using circuit boards as her canvas, she creates little bot people. In the kinetic arts >> Red Dwarf team. category, Marko Galt’s “Mechanical Woman Walking” is a beautifully crafted brass >> Red Dwarf vs. Dog.
>> Texas Heat.
SERVO 10.2008
59
Bogden.qxd
9/3/2008
8:01 AM
Page 60
External Interface for the NXT Robotic Brick A stock NXT can get pretty boring pretty quickly. Want to soup up this Honda Civic and turn it into a Lotus Esprit? Well then keep reading! by DENNIS BOGDEN dditional sensors can be purchased for your NXT including a compass, GPS, and temperature sensor. However, if the application being designed is to use a different type or brand of sensor or actuator, the NXT interface is not readily apparent.
A
This article describes an interface using RobotC software and integrated circuits with the Inter-IC Bus (I2C) that enable you to interface your own sensors and actuators to the NXT brick. Examples of device interfaces are R/C servos, shape memory alloy wire, relays, stepper motors, compasses and so on.
HARDWARE INTERFACE AND SOFTWARE PROGRAM I purchased some additional NXT interface cables from LEGO and built breadboarded some circuits to make a cable-breadboard adapter (Photo 1.) The pin numbers and wire colors correspond to the following signals:
PHOTO 1
60
SERVO 10.2008
• • • • • •
Pin 1 (White) = Switch input Pin 2 (Black) = Switch ground [VSS] Pin 3 (Red) = Digital ground [VSS] Pin 4 (Green) = + 4 to 5 volts [VCC] Pin 5 (Yellow) = I2C SCL Pin 6 (Blue) = I2C SDA
Bogden.qxd
9/3/2008
8:02 AM
Page 61
NOTE: Be careful! You can damage your NXT Brick if you apply the wrong signals to the wrong pins! The interface provides a standard I2C expansion bus. For the discussion that follows, you must connect pull-up resistors between VCC (pin 4) and both SCL (pin 5) and SDA (pin 6). Only one set of resistors is needed for multiple ICs, but each diagram shows the resistor connections for completeness.
R-SDA
R-SCL
Blue C6 of NXT cable Yellow C5 of NXT cable
NOTE: R-SCL and R-SDA are 75K to 82K values
RobotC programming Black C2 of software for the NXT NXT cable The software to control the interfaces is written in RobotC, the programming language for the NXT. RobotC was developed and is sold by Robomatter, Inc., in conjunction with the Carnegie Mellon University Robotics Academy. I won’t describe the attributes of RobotC (which are many) in detail but it is worth mentioning that it comes with debugger tools including an I2C test debugger.
DEVANTECH R117 ELECTRONIC COMPASS
Green C4 of NXT cable
1 VCC 3 SDA 2 SCL
Devantech R117Compass
9 VSS
SCHEMATIC 1. Connections for the Devantech R117 compass operating with an I2C interface.
A summary of steps in the flowchart are: • Set NXT port S4 and connect the cable into this port. • Define in the software the hardware address and other variables used in the program. • Build the I2C message to “wake up the compass.” • Send the wake up message over the I2C link. • Build the I2C return data from the compass message.
The Devantech R117 electronic compass by Acroname has many ways of obtaining its current reading. There is a PWM output and an I2C interface, which is shown in Schematic 1. When using the I2C interface, the resolution of the output can be selected by the user. A 0-255, eight bit value from register 1 can be obtained which gives a 360/256 = 1.4 degree resolution (not accounting for other errors). Also, a 16 bit value can be obtained from registers 2 and 3 with a raw value of 0-3599. (In this article, we will use the 0-255 ‘raw value,’ eight bit output.) The software communicates with the selected NXT port, configures the compass output (in this case, eight bit), communicates with the compass over the I2C bus, converts the output of the compass to 0-359 degrees, and the displays the value on the NXT display. The I2C addresses for this device are 0xC0 and 0xC1. Address 0xC0 is used to initiate a read of the compass and 0xC1 is the return value. If this is confusing, you have to remember that the LSB of the I2C address encodes the type of access: 0 to send/write a command, 1 to read a value. Program flow is explained through Flowchart 1. A partial listing of the software code in RobotC is shown in Program Listing 1. The program listing shows the I2C subroutine and calls.
• Send the I2C message and capture the compass reading. • Use transfer functions to get the compass reading to be 0-359 degrees. • Display the compass reading on the NXT display. • Loop again.
FLOWCHART 1—READ AND DISPLAY COMPASS VALUE ON NXT DISPLAY Here’s how the program works: • The first section of code shows how to define the NXT port to be used which is S4, and to define the compass wake-up address as 0xC0. • The next section of code is the I2C subroutine which manages inserting or retrieving a message from the I2C bus. • The next section of code is the Main program. In RobotC, tasks are listed before the main() function. • The I2C compass wake-up message is assembled and sent. • The I2C message to receive the compass data is built and sent. SERVO 10.2008
61
Bogden.qxd
9/3/2008
8:03 AM
Page 62
• The rest of the program that is not shown scales the retrieved compass data and then displays it on the NXT display. • The program repeats forever!
PCA9551 PWM (LED DRIVER) INTEGRATED CIRCUIT
FLOWCHART 1
Schematic 2 PWM---IC PCA9551 Pin 11 (Led6) to Pulse Width Modulate an LED
R-SDA
R-SCL
Blue C6 of NXT cable Yellow C5 of NXT cable
100
15 SDA
To VCC
2 A2 1 A0 3 A1
are 75K to 82K values
220 ohm
ohm
13 reset LED
PCA9551
NOTE: R-SCL and R-SDA
Green C4 of NXT cable
16 VCC
14 SCL
The PCA9551 is used to control devices through pulse width modulation (PWM) control via the I2C link. With this integrated circuit and the appropriate interface hardware, other devices can be controlled by the NXT using a PWM signal. These include control signals to sensors or other ICs, R/C servos, DC motor control, lights, shape memory alloy (SMA), and so on. The I2C address for this device is 0xC4. The “C” is pre-established and the “4” is set by tying pins A0, A1 to VSS, and A2 to VCC. This IC has two PWM control channels: PSC0 and PSC1. PSCO controls outputs LED 0-3 and PSC1 controls outputs LED 4-7. The period, duty cycle, and the output enables are controlled through internal registers in the IC. The control bytes to communicate to the registers are shown next. For the RobotC software, the I2C configuration is nine bytes.
11 Led6 PCA9551 Outputs are Led0 –Led7
8 VSS Black C2 of NXT cable
62
SERVO 10.2008
SCHEMATIC 2
PCF8591 ANALOGTO-DIGITAL AND DIGITAL-TOANALOG CONVERTER INTEGRATED CIRCUIT The PCF8591 is used to read analog input signals via the I2C link. (Later, the RobotC software for the NXT Robot will be listed that will communicate with the PCF8591.) With this expanded interface and the appropriate hardware to the PCF8591,
Bogden.qxd
9/3/2008
8:03 AM
Page 63
LISTING 1 - Devantech compass operation; display 0-355 degrees on NXT display; 12C communication portion is shown. const tSensors port = S4; const byte ICADDRESS = 0xC0;
// // // // //
NXT port compass is connected Address for R117 to initiate read of the compass
SensorType[port] = sensorI2CCustom; Read_Compass_loop: // Loop or repeat the program ControlIn = 0xC1;
// Wait for I2C Bus to Be Ready
//Address to read back data from compass { waitForI2CBus();
void waitForI2CBus() { TI2CStatus nStatus; nStatus = nI2CStatus[port]; while (true) { nStatus = nI2CStatus[port]; switch (nStatus) { case NO_ERR: return;
// Build outgoing message and send to activate the IC i2cconfg[Size] = 2; // Two bytes in msg // The compass initiate address (0xC0) i2cconfg[Address] = ICADDRESS; i2cconfg[Controlreg] = ControlIn; // The user declares where to read compass value
case STAT_COMM_PENDING: nxtDisplayTextLine(2, "I2C Pending"); break; }
// INITIALIZE Compass sendI2CMsg(port, i2cconfg[0] ,0); waitForI2CBus(); // Build outgoing message and send // One bytes in the message byte replyMessage[1]; i2cconfg[Size] = 1; i2cconfg[Address] = ICADDRESS;
} } // Main Task task main() { // I2C message configuration
sendI2CMsg(port, i2cconfg[0], 1); waitForI2CBus(); //READ THE RETURN VALUE FROM THE IC readI2CReply(port, replyMessage[0], 1); //DISPLAY VALUE ON NXT DISPLAY
byte i2cconfg[3]; const short Size = 0; const short Address = 1; const short Controlreg = 2; // In RobotC, under Motors and Sensors, // the port S4 is defined as I2C
O O O
The other three I2C integrated circuits to interface with the NXT are described in the text. The same I2C subroutine call is used with the address, size of message sent, and return value being unique for each part.
byte i2cconfg[9]; const short Size = 0; const short Address = 1; const short PSC = 2; const short PSC0_period = 3; const short PWM0_DC = 4; const short PSC1_period = 5; const short PWM1_DC = 6; const short LED0_3 = 7; const short LED4_7 = 8; // For our example the values for these control_reg =0x11; channel 0_period =0x00; channel 0 PWM =0x00; channel 1_period =0x09; channel 1 PWM =0xd4; LED_zero_three =0x00; LED_four_seven =0xFA;
// Will be sending 8 bytes in the message after this one // Part address (0xC4) // Control register-select which register to access below // Channel 0 PWM period // Channel 0 PWM duty cycle // Channel 1 PWM period // Channel 1 PWM duty cycle // Outputs to enable 0-3 // Outputs to enable 4-7 control bytes are: // select channel 1 // don't care // don't care // blink frequency= (channel 1 period +1)/38 // duty cycle=(256-PWM)/256 // 0-3 are not enabled // enable channel 6
After selecting the address, send the I2C message built in Listing 1 with the following code: sendI2CMsg(port, i2cconfg[0] ,1); waitForI2CBus();
SERVO 10.2008
63
Bogden.qxd
9/3/2008
8:04 AM
SCHEMATIC 3
Page 64
other sensors can be read by the NXT. These include temperature, pressure, chemical, light, resistive feedback, switches, and so Green C4 of on. The I2C address for this NXT cable device is 0x90. The “9” is pre-established and the “0” is set by tying pins A0, A1, and A2 to VSS. Note that the internal analog-to-digital converter (ADC) reference needs to be connected to reference voltages. In this example, the ADC high voltage 10K Pot reference (pin 14) is tied to VCC and the ADC low voltage reference (pin 13) Note: ADC is tied to VSS. inputs are Pins There are four ADC 1-4; I &2 have channels that can be set up internal pull up individually as single ended or differential inputs. There is also a digital-to-analog channel (DAC). Two bytes are sent over the I2C link: the address of the part (0x90) and the control register values for the IC. The control register bits are described in the part specification sheet. In our example, the control is set to (0x03) to read channel 3.
Schematic 3 ADC Integrated Circuit PCF8591 Read Pot position and display on NXT display
R-SDA
R-SCL
Blue C6 of NXT cable
16 VCC
10 SCL
Yellow C5 of NXT cable
14 ADref
9 SDA
PCF8591
12 Ext
NOTE: R-SCL and RSDA are 75K to 82K values
13 AD ground 5 A0 6 A1 3 ADIN3 7 A2 8 VSS
Black C2 of NXT cable
Parts List ITEM • RobotC • Devantech
SUPPLIER
PART#
PCF8574 A DIGITAL EXPANDER I/O INTEGRATED CIRCUIT
Robomatter, Inc. Acroname Robotics
R117 Compass
• PCF 8591 ADC • PCF 8574A
Digi-Key Digi-Key
LD-1431 LF-207
Digital I/O • PCA 9551D PWM
Jameco
1350758
SOURCES • www.robotc.net • www.acroname.com • www.digikey.com • www.jameco.com
The PCF8574A is used to control on/off devices via the I2C link. (Later, the RobotC software for the NXT robot will be listed that will communicate with the PCF8574A.) With this expanded interface and the appropriate interface hardware to the PCF8574A, other devices can be controlled by the NXT. These include control signals to sensors or other ICs, DC and stepper motors, lights, SMA, and so on. The I2C address for this device is 0x70. The “7” is pre-established and the “0” is set by tying pins A0, A1, and A2 to VSS. The eight pins can be configured as inputs or outputs. The pin control byte is: • Bit 0 = P0 • Bit 1 = P1 • Bit 2 = P2 and so on. When a bit is zero, then the output is off and can be read as an input. When the bit is one, the output is on. In this example, Port 0 is Bit 0 so writing a 0xFF will NOTE: The other 'glue' components can be purchased through Digi-Key, Jameco, and other electronic suppliers.
64
SERVO 10.2008
Bogden.qxd
9/3/2008
8:05 AM
Page 65
Schematic 4 Digital I/O---IC PCF8574A Pin 4 (P0) to turn on/off an LED
R-SDA
R-SCL
Blue C6 of NXT cable Yellow C5 of NXT cable
15 SDA
220 ohm
14 SCL
LED
PCF8574A NOTE: R-SCL and R-SDA are 75K to 82K values
Green C4 of NXT cable
16 VCC
1 A0 2 A1 3 A2
4 P0 PCF8574A Outputs are P0-P7
8 VSS
SCHEMATIC 4
Black C2 of NXT cable
have all the pins turned off; writing a 0xFE will turn port 0 on leaving all the other ports off. Therefore, two bytes are sent over the I2C link: the address of the part (0x70) and a byte which represents which I/O pin to enable as an output or input. The RobotC programs are available on the Servo Magazine website at (www.servomagazine.com).
STEER WINNING ROBOTS WITHOUT SERVOS!
CONCLUSION The RobotC programming software and the use of the I2C bus expands the usage of the NXT Brick to design more advanced robot controls, and opens the door to non-robotic control functions as well. This article has provided the means to expand the I/O of the NXT. The integrated circuits we’ve used have additional functions that weren’t mentioned but their specs can be downloaded online — just Google for them. With these expansion tools I now leave it to your imagination to create more powerful NXT applications! SV
P
erform proportional speed, direction, and steering with only two Radio/Control channels for vehicles using two separate brush-type electric motors mounted right and left with our mixing RDFR dual speed control. Used in many successful competitive robots. Single joystick operation: up goes straight ahead, down is reverse. Pure right or left 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 10.2008
65
RoboLinksOCT08.qxd
9/3/2008
5:46 PM
Page 66
W LO
! ST CO
Free Expert Technical Support 1 (800) 985-AWIT
LOW COST
Easy to Connect
CONTROLLERS & ROBOT KITS – SENSORS – DISPLAYS LO W
CO
ST ! Professional SW Dev. Tools
www.c-stamp.com
Electronic Parts & Supplies Since 1967
For the finest in robots, parts, and services, go to www.servomagazine.com and click on Robo-Links.
66
SERVO 10.2008
WebstoreOct08.qxd
9/3/2008
3:27 PM
Page 67
The SERVO Webstore Attention Subscribers ask about your discount on prices marked with an *
“EDITOR’S PICKS”
Getting Started in Electronics by Forrest Mims The title says it all. I grew up reading books on electronics by the author, Forrest Mims, and they're still the best learning about — and reviewing — the basics. If you're new to electronics, this is a musthave for your bookshelf. $19.95
Mechanisms and Mechanical Devices Sourcebook, Fourth Edition If you’re serious about designing and building your own robot, you shouldn’t be without this book. Each of the over 2,000 illustrations is worth at least 1,024 words. $89.95
Editor Bryan Bergeron’s recommended reads. Find these and many more great titles in the SERVO Magazine Webstore!
ROBOTICS
Robot Programmer's Bonanza by John Blankenship, Samuel Mishal
The first hands-on programming guide for today's robot hobbyist! Get ready to reach into your programming toolbox and control a robot like never before! Robot Programmer's Bonanza is the one-stop guide for everyone from robot novices to advanced hobbyists who are ready to go beyond just building robots and start programming them to perform useful tasks.
$29.95
Forbidden LEGO
by Ulrik Pilegaard / Mike Dooley Build the Models Your Parents Warned You Against.
Forbidden LEGO introduces you to the type of freestyle building that LEGOs master builders do for fun in the back room. Using LEGO bricks in combination with common household materials (from rubber bands and glue to plastic spoons and ping-pong balls) along with some very unorthodox building techniques, you’ll learn to create working models that LEGO would never endorse. $24.95
Circuitbuilding Do-It-Yourself For Dummies
by H. Ward Silver
Here's the fun and easy way to start building circuits for your projects. As you accomplish the tasks throughout the book, you'll construct many projects while learning the key circuitbuilding principles and techniques. Find out about measuring and testing, maintenance and troubleshooting, cables, connectors, how to test your stuff, and more. $24.95
FIRST Robots: Rack 'N' Roll Behind the Design by Vince Wilczynski / Stephanie Slezycki
The second annual book highlighting the creativity and process behind 30 winning robot designs from the 18th annual international FIRST Robotics Competition. The FIRST organization, founded by Dean Kamen (inventor of the Segway), promotes education in the sciences, technology, and engineering in collaboration with sponsors including Motorola, Xerox, NASA, Delphi, General Motors, and other companies invested in science education. $39.95
Lo W h ao k t New ’ s
SERVO Magazine Bundles
Published by T & L Publications, Inc.
Save $10 off the normal per bundle price!! Now you can get one year’s worth of all your favorite articles from SERVO Magazine in a convenient bundle of print copies. Available for years 04, 05, 06, and 07.
$57
Build Your Own Humanoid Robots by Karl Williams
GREAT 'DROIDS, INDEED! This unique guide to sophisticated robotics projects brings humanoid robot construction home to the hobbyist. Written by a well-known figure in the robotics community, Build Your Own Humanoid Robots provides step-by-step directions for six exciting projects, each costing less than $300. Together, they form the essential ingredients for making your own humanoid robot. $24.95*
Robotics Demystified
by Edwin Wise YOU DON'T NEED ARTIFICIAL INTELLIGENCE TO LEARN ROBOTICS! Now anyone with an interest in robotics can gain a deeper understanding — without formal training, unlimited time, or a genius IQ. In Robotics Demystified, expert robot builder and author Edwin Wise provides an effective and totally painless way to learn about the technologies used to build robots! $19.95 We accept VISA, MC, AMEX, and DISCOVER Prices do not include shipping and may be subject to change.
SERVO 10.2008
67
WebstoreOct08.qxd
9/3/2008
3:29 PM
Page 68
To order call 1-800-783-4624 MEMS & Nanotechnology for Kids by Marlene Bourne
Small is cool! What is nanotechnology? What are MEMS? And what makes them so special? Welcome to the wonderful world of really small stuff. Things so tiny, you need special microscopes to even see them. Winner of a 2008 IPPY Award (bronze medal) for best juvenile/young adult non-fiction, MEMS & Nanotechnology for Kids explores what you can find at the micro- and nano-scale; where you'll discover all sorts of amazingly small sensors, structures, and materials. Reg $24.95 Sale 18.95
CNC Robotics
by Geoff Williams CNC Robotics gives you step-by-step, illustrated directions for designing, constructing, and testing a fully functional CNC robot that saves you 80 percent of the price of an off-the-shelf bot — and that can be customized to suit your purposes exactly, because you designed it. Written by an accomplished workshop bot designer/builder, this book gives you everything you need. $34.95
Robot Builder’s Sourcebook by Gordon McComb
Fascinated by the world of robotics but don’t know how to tap into the incredible amount of information available on the subject? Clueless as to locating specific information on robotics? Want the names, addresses, phone numbers, and websites of companies that can supply the exact part, plan, kit, building material, programming language, operating system, computer system, or publication you’ve been searching for? Turn to Robot Builder’s Sourcebook — a unique clearinghouse of information that will open 2,500+ new doors and spark almost as many new ideas. $24.95
68
SERVO 10.2008
I’m glad oil prices are showing signs of coming down! WOO HOO! visit my online store @ www.ser v omagazine .com Linux Robotics
by D. Jay Newman
If you want your robot to have more brains than microcontrollers can deliver — if you want a truly intelligent, high-capability robot — everything you need is right here. Linux Robotics gives you stepby-step directions for “Zeppo,” a super-smart, single-boardpowered robot that can be built by any hobbyist. You also get complete instructions for incorporating Linux single boards into your own unique robotic designs. No programming experience is required. This book includes access to all the downloadable programs you need. $34.95
The Amateur Scientist 3.0 The Complete Collection by Bright Science, LLC
There are 1,000 projects on this CD, not to mention the additional technical info and bonus features. It doesn’t matter if you’re a complete novice looking to do their first science fair project or a super tech-head gadget freak; there are enough projects on the single CD-ROM to keep you and 50 of your friends busy for a lifetime! $26.99
WebstoreOct08.qxd
9/3/2008
3:31 PM
Page 69
Or order online www.servomagazine.com BACK ROOM SPECIALS
The Definitive Guide to Building Java Robots by Scott Preston
S AVE 10% plus GET FREE US SHIPPING! Buy both these books together in the month of October 2008 Building Robots with LEGO Mindstorms NXT
and
Programming Lego Mindstorms NXT
and save 10% off the list price. Plus get free shipping in the US!! Call 800 783-4624 or order online @ www.servomagazine.com List Price $29.95 Sale Price $ 26.95 List Price $40.95 Sale Price $35.95
Robot Builder’s Cookbook
FREE! with any e purchas 0 over $10
by Owen Bishop
This is a book for first-time robot builders, advanced builders wanting to know more about programming robots, and students in further and higher education tackling microcontrollerbased practical work. They will all find this book a unique and exciting source of projects, ideas, and techniques to be combined into a wide range of fascinating robots. $29.95 Sale Price $ 24.95
The Definitive Guide to Building Java Robots is for educators, students, hobbyists, and startups looking for Java/hardware interaction. This book shows you how to use your PC to build robots, and how you can interface with a microcontroller to do the basics. You’ll learn to design your robot to navigate, see, speak, recognize your face, listen to you, and build maps. $55.95 Sale Price $ 47.95
Phone-inly! n orders o
From HomoSapien to RoboSapien
SERVO Magazine T-Shirts
Before R2D2 there was R1D1
Get your very own limited-edition SERVO Magazine T-shirt. Shirts come in sizes S, M, L, and are available in either black or white. All shirts are 100% preshrunk cotton. Limited time offer. Call 1-800-783-4624. PROJECTS
W! NE
Tankbot Kit & Alpha Brain Kit As seen in the Sept. issue Tankbot/ Brain Alpha by Ron Hackett A bi-monthly series filled with projects and experiments to challenge you through your learning process while you grow your fully expandable Brain Alpha PCB!
The Alpha Brain kit is an excellent way to The TankBot gives you everything you get started in robotics. The brain — a need to start building your own sturdy PICAXE-14A — is easily programmed in a servo-motor robotic tracked vehicle. dialect of Basic that includes many powerful Powered by two modified R/C servos commands. At the end of each of Ron’s (44 oz-in torque). The assembled Tankbot articles, he will include programming for that measures 7 inches long, 4.75 inches wide, month’s project. The kit also includes a 400 and 3.5 inches high. The top deck is point breadboard which allows for drilled ready for the Alpha Brain. For more considerable expansion and experimentation. info & pictures, visit the SERVO Webstore For more info & pictures, visit the SERVO at www.servomagazine.com. Webstore at www.servomagazine.com. $59.95 Sale Price $ 56.95 $99.95 Sale Price $ 85.95 Combo Price $ 138.95
The SERVO Buddy Kit
An inexpensive circuit you can build to control a servo without a microcontroller!
For more information, please check out your May 2008 issue or go to our website @ www.servomagazine.com Subscriber’s Price $39.55 Non-Subscriber’s Price $43.95 PCB includes article reprint.
SERVO 10.2008
69
BasicBoardRobotics.qxd
9/2/2008
3:26 PM
Page 70
Hardware Serial Port Adapter by William Smith
I’m working on a new robot application for the BasicBoard from Beginner Electronics.com. I chose one of the tractor type bases from budgetrobotics.com as seen in Figure 1. This is a great little base to build a robot from. In the process of doing this, though, I wanted to get the expansion serial port on the BasicBoard working for future add-on sensors and other future ideas. That extra serial port connection ends up pointing to the front of the robot so this could be really handy. he BasicBoard has a built-in serial port for programming while this second serial port is a four-pin header connected to the hardware serial port peripheral pins of the Atom PIC16F877A chip. I tested this port by making it talk to a PC running a terminal program. This article will describe the simple example of how to use the HSERIN and HSEROUT commands in Atom Basic to control the hardware serial peripheral within the Atom interpreter chip. The main advantage to these commands and the hardware serial peripheral is the ability to send and receive information in the background while the BasicBoard’s main program is running. The 40-pin Atom interpreter chip used in the BasicBoard is actually a PIC16F877A with custom bootloader programming software inside. The BasicBoard connects to the programming pins of the Atom chip through the nine pin DB-9 connector at the top of the BasicBoard. You can send messages out this port, but I wanted to use the hardware serial port connections which are tied to the C6
T
Figure 1. BasicBoard Tractor Robot. Figure 2. Serial Adapter.
70
SERVO 10.2008
and C7 pins of the PIC16F877A. These are brought out to a four-pin connector on the side of the board. The pins are 5V, ground, transmit (Tx), and receive (Rx). The hardware serial port transmits in true RS-232 mode which means the port needs an RS-232 inverter chip to convert the signal to +12V and -12V signalling. There are many of those types of adapters available but I wanted a nice cable version. I created one as shown in Figure 2 to connect to the serial port pins. I built this adapter from some off-the-shelf parts. The case is a simple DB-9 shell that you can get at Jameco.com or even some RadioShack stores. I put a four pin connecter at the end of the wires but the key component is inside the case. It’s a small circuit board with an RS-232 inverter chip designed in that I purchased from HVWTECH.com. All the components are surface mount, so the board is very small. I had to modify the case a little to make the board fit but it didn’t take much work. The screw holes ended up being blocked by the circuit board so I had to use a piece of tape on the sides to hold the case together. The circuit board is shown in Figure 3. The RS-232 board is advertised as a TTL to RS-232 converter that allows any Transistor Transistor Logic (0-5 volt) device — such as a microcontroller — to communicate with true RS-232 (±12V) devices such as a PC. It’s capable of speeds up to 115K baud and is reported to be able to communicate at distances of up to Figure 3. HVWTECH.com several hundred feet. The module RS-232 Board. costs under $10, which I found to be
BasicBoardRobotics.qxd
9/2/2008
3:27 PM
Page 71
quite inexpensive for such a custom built module. The RS-232 Driver Module is available in two configurations: modems (DCE); and things that connect to modems (DTE). I’m using the DCE version since I want to connect to the PC serial port (just like a modem would). For the connection to the PC, I used a nine pin straight-thru cable. The completed adapter is shown connected to the BasicBoard in Figure 4. The BasicBoard supplies the power to the module so it’s a simple connection between the serial port adapter module on the BasicBoard and the PC serial port.
Figure 4. Completed Setup.
Software To demonstrate how to use the adapter, I now have to show the software to control it. The application will create a simple communication connection between the BasicBoard and the Atom development software’s built-in terminal window. The program will have the BasicBoard send out a statement requesting which LED the user would like to light up (0 through 7). The user then enters the LED number in the terminal window and presses the enter key on the PC. The ASCII value of the number is sent through the serial adapter and when the BasicBoard receives that value, it turns on the LED. It will also display the value chosen on the BasicBoard’s LCD display. The program runs over and over again, asking for and receiving the LED information. The BasicBoard’s Atom programming software screen with terminal window after the BasicBoard has sent the information is shown in Figure 5. This is how it should look when you get your hardware serial port adapter working. Now, onto the code listing for the BasicBoard. It is fairly simple but the key lines are the HSEROUT and HSERIN commands. These are specially written to control the hardware serial port. Before we can use these commands, we first have to set up the hardware serial port and that is done with the SETHSERIAL command:
temp var byte old var byte pause 500 lcdwrite 17\16,outc,[initlcd1,initlcd2,twoline,scrblk,clear,home]
Finally, the main program is written that sends out the statements to be displayed in the PC terminal window. Each line is sent with a separate HSEROUT command. The HSEROUT sends the ASCII codes 10 and 13 which represent the line feed and carriage return. hserout hserout hserout hserout
[“Hello I am the Basic Board”] [10,13] [“Which LED would you like me to light”] [10,13]
Figure 5. Atom Screen Capture.
sethserial H57600
This sets the BasicBoard hardware serial port to 57,600 baud at eight data bits, no parity, and one stop bit. You can check the various options for this setup in the Atom command manual. The program then establishes the variables the program will use and also sets up the BasicBoard LCD similar to the LCD project in the BasicBoard manual. SERVO 10.2008
71
BasicBoardRobotics.qxd
9/2/2008
3:28 PM
Page 72
After this, the program sends the statement: “PC says lite LED number :” on the two LCD lines. lcdwrite 17\16,outc,[clear,home,”PC says lite LED”,scr ram+$40,”number: “, dec temp]
The program then uses the HSERIN command to receive the LED choice from the PC. The program does not use the optional timeout function available for this command so the program will wait here until a value is received. The value received will be an ASCII value so the DEC modifier is placed in front of it to convert the ASCII value to the numeric value. This makes it easier to control the LED with the High and Low commands. The previous LED choice is stored in the “old” variable so it can be shut off when the new LED is lit. The example program is: sethserial H57600 temp var byte old var byte pause 500 lcdwrite 17\16,outc,[initlcd1,initlcd2,twoline,scrblk,clear,home] main hserout [“Hello I am the Basic Board”] hserout [10,13] hserout [“Which LED would you like me to light”]
72
SERVO 10.2008
hserout [10,13] lcdwrite 17\16,outc,[clear,home,”PC says lite LED”,scr ram+$40,”number: “, dec temp] old = temp HSERIN [dec temp] high temp low old goto main
Conclusion If you don’t have a BasicBoard, this may be a little difficult to follow but any PIC board with the C6 and C7 pins can use the BasicAtom interpreter chip and the RS-232 adapter to create a similar setup. I want to control other modules that require a RS-232 connection. This setup should allow the robot platform to communicate with the extra modules via the hardware serial port while the main loop of code controls other items. This simple example shows some of the power of the Basic Atom language but this type of command is available in other compilers such as PICBASIC PRO and other Basic compilers. I hope to cover some of those in my next column as I have had requests from people to control the BasicBoard with something other than Atom software. There are a lot of options to do that, so I will get to work. If you have questions, email us at BeginnerElectronics @gmail.com. See you next time. SV
RoboResourcesF.qxd
9/3/2008
3:03 PM
Page 73
Tune in each month for a heads-up on where to get all of your “robotics resources” for the best prices!
Getting Kids into Robotics R
obots and kids go together like bacon and eggs, peaches and cream, resistors and capacitors. Thanks to low-cost construction kits — and not to mention popular movies that glamorize automatons — more and more children are exploring the world of robots. And that’s not a bad thing. Robotics encompasses multiple disciplines, including mechanical engineering, software programming, electronics, even human psychology. In all, it’s a great field to be interested in, because there are so many options for further study and exploration. In this column, we’ll review some of the kits, books, and other material available that are either expressly designed to motivate children in learning about robotics, or are readily adaptable to a child-age audience because of their design, support documentation, or other features.
Let’s Make a Robot! Building a robot can be a timeconsuming affair, requiring hours of sawing, drilling, grinding, soldering, and programming. Many kids simply don’t have the attention span to wait that long before seeing results, so for the typical child a ready-to-go kit is the best option. Ideally, the kit should include all the mechanical and electronic components to make a functional robot capable of at least
rudimentary actions, such as reacting to light or following a black line on a white piece of paper. Fortunately, there are many such kits available, at prices starting at about $20. Of course, the more sophisticated the robot and its abilities, the more the robot will cost. At the lower end of the scale is the single-function kit, requiring at least mechanical assembly. By “single-function,” it means just that. These ‘bots are made to do one thing and encompass no intelligence or programming. For example, the robot may merely react to sound, or follow a line. The OWI-9910 Weasel is an example. Two photo detectors on the underside of the robot detect a line drawn on the ground and two touch switches on its body give it a simple obstacle avoidance mechanism. Some robot kits are designed for remote control by a human. The least expensive of this breed uses a wired tether. You steer the robot by flicking a set of switches. For instance, there’s the OWI-9280 Soccer Pro kit. It’s a simple wheelbased vehicle with a two switch wired remote. With a couple of these, your child and a friend can play miniature robotic soccer, pushing a ball around a small field. There are many other singlefunction robot kits, and the OWI product line is perhaps the most complete in this category. The kits
are available from several retailers (a couple of the main online stores are listed in the Sources), and are grouped by skill level. These basic mechanical-only kits comprise the least expensive of the lot. Next, are the kits that require electronics of some kind come with complete and ready-to-go circuit boards, though a few models are available with the electronics also in kit form. These are handy for learning about soldering and electronics construction. For purely mechanical construction, there’s the robotics and educational products from Tamiya. Most of these are not found in local area hobby stores, but are common enough online, especially from robotics-specific retailers. We provide a short list of sources for these, as well. Next up the ladder are fully programmable kits (typical price range is $120-$175), where you develop and download a script for the robot’s action from a personal computer. Once programmed, the robot is self-sufficient and autonomous. Probably the most well-known kit of this type is the Parallax BOE-Bot ($160), which consists of a metal chassis and hardware, twin servo motors and wheels, and an already-assembled electronics board (the BOE Board), complete with the Parallax BASIC Stamp microcontroller. The BOE Board is connected to a host computer via serial or USB. SERVO 10.2008
73
RoboResourcesF.qxd
9/3/2008
3:04 PM
Page 74
Capsela, and Erector.
Sources Construction Toys www.constructiontoys.com Online and local retailer of construction toys. These toys are available both online and in the retail store: Capsela; Eitech; Erector; Fischertechnik; Geofix; Geomag; K’NEX; LEGO Dacta; Roger’s Connection; Rhomblocks; Rokenbok; Zome System.
e-Hobbyland e-hobbyland.com Well-established retail and online seller of all types of toys.
Elenco Electronics www.elenco.com The Jameco Robot Store sells a number of ready-to-go and kit products ideal for student use.
The programming environment is included free of charge, and there are plenty of coding examples to get you started. The BOE-Bot documentation is extensive, and the nature of the programming language used by the BASIC Stamp makes it well-suited for middle school and higher students.
Other options exist, of course. A relative newcomer is the OOBug, from the makers of the OOPic microcontroller. The OOBug ($160) consists of an assembled circuit board upon which motors and a clear plastic body are mounted. Assembly time is under 15 minutes. Whereas optical sensors for such tasks as line following or object detection are often extra on other programmable kits, they’re standard on the OOBug, and ready for use. Like the BOE-Bot, the OOBug is programmed via a computer link (specifically a USB cable), and the programming environment is included free of charge. The OOBug further differentiates itself by supporting music, sound, and speech effects, as well as “social” robotics, where robots may be programmed to interact with one another, as well
74
SERVO 10.2008
as the environment. Finally, for lack of a better term, “learning system” kits encompass those that provide more than one possible robot design. The LEGO Mindstorms NXT and Vex kits are excellent examples. At the core of the kit is a self-contained microcontroller module, which provides for programming the robot. Connection to a host PC is done via serial, USB, and — in the case of older model Mindstorms kits — infrared link. Motors and sensors connect to the microcontroller module in various arrangements, giving flexibility in design. Then, using plastic or metal parts, you build the robot chassis, either by snapping pieces together (as with LEGO) or assembling the parts using metal or plastic fasteners. In either case, you can completely disassemble your creation so you can reuse all the components again. Learning system kits encourage a greater degree of design experimentation, and are particularly well-suited for kids who are mechanically inclined. Other learning system kits include Fischertechnik, K-NEX,
Offers a line of educational electronics and robotics products, including novel “snap-together” kits ideal for younger children.
Fischertechnik www.fischertechnik.com Company website for Fischertechnik in North America. Check out the Retail Outlets links.
Hobby Engineering www.hobbyengineering.com General source for robot parts, as well as a lengthy list of Erector set kits of all shapes and sizes.
HVW Tech www.hvwtech.com Hobby electronics retailer in Canada also resells a number of popular robot kits, including products from Parallax.
Jameco Robot Store www.robotstore.com Reseller of a number of robot kits, including the Tamiya remote controlled robot construction set.
KBtoys.com www.kbtoys.com Online mail order. Check often for deep discounts on LEGO,
RoboResourcesF.qxd
9/3/2008
3:05 PM
Page 75
K’NEX, and other brands.
LEGO Shop-at-Home shop.lego.com Online outlet for LEGO products, including spare parts (when available).
company also sells Rokenbok radio controlled toys.
OWI Robots www.owirobots.com Importer of the OWI robot line of educational robotics.
Robotis line of robot construction sets and parts. Check out the dealer pages to find a reseller near you.
Robotshop www.robotshop.ca www.robotshop.com Resellers of Fischertechnik and other robot construction sets.
LEGO Mindstorms mindstorms.lego.com
Parallax www.parallax.com
Informational page for the LEGO Mindstorms sets. Be sure to check out the user-to-user forums to see what other LEGO builders are up to.
In addition to microcontrollers such as the BASIC Stamp, Parallax offers numerous robot kits, including the BOE-Bot (wheeled) and Penguin (walking). Also offers robot components, such as wheels, servos, and sensors.
Robot Kits Direct robotikitsdirect.com
Pololu www.pololu.com
Solarbotics www.solarbotics.com
Makers of small plastic robot bases designed for use with Tamiya motors. Also sells servos, wheels, and treads and sprockets for building tracked robots, as well as sensors, microcontrollers, and other electronics.
Primary retailer of BEAM robots — a “simple is better” approach to design. Products include various light-attracted bugs and walking robot kits, motors, solar cells, and electronics.
Junun.org www.junun.org/MarkIII/ Resellers of the Mark III mini Sumo robot kit, originally designed by the Portland Area Robotics Society (PARTS) for mini Sumo competitions. The kit includes all hardware, motors, wheels, and electronics. The website also sells low-cost sensors, such as the Sharp IR proximity modules, and various support electronics common in amateur robotics.
Machine Science www.machinescience.com Offers an expandable metal robot base, which includes motors, wheels, microcontroller, and other electronics.
Norland Research www.smallrobot.com Kit of parts for turning a Texas Instruments scientific calculator into a robot.
OOBug www.oobug.com Entry-level “deskpet” robot kit. The OOBug differentiates itself in that it is designed to build cooperative or social robots, able to communicate and share information between each other.
Only Toys www.onlytoys.com Only Toys carries metal Erector sets; most are for building vehicles, and some (like the Steam Engine) are quite elaborate. The
qfix qfix-shop.de German-based manufacturer and seller of small robot kits for education. Website is in Deutsch and English.
RB Robotics www.rbrobotics.com New owners of the RB5X educational robot. As noted on the website, “The RB5X robot has been produced for over 20 years. With a proven track record and a developed set of teaching aids, it is a great choice for any classroom.” Full kits and individual parts available.
Robix www.robix.com Aluminum robot kits, primarily designed for educational use. The aluminum pieces and servos can be constructed in numerous ways to make a variety of robotic forms.
Robotis www.robotis.com Manufacturer’s site for the
Plastic robot kits in various skill levels, from beginner to advanced. An example is the OWI-9910 Weasel, which combines touch sensing and a basic wall hugging behavior.
Tamiya www.tamiya.com Home page for Tamiya. Check out their Educational Construction Series line of kits, such as the remote controlled robot construction set. No online ordering, but you can use the product listing to see what’s available.
Timberdoodle www.timberdoodle.com Timberdoodle specializes in home education products. They offer a good selection of Fischertechnik kits at good prices. Also sells K’NEX and electronics learning labs. Be sure to check their “swan gong” closeout deals.
VexLabs Vex Robotics Kits www.vexlabs.com Makers of the VEX Robotics Design System. Use their online ordering system. SV
CONTACT THE AUTHOR Gordon McComb can be reached via email at
[email protected]
SERVO 10.2008
75
Appetizer.qxd
9/3/2008
5:34 PM
Page 76
RoboGames: RoboMagellan 2008 by Camp Peavy Photos by Tim Craig
I
t was a chilly June day above the Ft. Mason Center, San Francisco at the Great Meadow: 14 teams entered; eight took the field; five touched the goal; three touched the goal plus two bonus cones. “Zippy” and “Intrepid” traversing over 500 feet touched both bonus cones and the goal in exactly five minutes: 28 seconds ... a tie for the gold medal. RoboMagellan robots usually take a long time to build. One generally starts in the fall building for RoboGames in June. “June” arrives and it’s a series of frantic all-nighters focused on software, overall behavior, and fixing blown circuits. Many times, the first year is a bust (14 entered) but after a year or two the robot comes together. This year there was an exception in a robot named “Zippy” created in a few short weeks by FIRST alumni Ben Filippenko and Sergiy Nesterenko. In the end, Zippy and Intrepid (built by RoboMagellan veteran Mark Curry) tied for gold with a goal-plus-two-bonus-cone run of five minutes and 28 seconds exactly
. The rules currently have no procedure for breaking a tie ... who would think with a total distance of 550 feet there would ever be a tie? In the future, I think using one’s previous fastest time should be used as the tie-breaker. For the uninitiated, RoboMagellan is an outdoor contest where one is given the GPS coordinates for a “goal” and an 18 inch orange traffic cone is placed at that coordinate. The starting point is no less than 300 foot away; the length of a football field. Bonus cones are placed which give a fractional multiplier (between 0.9 and 0.1). One may elect not to go for the bonus cones but you must touch the goal for a score. We handed out the course map in front of the Ft. Mason Center at
76
SERVO 10.2008
Mark Curry’s “Intrepid” was the only robot to touch both bonus cones and the goal on all three runs. On its third run, it tied for gold with a real time of five minutes 28 seconds.
noon and agreed to meet at the park at 12:30. This year’s map was basically last year’s map turned upside down. The start became the goal and the goal became the start ... bonus cone #1 became bonus cone #2 and viceversa. The fractional multipliers were increased from “x .25 and x .5” to “x .1 and x .25” because last year the bonus multipliers weren’t enough. First up, “WolfNav” after a few minutes of stopping and starting called it quits; total distance eight feet. The second run wasn’t much better. It was a gallant attempt but as mentioned these robots are challenging to build; Cody and John still needed considerable troubleshooting to navigate the entire course so they elected not to try a third run. Our second contestant was Zippy. True to his name, Zippy zipped from bonus cone to bonus cone to the goal in less than six minutes. On its second run Zippy improved to the five minutes 28 seconds which would tie Intrepid for the gold medal. “Beaver One” from Pasadena, CA headed by Tony Wu managed an 85 foot run the first time in four minutes 11 seconds. The second run got closer but still could not make it to the first bonus cone. On the third run they did touch the first bonus cone at three minutes five seconds. Intrepid was the only robot to touch the goal and both bonus cones on all three runs.
“Zippy” tied with “Intrepid” for gold with a goalplus-two-bonuscone run of five minutes and 28 seconds.
“A3” by Jim McGuffin and Doug Coral were up next. On the first run, they had trouble getting out of the crater. After a series of wheelies and almost falling over, A3 recovered nicely and went 300 feet in six minutes 15 seconds. The second run didn’t go as well, but the third run was the charm ... five minutes 39 seconds ... both bonus cones plus the goal ... good for silver. Next up was “GURU,” an RC car based robot built by a group of aerospace engineers known as the Robot Doctors. After one attempt to reach the bonus cone they went straight for the goal on their second and hit it with a one minute 23 second straightshot run; good enough for bronze. “Red Dwarf,” an RC car-based rover, had three good runs but could never make it to the goal. The last competitor was a trackbased entry from the University of Waterloo named “Marauder.” On the first run our northern neighbors touched the goal but no bonus cones (close) in five minutes and 23 seconds. We are at the dawn of a new age ... an age with machines as different as plants are from animals. The future has begun and you are watching it unfold before your very eyes. If you’ve finished a table-top robot and are looking for that next project, consider a RoboMagellan robot. A robot that can get from one place to another in a cluttered environment is a useful device and a lot of fun. SV
Full Page.qxd
9/3/2008
12:37 PM
Page 77
)e[8eelXc8ljk`e
D8B<8ljk`eN\`i[ =I<<8;LCK;8PG8JJ ),mXcl\ n_\epfljlYjZi`Y\ kfD8B<fi:I8=K%JlYjZi`Y\ kfYfk_Xe[^\kknfgXjj\j nnn%dXb\i]X`i\k`Zb\kj%Zfd
8knf$[Xp#]Xd`cp$]i`\e[cp\m\ekk_XkZ\c\YiXk\jXikj#ZiX]kj#]ff[#dlj`Z# \e^`e\\i`e^#Xe[jZ`\eZ\gifa\ZkjXe[k_\;f$`k$Pflij\c];@P d`e[j\k%
9LP K@:B
=<8KLI@E>*''"D8B1 N <[`Yc\8ljk`e=ff[DXb\iGXm`c`feN =`i\8ikjN <\gp9`i[;`\k:fb\D\ekfj=flekX`ej N K\jcX:f`cjN 8ljk`e9`b\QffN 8ik>fc]:flij\N C`]\$J`q\[Dflj\kiXgN K_\IfYfk>iflg N 8ljk`e:_`c[i\eËjDlj\ldN Gldgb`eGcXp;XpN 8ck\ieXk`m\