Servo Magazine 10-2009

84 Pages • 41,106 Words • PDF • 11.8 MB
Uploaded at 2021-09-24 17:17

This document was submitted by our user and they confirm that they have the consent to share it. Assuming that you are writer or own the copyright of this document, report to us by using this DMCA report button.


Vol. 7 No. 10

SERVO MAGAZINE

ROCK-AFIRE EXPLOSION • ROBOT ANIMALS • DUAL SERIAL MOTOR CONTROLLER

1 0>

October 2009

4

74470 58285

0

$7.00

CANADA

$5.50

U.S.

2

SERVO 10.2009

PAGE 76

The Combat Zone... Features 26 29 PAGE 10 PAGE 34

Columns 08 Robytes by Jeff Eckert

Stimulating Robot Tidbits

10

GeerHead

33 34

Events 32

by David Geer

Adept Quattro Robot Handles Solar Cells With Care

14

Ask Mr. Roboto by Dennis Clark

33 36

Your Problems Solved Here

67

Beginner Electronics by William Smith

PICkit 1 Programmer

72

Results and Upcoming Competitions EVENT REPORT: Gulf Coast Robotics Sports 2 ROBOT PROFILE: Professor Chaos

Departments

by Tom Carroll

06 18 19 20 22

Robot Animals Strive to Match Humanoids in Realism

Cover Photo by John David Zerwas

Robotics Resources by Gordon McComb

Here Come the (Paper?) Robots!

76

BUILD REPORT: Shaka MANUFACTURING: RioBotz Combat Tutorial: Materials Part 2 PARTS IS PARTS: Coloring Titanium Thoughts of a New EO

Then and Now

Mind/Iron Events Calendar Showcase New Products Bots in Brief

64 81 81

SERVO Webstore Robo-Links Advertiser’s Index

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]

4

SERVO 10.2009

10.2009 VOL. 7

NO. 10

PAGE 60

Features & Projects 37

CCS Mechatronics

54

by Fred Eady This time, we’ll take a look at the softer side of robot construction and write some basic machine control component code using Custom Computer Services’ C compiler.

44 50

by Martin Weiss A serial interface will be used to facilitate communication between the master and the motor controller, making this a great building block for a variety of applications.

Creepy Hybrid — Part 2 by Alan Marconett This time, we’ll program the microcontroller and the servo controller board to complete this unique platform.

Rockin’ Robot Style by Joe Shearer Former Showbiz Pizza animatronic band members reunite in a “Rock-afire Explosion.”

Build a Building Block: A Dual Serial Motor Controller

60

Robotics Software Engineering by Fulvio Mastrogiovanni Current trends in software development for robots are discussed.

SERVO 10.2009

5

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

Mind / Iron by Bryan Bergeron, Editor Œ

Sensory Overload If you’ve been into robotics for more than a few years, at some point you’ve probably spent hours trying to fabricate a sensor either because the best one for the job was too expensive or because one didn’t exist. You’ve probably also come to appreciate that selecting and interfacing sensors to processing gear are at least half of the equation when designing robots. With factory robots in Japan receiving pink slips and a general surplus of sensors and other robotics components on the market, it’s become a buyer’s market. The design challenge has shifted from affordability to the best fit for a particular application. There is a wealth of discrete sensors on the market, with accuracy and functionality for any budget. For example, I’ve been experimenting with the new Honeywell dual-axis magnetic sensors, available from the folks at SparkFun Electronics (www.sparkfun.com). The leadless

SMD package is virtually impossible to work with without a good hot air pen and magnifier. If you’re limited to a soldering iron, then take a look at the thumbnail-sized breakout board, also from SparkFun. If you’re into kits, I’ve found the products from the Australian company Oatley Electronics (www. oatleyelectronics.com) some of the best around. I’m in the middle of a project that uses their Hall-effect interface kit (see photo) which makes a great rotational speed sensor for a large robot. If you’re working with a carpet roamer, then go with the nearly microscopic Honeywell sensors. However, if you need a rugged sensor that you can service without a microscope, then take a look at the Oatley kit. One of the best features of the Oatley product is the provision for a remote sensor. No need to expose the entire circuit to dust, dirt, and mud – simply snap off the edge of the main circuit board and connect a three-wire cable between the two boards. As with SparkFun, you can

Subscriptions Toll Free 1-877-525-2539 Outside US 1-818-487-4545 P.O. Box 15277, N. Hollywood, CA 91615 PUBLISHER Larry Lemieux [email protected] ASSOCIATE PUBLISHER/ VP OF SALES/MARKETING Robin Lemieux [email protected] EDITOR Bryan Bergeron [email protected] CONTRIBUTING EDITORS Jeff Eckert Tom Carroll Gordon McComb David Geer Dennis Clark R. Steven Rainwater Fred Eady Kevin Berry Alan Marconett Fulvio Mastrogiovanni Joe Shearer Martin Weiss Thomas Kenney Marco Meggiolaro Seth Carr William Smith CIRCULATION DIRECTOR Tracy Kerley [email protected] MARKETING COORDINATOR WEBSTORE Brian Kirkpatrick [email protected] WEB CONTENT Michael Kaudze [email protected] ADMINISTRATIVE ASSISTANT Debbie Stauffacher PRODUCTION/GRAPHICS Shannon Christensen Copyright 2009 by T & L Publications, Inc. All Rights Reserved

Mind/Iron Continued

6

SERVO 10.2009

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.

go to the Oatley website and download detailed information on these and other sensors. One of the beneficial side-effects of the game industry is renewed interest in multidimensional controllers. My favorite — the Nintendo Wii controller — is probably the most repurposed sensor in history. I’ve seen the mems harvested from these inexpensive controllers show up in everything from surgical simulators for training clinicians to exercise equipment. The strain gauge sensor in the Wii Fitness product has a strong following, as well. From what I can see, the strongest push for cheaper, faster, more efficient sensors is coming from the smart phone industry. Smart phones in the US are starting to catch up with those in Japan, with magnetic field sensors, multi-axis accelerometers, ambient light, and distance (for shutting down the display when the phone is against your ear). Even body impedance (for body fat calculation) is the norm. Soon, it’s going to be easy enough to drop smart phones into your robot platform and instantly have a full arsenal of sensors, two-way audio and video, voice command, and world-wide control via the Internet. Someone will have to think up an alternative name for the obvious “iRobot” platform. The nature of our relationship with sensors is changing. Well over a year ago, I retired my multi-function, sensor-laden watch with barometric pressure, temperature, direction, altitude, and chronometer in favor of my smart phone. Those old data points are insufficient. I don’t simply want direction, but direction relative to the nearest restroom or filling station. I’m not concerned with raw altitude, but my altitude relative to my surroundings. And who looks at their wrist for time anymore? Dump your watch and see how long it takes for you to stop reflexively glancing at your wrist for the time instead of at your smart phone. The explosion in affordable sensors is a good thing. Of course, there will be an eventual consolidation of the vendors and standards, and the eventual emergence of a multi-function sensor that’s integrated into every smart appliance on the planet. At that point, your drop-in cell phone will enable your robot with GPS, face recognition, voice recognition, and a host of other features that would have once cost thousands of dollars to implement with discrete sensors. For now, enjoy the affordability and variety of the devices flooding the market. SV

SERVO 10.2009

7

Robytes NAV Development Enters Phase II

Bot Conducts Motorcycle Tests

AV’s Nano Air Vehicle, entering phase II development. Courtesy of AeorVironment.

“Flossie,” Castrol’s robotic motorcyclist.

As a result of achieving controlled hovering flight with its prototype Nano Air Vehicle (NAV) late last year, AeroVironment, Inc. (www.avinc.com), has now been awarded phase II funding ($2.1 million) from the Defense Advanced Research Projects Agency (DARPA) for continuing development. The goal is to come up with a little wing flapper that (1) weighs about 10 g; (2) can hover for extended periods; (3) zips along at up to 10 m/s (22 mph); (4) can withstand wind gusts of up to 2.5 m/s; (5) can operate inside buildings; and (6) can communicate with command and control from up to 1 km. The “Mercury” phase I unit didn’t clear all of those hurdles, but it “accomplished a technical milestone never before achieved: the controlled hovering flight of an air vehicle system with two flapping wings that carries its own energy source and uses only the flapping wings for propulsion and control.” Phase II will “focus on optimizing the aircraft for longer flight endurance, establishing the transition capability from hover to forward flight and back, and reducing its size, weight, and acoustic signature.” The contract continues through the summer of 2010.

If you want to conduct some grueling motor oil tests using a high-performance motorcycle, it’s important to put it through the routine with perfect repeatability and reliability. That, of course, is pretty much impossible with a human rider, especially one who has ingested a case of beer and emerged a little banged up from a bar brawl. So, Castrol came up with Flossie the robotic biker to ride the hog. According to Jo Simpson, a “lubricant development technologist” at Castrol, Flossie — being capable of making exactly the same gear change or the same acceleration time after time — is highly valuable in tests to verify product benefits such as increased power and acceleration. “It is equipped with a self-learning mode to enable it to know the gear change pattern, clutch feel, and throttle response of the bike — just like any rider would on their first outing on a new machine.” But don’t expect to see Flossie show up at Daytona to flash her hydraulic cylinders at you. Unfortunately, she rides only while strapped firmly to a dynamometer. (But she really likes it that way.) To see her in action, visit www. castrolmoto.com.

by Jeff Eckert Rover Finds Meteorite

Pancam view of Block Island — Mars’ largest known meteorite. Courtesy of Nasa/JPL-Caltech/Cornell University.

Meanwhile, up on the Red Planet, rover “Opportunity” recently stumbled upon a watermelon-size rock that turned out to be an ironnickel meteorite. Dubbed “Block Island” (possibly but not explicitly because it’s shaped a bit like the island resort off the coast of Rhode Island), it is the largest known meteorite on the planet. The interesting thing about it is that it is too large to have hit the ground without disintegrating unless Mars had a much denser atmosphere at the time of its arrival. According to rover team member Matt Golombek, “Either Mars has hidden reserves of carbon-dioxide ice that can supply large amounts of carbon-dioxide gas into the atmosphere during warm periods of more recent climate cycles, or Block Island fell billions of years ago.” Next on tap for Opportunity is a trek to the Endeavor Crater several miles away. Amazingly, the bot and its twin, Spirit, landed in January 2004 and were expected to remain on duty for only three months. Eat your heart out, Energizer bunny. To keep up with their activities, visit marsrovers.nasa.gov.

Robotic Power Trowel Okay, it’s not as romantic as

8

SERVO 10.2009

Be warned, however, that you’ll need some serious cash because minimum bids start at $46,000 for the least desirable areas and run as high as $619,000 for the snobby Julius Caesar region. Step right up, folks.

Bot Training Introduced

The Whiteman STX is the underlying platform of a new robotic power trowel. Courtesy of Multiquip, Inc.

exploring Mars, but a Lithuanian startup company called ROBOTUS (www.robotus.lt, also known as JSC Robots) has been developing a robotic power trowel intended to make floor finishing more efficient, less burdensome, and less dependent on human resources. The company’s R&D division has modified a Whiteman STX 45-hp hydrostatic rideon trowel by adding an automatic control unit and a laser positioning system for navigation. According to ROBOTUS, “Complex robot operating conditions like fast-changing train surface parameters and the unusual movement principle of the trowel-like machine were the biggest problems for engineers while developing control algorithms and systems for the robot.” But the result is a system that not only improves the accuracy of trowel navigation, it allows one operator to control several machines simultaneously via a LAN or WAN. Reportedly, the system can be installed on any standard hydraulic power trowel. You can see a demonstration by going to YouTube and searching for “robotic power trowel.”

Lunar Ads to Come? Probably the looniest (literally) idea to come around in a while is from Moon Publicity, LLC (www. moonpublicity.com) which proposes to use shadow-shaping robots to

Will robots be used to build lunar billboards?

create advertisements on the moon. According to the company’s website, the concept offers the opportunity to have “twelve billion eyeballs looking at your logo in the sky for several days every month for the next several thousand years.” What the company is offering, however, is not the actual advertisement but a license to use the technology — should it ever become available — on one of 44 regions on the lunar surface. And you’d better hurry, because bidding is scheduled to end October 20th.

Most robotic training programs are aimed at design and construction skills, but not all industry jobs are in these fields. In fact, bots are complex, break from time to time, and require maintenance. For those who are interested in working as a robot maintenance professional, Toolingu.com has introduced web-based training that addresses common robot components, proper maintenance, and troubleshooting methods. It also covers important subjects such as mechanical drives and motors, pneumatics, and programmable logic controllers, all tailored toward production environments. For details, visit www.toolingu.com. SV

Ready to graduate from toys and overpriced stamps? TM

A powerful PIC32® based microcontroller board, ideal for robotic education & experimentation in C, C++, and Assembler.

‡Microchip® PIC32MX460F512L ‡80 MHz 32-bit MIPS processor ‡512K Flash, 32K RAM ‡86%SURJUDPGHEXJ,QWHUIDFH ‡86%27*KRVWGHYLFH&DSDEOH ‡86%SRZHUHG ‡FKDQQHOELWNVSV$' converter

‡(LJKW5&VHUYRFRQQHFWRUVWZR 63,SRUWVWZR,2&SRUWVWZR8$57V ‡1LQH3PRGŒFRQQHFWRUV ‡)LYHELWWLPHUVZLWKLQSXW FDSWXUHDQG3:0RXWSXWV ‡2QERDUGEXWWRQVDQG/('V ‡$OO,2V(6' VKRUWFLUFXLW protected

Enter the value code “servo2009a” on our website for this special introductory price

9.99 29.99

$ $

Expand your designs! Pmods™ are a wide range of small I/O interface boards that offer an ideal way to extend the capabilities of microcontroller & FPGA boards.

2-axis joystick w/ 3 pushbuttons

2A H-bridge w/ feedback inputs

2-line character LCD w/ serial interface

Visit our website for a wide assortment of powerful microcontroller boards, FPGA boards, peripherals, reference designs, sample projects, tutorials, textbooks, and more.

www.digilentinc.com SERVO 10.2009

9

by David Geer

Contact the author at [email protected]

Adept Quattro Handles Solar Cells With Care The Adept Quattro s650H is an industrial robot with four parallel arms mounted on a rotational body. The arms are extensions of four motors, one motor per appendage. These arms are a good fit for processing crystalline silicon wafers for solar cells as they produce more solar cells per hour than human employees do.

Silicon Wafer Processing The Adept Quattro s650H robots transfer the wafers through a variety of processes. These include loading the wafers on to a conveyor belt system so that they can be transported to and through the PECVD process. The PECVD process uses a plasma-enhanced chemical vapor deposition — also referred to as anti-reflective coating — in which the wafers are doped with phosphorus, screen printed, and sorted according to their final quality or classification, according to Kevin Stein, Applications Engineer, Adept One of Adept’s industrial robots — the Viper 650 table mounted arm.

Technology, Inc. “Individual wafers get transferred in and out of these process machines by Quattro,” explains Stein. The robots handle the wafers individually with great care and precision. In the past, human operators handled the wafers. “But robots provide higher efficiency and less waste by decreasing the breakage rate. The Adept Quattro robot provides less than 0.1% breakage depending on the application and type of cell handled. Robots do not get tired, take breaks, or call in sick,” says Stein. The efficiency of the Quattro reduces the cost per watt of solar production, Stein adds, giving the manufacturer a competitive advantage. “The cost per watt is the amount of money spent to deliver usable energy. The most frequent use of the terminology is by energy companies who say it costs “x” dollars per kilowatt hour of electricity. Using Quattro to increase solar cell production efficiencies through automation ultimately costs that manufacturer less money to produce the same amount of energy. Therefore, reducing the cost per watt,” Stein explains.

Quattro Mechanics According to the Quattro User Guide, “the Adept Quattro s650H robot is a four-axis parallel robot … four identical axis motors control movement of the robot tool in X, Y, and Z directions, as well as Theta rotation.” As previously mentioned, four robotic arm linkages are attached to the robot’s rotational platform. This is unique as compared with traditional three-arm robots. “It earns the Adept Quattro the unique title as the first of a new class of robots called Delta-4 Kinematic,” Stein explains. According to Stein, this is all part of what is referred to as the robot’s kinematics. The kinematics are derived from the underlying algorithms that coordinate rotational motion (from the motors) to translation/linear motion (tooling

10

SERVO 10.2009

GEERHEAD plate) in X,Y, or Z directions at the tool flange, Stein continues. “All four motors are moved in unison so the robot moves to the desired location,” says Stein. Looking at only a single arm and motor combination, the servo motor turns the gearbox that is connected to the inner arm. When the motor turns, this creates an up and down motion at the end of the inner arm. “The outer arm (passive) connects to the end of the inner arm (driven). When the inner arm moves, it pushes or pulls on the outer arm connected to the platform (tooling plate) causing the platform to move. So, the motor rotates causing the inner arm to move up which then pulls the outer arm connected to the platform. When you combine all four motors, you get four axis of motion,” Stein details. The Delta-4 Kinematic design enables the Quattro to move in translational X, Y, and Z orientations and in rotational (Theta) orientations simultaneously. These capabilities drive the robot to precise locations for parts and product handling. “The robot has four degrees of freedom that allow movement in a Cartesian coordinate system X, Y, Z, and Rotation. The robot uses all four motors simultaneously to move anywhere in the workspace — forward, backward, sideways, up, down, and rotated,” says Stein. While the common three-arm style robot offers some rotational motion (and a fourth telescoping arm), these do not offer the same full range of motion of the Quattro — nor the repeatability of moving through the exact same positions repeatedly. “The Adept Quattro features four identical arms that share the forces and inertial load applied to the end effector. The Quattro robot’s design enables consistent speeds and acceleration, regardless of where in the work envelope the robot is moving,” says Stein. This makes a larger work envelope, faster cycling, and larger payloads possible.

Adept Quattro robots geared up for packaging consumer goods such as candies.

individual Quattro robots. The operating system on the SmartController is Adept’s own V+ — a real-time operating system with its own command language. The CX communicates through the Adept distributed architecture called SmartServo, which is an IEEE 1394 communications interface. The SmartController works with the Quattro, other Adept robots, and third-party hardware. Single-arm Adept Viper bin — picking robot.

The SmartController CX The Adept SmartController CX motion controller communicates command and control information to the Quattro robots set up to sort and stack solar cell wafers into bins.

SERVO 10.2009

11

GEERHEAD Resources Home of Adept www.adept.com/ Information about Corporate Events http://ir.adept.com/corpevents.cfm Adept Robot Products Page www.adept.com/products/robots

The V+ OS processes information about where the robots need to proceed to complete their tasks. The OS forwards the commands through the SmartServo network to the Amplifier-In-Base technology in the base of each robot. “V+ determines the trajectory points, and the servo code on the AIB handles the low-level motor control loops,” says Stein.

AdeptSight Image Processing The Quattro machine vision system is AdeptSight — a conglomeration of Adept Technology machine vision tools. The system inspects product and guides the robot through its various picking and sorting applications. AdeptSight version 3.0 works out of the box for all Adept robots and robot control systems. Customers may also use it as a framework for developing their own customized applications for Adept robots. An Adept Quattro robot in another sorting process, of sorts. “AdeptSight features model-based object finding with automatic model teaching fully editable models. It provides In addition to firewire, the CX interfaces with digital advanced disambiguation between similar objects [so the I/O, serial, DeviceNet, belt encoder, safety circuit robots can tell similar parts apart],” says Stein. connections, and a manual control pendant device. AdeptSight machine vision mounts on the robot’s “DeviceNet provides expanded digital input/outputs, up arms, on the robot’s tools, and in two positions for to 512 each per Smart Controller,” says Stein. monitoring the conveyor belts that move the parts or products that are under the robots’ care. The cameras that Adept Cobra 600 industrial robot arm. Robot arm for use in clean rooms. form the eyes of the machine vision calibrate themselves automatically to configure themselves for each particular mounting and application. AdeptSight is compatible with a selection of supported cameras. The AdeptSight software itself is loaded into the Adept ACE control framework that guides the robots. The overall ACE software offers a GUI interface, intuitive programming, diagnostics, and support tools. “By providing a variety of calibrations, our products make it easy to translate vision

12

SERVO 10.2009

GEERHEAD coordinates into robot coordinates. Because Adept was among the first companies to offer integrated vision systems, we have decades of experience providing simple wizard based calibration procedures,” says Stein. This enables customers to reduce their development time and get Adept systems up and running in minutes rather than hours or days. Customers simply follow the prompts through a sequence of wizards to configure the AdeptSight technology. Wizards assist with camera calibration, vision tool learning, “moving the robot to the calibration target,” and starting the automated camera to robot calibration. “During a camera to robot calibration, the robot needs to be taught the first position of the calibration tool/target. You take a picture of the calibration tool, then move the robot so the end-effector is touching the cal tool/target and then the robot completes the rest of the calibration automatically moving the cal tool between each picture to average the data over the camera’s entire field of view,” Stein says.

Adept Quattro Robot Intelligence In addition to the robot’s camera eyes, it has touch sensors in the tooling plate. This way, the robot knows when it has picked up a product. The Adept ACE control software runs on the Adept SmartVision EX vision processor which is a Windows XP-based embedded, pre-configured operating system. Adept programs its robots using V+ — a real-time programming language developed by Adept for this very purpose. Customers configure the OS through the AdeptWindows command line interface. AdeptWindows enables the user to manipulate the robot, end, or begin robot programs. Novice programmers can use the Adept ACE general user interface to program the V+ OS. In a new development to the 20-year-old program, Adept has added ACE PackXpert, an Adept ACE extension for programming and managing packaging applications. The new packaging software dramatically reduces programming time. All the customer has to do is use an intuitive point and click wizard to deploy their new Adept applications. The embedded OS supports up to four cameras simultaneously. The AIB runs a power PC microprocessor while the Adept SmartController CX runs a Motorola 68K processor. The robots communicate across IEEE 1394A technology (FireWire cables are an example of 1394 high speed bus technology) using a proprietary communications protocol developed in-house by Adept Technology.

Quattro In Action The Adept Quattro robot uses its vision software, cameras, and tools to detect unacceptable solar cell wafers coming off the line. The robot then rates the unacceptable

Input, Output, and Cabling Adept Technology’s I/O ports based on their XDIO and DIO technologies enable the robot’s sensors, air lines, grippers, and force gauges with wiring through 12 inputs and eight outputs (each). “These XDIO and DIO connections are used within robot programs to allow the robot to perform certain actions depending on conditions transmitted through these signals,” says Kevin Stein, Applications Engineering Dept. XSYS is the Adept Technology hard-wired safety system. XSYS connections and cabling transmit E-stop information to the OS. “In the event of an E-stop (emergency stop), the XSYS line will notify the AIB which will perform safe shutdown procedures to halt the robot within a few milliseconds,” explains Stein.

product as “bad” and processes the “good” products. When a new specification is set for a solar cell product, the customer need only re-program the Adept ACE software for the robot to continue processing the product appropriately. The Adept Quattro will help throttle solar cell production up to speed to ensure an increasing opportunity for dependence on this alternative power source. SV

Teach

Robotics Use BotBrain

Educational Robots in Your

Class, Club, Camp or Competition - Teacher Tested Curriculum meets National Standards - Challenge based lesson plans engage students - Competitions based on Real World Applications add interest - Basic Stamp® controller lets you use Parallax materials and support - Personal Support keeps you moving smoothly - Challenge Environments make it easy to set up

BotBrain Educational Robots

www.servo.botbrain.com SERVO 10.2009

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 This month sees mostly questions about motors and how to use them efficiently; some of them I can even reasonably answer.

Q

. I have two questions. First, could you explain how to implement dynamic braking using an Hbridge to return energy back to my robot batteries to extend operation? I am very confused about this because when the motor stops I know the current is able to flow back through the protection diodes in parallel with the transistors. Conversely, the motors back EMF is lower than the supply voltage, therefore current couldn’t flow to the higher potential without some sort of configuration to step up that voltage, correct? Also, could you explain why my motor is so hot when I use locked anti-phase PWM compared to when I use sign magnitude PWM? I did the calculations and the RMS voltage is the same for both configurations except when braked at 50% duty cycle while using locked anti-phase. — Fran

A

. Great questions! Unfortunately, I will have to disappoint you on your first question. Implementing regenerative braking is a very complex problem. You have touched on some of the issues such as a mismatch in the generated voltage as compared to the battery source voltage, and how to line up the diodes in your charging bridge. You will have to use a bridge rectifier here because the voltage generated will be of the opposite polarity to the voltage used to run the motor in the direction that it is currently going. Most papers that I have read on this topic prefer to put a MOSFET switch in the circuit to prevent the bridge from “sucking” power away from the motor when you are driving the motor. Because you can’t just pump the current being created straight back to the battery (charging current can NOT be infinite or unbounded), you also need to PWM the current to the battery to control the charge rate.

14

SERVO 10.2009

In those (ahem) less expensive motors that we often use for our robot drive trains, the back EMF is typically less than what the drive H-bridge is supplying. In some cases, this may not be so. Therefore, a way to reduce that voltage may also be required. As you have noted, if the voltage is lower than the battery voltage then we need to boost it up so that current can flow back to the battery. Let’s look at what we are proposing in our charging system: •Rectification for current returned from the motor to the battery (with losses). •MOSFETs for isolation, switching, and PWM of returned current (with losses). •Boost or buck regulation of returned voltage (with losses). Every step along the way we have losses. Your bridge will drop something in the region of 1.2V from your generated voltage. Regulators will not be perfectly efficient; if you are lucky, you could get 75% efficiency. Because you are using PWM, you are literally throwing away some power (and losing braking effectiveness) when you are shut off. This does not sound ideal. Every paper that I’ve read suggests that you need to use high voltage systems (200+ volts) to get enough energy back to make it worth the effort AND that your braking needs to be slow and gradual to capture any significant energy at all — either that or you need to be braking a lot to get a lot of charge back to the battery. I’ve also read the suggestion of the use of a brushless DC motor or a synchronous AC motor for best effect. You don’t say as much, but I don’t think that you were planning on using either. However, if you just wanted dynamic braking, this can be done as simply as adding a MOSFET and a high power resistor across the motor terminals. When you turn off the power to the motor, you could then switch on the MOSFET and short the windings of the motor together which will cause braking proportional to the speed of the

motor when you brake. If you PWM the MOSFET, you can adjust the braking strength that will be generated to be proportional to the percentage of the “on” time of the MOSFET. Figure 1 shows a simple dynamic braking circuit. This circuit uses an N-channel MOSFET; the diode D1 protects the MOSFET from reverse voltage — the intrinsic diode of the MOSFET may be able to handle the current, but I believe you can never be too careful. The values of the resistors depend upon the MOSFET you use, the PWM frequency you run at, and the amount of current you expect to have to deal with (in the case of the shunt resistor R1). In case you have never worked with MOSFETs, I’ll give you a short primer on the care and feeding of your microcontroller when running one. R2 limits the inrush current needed to charge the Gate capacitor of the MOSFET to something that your microcontroller will handle; typically 20 ma. R3 quickly discharges the Gate capacitor when you have turned the MOSFET off. The values of these resistors depends upon the type of MOSFET that you are using. If you Google for MOSFET driver circuits, you can quickly hone in on some rules of thumb for sizing your resistors. For the casual designer, there are some pretty wide specification windows that will work just fine. Notice one more thing about Figure 1. This brake works best on a DC motor that turns in only one direction. You will waste a lot of energy if you run this motor in reverse. This circuit works fine (in a simplistic way) for a motor that runs a hybrid car or a brushless DC motor; both of these run their motor drivers in only one direction. (Yes, a brushless motor will run backwards, but that is because the field order is reversed, not the current running in any winding.) Braking a motor that runs in both directions is even more complex. What I’m trying to say is that unless you are doing your EE Masters Thesis on dynamic braking, I don’t recommend trying to do dynamic braking on your robot. To make it worth the effort, you’d need good motors, a robot that has some real weight behind it, and a fast charging battery pack. Now to answer your second question: Why does your DC motor get so hot when running locked anti-phase speed control? The answer to this question is simple. No matter what speed you are running, the locked anti-phase motor has the same current running through it. With sign-magnitude with slow speed, you have little current; with high speed, you have more current running through it. Locked anti-phase has both phases (forward and reverse) running to it at all times. The resistance of wire means that current causes losses in the wire due to the resistance of the wire. Those power losses manifest as heat. If your motor is not very efficient and takes a lot of current to run fast, then it will heat up quickly when running locked anti-phase. Locked anti-phase is great for running efficient DC motors in applications where you want

Figure 1. Dynamic brake. very fast reactions to speed changes and/or you want tight control of the motor speed. Sign-amplitude is the PWM of choice when you are using low efficiency motors in an application where you don’t need fast response to speed changes, and you are perhaps using a PID to control your speed.

Q

. I have really enjoyed your column! It really is practical and tackles many problems robot builders face. I have used the PID algorithm successfully many times for speed control of brushed DC motors at relatively high speeds, but for lower speeds (1.5 radians per second and less) and rapid motor reversals, I have had a terribly hard time trying to get the motor to quickly and smoothly reach the desired speed. It’s most likely due to non-linearities such as the motor’s static friction, etc. Do you know how I can fix this? — Matt

A

. I have two suggestions, Matt. The first suggestion is to increase the resolution of your PID algorithm. If you are using eight bit numbers, go to 16. Or, if you are using 16 bit numbers already, then check to see the range of your sensor inputs. If your resolution is too crude, then you will see jerky response to PID calculations at slower speeds. If you aren’t using your “I” component, try using it; I’ve seen PID algorithms smooth out with a light touch of the Integral term. My second recommendation is to use some form of trapezoidal ramping function in your PID loop. Rather than immediately giving your PID loop the new velocity, break your velocity change into increments to slow your PID response. I’ve found that this works exceedingly well when you switch from one direction to another. In my columns for November 2008 and again in April 2009, I showed a PID algorithm that implements a smooth ramping function for a PID algorithm. The November issue has code that you can download from the SERVO Magazine website, as well. I feel that the most likely fix will be my first one. Especially if you experiment more with the Integral term. Remember to NOT make that term too strong; a light touch will smooth out most problems with slow speed transitions, including those that have to deal with static friction. I’ve used PID to “servo” low quality motors at pretty slow speeds and found that it does work pretty well. SERVO 10.2009

15

Figure 2. LEGO wheel on a Robo Builder servo. Reader Tip Here’s a reader hint and a nice tutorial on how to use LEGO wheels with the Robo Builder series of robots that Trossen Robotics sells. Joe Strout says “LEGO makes the best wheels and tires in the world (IHO) and he put up a nice web page explaining how to do it, which you can find here: www.strout.net/info/robotics/tutorials/Robo Builder-wheel.html. Figure 2 shows the end result of his efforts. Thanks for sharing, Joe! SV

Complete Fabrication Center tio istra Reg ss 100 e AS 9 In Proc

Quality prototype parts within 24 hours!!

n

Precision Laser, Waterjet, Plasma, Machining, Micro-Machining, Forming, and Welding Capabilities Parts from practically any material and from 0.001” to 6.000” in thickness. Finishes such as powder coat, paint, plating, anodizing, silk screen, and more!

* Quick * Affordable * Precise * No Minimums 24 hour turn time based on quantity and finish requirements

16

SERVO 10.2009

Fabricated, silkscreened and shipped in 2 business days with no expedite charges! Integrated Ideas & Technologies, Inc. 6164 W. Seltice Way • Post Falls, ID • 83854 • USA Ph (208) 262-7200 • Fax (208) 262-7177 • www.iitmetalfab.com

STEER WINNING ROBOTS WITHOUT SERVOS!

ROBOTIC EDUCATION EXPO How Will Robotics Affect Your Future? :`Zma^kbg`h_m^Z\a^kl%lmn]^gml%iZk^gmlZg]\hffngbmrf^f[^klmh ^qiehk^k^lhnk\^l_hkZeemabg`lkh[hmb\bgma^@k^Zm^kLZg=b^`hZk^Z'

October 10th, 2009 9:00 a.m. – 1:00 p.m. Cuyamaca College 900 Rancho San Diego Parkway, El Cajon, CA 92019 in the Student Center

Free Admission!! Event update at: http://www.sdsa.org/robotics Exhibitors on site will include: • Representatives from Botball, First Robotics Competitions, iARoC, and Autonomous Underwater Vehicle Competition. • SeaBotix • Wintriss Technical School • Robo X Chess Team • And more Special Presentations: Team X Robotics in Chess Throw down with human chess club. Mini robotic challenge demonstrations throughout the day. Steve Goodgame, CEO of KIPR (Botball), will be onsite to discuss Botball! Exhibitors will demonstrate and inform participants about their programs and how schools and individuals can become involved. New exhibitors are always welcome! Please contact SDSA Robotics Program Manager Dave Massey at: [email protected] www.sdsa.org

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.2009

17

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

Music Hall, SM Mall of Asia, Philippines The competion includes two main events: Agribots in the City and Sumobot Robotics. www.pinoyrobotgames.org

24-25 Chibotica iHobby Expo, Rosemont, IL Lots of events including line following, maze solving, mini-Sumo, Robo-One, talent show, and combat. www.chibots.org

— R. Steven Rainwater

26-28 Competencia Robotica (LARC) Center for Robotics UTFSM, Valparaiso, Chile Rescue Robots must save simulated survivors in a disaster area. http://robotica.elo.utfsm.cl/ competencia

O c tober 3-4

The Franklin Cup Franklin Institute Science Museum, Philadelphia, PA RC vehicles destroy each other in Philadelphia. www.nerc.us

9-11

9-11

10

MindSpark College of Engineering, Pune, India Events include Micromouse, Dogfight, and the ominous sounding Search and Destroy. www.mind-spark.org Robothon Seattle Center, Seattle, WA Lots of events including RoboMagellan, Micromouse, line following, line maze solving, and more. www.robothon.org CalGames Woodside High School, San Jose, CA This competition is based on the FIRST rules. www.wrrf.org

28

N ov e m b e r 4-5

Junior Robotics Challenge Singapore This year’s contest combined line following and can collection into a single event. www.woodlandsringsec.moe.edu.sg

6-8

Korea Intelligent Robot Contest POSTECH, Pohang City, Korea Events are planned for intelligent voice and object recognition robots, as well as for cleaning robots. http://irc.piro.re.kr

7

Bloomington VEX Tournament Ivy Tech Community College, Bloomington, IN Events in this tournament include Top-It-Off-2, Pythagorean-2, VEX Tractor Pull, and CAD Design Contest.

23-25 Critter Crunch Hyatt Regency Tech Center, Denver, CO Robot destruction by The Denver Area Scientists. www.milehighcon.org/critrule.htm

23-24 Philippines National Robotics Competition

18

SERVO 10.2009

Robotics Club (HBRC) Challenge — Phase III CMU Silicon Valley Campus, Silicon Valley, CA Three events including the TABLEBot Challenge, a RoboMagellan contest, and an Open Exhibition. www.hbrobotics.org

http://robotics. bloomington.google pages.com

7-8

9

Robotics Innovations Competition and Conference Worcester Polytechnic Institute, Worcester, MA Robots must perform a task that improves quality of life for a human. Team must present a written report. Cash prizes up to $5,000. http://ricc.wpi.edu TERPA Robot Competition Woburn, MA This is a last minute addition and we were unable to get details by press time, so check the website for updates. www.tepra2009.wpi.edu

20-21 Real World Robot Challenge Tsukuba Expo Center, Tsukuba, Japan Autonomous robots must navigate a real-world environment. www.robomedia.org/ challenge09

21-22 Canadian National Robot Games Ontario Science Centre, Toronto, Ontario, Canada Events include mini Sumo (novice, advanced, master), Full-size Sumo (autonomous and RC), fire fighting, line following, walker race, and Search and Rescue. www.robotgames.com

28-29 Roaming Robots Grand Final Wigan, UK RC vehicles destroy each other amid pyrotechnics and strobe lights. www.roamingrobots. co.uk

C Stamp is ... M

ic r oc on tro l

le rs !

L M OW AN UF CO AC ST TU PC RI B NG !

Sensors and Boards Communications! for Development!

sp i D

s! y la

Come see what else at

www.c-stamp.com

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

New Products

N E W P RO D U C T S CONTROLLERS & PROCESSORS

M

ikronauts now has available three new processors.

Morpheus This powerful dual Parallax P8X32 based single board computer features: • Eight 20 MIPS RISC cores (16 cores/320 MIPS total) with each processor. • I2C 32 KB boot EEPROM (256 Kb). • I2C real time clock with capacitor backup. • SPI 32 KB RAM for #1 Propeller. • SPI 1 MB-8 MB Flash for #1 Propeller. • PS/2 keyboard jack. • PS/2 mouse jack. • VGA connector, 256 color bitmap graphics for Propeller #2. • 1/8” line level stereo audio jack. • 512 KB parallel SRAM for #2 Propeller (4 Mbit). • 24 bit address bus/eight bit data bus stacking expansion connector. • One available eight bit ProtoBoard/SpinStudio compatible expansion headers. • Memory expansion to 15.5 MB, 512K memory mapped I/O space. • 20 MBytes/sec burst read or write memory bandwidth. • Graphics up to 1024x768 pixels, four colors from 256. • 256x192 256 color graphics mode, more modes later. • Four bit bus connecting Propellers #1 and #2. • DC power input using two wire screw terminal. • Mini power switch. • Parallax PropPlug compatible. • Line of expansion boards.

total of 2 MB per Mem+ board. • 20 MBytes/sec burst read or write memory bandwidth. • Jumper selectable for one of four address ranges allowing four Mem+ boards per system for 7.5 MB. • MAX3232 based serial port for programming Morpheus and/or user serial port. • MCP23S17 I/O expander provides 16 digital I/O lines. • SD card interface provides mass storage for Morpheus. • Stacks right on top of Morpheus. Prices is $24.95 bare PCB; $89.95 full kit; or $129.95 assembled and tested.

SchoolBoard This is solderless prototyping board that stacks on Morpheus. It offers: • Stacking header for EXP1 which gives direct access to Propeller #1’s P0-P7 I/O pins. • Stacking header for MORPHBUS which gives direct access to Propeller #2’s bus: A0-A27, D0-D7,/RD,/WR, +3.3V, +5V, GND. • Solderless breadboard mounted on MORPHEUS form factor supports PCB with pads for the headers. • Includes stacking connectors; extra five pin stacking connector provided so PropPlug connector access is preserved. Prices is $29.95 full kit or $39.95 assembled and tested. For further information on these three items, please go to:

Mikronauts

MOTOR CONTROLLERS

Prices is $29.95 USD bare PCB; $119.95 USD full kit; or $179.95 assembled and tested.

Mem+ Mem+ is a 2 MB Memory and I/O expansion board for Morpheus. Features include: • Holds four 512 KB (4 Mbit) DIP memory chips for a

20

SERVO 10.2009

Tel: 604•339•6793 Email: [email protected] Website: http://Mikronauts.com

Jrk USB Motor Controller

P

ololu announces the release of the jrk line of USB motor controllers: highly configurable, versatile devices that make it easy to

add open- or closed-loop control of brushed DC motors to your computer- or microcontroller-based project. The jrk supports four interface modes: USB for PC-based control; logic-level (TTL) serial for use with embedded systems; analog voltage for simple potentiometers and joysticks; and RC pulse for radio control systems. It can perform open-loop speed control, closed-loop position control with analog voltage feedback to make your own servos, and closed-loop speed control with frequency feedback from a tachometer. The jrk 21v3 (the smaller of the two units currently available) has an operating range of 5V-28V and can deliver 3A continuous output (5A peak). The jrk 12v12 (the more powerful of the two) has an operating range of 6V-16V and can deliver a continuous output of 12A (30A peak). Both devices can handle transients of up to 40V. A free configuration program (Windows XP and Vista compatible) is available for calibrating your system. Real-time plots of variables such as control input, feedback, motor output, and current draw make it easy to fine-tune settings such as PID constants, acceleration, and current limit for your application. The unit price is $49.95 for the jrk 21v3 (item #1392) and $99.95 for the jrk 12v12 (item #1393). For further information, please contact:

Pololu Corporation

6000 S. Eastern Ave. Suite 12-D Las Vegas, NV 89119 877•7•POLOLU or 702•262•6648 Fax: 702•262•6894 Email: [email protected] Website: www.pololu.com

ROBOT GAMES Minesweeper Competition Simulates Use of Real-World Robots

T

his competition Environment for classrooms, clubs and summer camps is now available from BotBrain. It works with LEGO, BotBrain, and other mobile robots. The rules are simple: Score is the number of “mines” you disarm by setting them off. Find the “mines” with sensors and double your points. Your bot keeps going until it gets stuck, takes too much damage, or time runs out. The environment has been tested in hundreds of competitions from elementary through high school. No tools are required and many different layouts are possible. The unit disassembles easily for storage. “Mines” are modified mousetraps that cannot pinch fingers. It is made from hardwood plywood and the contents

include slip-together sides and floor, “mines,” mineholder cups, rules and instructions. The retail price is $249. (Robot not included.) BotBrain also sells environments for maze running, fire fighting, and planetary exploration competitions. For further information, please contact:

BotBrain Educational Robots

Website: www.botbrain.com

SENSORS Triaxial Accelerometer Sensor

T

he CS425000 is an accelerometer sensor module with a digital output now available from A-WIT Technologies. It can sense gravitational (g) force of ±4g on all three axes (X, Y, and Z). Application of industrial CMOS processes with a patented micro-electromechanical system (MEMS) ensures the highest reliability and excellent long-term stability. A twowire serial interface and internal voltage regulation allows fast and easy system integration with a C Stamp. The sensor is compatible with the C Stamp microcomputer’s supplies and signal levels. The device includes a MEMS accelerometer that is seamlessly coupled to a 13-bit analog-to-digital converter with a serial interface on the same module. This module gives a resolution of 976 uG on each axis. Communicating with the sensor is made easy with A-WIT’s supplied software command ACCSIN. This simple one command interface is all that is required to set up and acquire (from the sensor) an acceleration vector in gs for each of the X, Y, and Z dimensions. The sensors are priced at $26.25. All items are new, fully tested, and factory direct. All software is included at no extra charge. Specifications include: measures ±4 g on any axis; high precision acceleration sensor with a resolution of 976 µgs; power requirements are 5 VDC; dimensions are 0.8 x 0.9 in (20.3 x 22.9 mm); operating temperature is 40 to +185 °F (-40 to +85 °C); fully calibrated, digital output; no external components required; Fast response time; ultra low power consumption; small size; and automatic power down. Applications include any type of tilt, motion, and vibration sensing. For further information, please contact:

A-WIT Technologies

656 Ironwood Drive Williamstown, NJ 08094 800•985•AWIT or 800•985•2948 Fax: 800•985•2948 Email: [email protected] Website: www.c-stamp.com

SERVO 10.2009

21

bots

IN BRIEF A BATTERY OF BALANCE Meet Switchblade from the UCSD (University of California San Diego) Coordinated Robotics Lab. Switchblade uses the same basic principle of movable mass to climb and balance as UCSD’s other robot iLean, except Switchblade alters its center of gravity by locating its battery packs out on a rotating boom. iLean maneuvers stairs by climbing up its own body, then shifting its center of mass from the bottom of one stair to the top of another. (This is one of those things that’s futile to explain, so just go watch the video at www.botjunkie .com/index.php?s=iLean+robot). It’s an exceptionally cool idea to take advantage of batteries in this way. Many robots use battery packs located close to the ground to passively stabilize themselves, but it’s a brilliant idea to use the heaviest

and bulkiest parts of a robot to actually enable motion. Next up for Switchblade is the addition of extendable segments to the boom arms, as well as some manipulators to let it do stuff. Switchblade is a nimble treaded rover that can pop wheelies and overcome obstacles nearly as high as it is long. The key to its agility is the fact that it can “throw its weight around”, by actuating a heavy boom (containing the vehicle’s batteries) in order to reposition its center of mass favorably — which it can do quite quickly.The current prototype was built in partnership with National Instruments, and is built around the NI sbRIO 9602 with the control design performed in LabView. Check http://renaissance.ucsd.edu/CoordinatedRoboticsLab/Switchblade.html for further info.

EYEBOT CAN SEE YOU One of the major disadvantages of flying robots is that they’re generally useless when they’re not in the air. Plus, the amount of time they can spend in the air is severely limited by their capacity for fuel. Plus, more fuel means more weight, means bigger engines, means more fuel, and so on. EPFL has developed a robot called Eyebot that — while based on the familiar quad-rotor helicopter design — includes an innovative extra feature: the ability to stick to ceilings with a magnet. This gives Eyebot the capability to loiter indefinitely in advantageous positions while providing surveillance with a pan-and-tilt camera system. It can autonomously attach and detach itself from ceilings; it uses simple optical flow analysis to detect drift; and has infrared sensors to avoid obstacles. Apparently, the designers envision the Eyebot stationing itself on a ceiling with a bunch of its friends and firing LASERS at people: Okay, not really. But the Eyebot will include a laser pointer with which it can locate and illuminate predefined targets, either helping you find your suitcase or, doing other things. Go to http://lis.epfl.ch/?content=research/projects /Eyebot/ for more details.

22

SERVO 10.2009

bots

IN BRIEF ‘PLANE’ AND SIMPLE UAV Apparently, there’s a big potential market for small, simple, and cheap man-portable UAVs that individual soldiers can rely on for on-demand reconnaissance.The Point and Toss UAV is a little robotic plane which — while certainly small (at a pound and a half with a three foot wingspan) and cheap — may very well be able to claim unambiguous victory in this category. The operation of the Point and Toss is literally that simple:You point it in the direction you want it to go, click a hand controller to lock the heading and start the engine, and then toss.The UAV automatically stabilizes itself, flies out for about half a mile at 250 feet taking pictures and video to an SD card, and then autonomously turns around and lands at your feet. The UAV doesn’t have a loiter capability, so if you’re in an evolving environment, you’re going to have to keep chucking the thing out to keep up-to-date on what’s going on.You’re also restricted to one direction at a time. Guess the point is that the Point and Toss is easy enough for anyone to operate with practically no training, cheap enough for everyone to have access to one, and small enough to make that not unrealistic. You can find out stuff at www.pointandtoss.com.

GIVE US A HAND What makes the robotic hand (from the Neurobotics Lab at the University of Washington) special is that it’s designed to be an exact replica of a human hand. The shape of the bones, the attachment points of the tendons, even the musculotendon passive viscoelasticity (whatever that means) are functionally identical.The hand is a testbed for investigating the potential for complex neural control. If your brain sends a signal to a robot hand, the hand better be able to interpret the signal and move the way you’re expecting it to. More at http://neurobotics.cs.washington.edu/projects. html#project8.

Cool tidbits and interesting info herein mainly provided by Evan Ackerman at www.botjunkie.com, but also www.robotsnob.com

SERVO 10.2009

23

UAV FIRE BRIGADE Instead of designing one single generalized fire-fighting robot, QinetiQ has developed an entire specialized robot team to tackle especially dangerous fires involving acetylene gas cylinders.There are three different ROVs, each with a specific task: a modified Talon equipped with thermal imaging cameras that does reconnaissance; a larger bot with wheels called Black Max that carries a high pressure water hose; and the Brokk 90, which is a robotic mini-digger that can shove debris and obstacles out of the way to get at the cylinders themselves. Following a successful series of trials, QinetiQ is now working alongside key government partners to deliver a robot-based service that is being used to help fight fires and support other major incidents – particularly if acetylene gas cylinders are involved which can become highly unstable – thereby protecting fire fighters.This initiative is funded jointly by Network Rail (the Highways Agency and Transport for London) in collaboration with the London Fire Brigade. If acetylene gas cylinders are thought to be involved in a fire, the London Fire Brigade and others can request QinetiQ to attend and deploy a range of (ROVs) with all-terrain capabilities.Their onboard cameras can identify whether any acetylene cylinders are present and — using thermal imaging — can gauge whether the cylinders are sufficiently cool for fire fighters to safely approach and remove them.The ROVs can also be used to gain access to premises and vehicles, target cooling onto cylinders, move debris and other items, or assess other potential risks. Visit www.qinetiq.com if you need more details.

GAME BOT Here’s a clever little game that allows you to build your own robot online (www.2dplay.com/build-a-robot/build-a-robot-play.htm). Using your mouse, you can customize until you are happy with your creation and then can share it on Newgrounds.com.

WALK THIS WAY REMOTELY INTERESTING Owners of WowWee robots including Robosapien, Tribot, Roboreptile, FemiSapien, and others might want to think about adopting WowWee’s RoboRemote Robot Universal Remote Controller.The included software helps you to program and store sequences of actions with customizable function buttons. Not only does it work with the IR controlled bots you have now, the remote will work with all future generations of same.The RoboRemote works up to 6.5 ft away; runs on three AAA batteries (not included); supports Windows XP/Vista; and can get automatic updates for new products via USB. Buy yours now at www.amazon.com.

24

SERVO 10.2009

Researchers at Carnegie Mellon University have developed some pretty novel approaches to humanoid robot navigation and path planning using a Honda Asimo and HRP-2 Promet as their test subjects.The robots are able to perceive obstacles in their environment and walk around them to reach a goal destination.They can even predict the velocity of moving obstacles and time their footsteps using computer vision algorithms in order to get through the area unharmed. Turning AIST’s robotics laboratory in Japan into a makeshift motion-capture studio allowed researchers to augment reality by matching realworld objects such as tables and chairs with 3D models.This allowed the HRP-2 Promet humanoid to see obstacles in its environment both in simulation and the real world. Check out the incredible videos at www.plasticpals.com/?p=11657.

HERE COMES THE SUNFLOWER Himawari, is a creation of Akira Nakayasu of Kyushu University.With 48 white LEDs placed in its head and a camera to capture movement — instead of seeking out the sun — the robotic flower follows a hand with the assistance of 80 actuators that move other parts of the flower, as well. Nakayasu says it seeks that hand the way a real flower seeks sunshine. Kind of like a glorified iFlower. “Himawari” means sunflower in Japanese. Sunflowers exhibit heliotropism which is the tendency to move their heads so they face the sun during sunrise. That movement of the flower stem and the blossoming towards the sun seems to communicate a message. Himawari as a robotic plant is influenced by the sunflower’s motion pattern, but reacts to human movements.The stalk is driven by servo motors; the inside flower is made of LEDs; and the flower tentacles and petals use shape-memory alloy actuators to wriggle quietly. Himawari moves slowly to react to human presence, to face them and communicate. Visit http://ander.jp/ for more enlightening facts.

ROBOT PEZantries Who doesn't love giant robots? Who doesn't love PEZ? Put them both together and you get the Giant PEZ Robot B-9.The 12" tall robot from "Lost in Space" comes with 12 packages of candy and will be your best friend when you need a quick sugar high. Rush to www.amazon.com to get your fix.

BATTER UP! To demonstrate the latest advances in high-speed industrial robot technology, researchers at the University of Tokyo have pitted a baseball-pitching robotic arm against a mechanical batter with a near-perfect swing.The robot pitcher consists of a high-speed, three-fingered hand (developed by professor Masatoshi Ishikawa and his team from the Graduate School of Information Science and Technology) mounted on a mechanical arm (developed at the Massachusetts Institute of Technology).With superb control of nimble fingers that can open and close at a rate of up to 10 times per second, the robot can release the ball with perfect timing. Precise coordination between the fingers, hand, and arm allow the robot pitcher to hit the strike zone 90% of the time.The robot batter is an upgraded version of a machine that Ishikawa’s team developed in 2003. In a demonstration which was designed to showcase the speed at which multiple high-speed industrial robots can respond to external circumstances and perform activities together, researchers placed the robot pitcher 3.5 meters (11 ft) away from the mechanical batter.The pitcher’s 40 kph (25 mph) sidearm throws posed little challenge to the batter, whose 1000-frame-per-second camera eyes allow it to see the ball in super slow motion as it approaches.The robot batter has a near-perfect batting average when swinging at pitches in the strike zone. To make future contests more interesting, the researchers plan to increase the robot pitcher’s throwing speed to 150 kph (93 mph) and teach it to throw breaking balls and changeups. In addition, they plan to train the robot batter to repeatedly hit balls to the same target. Go to www.pinktentacle.com/2009/07/video-robot-baseball/ to see the video. Game on.

SERVO 10.2009

25

Featured This Month: Features 26 BUILD REPORT: Shaka

by Thomas Kenney

BUILD REP

29 MANUFACTURING:

Shaka

RioBotz Combot Tutorial Summarized — Materials: Part 2 Summarized by Kevin M. Berry

33 PARTS IS PARTS: Coloring Titanium Summarized by Kevin M. Berry

34 Thoughts of a New EO by Seth Carr

Events 32 Jul/Aug 2009 Results and Oct/Nov 2009 Upcoming Events

33 EVENT REPORT: Gulf Coast Robotics Sports 2 by Seth Carr

ROBOT PROFILE – Top Ranked Robot This Month: 36 Professor Chaos by Kevin Berry

● by Thomas Kenney

I

n late 2007, I began the design and construction of my first combat robot over three pounds: a 30 pound featherweight. The construction process took place over a period of two months. Looking back at what is left of the bot, it looks very primitive compared to most modern featherweights. That robot — Shaka — finished its first competition with a mediocre record of 1-2, with its only win being a complete fluke in which the opponent’s main power switch broke down. With all the lessons I had learned in the construction process and the competition, I resolved to rebuild Shaka to improve in every area and be competitive among featherweights today. The main weakness of the first version of the bot was its massively undersized drive motors; those used were the 36

PHOTO 1.The original version of Shaka that fought at RoboGames 2008.

26

SERVO 10.2009

RT

mm 25:1 Banebots models. I had originally intended to use the larger 42 mm gear motors, but that model went out of production two days before orders for the bot’s parts were placed. These were the causes of both of Shaka’s losses, with the motors going up in smoke in both fights. In addition, the support structure for the spinning disc weapon was far too weak for its application. It was made of two pieces of 1/8” wall 2”x4” 6061 aluminum and bent in horribly on the robot’s only real hit. The weapon itself was a

6.75” diameter vertical disc weighing around four pounds, spun by an Axi 5330/18 brushless motor through a 1.5:1 reduction. Although not too underpowered, the disc was completely solid all the way through, with no extra weight towards the outside. With the 1.5:1 gear reduction, the Axi was using very little of its potential torque. The frame of the robot was a mix of .5” UHMW and 1/8” 4130 steel. Although it held up in the few fights that this robot had with its small weapon, I have found through other bots that UHMW is far too flexible for the chassis of robots with spinner weapons. There was no problem with the 1/8” 4130, but since it wasn’t hardened it wasn’t nearly as strong as it could be. I began by redesigning the robot in SolidWorks CAD (www. solidworks.com). With this, I was able to estimate the weight off all the assembled components. However, I neglected to add the screws and wiring to the weight estimate which was an issue later on. The first decision I made on this new design was the drive motors to be used. I wanted something proven and reliable. After losing two matches because of the Banebots gear motors, I was willing to sacrifice weight, space, and cash for a better option. After doing some research and asking for the opinions of others, I settled with the 18V Dewalt drill motors with the accompanying gearboxes, mounts, shafts, and pillow blocks from Team Delta (www.teamdelta.com). Although somewhat overkill for a featherweight with an active weapon, these motors have been used in countless successful bots from 30 to 340 pounds (with around five motors per side). There were some drawbacks though, mainly in that the entire setup weighed nearly three pounds per side, and with the pillow blocks from Team Delta, the width of the robot was pushed out to 18”.

Next, I began designing Shaka’s new weapon system. Like the first version, I went with a vertical disc weapon. The previous disc weighed in at 3.75 pounds and had a 5.5” OD without the two teeth which protruded 5/8” each. It had no internal cutouts and with its small diameter yielded a very low moment of inertia. I redesigned the disc to improve in all of these areas and take advantage of the Axi’s ridiculous torque by gearing the weapon 1:1. The redesigned disc had an outer diameter of 11” with the teeth and had some internal cutouts to save weight while increasing MOI. After designing the first disc, I drew up a second that was counterbalanced to have a single tooth instead of the traditional two. With only one tooth, this disc was designed to dig in more on impacts and in the end get twice the bite as a two toothed disc at the same RPM. Both of the discs weigh just under seven pounds. The discs were attached to the 3/4” steel shaft through a piece of 3/16” keystock, and the shaft itself was supported by two flange mount pillow blocks from Team Delta which were directly attached to designated frame pieces. The Axi 5330/18 brushless motor from the first Shaka was used again, as were the Powertwist V-Belts which allowed accurate tensioning without having to experiment through purchasing three or four different sizes of one piece belts. The Axi does get warm when spinning the new discs at 1:1, but it has no problem getting them up to 6,500 RPM within a few seconds when running at 24V. This time around, for the frame I used almost exclusively 6061 aluminum. Although much stiffer than the UHMW that had been used in the first version, its strength in that aspect dims in comparison to other alloys such as 2024 and 7075 aluminum. The only

PHOTO 2. Preliminary SolidWorks CAD of Shaka’s revision.

advantage 6061 holds over those two is the price tag — which I was looking at more than the strength of the material at the time of the purchase. Since the build, I’ve discovered Yarde Metal’s drop zone, and if I ever need to replace any of the frame I’ll be using 7075 from there instead of 6061. Most of the structural frame is made up of .5” thick 6061. The base plate was a piece of .125” thick 6061 and was cut by water jet at Big Blue Saw during one of their sales. I was able to save an hour or so of work by having the mounting holes cut for the Dewalt drill gear motors and the pillow blocks during the water jetting process. The side armor was once again .125” thick 4130 steel. This time though, it was hardened to RC 43 instead of being left in the annealed state. It was also mounted at a 70 degree angle in an attempt to deflect spinner hits more effectively. The rear area of the chassis surrounding the drive motors was still .5” UHMW for the purpose of weight savings. The lack of rigidity wasn’t an issue in this part of the frame. The robot’s top armor was .09” polycarbonate. This would be PHOTO 3. Shaka’s two new discs (center and right) shown for size comparison next to one of the old ones.

SERVO 10.2009

27

PHOTO 5. The robot’s frame begins to take shape.

PHOTO 4. Shaka’s aluminum weapon rails after being water jet cut by Team Whyachi.

inadequate if any non-sportsman featherweights with overhead weapons competed, but that’s not an issue since the class is currently made up of mostly spinners and wedges. Everything was secured together with 10-32 screws for the metal pieces, and 10-24 and 1/4”-20 for the UHMW. The first version of Shaka used unhardened 4130 steel welded to a pair of Home Depot hinges in an attempt to counter wedges. The hinges were ripped in half on the first spinner hit and the steel itself bent horribly. This time, we welded a pair of single piece anti-wedge skids out of some 4130. Although far more durable and effective, they were rather heavy at around seven ounces each. When fighting horizontal spinners and other bots that the skids would be useless against, we switched out the steel PHOTO 6. One of Shaka’s front aluminum frame pieces during the weight reduction process.

28

SERVO 10.2009

skids for a UHMW pair and some ablative .5” thick UHMW front armor that had been fabricated out of the old Shaka’s chassis. I had originally intended to power the entire robot off of 24V of 3,300 mAh NiMH batteries. As the skids were added to the design, I began to see that it wouldn’t be able to make weight with those batteries. I also wasn’t sure if the capacity would be sufficient, taking into account the massive amp draw of the Dewalts and the large Axi brushless. After looking at several other options, I settled for a 5 Ah 20/30C 6s (22.2V) LiPoly from United Hobbies (www.unitedhobbies. com). Though the quality isn’t as great as some equivalent brand name batteries (such as ThunderPower and Polyquest), the difference in price was huge ($400). The only problem I had with it was that the 20C continuous discharge rate didn’t seem to be enough. The battery has since been replaced with an equivalent 30C continuous model. After the robot was completed, we threw it on the scale for a quick PHOTO 7. The nearly finished robot, still during the weight reduction process.

weight check and discovered that it was a staggering 2.5 pounds overweight. The first place I looked for extra weight was in all of the aluminum pieces. I began by cutting down the Dewalt pillow blocks to nearly half their original weight, and then milled down the corners of the weapon-bearing blocks and pocketed the front aluminum 1/8” deep. I also slotted out the large inner aluminum frame rail. After doing all this, the bot still weighed 30.5 lbs, but the last eight ounces were eventually removed by shortening every wire and taking an angle grinder to the inside of the steel side armor. After one and a half all nighters and two 24 packs of Dr. Pepper, the robot was finished four hours before our plane was scheduled to take off. In the end, Shaka went 2-1 at RoboGames, not including a forfeit to our other featherweight, Pinball. In truth though, it only had one real fight — a one hit victory over the gas powered horizontal spinner, Chainzilla. Its other win and only loss were both from the Brazilian full body spinner, UFO. Before the first of these fights (Shaka’s loss), I was messing around with one of the Dewalt gearboxes and I forgot to actually screw it back into the mount. Shaka was able to move for the first second of the match, and PHOTO 8. A completed Shaka gets ready to fight UFO for a second time at RoboGames 2009.

no more. The other driver was gracious enough not to get in a free hit. I made sure to properly attach both gearboxes to their mounts before the second match. In UFO’s previous match, their shell had been dented inward to the point that it was irreparable and completely prevented the weapon spin-up. The team opted to replace their shell with a large steel bar angled at the tips. Shaka was able to drive fine

this time, but due to the huge twisting force, UFO flipped over upon spin-up. There are several things I plan to improve on in Shaka when I get the chance. First, I’m going to decrease the width of the robot at least 1.5” by removing the Dewalt pillow blocks and supporting the shaft by pressing bushings into the UHMW side. I also plan to remove the weapon bearing blocks and

replace them with a pair of bushings pressed into the weapon support rails. I’ve already replaced the battery with one that has a more adequate discharge rate. Overall, I’m happy with the little combat performance that this robot has had, and will be taking it along with the rest of the MH robotics fleet to the upcoming Franklin Institute event to find any other bugs that need to be worked out. SV

MANUFACTURING: RioBotz COMB T TUTORIAL SUMMARIZED: Materials – Part 2 ● Original Text by Professor Marco Antonio Meggiolaro; Summarized by Kevin M. Berry

P

rofessor Marco Antonio Meggiolaro, of the Pontifical Catholic University of Rio de Janeiro, Brazil, recently translated his popular book, the RioBotz Combot Tutorial, into English. Last month, SERVO summarized the first part of Chapter 3 — “Materials” — focusing on commonly used metals in combat bot building. This month, we switch focus to non-metals. Marco’s book is available free for download at www.riobotz.com. br/en/tutorial.html, and for hard copy purchases (at no profit to Marco), at www.lulu.com/content/7150541. All information here is provided courtesy of Professor Meggiolaro and RioBotz. Let’s get started! The main nonmetals that need to be mentioned in

combat robot design are:

Polycarbonate This popular plastic — commonly known as Lexan (trademarked by SABIC Innovative Plastics, Inc.) — is a polymeric thermoplastic (which softens and melts when heated, instead of burning) that is transparent to light waves and radio-control signals. It has high impact toughness, and it is very light, with a density of 1.2. When used in combat robot armor, it absorbs a lot of energy as it is

deformed during an impact. In spite of that, fewer and fewer combat robots have been using this material, because of its disadvantages: it has very low Young modulus (E = 2.2 GPa — about 1% of the stiffness of steels — making the robot structure very flexible even for high thicknesses), it cracks easily (the cracks usually appear starting from the holes, and they propagate without absorbing much of the impact energy), and it is cut easily (becoming vulnerable to sawbots). Wood makes for showy displays, but unfortunately loses matches.

Antweight Babe shows the toughness of Kevlar/Nomex honeycomb against spinners.

SERVO 10.2009

29

is bent, allowing it to slide with relatively low friction in case it makes contact. The high toughness of UHMW makes it a good choice even for structural parts, such as the motor mounts of the CF layered with foam makes a tough, light structural panel. Dragonplate substitutes balsa wood for the foam. hobbyweight Fiasco, To avoid cracking, chamfer all shown in the photo. PETG holes to remove sharp corners and edges, and provide the polycarbonThis is a modified type of PET Nylon, Delrin (acetal) ate with support along with some (polyethylene terephthalate) with an damping, for instance using a thin impact toughness in between the These are thermoplastic polymers layer of rubber or neoprene. Avoid values for acrylic and polycarbonate. with high strength, low density, and tapping polycarb, but if you must It is a cheap substitute for polycarb, relatively high toughness. They are do it then guarantee that the hole is but with worse properties. We’ve good for internal spacers in the robots tapped very deeply with several tried it in combat and decided that and even as motor mounts (similar threads or else they might break. it would be better used to make a to UHMW). Nylon is a generic term, Never use threadlockers such as nice transparent trophy shelf. while Delrin is a registered trademark Loctite 242 in Lexan, because of DuPont. (besides not locking) it causes a Teflon chemical reaction that makes it Rubber, Neoprene, brittle. Acetone should also be Teflon is a well-known Hook-and-Loop avoided. Polycarbonate is almost household material (trademarked Fastener (Velcro) universally the material used to by DuPont). Its acronym soup name construct combat arenas. is PTFE (polytetrafluoroethylene). These are excellent materials to Having very low friction, it can dampen the robot’s critical internal be used as a sliding bearing for components, such as receivers, elecAcrylic moderate loads or as a skid under tronics, and batteries. High-strength This is a good material to the robot to slide in the arena. Its mushroom-head hook-and-loop is build fish tanks, but do not use it main problem is its high cost. also excellent to hold light compoin combat because it has the same nents. This is, of course, a high density as Lexan but with 20 to 35 strength version of the ubiquitous UHMW times less impact toughness. (Note: “Velcro,” another common houseMarco implies, but does not clearly UHMW (Ultra High Molecular hold material (Velcro is a registered state, that it shatters spectacularly, Weight) plastic is a high density trademark of Velcro Industries). leaving razor sharp splinters polyethylene that also has very low Mushroom-head is a “male-male” everywhere. Please do not email friction. Known as the “poor man’s system, instead of the traditional SERVO asking how I gained this Teflon,” it doesn’t slide as well as “male-female” system with Velcro. knowledge!) Teflon but it is cheap and it has higher strength. Shell spinners, such Epoxy as Megabyte, use internal spacers As bot armor, acrylic makes a great trophy shelf! made out of Excellent adhesive; good to glue UHMW fiberglass, Kevlar, and carbon fiber between the onto metals. Clean the metal part shell and the with alcohol or acetone before inner robot applying it to maximize holding structure, strength. Always use professional guaranteeing epoxy which cures in 24 hours — that the shell not the hobby grade. won’t hit the internal metal Phenolic Laminate parts of the robot even if it This is an industrial laminate —

30

SERVO 10.2009

very hard and dense — made by applying heat and pressure in cellulose layers impregnated with phenolic synthetic resins, agglomerating them as a solid and compact mass. Also known as Celeron (trademarked by GRT Genesis), it is an excellent electric insulator. We mount all the electronics of our robots on such laminates, which are then shock-mounted to the robot structure using vibration-damping mounts or mushroom-head hook-and-loop resulting in electrical insulation, as well. The regular phenolic laminates are relatively brittle, but a high strength version called garolite (available at www.mcmaster.com) has already been used even in the structure of antweights and beetleweights. Garolite — a generic term for a family of phenolics — is transparent to radio signals and very impact resistant. However, avoid tapping it since its threads are prone to stripping.

Wood Wood has low impact toughness if compared to metals. It should not be used in the structure, unless your robot is very skillfully driven, such as the wooden lightweight The Brown Note, which got the silver medal at RoboGames 2008 after losing to the vertical spinner K2. A few builders have mounted wooden bumpers in front of their robot when facing spinners, to work as ablative armor. While a shell spinner chews up the wooden bumper of its opponent little by little, it loses kinetic energy and slows down, becoming vulnerable.

plates of military tanks. The ceramic breaks up the projectiles, while their fragments are stopped by an inner steel layer. Ceramics are also extremely resistant to abrasion. The famous lifter BioHazard used 4” square 0.06” thick alumina tiles (Al2O33, which forms sapphires when in pure form) glued under its bottom to protect it against circular saws that emerged from the BattleBots arena floor.

Fiberglass Formally known as GFRP (glass fiber reinforced polymer), it is made out of very thin glass fibers held together by a polymeric adhesive (known as the polymer matrix) such as an epoxy resin. It is used heavily in boats. It has potential use in the robot structures since it is rigid and light, however, its impact toughness is low, compared with most metals.

Kevlar Kevlar, another DuPont trademarked material, is also known as KFRP (Kevlar fiber reinforced polymer). It is sometimes seen as a yellow fabric made out of aramid fibers — a type of nylon, five times more resistant than steel fibers of the same weight. Used in bulletproof vests, it has extraordinary impact toughness. Touro uses a Kevlar layer covered with professional epoxy (the polymer matrix) sandwiched between the aerospace aluminum UHMW is an ideal structural material.

walls of the structure and the external Ti-6Al-4V plates of the armor to increase its impact toughness. The fabric is very difficult to cut; it is recommended to use special shears, available at www.mc master.com. Kevlar fabric is not expensive. We’ve paid less than US$12 in Touro – more specifically, we’ve used the aramid fabric KK475, which costs about US$60/m2 (less than US$6/ft2) in Brazil.

Carbon Fiber Sometimes called CF or CFRP (carbon fiber reinforced polymer), it is available in several colors. CF is very expensive but extremely rigid and light, and because of that it has been used in racing cars and aircraft for years. It is excellent to mount the robot’s internal parts to because Self inflicted damage is the worst kind!

Ceramics Ceramics are very brittle under traction, but under compression they are the most resistant materials in the world, so much so that they are used underneath the armor

SERVO 10.2009

31

of its high stiffness. It is a myth that carbon fiber has high impact toughness, though. It surely has a high strength under static loads, but it does not take severe impacts. The undercutter Utterly Offensive is a good example of that; its carbon fiber baseplate (see photo) self-destructed when it was scraped by its own spinning blade. The plate was later switched to titanium. Carbon fiber is not a good armor material, unless it is combined with Kevlar to achieve high impact toughness.

Other Polymer Matrix Composites There are several other composites that use a polymer matrix (such as epoxy or polyester) besides plain GFRP, KFRP, and CFRP. For instance, you can tailor lay-ups of aramid and carbon fibers cured (bonded) together with a polymer matrix to achieve optimum impact toughness (due to Kevlar) and stiffness (due to carbon). It is possible to generate complex unibody structures by combining several parts into a single

cured assembly, reducing or even eliminating the need for fasteners and saving weight and assembly time. One technique is to use adhesive bonding where composites or metals are bonded to other composites, honeycomb cores foam cores, or metallic pieces. An example is where a rigid unit is made with a polymethacrylimide foam core, sandwiched by CFRP sheets (see photo). Besides increasing the panel bending stiffness, the foam core also works as a shock mount, increasing the impact strength. It also becomes a good option for the robot structure and even the armor. An even the higher stiffness-toweight ratio can be obtained if the core is made out of balsa wood, as shown in the photo of DragonPlate. However, its impact toughness is relatively low. We use a Kevlar/Nomex honeycomb material, purchased from www.acmeindustrialsurplus.com, in all of our insect class bots, and have several sheets up to 1” thick we plan to use in bigger bots. It has proven extraordinarily effective against spinners. Babe (see photo)

spent a whole event giving spinner rides with minimal damage). Professor Marco notes that, while these composites are tough, a metallic overlay such as the titanium side panels on Babe significantly increase long-term damage resistance.

Metal Matrix and Ceramic Matrix Composites Instead of having their fibers embedded and held together in a polymer matrix, these composites use either a metal or a ceramic matrix. The fibers (or even tiles in a few cases) can also be made out of metal or ceramic, which tends to increase the ultimate strength and stiffness of the matrix material. However, most ceramic matrix composites have low impact strength, which limits their use in combat — not to mention their very high cost. On the other hand, when part of a multi-layer composite armor plate such as the Chobham armor, ceramic tiles embedded in a metal matrix can be very effective to shatter kinetic energy weapons. SV

EVENTS Completed and Upcoming Events Completed Events for July 16 to Aug 15, 2009

October 4th and 5th. For more information, go to www.nerc.us.

P

A Bot Blast 2009 was held July 18th in Bloomsburg, PA. Twenty-seven robots were registered.

Upcoming Events for Oct-Nov 2009

F

ranklin Institute 2009 will be presented by North East Robotics Club in Philadelphia, PA

32

SERVO 10.2009

in Rosemont, IL October 23rd through 25th. For more information, go to www.theCRCA.org.

R

M

echa-Mayhem 2009 will be presented by the Chicago Robotic Combat Association

obothon Robot Combat 2009 will be presented by Western Allied Robotics in Seattle, WA October 11th. For more information, go to www.western alliedrobotics.com. SV

EVENT REPORT: Gulf Coast Rob tics Sports 2 ● by Seth Carr

J

uly 11th was the second Gulf the 150 gram Flea weight class, Coast Robot Sports event at the there were only three entries, so Robot MarketPlace in Bradenton, FL. the fights were in the round robin Fifteen robots showed up for a format. At the end of all three chance at one of the prizes, totaling robots fighting, everyone was even, over $150. It was a fun event, with so a double elimination round robin an even mix of old (chronologically) tournament was held. builders and new ones. Notable The event took place inside the entry Sting was one such newbie to Hobby MarketPlace, which is the SECR-FL events. Sting swept through physical store front to the Robot the three-pound Pirhana is a long time participant Beetleweight in Florida insect events. class, going undefeated to first place. In the one-pound Ant weight class, overnight-built Sporkinok surprised everyone — even its builder — by coming in second place, with both losses to first place winner DDT. In

MarketPlace. Fighting happened in the enclosed and permanently set-up arena which used to be used at SozBot events. The event drew a good amount of spectators, most of whom heard of the event through word of mouth and flyers that were posted in the store. The next event is slated for mid October. SV The Robot MarketPlace arena made the move from the west coast to Florida.

PARTS IS PARTS: Col ring Titanium From the RioBotz Combot Tutorial ● Original Text by Professor Marco Antonio Meggiolaro; Summarized by Kevin M. Berry

A

curiosity about titanium is that its surface can be colored without paints or pigments; just using Coke (or Pepsi) in a technique called electrolysis or anodizing. To color it, you need a piece of stainless steel (SS) with an equal or

larger area than the one of the titanium to be colored, a SS screw, a titanium screw, Coke, and a DC power source (of at least 30V). The setup is shown in Figure 1. Polish the titanium surface well and clean it with alcohol or acetone — do not

leave any fingerprints. Place the titanium part (which will be the anode) and the SS one (the cathode) submerged in Coke (the electrolyte, which can also be replaced with Trisodium Phosphate [Na3PO4]) very close together but

SERVO 10.2009

33

without making contact. Make sure the titanium screw is in contact with the titanium part to be colored but not with the SS plate (we used a rubber grommet to guarantee this, as shown in the Figure 2), and the SS screw only touches the SS piece. Connect the positive of the DC power source to the titanium screw and the negative to the SS one without letting the wire contacts touch the electrolyte. Apply a DC voltage between 15V and 75V for a few seconds and it is finished — the titanium part is colored! A range of colors can be done. The titanium color obtained by the electrolysis process depends on the applied voltage. The higher the voltage, the thicker the titanium oxide layer wil be that is formed on the plate (anode), changing its color. This color change happens

accumulates on the contacts. The best option would be to use Trisodium Phosphate (also known as TSP), diluted at about 100 grams for each liter of distilled water (about 13 oz/gallon). Besides being transparent (which allows you to see the colors as you increase the voltage), TSP is a detergent that helps to keep the titanium surface clean during the electrolysis, resulting in a more uniform color. In Figure 3, you can see Titan’s side walls, the top two plates before the process, and the bottom one after being colored using TSP and 30V. Note the masking that we’ve used on the top plate (written TiTAN) is made out of waterproof adhesive contact paper. The mask protects the region during electrolysis, afterwards leaving letters with the original color of the titanium (as it can be seen in RioBotz written on the bottom plate). SV

FIGURE 1

because the oxide layer causes diffraction of the light waves. The colors are gold (applying 15V), bronze (20V), purple (25V), bluepurple (30V), light blue (35V), white bluish (40V to 45V), white greenish (50V), light green (55V), yellowgreenish (60V to 65V), greenishgold (70V), and copper (75V). There are other colors up to 125V, but they are opaque, (not very brilliant). Coke works well, but it is not the best electrolyte. We’ve discovered that Diet Coke is a little better because it doesn’t have sugar which FIGURE 2

FIGURE 3

TH

UGHTS OF A NEW EO ● by Seth Carr

S

o, you’ve been building robots for a while and now you want to put on an event. Sounds easy enough, in theory. Theory — however — is not as easy as it seems. Organizing an event (or “EOing” as it’s called) of any size is

34

SERVO 10.2009

stressful. You have to find a venue; then you need an arena; then you have to get said arena to said venue; then you have to set up said arena; then you have to make the brackets; then schedule fights; make sure the crow is entertained;

make sure the competitors are accommodated; and... Well, you get the point. As the size of the event goes up, so do the stressors and other extenuating factors. For the sake of simplicity (and this article), we’ll be

dealing with an event for the insect weight classes: 150 grams, one pound, and three pounds. A few months ago, I too was in the new EO shoes. I had a general idea of what to do, but a better road map — and more sleep — would have helped. I’ll start off with the basics.

The Venue, or where this shindig is gonna happen. First rule of thumb for small events: Never pay for a venue! Unless you have money to burn, you will not make a return on the cost. “So, where am I going to hold the event?” you may be asking. EOs that have come before you have used locations varying from hobby shops, to SciFi conventions, to their own garage and/or yard. I used networking and people I know to piggy back on other events. For me, it was easy to get an event at MetroCon in Tampa because I knew the owner personally. Jim Smentowski — of Nightmare and Backlash fame — owns a hobby shop where he holds his events. Western Allied Robotics in the northwest United States held an event in a mall. It’s all in how you pitch it to the owners.

The Arena, or what keeps the bots from injuring bystanders. For insects, generally a six or seven foot square arena is the standard. The polycarbonate walls need to be at least 1/4”, with another bumper that rises at least four or five inches off the floor. The floor should be sturdy enough to support the arena, with either a metal or cheaper replaceable material on it. A nice coat of traction paint helps the robots move.

Brackets, or who fights who? There are various spreadsheets and full programs out there for

making and Combine a new EO, an convention, and managing brackets. Anime a round robin beetle I used the Builder’s bracket, and you get … The Thinker? (Hula Database program hoop shown for size comparison only.) which worked great for double elimination, but failed to make a round robin bracket. Try to find someone with a knack for complex things to help with this part. Short of that, flail your arms in the air and hope it sorts itself out than too little. Make sure you get (like I mostly did). everyone’s phone numbers, too. That way, when someone is late you can call them and yell at them. Schedule, or who One final thing is entrance fees. fights who, when? In the ideal world, people could just This is where it gets a bit more show up and compete for free. This hairy, especially if you’re limited is true in a few cases, but for the for time or have a crowd to keep most part, there is some money that entertained. Just stay a few fights needs to be made back. Take into ahead to give the competitors account any fees you may have, plenty of notice so they can have such as registration sites, arena their bots ready. You will run into rental, etc. You have to find a way snags, so just have a Plan B. (Mine to balance not too expensive and was the round robin beetle weight not getting enough money to cover bracket.) Find what works for you — costs. A portion of the fees can also that’s the best advice I can give. go towards prizes. You may be able to find a company willing to donate or give you prizes at a reduced cost Final Thoughts if you look hard enough. SV Those are the big things that you have to deal with yourself. Getting people to help goes a long way. It’s amazingly helpful to arrive the day before the event to get ready. Decide how long you think it will take to set up, add an hour, and you may have enough time. Have a separate person to handle competitor check-ins. Also, make sure there’s plenty of power. Be sure to give your competitors all the information you can up front, i.e., is there a charge to get into the venue; what’s the earliest they can show up; what’s the LATEST they can show up; stuff like that. Too EO — 19th much information is better Century version.

SERVO 10.2009

35

ROBOT PR

FILE

TOP RANKED ROBOT THIS MONTH ● by Kevin Berry

Professor Chaos: Currently Ranked #1 Top Ranked Combat Bots Historical Data

Ranking

Weight Class

Bot

150 grams

"VD"

26/7

1 pound

"Dark Pounder"

44/5

Win/Loss Weight Class

Bot

Win/Loss

150 grams

"The Joke"

4/0

1 pound

"Black Death"

15/1

1 kg

"Roadbug"

30/10

1 kg

"Roadbug"

6/0

3 pounds

"3pd"

48/21

3 pounds

"Gutter Monkey"

9/1

6 pounds

"G.I.R."

19/2

6 pounds

"G.I.R."

5/0

12 pounds

"Solaris"

42/12

12 pounds

"Surgical Strike"

17/4

15 pounds

"Humdinger 2"

29/2

15 pounds

"Humdinger 2"

18/0

30 pounds

"Helios"

31/6

30 pounds

"Pyromancer"

10/0

30 (sport)

"Upheaval"

19/7

30 (sport)

"Upheaval"

14/3

60 pounds

"Wedge of Doom"

43/5

60 pounds

"The Big B"

11/4

120 pounds

"Devil's Plunger"

53/15

120 pounds

"Professor Chaos"

10/0

220 pounds

"BioHazard"

35/5

220 pounds

"Original Sin"

15/3

340 pounds

"SHOVELHEAD"

39/15

340 pounds

"Ziggy"

7/2

390 pounds

"MidEvil"

28/9

Class: 120 lb Middleweight Team: WPI Combat Robotics Builder(s): Brian Benson, Vadim Chernyak Location: Worcester, MA BotRank Data Total Fights Lifetime History 10 Current Record 10 Events 2

Wins 10 10

Losses 0 0

Data as of August 15, 2009

P

rofessor Chaos has competed in: RoboGames 2008 and RoboGames 2009. Details are: ● Configuration: Four wheel drive, single tooth vertical disk spinner.

● Weapon batteries: Same as drive. ● Weapon motor: S28-400 Magmotor.

● Frame: Machined aluminum interconnecting frame.

● Weapon controller: Team Whyachi Contactor.

● Drive motors: S28-150 Magmotors.

● Armor: 3/16" AR400 steel rubber, shock mounted titanium.

● Wheels: Colson.

● Radio system: DX6 Spread Spectrum.

● Hubs: Custom. ● Drive ESC: Sidewinder.

36

● Drive batteries: 4x 26.4V A123 packs.

SERVO 10.2009

● Future plans: Keep improving the design and have fun!

● Design philosophy: Build a durable robot incapable of breaking itself, with a balance between the weapon, drive, frame, and armor. ● Builder’s bragging opportunity: Built in two weeks, assembled to completion for the first time at its premier event, two time RoboGames champion and thus far undefeated! SV Information and photos are courtesy of Brian Benson. All fight statistics are courtesy of BotRank (www.botrank.com) as of August 15, 2009. Event attendance data is courtesy of BotRank and The Builder’s Database (www.buildersdb.com) as of August 15, 2009.

C C Mechatronics S By Fred Eady

I practice what I preach. When I’m not pounding out words and hardware designs for SERVO, you can find me hard at work writing code and punching together real world mechatronic devices. This month, we’ll take a look at the soft side of mechatronic construction and write some basic machine control component code using the CCS C compiler.

The Art of Mechatronics

Mechatronic Interfacing 101

The word mechatronics describes the melding of mechanical and electronic disciplines to arrive at a suitable solution to a given problem or task. Mechatronics can also be defined as the methodology used to replace mechanical devices with like-function electrical devices. For instance, a mechatronic equivalent of a purely mechanical relay is a solid-state relay, and simple mechanical SPST switches can be mimicked by low-on-resistance MOSFETs or simple transistors. As a SERVO reader, you likely already have your Mechatronics Degree in Robotic Arts. Once again, in this month’s discussion I’m going to orbit on the outer limits of what most people recognize as a robot. The electronic intelligence and mechanical hardware we’ll be talking about can indeed be assembled in such a way as to help create a classic robotic device. However, our machine control hardware and firmware examples won’t end up as a walking, talking, or thinking piece of iron. Instead, our C code seed routines will be crafted to enable them to grow into functions that spin motor shafts, drive solenoid coils, and read position sensors.

The use of the CCS C compiler as the firmware generator tells us immediately that we will be working with PIC microcontrollers. PICs are hearty microcontrollers that come standard with I/O pins that can source or sink up to 25 mA per pin. Although the 25 mA per pin figure sounds adequate for most any drive requirement, the PIC mechatronic circuit designer is usually limited to a maximum aggregate PIC I/O current source/sink limit of around 200 mA. Assuming a five volt power source and a 470Ω current limiting resistor, that’s equivalent to driving about 20 LEDs directly from a single PIC microcontroller’s I/O pins. Obviously, not every load we will be required to drive with a PIC I/O pin will fall within the 25 mA current consumption window. In addition, we are sure to encounter devices that need to be driven with voltages that exceed the PIC’s I/O pin maximum voltage value. For instance, most off-the-shelf devices intended for CNC applications use 24 volt logic. If we are to be able to employ the unique services of a device with 24 volt logic, we must be able to translate the device’s 24 volt logic level to the PIC’s 3.3 volt or 5.0 volt logic level.

SERVO 10.2009

37

RTN

RUN

RTN

STOP

RUN

+5V

STOP

FIGURE 2B

FIGURE 2A

4

TO PIC RUN I/O PIN

3

STOP - NC

1

FOD817A

2

470

+5V RUN - NO

I’ll bet that in most cases a typical 24 volt CNC control device’s logic is really based on the logic driven by a 5.0 volt microcontroller. Photo 1 provides some proof to back up my wager. What you see in Photo 1 is a roach’s-eye view of the 24 volt interface area of a commercial CNC DC motor controller. We don’t have the luxury of a schematic diagram for the unit. So, we must resort to one of the most powerful tools at our disposal — observation. Photo 1 is speaking very loudly to us. Note the motion commands that are associated with each of the motor controller’s screw terminals. Although you can’t see the extra commands in Photo 1, this particular motor controller can also run and jog a DC motor in reverse. Thus, this motor controller can RUN REV, JOG REV, RUN FWD, JOG FWD, and STOP. The six-pin parts to the right of the screw terminal block are 4N37 phototransistor optocouplers. There is one 4N37 for every motor controller movement command. Traveling down the screw terminal block, we see positions for RTN (Return), +24V, and COM (Common). Interestingly enough, the RTN and COM terminals are electrically connected via a jumper. The +24V terminal tells Figure 1. No rocket science here. This is a typical 4N37 optocoupler circuit. Provide the LED with a ground path and the optocoupler output goes logically low. Personally, I prefer to use four-pin optocouplers that don’t provide access to the base of the transistor. RUN REV-RUN FWD-JOG REV-JOG FWD-STOP

RTN

38

SERVO 10.2009

+24

4.7K 1

4N37

6 5

2

4

4

TO PIC STOP I/O PIN

3

FOD817A

1

Photo 1. This is a low level aerial shot of the optocoupler area of the DC motor controller printed circuit board. I had to get up on my donkey while analyzing the components that are supporting the 4N37 optocouplers.

2

470

Figure 2. The mechanical switches can be human-accessible pushbuttons or switches actuated by the mechanical hardware. Figure 2B is the mechatronic equivalent of Figure 2A. Now that we’ve determined that the command terminals are simply ground return points for their respective 4N37 LEDs, all we have to do is provide that ground path to initiate the associated command.

us a couple of things. This DC motor controller is indeed a 24 volt system which supports the presence of the 4N37 optocouplers, which are probably being used as logic converters. To further convince us of its +24 volt roots, according to the motor controller’s user manual, the +24V screw terminal signal is a very low current supply (12 mA) that can be used to drive external sensors which most likely will communicate with the command screw terminals. I can’t immediately think of any microcontroller that uses 24 volt logic. So, that means that somewhere inside of the motor controller lies a +5 volt or +3.3 volt power source. We don’t have to look far in Photo 1 as a 5.0 volt 7805 linear voltage regulator is mounted to the right of the column of 4N37s. I put a magnified eye to the 4N37 supporting circuitry and came up with what I think is going on between the screw terminals and the optocouplers. Sorting out the printed circuit board traces and comparing what I thought I +5 saw within the 4N37 datasheet, I came up with the circuit you see in Figure 1. If you get up on your donkey with 10K me, I think we can prove out some LOGIC OUTPUT assumptions we have made by studying the screw terminal block command legends. Let’s begin by deriving the 240K value of the 4N37’s LED current limiting resistor with the assumption that the LED in Figure 1 is being fed from a +24 volt source. Here’s the math:

+5V

4.7K

10K

4

TO PIC INPUT PIN

3

24V RTN

+24V

1

Substituting five volts for 24 volts in the LED current math will result in a sub-milliampere current figure. So, we can now say with confidence that a +24 volt power source is feeding the 4N37’s LED. That also leads us to believe that the 4N37 is acting as a +24-to-TTL logic converter. AHA! The motor controller user manual points out that to execute a motion command, that command’s associated screw terminal connection must be forced to make a low-resistance electrical connection with RTN. Since RTN and COM are tied together via a jumper within the motor controller, we can sit tall on our donkey and proclaim that the ground in Figure 1 represents RTN and that pin 2 of each 4N37 is connected to its associated command screw terminal. So, to RUN FWD, we would short the RUN FWD screw terminal (pin 2 of the associated 4N37) to RTN. In response, the motor controller will drive the motor in a forward direction until a STOP command is issued. The user manual says that STOP is the only command that can be initiated by a normally open or normally closed circuit to RTN. The RUN COMMAND setup you see in Figure 2 depicts a mechanical RUN/STOP configuration in which the RUN switch is normally open and the STOP switch is normally closed. In this scenario, opening the normally closed STOP switch circuit to RTN will initiate a STOP command. There is no reason to doubt the validity of Figure 1. It’s rather obvious that all we have to do to initiate a motion command is provide the associated 4N37 LED a ground path to RTN. According to what is presented in Figure 2A, we can issue mechanical motion commands to the motor controller using pushbuttons or mechanical switches that are under the control of the mechanical hardware. Dropping +24 through an LED and current limiting resistor is nothing to a typical mechanical switch. Providing a ground path for the same +24 volt LED circuit through a PIC I/O pin will result in the release of the PIC’s magic smoke. The mechatronic equivalent of the mechanical switches in Figure 2A comes in a four-pin package. The Fairchild FOD817A phototransistor optocouplers you see replacing the mechanical switches in Figure 2B can hold their own when it comes to interfacing +24 volt logic to the I/O pins of the PIC. The FOD817A’s phototransistor is guaranteed to switch 70 volts with a continuous collector current of 50 mA. That provides plenty of headroom when driving the +24 volt 5.0 mA loads required by the motor controller’s 4N37 LEDs. To apply Figure 2B’s electronic switches to Figure 2A’s RUN COMMAND mechanical logic, all we have to do is drive

Figure 3. In addition to performing logic conversion, the FOD817A provides full electrical isolation of the 24 volt logic from the PIC’s I/O subsystem. The FOD817A also has enough thump to drive a 50 mA load.

2

RLIMIT = (SOURCE VOLTAGE – LED FORWARD VOLTAGE) / LED CURRENT 4700 = (24-1.18)/ LED CURRENT SOLVING FOR LED CURRENT -> (24-1.18) / 4700 = 0.004855319 AMPERES OR 4.855319 mA

the STOP command’s optocoupler which will mimic a normally closed mechanical switch. According to the DC motor controller user manual, to initiate a RUN command we simply apply a 50 mS low-going logical pulse to the RUN optocoupler. Temporarily removing the logical drive to the STOP optocoupler will force the motor shaft to stop rotating. Remember, I/O is short for Input/Output no matter what the logic levels dictate. We’ve just used FOD817A optocouplers to control a 24 volt logic device with a five volt PIC I/O pin. Odds are if the 24 volt device wants to communicate a status, it will use 24 volt logic. We can use the same FOD817A optocoupler to convert the CNC device’s 24 volt logic to logic levels the PIC can absorb and understand without inflicting damage on the PIC’s I/O subsystem. The FOD817A circuit you see in Figure 3 is a morph of Figure 1. Connecting pin 2 of the FOD817A to the 24 volt return (ground) completes the 4.7KΩ LED doorbell circuit and forces the transistor to conduct and present a logical low to the PIC’s I/O pin. Otherwise, the LED is off and the transistor is likewise off creating a logical high condition at the transistor’s collector.

To Source or Sink ... That Is the Question If we consider Figure 1 to be a typical CNC device input circuit, it’s obvious that we can either source the

Figure 4. This particular sensor provides an output that depends on the strength of a magnetic field. The LEDs signal when the PNP transistor is biased on or off. The LEDs are used to properly place the sensor relative to the source magnetic field.

SERVO 10.2009

39

If we have a horse and want a zebra, we simply paint on the stripes. CCS C gives us the ability to key on a high or low logic level by simply coding in what we wish to see.

Coding In a Sensor Set Using CCS C

Figure 5. No rocket science here, either. You’ve probably used an NPN transistor circuit just like this to drive an LED or a small signal relay from a PIC I/O pin.

optocoupler’s LED by switching its 24 volt power source or provide a sink for the LED current via a ground path. Figure 4 is a schematic depiction of a CNC sensor that is designed to source a voltage when it comes into proximity of a magnetic field. Applying +24 volts to the sensor’s DC(+) pin and providing a proper magnetic field for the sensor’s input would drive the sensor’s OUT pin to +24 volts (or whatever voltage is applied to the DC(+) pin) minus a small voltage drop across the PNP transistor, which is typically 0.8 volts. To drive our optocoupler LED with this sensor, we would connect the optocoupler LED’s cathode to the sensor’s DC(-) pin — which is grounded — and the optocoupler LED’s current limiting resistor to the sensor’s OUT pin. The same magnetic sensor type with a current sink output is shown in Figure 5. In the sink sensor scenario, the magnetic switch circuitry drives the base of an NPN transistor. Like the source sensor, +24 volts is applied to the sensor’s DC(+) pin. However, instead of sourcing the optocoupler LED, the sinking sensor’s OUT pin provides a ground path for the optocoupler LED when the NPN transistor is driven to an ON state. Thus, to drive our optocoupler input with this sinking sensor, we would connect the optocoupler LED’s current limiting resistor to the sensor’s DC(+) pin and the optocoupler LED’s cathode to the sensor’s OUT pin. The DC(-) pin is grounded. Logically, there’s no advantage to a sinking versus a sourcing sensor. A sourcing sensor will post a logical high for a true input. So, we code our PIC to look for a logical high to be true. The opposite applies for a sinking sensor where a logically low output represents a true input. Likewise, we simply code the PIC for a logically low true. Thanks to the mechanisms built into the C language, we don’t have to worry about the polarity of our sensor logic. Here’s the cure for a negative logic headache: #define sourcing_sensor_ON

1

#define sinking_sensor_ON

0

40

SERVO 10.2009

//sourcing //sensor ON //sinking //sensor ON

Now that we have our magnetic sensor driving an FOD817A optocoupler, let’s construct a function to read the sensor status. The target microcontroller is a PIC18LF4620 and our optocoupler outputs are electrically connected to its I/O pins RA0 and RA1. We’ll use sinking sensors which are monitoring the extreme positions of a linear actuator. The sensor feeding pin RA0 is positioned to sense the minimum stroke position and pin RA1 is set to receive the maximum stroke position status. To make our code easy to read and maintain, we’ll assign some logical names to the microcontroller pins and the sensor logic states: #define #define #define #define

SENSOR_MIN SENSOR_MAX ON OFF

PIN_A0 PIN_A1 0 //NPN sinking sensor 1 //NPN sinking sensor

Using the aforementioned sensor aliases, using CCS C to programmatically read the sensors’ status is done in this way: If(input(SENSOR_MIN) == ON && input(SENSOR_MAX) == OFF) { //LINEAR ACTUATOR AT MINIMUM STROKE CODE //GOES HERE }

If you feel that you can handle the negative logic of the sinking sensor without the aliases, you can eliminate the ON and OFF definitions and write your sensor test code in this manner: If(!input(SENSOR_MIN) && input(SENSOR_MAX)) { //LINEAR ACTUATOR AT MINIMUM STROKE CODE //GOES HERE }

To avoid us having to remember that the sensors are working in negative logic land, let’s go up one more alias level with a rewrite of the SENSOR_MIN and SENSOR_MAX defines. This time around, we’ll predefine a logically ON condition for the SENSOR_MIN and SENSOR_MAX inputs: #define SENSOR_MIN #define SENSOR_MAX

!input(PIN_A0) !input(PIN_A1)

//ON = 0 //ON = 0

Now our sensor state code takes on this look: If(SENSOR_MIN && !SENSOR_MAX) { //LINEAR ACTUATOR AT MINIMUM STROKE CODE //GOES HERE }

The “!” character represents a logical NOT. So, if you were to recite the conditional if statement out loud, you would say “If SENSOR_MIN AND NOT SENSOR_MAX, THEN THE ACTUATOR IS AT MINIMUM STROKE.” Now that we have a positive method of determining the actuator position in the code, we obviously want to install a function that lets us know if the linear actuator is at its minimum or maximum stroke. It might be a good idea to check for a stuck condition or fault condition, as well. With that, follow the bouncing ball. Here’s a new set of sensor #define statements: #define #define #define #define #define #define #define

SENSOR_MIN SENSOR_MAX FAULT MAX MIN STUCK DRIVE_MIN

#define DRIVE_MAX

!input(PIN_A0) !input(PIN_A1) 0 1 2 3 PIN_C4 //simulates //SENSOR_MIN output PIN_C5 //simulates //SENSOR_MAX output

Notice we’ve added a STUCK condition for an actuator position that is not at either of the movement extremes. It is possible for both sensors to read as OFF in a jammed actuator situation. However, when both sensors simultaneously read as ON that would most likely indicate a sensor failure. So, a FAULT condition is also part of our new set of #define statements. The DRIVE_MAX and DRIVE_MIN #define statements indentify PIC18LF4620 debugging pins that we’ll use to simulate the outputs of the magnetic sensors. Using the PORTC pins as sensor emulators provides a truth table that matches the conditions you’ve already seen in our sensor definitions: 0 = SENSOR ON

When called, the actuator_position function will return a byte that represents the disposition of the actuator as determined by reading the actuator position sensors. Each time the actuator_position function is called, it will initially set the actuator position to STUCK and attempt to determine the actuator’s real position by reading the sensors.

Validating the Concepts If you’re a Nuts & Volts reader, you may recognize the hardware platform shown in Photo 2. To put some credibility behind our code, a 2x8 LCD was hand-wired into the PIC18LF4620-based, USB-powered project board. The CCS C compiler includes a native LCD driver and to make the LCD insertion as painless as possible, I adhered to the LCD-to-PIC18LF4620 pinout dictated by the CCS LCD driver defaults. My LCD and printed circuit board (PCB) handiwork are exposed in the electronic primitives that make up Schematic 1. As for firmware, this is all it takes to add CCS C built-in LCD support to our application: #define LCD_ENABLE_PIN #define LCD_RS_PIN #define LCD_RW_PIN #define LCD_TYPE #include

PIN_E0 PIN_E2 PIN_E1 2 //2 line display

Be sure to keep your LCD definitions and includes in the order listed. The lcd.c module makes configuration decisions based on the LCD control pin defines. The actuator_position function can be called from within the C main function in an endless do-while loop as shown in this code snippet: do{ switch (actuator_position())

PIN_C5 0 0 1 1

PIN_C4 0 1 0 1

CONDITION FAULT ACTUATOR AT MAXIMUM STROKE ACTUATOR AT MINIMUM STROKE ACTUATOR JAMMED

At this point, we’ve got enough optocoupler logic to construct that function we’ve been forming up: int8 actuator_position(void) { int8 position; position = STUCK; if(SENSOR_MIN && !SENSOR_MAX) { position = MIN; } else if(!SENSOR_MIN && SENSOR_MAX) { position = MAX; } else if(SENSOR_MIN && SENSOR_MAX) { position = FAULT; } return position; }

Photo 2. The PIC18LF4620-based hardware you see here is USB-powered and was featured in the March 2009 Nuts & Volts Design Cycle column. This board is an excellent platform for our CNC code as we can also use the USB portal to communicate with a PC application.

SERVO 10.2009

41

{

case 1://MAX SENSOR ON output_bit(DRIVE_MAX,0); output_bit(DRIVE_MIN,1); ++rev_cntr; break; case 2://MIN SENSOR ON output_bit(DRIVE_MAX,1); output_bit(DRIVE_MIN,0); ++rev_cntr; break; case 3://BOTH SENSORS OFF output_bit(DRIVE_MAX,1); output_bit(DRIVE_MIN,1); rev_cntr = 0; break;

case MIN: lcd_putc(“\nACTU=MIN”); break; case MAX: lcd_putc(“\nACTU=MAX”); break; case STUCK: lcd_putc(“\n STUCK “); break; case FAULT: lcd_putc(“\n FAULT “); break; } delay_ms(2000);

}

}while(1);

The emulator code is running in Photo 2 and was caught by the camera as it executed the rev_cntr = 1 switch case. An ON condition is forced at the SENSOR_MAX pin and the resultant emulated actuator position/status is displayed by the LCD.

I’ve added a two second delay to allow us to read the LCD message as the linear actuator emulator routine cycles through the magnetic sensor truth table. I placed this emulation code at the top of the do-while loop:

Optocouplers Rule

switch(rev_cntr) { case 0://BOTH SENSORS ON output_bit(DRIVE_MAX,0); output_bit(DRIVE_MIN,0); ++rev_cntr; break;

The FOD817A can act as a PIC I/O pin buffer, a logic converter, and a low-current device driver while providing complete electrical isolation between its input and output +5VDC

6 5 4

NO T ES: 1. USB C O NNEC T O R-MO USER 806-KUSBX-SMT BS1NB30 2. C 1 - DIGIKEY 511-1471-1-ND 3. C 4 - MO USER 80-C 0805C 105M4R 4. A LL LEDS 1206 SMT P A C KA GE 5. A LL RESIST O RS 0805 SMT P A C KA GE 6. A LL C A P A C IT O RS 0805 SMT P A C KA GE 7. A LL X C O MP O NENT S EXT ERNA L T O P C B U1 2 1 28 27 24 23

10 13 14 15 16 17 18 19 20 21 22 9

6 5 4

3 2 1

R4 10K

3 2 1

ICSP CONNECTOR

NC NC NC NC NC NC NC NC NC NC NC

VDD

18

TXD RXD

C1 4.7uF

17 16 15 14 11 10 9 8

C2 0.1uF

26 25

1 44 43 42 37 36 35 32

VBUS SUSPEND SUSPEND VREGIN

RST

VBUS DD+ GND

11 12 7 8 5 4 3

1 2 3 4

C3 0.1uF

C4 1.0uF

R1 470

24 23 22 21 20 19

SUSPEND

VBUS

U2 MCLR/Vpp RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 RC7/RXD RC6/TXD RC5 RC4 RC3 RC2 RC1 RC0 RA5 RA4 RA3 RA2 RA1 RA0

VDD VDD

7 28

C8 20pF D1 1

2 3

Y1 20MHz

30

31

C6 0.1uF

LCD1X RD7/PSP7 RD6/PSP6 RD5/PSP5 RD4/PSP4 RD3/PSP3 RD2/PSP2 RD1/PSP1 RD0/PSP0 RE0/RD RE1/WR RE2/CS

5 4 3 2 41 40 39 38 25 26 27

D7 D6 D5 D4 D3 D2 D1 D0 E RW CS

+5VDC

14 13 12 11 10 9 8 7 6 5 4 3 2 1 C7 0.1uF

R5X 10K

OSC1/CLKIN

D7 D6 D5 D4 D3 D2 D1 D0 E R/W CS VO VCC GND +5VDC

R6X 33

OSC2/CLKOUT

C9 20pF

4 Vss Vss SP0503BAHTG

C5 0.1uF

NHD-0208AZ-FL-Y BW

USB CONN

CP2102

1 2 3

PIC

R3 1K

6 +

JP1

C7 0.1uF

R2 100

VDD

RI DCD DTR DSR RTS CTS

VDD

29 6

LCD BACKLIGHT LED

PIC18LF4620-I/PT

Schematic 1. I designed this circuit in the Nuts & Volts Design Cycle universe with reuse in mind. You can put this utilitarian design to work in a number of your projects. It just happens to be perfect for our CNC device driver project.

42

SERVO 10.2009

circuits. That makes the optocoupler a powerful player in the CNC and mechatronics worlds. I’ve posted the FOD817A optocoupler application CCS C source code we discussed on the SERVO download site at www.servomagazine.com. Next time, we’ll build on the optocoupler knowledge we’ve gained. So, be ready to mount some components, melt some solder and write some additional CNC seed code with CCS C. SV

Sources CCS C Compiler Custom Computer Services, Inc. www.ccsinfo.com FOD817A Fairchild Semiconductor www.fairchildsemi.com PIC18LF4620 Microchip Technologies www.microchip.com

Fred Eady may be reached via email at: [email protected].

SERVO 10.2009

43

Creepy Hybrid Part 2

By Alan Marconett

Last time, we discussed the mechanical aspects of Strider, the “Creepy Hybrid” — a low-cost platform for exploring the operation and construction of a legged robot. We’ve also got it mostly assembled. This time, we’ll discuss how to program the microcontroller and the servo controller board.

For Starters For our learning experience, we will compile our own “stripped down” and modified version of the Lynxmotion (LM) AH3-R Basic program that will run on the BB2 board with an Atom Basic module installed. The Atom module sends serial commands to the SSC32 servo driver board. For our own fully commented Creepy Hybrid control program, check the SERVO website for downloads (www.servomagazine.com).

Creepy Code Our BASIC program will only use the joysticks of the wireless PS2 controller and few — if any — of the buttons as it is just intended to get us started. We made an effort to minimize the code length in order to simplify the program. Feel free to expand it! The basic (no pun intended) tasks of our program can be summarized:

44

SERVO 10.2009

•Read PS2 joystick (or a COM port). •Interpret the joystick data into a “motion vector” (which way we want to go). •Calculate IK (Inverse Kinematics) for the leg moves. •Move the legs. Using some “canned” peripheral functions available in Basic Micro’s Atom Basic makes it easy to read the PS2 interface from a joystick or a COM port. The shiftout and shiftin commands you see first initialize the PS2 interface for us (we want the joystick in analog mode) and then allow us to read information from the joystick. We’re primarily interested in the data from the right joystick. This joystick will allow us to control or drive the robot forward or backward, and make left or right turns. But you knew that! To keep this program similar to the original LM code so that you can also start understanding it, I’m going to use the same coordinate systems as the AH3-R Basic program created by the free LM PowerPod utility. That is, X is

forward and backward, Z is left to right, and Y is up and down. Confused yet? Don’t worry, you really don’t have to understand any of the IK code in order to program and run the robot. I’m also going to keep most of the variable names, as well. After you are familiar with our version of the code, you should have a good start on understanding the full AH3-R code.

Orders Received! The PS2 wireless joystick is our primary control device for this robot (Creepy2ps2.BAS version). It’s how we receive our marching orders. The control program running on the BB2 reads the PS2 and saves the data into the PS2 variable array called DualShock. From here, we get the XSpeed and YSpeed parameters, and then calculate a vector angle (DAngle) and a distance (DCoord) which are the components of our motion or “command” vector. When we detect a command that we need to act on, we’ll set a value in MovesDelay which will allow us to take a few steps. We’ll also watch for a few other buttons, such as the circle and triangle buttons, and the left joystick. We have a height control (left vertical joystick, LegUpShift) and a steering control (left horizontal joystick, Steering). We will read the digital joystick left and right buttons to control our gait speed (GaitSpeedTmp). Oh yes, we can also sound a horn by pressing the left joystick button!

Alternate PIC boards.

(Inverse Kinematics) comes in. It does the calculations of “How do I move my leg joints to get the foot to this position?” We’ll do this with a little pythagorean theorem, a sine and cosine calculation here and there, and the good old cosine law. If you don’t care for more high school trig, feel free to skip to the next section. We’ll calculate a hip angle first. Our current Xpos and Zpos (foot distances from 0) for one leg are two sides of a right triangle. The hypotenuse of this triangle is calculated It’s relatively easy to do the FK (Forward Kinematics) (Distance) and then we figure out the angle between them for a leg. That’s just “I have the angles of the hip, thigh, using the Arc Cosine function. Atom Basic doesn’t have and knee joints, and the lengths of the tibia and femur. an acos function, so the original program cleverly uses a How do I figure out where the foot will go?” subroutine to do so using a look-up table. The result is What’s harder is figuring out how to set the servo stored in HipH_Angle (horizontal). angles to move the foot where we want. That’s where IK Next, we’re going to calculate the knee angle. Remember “c^2 = a^2 + b^2 - 2ab The program to run Strider is available online at www.servo cos(C)” — the cosine law? magazine.com. Get the appropriate BAS control program (PS2 or COM), Think of the tibia as the “b” side of and then compile and download the file to the BB2 with the appropriate IDE the triangle and the femur as the “a” available from Basic Micro (www.basicmicro.com). I used the 5.3.1.3 Atom side. We’ll square the tibia length and IDE. Refer to the BB2 and Basic Atom documentation to accomplish this. the femur lengths, and then subtract Builders will find it useful to download the Power Pod program from the the square of our previous triangle’s Lynxmotion website at www.lynxmotion.com, generate code for the CH3-R hypotenuse. (Still with me?) We still need Hexapod robot, and follow along in it for comparison. Many of the variables a 2ab term, which is two times the femur mentioned here have been designed to be the same as in the CH3-R robot length times the tibia length. All we have code. When building the CH3-R program, several parameters you’ll be to do now is take the arc cosine of this interested in are: partial result, and we’ve got our knee angle (Knee_Angle). Two calcs down, IDE: Basic Micro IDE V05.xx one to go. Control: PS2 We’ll use the cosine law again, only H3 Leg: 3FOFA this time we’ll add two angles together: H3 Body: Round one formed by the femur and tibia PS2 Controller/BB2 connections: BB2 (pins 12, 13, 14, and 15) (HipVertAngle), and one formed on the PS2 sticks dead zone: small ground (TempAngle). The result is the Tibia Angle: vertical vertical hip angle (HipV_Angle). I won’t SSC32 on (pin 8) go through all that again; that’ll be left as an exercise for the reader!

Inverse Kinematics

SERVO 10.2009

45

constants for the allowed range of the servos, such as HipV_PulseMin and HipV_PulseMax, for example. serout SSC32,i38400, [ “#”,FRHH,FRHH2,”P”,DEC HipH_Pulse(2)

The 3DOF leg.

Notice that I haven’t mentioned some of the scaling (the 127s) used by the program to work with Atom Basic functions, nor the range limiting equations that use the min and max functions to insure our calculated angles are within the range of motion of the respective servos. These limits and the lengths of the femur and tibia are all specified as constants in the start of the program. Change them if you change the leg component dimensions. We’ll do these calcs for both legs. Imagine all the calcs that need to be done for a hexapod or an octapod!

Move Those Legs! Now that we’ve got our three servo angles per leg, we’ll scale them into pulse ranges that our servos can understand. We’ll also use the min and max functions again to insure that the calculated values won’t send a servo into the stops. (You wouldn’t like that!) Some min/max constant examples: HipH_PulseMax - HipH_PulseMin HipV_AngleMax - HipV_AngleMin

You’ll also see three more variables: HipH_Pulse, HipV_Pulse, and Knee_Pulse. You guessed it! These are the pulse values we’ll send to the servos later. For the calculation of each of these three variables, we’ll use

With these values in hand, we’ll send them to the SSC-32 with the special Atom Basic command serout. We send out a string of characters and values that the SSC-32 interprets for us and continuously positions our servos. Believe me, the SSC-32 saves a LOT of work (calculations) getting our servos to their positions! We send the servo # (character constants defined as RRHV,RRHV2 and others), a ‘P’ for a position command, and a decimal value which is the position of the servo we just calculated. We do this for all six of our servos. Whew!

But Wait! Before we can do those IK calculations and move the legs, we need to back up a bit and figure out which leg to lift and when. In the Tripod subroutines, we basically alternate between the two legs — lifting one of them, moving the lifted leg forward, and the “grounded” leg back to take a step. The “Tripod” and “Steps” variables are used to walk us through dividing up the gait into little steps to make the moves smooth, and alternating which leg is up. YPos(Index) = -Tibia_Length + Height XPos(Index) = XPos(Index) + (XPos2(Index) - (XPos(Index) - (HipV_HipH + Femur_Length)))/StepFlag ZPos(Index) = ZPos(Index) + (ZPos2(Index) - ZPos(Index))/StepFlag

We’ve now updated the X, Y, and Z positions for the feet by a little bit each time through the loop. This entire gait action is controlled by a big loop; it proceeds when we have a reason to move the legs (MovesDelay) and have finished the last move of the legs. We can’t very well issue new move commands to the legs while the SSC-32 is still moving them from the previous commands, now can we?

Did I Miss Anything? There are some little subroutines that set up the trig functions that I mentioned. I won’t go over them here. We have some initialization routines for the leg’s starting positions (H3Init and InitPos), but that’s about it. There are also three LEDs that can optionally be wired in to allow monitoring of the PS2 or COM activity (yellow), and the two legs (red and green).

Alternate Code Another angle of the 3DOF leg.

46

SERVO 10.2009

A program very similar to the Atom Basic program can be written and compiled by MBasic Pro from Basic Micro.

This is a conventional compiler that can generate executable code that will run on a PIC chip installed in either of the previously mentioned PICkit 2 demo board or SchmartBoard’s “A PIC” board. The advantage here is that you can write code for any of several different blank PICs and use them in a PCB (printed circuit board) of your own choosing. (Some of us like to make our own boards!) Besides the Atom Basic, there is also the Atom Pro Basic, which is a much faster processor with more functions. It requires a slightly different Basic program to run it (Creepy2p.BAS), which is also available for download. The “Pro” IDE for this module allows compiling C programs that can be run on the Pro module.

Components of the IK calculations.

PC COMS Oh yeah, you will have a different routine to replace the PS2 interface if you elect to use a COM port connected to a PC instead. On the PC end, you can use the PS2 simulation program (Serial_CP_H3.exe) supplied with PowerPod to talk to the bot. The COM version (Creepy2com.BAS) has the appropriate serial interface code. In this case, the bot sends the characters “Rd” to the PC to tell it when it is ready to receive a new command. There is also the addition of a checksum calc to insure the data is okay.

PC Direct to SSC-32 For a really simple implementation, it’s also possible to directly control the SSC-32 board from a Basic or C program running on the PC via a trailing COM wire (or use Blue Smirf). While I haven’t actually done this yet, it looks like an interesting possibility for those inclined. The same basic calculations would be done, but this time on the PC instead. The PC program would send the same servo commands out over a serial port to the SSC-32. You’d be on your own to work out a joystick.

work in this manner, although they’ve combined the two sticks of the old caterpillar tractor into our modern joystick. Our legs would simply move forward/backward at the same speed, or slightly different speeds to make turns (just like with tracks). The other way (much more fun) for a legged robot to move is to move each leg so that it gains ground in a “vector” (angle and distance) relative to its chassis. The robot is thus able to “translate” in any desired direction. Translation is defined as “Motion of a body in which every point of the body moves parallel to and the same distance as every other point of the body.” That is a good definition of the motions my round hexapod robot is capable of. A quadruped robot with splayed legs should also be capable of this motion (I’ll find out when I build a quadruped for my next project).

More on the Creep Gait and Steering Actually, there are two ways to move a basically rectangular robot forward. One can simply put half the legs/wheels on one side of the robot on one “stick” (control channel) and the other half of the legs/wheels on the other side on the other stick. This is a basic tank drive (also called skid-steer) which can still be seen in use today in tracked vehicles. The operator controls the power/ braking applied to each track individually, and the balance of the power or braking causes the vehicle to turn or go straight. Many R/C controlled four wheel drive vehicles

Strider kneeling.

SERVO 10.2009

47

Strider’s bracket, spacer, and wheel.

— if all is well — a full-fledged walk on a kitchen or hardwood floor is recommended. Deep pile rugs will probably give Strider problems — he gets his feet caught!

Driving the Creepy Hybrid

Strider won’t be fully capable of this omni-directional motion, as the two back wheels can’t be moved under command like the legs can. But Strider can do a pirouette, much the same as a show horse, i.e., he can make a circle with his two front legs around the two stationary wheels. okay, the wheels actually rotate but the center of the axle between the two wheels stays in place. So, what we have is the two legs being capable of moving in any direction, with the wheels basically just following. Both models of steering can be simplified to a “bicycle” model (front steerable and rear non-steerable wheels); this method of steering only allows us to turn in circles of about twice our length. The round hexapod (or octapod, for that matter) could be considered a “unicycle” model, and capable of rotating around its own center.

Warning! Keep fingers clear of the legs when first powering up. The servos can move very fast and can pinch! Legged robots have also been known to “jump” off of tables when first powered on.

Power Up! Assuming you’ve adjusted your legs using the PowerPod utility as described earlier, you’re ready to try some initial moves. The control program powers up the legs in steps to avoid damage. With only two legs, this is not much of a chore, but should be observed carefully. If the legs are assembled incorrectly or other than a left and right pair (and on the proper sides), subsequent incorrect motions may cause the legs to strike each other and possibly cause damage. Be ready to remove servo power should this happen. Careful setup with PowerPod should reduce the likelihood of this. Once powered up, you might try the “Circle” and “Triangle” commands. After that, a gingerly tug on the right joystick to take a step or two should cause the legs to make a few gait cycles and reward your efforts. After that

48

SERVO 10.2009

To drive Strider like a car, pull back a little on the right joystick and then use the left joystick Y-axis (left-right) to steer. Or, you can translate (go in various directions without steering) using just the right joystick. A push forward on the joystick and Strider will back up. Rotation controlled by the left joystick X-axis (horizontal) is called steering. It’s not really steering because if you try to turn while both right joysticks are centered, the robot will rotate in place (pirouette). The left joystick’s Y-axis (vertical) changes the robot’s ride height. The Triangle button lowers the front end (legs) to the ground, then turns off all the servos; press the Triangle button again to turn the servos back on and reset the program to default settings. The Circle button returns the robot to setup position (all servos at 1,500 mS) which is useful for checking leg setup. You can control the speed of walking via left and right keys on the D-Pad. Up and down on the D-Pad increases or decreases the amount of leg lift. The original AH3-R code running on a hexapod will, of course, have many more moves. The chassis can be tilted and rotated considerably, and some additional changes to the gait can be made. There are even “FLY” and “ATTACK” modes! Most of these moves are not possible with only two

Links to Resources Legs, Servos, PS2, Battery, BB2, SSC-32, PowerPod www.lynxmotion.com Atom Basic, Atom Pro Basic, MBasic Pro Compiler www.basicmicro.com Bluetooth UBW www.sparkfun.com/commerce/ categories.php?cPath=16_115 SchmartBoard jumpers, Eight-bit PIC Module A www.schmartboard.com Hi-Tech PICC-18 Compiler www.htsoft.com DM164120-3 PICkit 2 28-pin PIC Demo Board www.microchipdirect.com Microchip Datasheets, ICD 2, MPLAB www.microchip.com Parts, PICs www.digikey.com DT106 Development Board www.dontronics-shop.com Aluminum Stock www.onlinemetals.com

Top view.

CAD drawing of the Hexapod chassis plate.

legs, but a lot has been learned, none the less!

learn a little about how to use legs on a robot. Having a little foresight, we started with either a quadruped or hexapod chassis, knowing that we can add additional legs later. As there is already code available for hexapods The Creepy Hybrid can be thought of as an (AH3-R), this is a logical choice. For more of a challenge, “introductory legged robot.” With it, we’ve been able to new code for a quadruped can be written. I’d also like to explore 2DOF legs on Strider. With fewer calcs to do All the CAD drawings, as well as the .BAS files are available for download at (four vs. six servos), maybe just a sinwww.servomagazine.com. gle processor could run the entire bot! SOFTWARE Downloads: Plus, with faster micros, it should Creepy2ps2.bas Basic Atom 5.3 PS2 program be possible to combine the bot control Creepy2com.bas Basic Atom 5.3 COM (RS-232) control Creepyp2.bas Basic Atom Pro 8.0.1.8 PS2 or RS-232 control and servo control program into a Creepy2Mb.bas Mbasic Pro 5.2 program PS2 single program, and run six or even 12 servos on one processor board. Thus, a simpler (less expensive) bot could be built. SV

Future Plans

Creepy Hybrid Parts List

❐ 3DOF leg pair ❐ Hitec HS475 servos (six) ❐ Hitec servo horns (six) ❐ 6V battery pack ❐ 9V battery ❐ 9V battery connector ❐ SPST toggle switches (one or two) ❐ 6V battery connector ❐ Quadruped chassis plate pair ❐ Chassis spacer pair ❐ Leg bracket pair ❐ Battery bracket ❐ Wheel pair ❐ PS2 plate ❐ PS2 wireless joystick ❐ Blue Smirf (alternate) ❐ BB2 (Bot Board 2) ❐ 28-pin PIC Demo board DS41301A (Microchip) (alternate)

❐ Eight-bit A-PIC board (SchmartBoard)

❐ UBW Sparkfun (alternate) ❐ DT106 DonTronics (alternate) ❐ Basic Atom 28 module ❐ Basic Atom Pro 28 module (alternate) ❐ MBasic Pro from Basic Micro (alternate) ❐ SSC-32 Servo board ❐ SSC-12 (alternate) HARDWARE

❐ 6-32 hex aluminum spacers (two or four)

❐ 4-40 hex aluminum spacers (eight or 12) ❐ 2-56 screws ❐ 6-32 screws ❐ 4-40 screws ❐ 4-40 nuts ❐ 6’ DB9 serial cable M-F ❐ .025 jumpers 10

(alternate)

SERVO 10.2009

49

S ’ t y n i l Robot e k c o

R

By Joe Shearer

Photos provided by Mike Rippy and David Ferguson

What are the odds a band that spent years toiling at kids’ birthday parties in a pizza joint would get a second shot at immortality? Well, if your name is the Rock-afire Explosion and your members include guitar- and banjo-playing bears, a cheerleading mouse, a keyboard-playing gorilla, and a ventriloquist wolf, you have a leg up on the competition when it comes to robot fanatics.

T

he Rock-afire Explosion is a gang of animatronic rockers who thrilled kids throughout the 1980s at Showbiz Pizza Place — the pizza joint-cum-video arcade-cum robot rock ‘n roll playland. The band is a childhood legend for many Gen Xers: Fats Geronimo, the ivory-tickling gorilla; lead guitarist Beach Bear; country bear Billy Bob Brockali (with sidekick Looney Bird in a nearby oil drum) on banjo; outerspace canine Dook LaRue on drums; cheerleader mouse Mitzi Mozzarela providing vocals and moral support; and stand-up comedian Rolfe DeWolfe, a wolf who always had his trusty puppet Earl Schmerle within arm’s reach. When Showbiz went the way of the dodo in the late 1980s, it was replaced by the more cost-efficient

50

SERVO 10.2009

Chuck E. Cheese brand. It marked a passage for a generation, a reminder that the world — for better or worse — changes. However, for a small but loyal group of fans — including 31-year-old David Ferguson — the birthday party never ends. Ferguson is one of a handful of collectors across the country who have taken the ultimate step in keeping their beloved characters alive: They own their own complete, fully-functional robotic rock band, complete with stage lights, props, and the various accoutrements to display and use in their man caves, guest rooms, basements, or garages. Ferguson was determined to get the band back together, and converted the garage of his otherwise unassuming suburban Fishers, IN

home into a makeshift stage. The space has been carpeted and outfitted with blacklights, transforming it into a showroom of sorts with toys, photos, posters, and other memorabilia and collectibles from the restaurants adorning the opposite wall. So, why go to the trouble and expense of installing them in your own home when there is a large supply of reasonable facsimilies in existing Chuck E. Cheese restaurants? For many children growing up in the 80s, Showbiz Pizza Place is something of a Valhalla, a magical place that holds special memories. Many — Ferguson among them — were left cold by the shift from Showbiz to Chuck E. Cheese, and feel like (as many do) the original incarnation is superior to what they feel is the

scaled-down version that exists today.

History Showbiz Pizza Place took a twisted, complex turn from its original incarnation in the 80s to its current identity. In 1979, a company called Topeka Inn Management struck a deal with the Chuck E. Cheese’s Pizza Time Theatre, which created the robotics for a live animatronic stage show with the idea of opening a chain of high-concept entertainment-themed restaurants featuring pizza, video games, and animatronic amusement. But prior to opening the first Pizza Time franchise, Topeka Inn head Bob Brock discovered a similar, but more advanced team of robots produced by Creative Engineering, Inc. (CEI), known as “The Wolf Pack Five.” The Wolf Pack contained fullbodied, life-sized characters, used three stages, and featured complex lighting and choreography. The Pizza Time Players — by contrast — were half-bodied, performing from a “balcony” stage that obscured the robots from the waist down, and featured about half the movement of the Wolf Pack bots with more simplistic, less realistic costumes, plus featured similar characters with little variation in movement. “The [Wolf Pack] animatronics were quite sophisticated, arguably on par with what could be found at a Disney theme park,” said Travis Schafer, Showbiz Pizza historian and owner of www.showbizpizza.com. “The Pizza Time characters looked more like giant stuffed animals.” Brock couldn’t pass up the more functional, better looking Wolfpack bots (and feared a competitor might snatch them up and trump his setup down the road), so he broke ties with Pizza Time and joined forces with CEI to form Showbiz Pizza Place. The Wolfpack five underwent cosmetic redesigns and became “The Rock-afire Explosion.” Chuck E. Cheese and Showbiz grew into competing companies, and each expanded quickly during the early 1980s before falling on hard economic times. Showbiz bought out Pizza Time in June 1985, and retained

rights to the Chuck E. Cheese branding, along with their own characters, running restaurants using both sets of animatronics. Over the next several years, growing internal strife between Showbiz and CEI, along with the leverage afforded them by the rights of the Chuck E. Cheese characters, led to Showbiz dropping CEI as their animatronics provider. The Showbiz Pizza name, properties and the stores were all converted to Chuck E. Cheese operations around 1990. Chuck E. Cheese spokesperson Brenda Holloway said the decision wasn’t a hard one to make based on the potential savings. “We found that it would be more cost-effective to just use the characters we had,” Holloway commented. The Rock-afire Explosion shows were retrofitted to become Chuck E. Cheese characters swapping clothing and outer cosmetics, but retained much of the underlying mechanics. New stores were outfitted with newer, simpler units, often featuring just one robot with other interactive activities in place of the costlier robots. By 1990 — like any number of great bands — The Rock-afire Explosion went their separate ways. The remaining unused Rock-afire units sat in the Orlando, FL warehouse owned by CEI founder Aaron Fechter. When Fechter decided to start selling them on eBay, Ferguson — a robotics junkie eager to dig into the guts of the show — jumped at the chance.

Inner Workings The robots function using compressed air which is forced through a series of valves and manifolds into each robot, where electrically-controlled air (MAC) valves force air through double-acting air cylinders. The air pressure translates into linear movements within each unit. Flow control valves regulate the amount of air pumping through the robots. Each valve has two ports that run to a single movement. When the valve is turned on, port A pushes air into the cylinder, while port B exhausts air from the cylinder. Turning off the valve alternates each port’s function. SERVO 10.2009

51

that’s in the 7-8 CFM range. That, he notes, is enough to run a 3-4 minute show, then pauses for an intermission of 2-3 minutes while the air tank refills. With dozens of moving parts to deal with, the machines of course require their share of upkeep. Ferguson chiefly runs his bots only on the weekends, saving the machines to a degree. He says he has to lubricate moving parts approximately bi-monthly, maybe a little more often during Indiana’s notoriously fickle summers, as moisture and humidity cause the valves and cylinders to stick.

Installation, Customization, and Tweaks Enclosed cylinders in the robots heads control movements for the eyes, eyelids, and mouth. The heads turn inside the body.

The Rock-afire robots are framed with an aluminum skeleton with fiberglass panels overlaid to create the shape of each character’s body. Leather flaps layed over joints gives a stiffer, more realistic look and prevents the costumes from pinching in the joints. Bronze bushings, steel pins, and pivots along with an array of air cylinders working in concert provide a fluid range of motion, and a durable design prevents a lot of major breakdowns. “When they designed these robots, they did a good job of really making them robust,” Ferguson said. The heads feature a lot of movement packed into a small frame, controlling eye, eyelid, mouth, and head turns (the latter of which turns down inside the body). The restaurants employed the services of a large 100 cubic feet per minute air compressor to fuel the robots — something that is not only impractical for residential use, but carries a price tag approaching or exceeding $10,000. The larger compressors run on 480 volts, while a standard residence is wired for 220 volts. Instead, he bought two smaller, more budget-friendly compressors: one that’s about 13 CFM and another

52

SERVO 10.2009

maintenance, and electrical bills. Once he had them at his house, he had to find a way to creatively install them in his 20’ x 20’ two-car garage. Aided by the original installation manuals — which he located with the help of some friends — he built a custom version of the three-stage layout to fit within his allotted space, placing the two secondary stages parallel to each other on either end of the main stage (in the restaurant layout the stages sat side-by-side). Using the center curtain track of the main stage as a guide, Ferguson measured (“I had to trim a little of the curtains off,” he noted) then framed the center stage and floored the platform with plywood, cutting trap doors in the stage to access the air (MAC) valves which run under the stage to the compressors outside. Ferguson installed insulation on his garage door, removed the garage door opener, and tightly braced the door closed. He painted the ceiling black and the walls red, and installed a backdrop. After he installed the robots, he tracked down miscellaneous parts he was missing, and in some cases recreated them from scratch (most notably the hand puppet Earl’s body,

Ferguson was six years old the first time he went to Showbiz Pizza, and instantly fell in love. “It wasn’t so much the games,” he said. “It was the robots.” Ferguson’s father was an engineer, and seeing the show in action at Showbiz grabbed Ferguson’s attention which still continues 25 years later. By the time he was 13, he was going several times a week, studying and observing the robots. “Something just bit me,” he said. “I was completely taken aback by how the robots moved. It just took over my life. I’m fascinated by every aspect of it.” Before he owned the robots, Ferguson said he found a sort of escape in listening to the old songs on vinyl. “Beyond the fact that the show is animatronically superior to any commercially available show near me, I have a love for the music and characters,” Ferguson said. “I could put on the old vinyl and as I listened to all the songs, it took me back to my childhood.” Ferguson estimates he spent $5,000 to $6,000 on The robots movements are controlled by his set of robots, excluding switching air valves on and off. Each robot is accessories, travel expenses, controlled by roughly 18 of these 24V valves.

and some of the background pieces on Billy Bob’s stage). Thus was born the room Ferguson and his friends know today as “Mitzi’s Mousetrap.”

discreet semiconductors and troublesome adjustments of potentiometers. This also enabled him to use the more energy-efficient switching power supplies and throw out the old linear power The original animatronic computer supplies which ran on spaceused a reel-to-reel four-track audio hogging transformers. system. The first two tracks comprised Not being content to merely the audio for the show, and the relive his childhood, Ferguson remaining two transmitted data by sought to bring them into the way of a Manchester biphase 21st century, creating a C++datastream encoded with instructions based software program that that tell the pneumatic valves when to allows Ferguson to program the turn on and off. The control system robots to customize the shows converts the datastream to 240 beyond their original set list of almost separate channels that run to the 200 songs, shows, and skits. characters. The original system ran on The software — dubbed an analog signal. Ferguson, however, “Programblue” — allows him to record built a newer computer that he calls a the robots’ movements and data with “blue box” which allowed him to to-the-millisecond timing on the audio. convert the signal to digital using a The movement data is tracked to the microcontroller, giving him greater position of the audio, ensuring that flexibility in operating and maintaining the movements won’t fall out of sync the steel beasts. He no longer has to if the audio slows down or speeds up. worry about calibrating the machines; Adding the tracks is not as simple their movements are more accurate; as pressing a button. Each robot must and he can bypass the outdated be programmed individually: leg, arm, head, mouth, and eye motions all have to be programmed separately. Ferguson estimates a three-minute song takes a minimum of six hours of work to program, moving upwards to a full day depending on the complexity of the choreography. “That’s where the artistic part of it comes in,” he said. “It’s interesting to see what some of the other people come up with when they do a show.” Ferguson also created Programblue to create container files that hold the data, meaning he can trade and exchange new programs with his fellow Rock-afire fanatics who have gotten copies of the software, then programmed their own The Bluebox inter faces to a standard computer using a single USB cable. This animatronic custom shows. control system houses an outstanding Ferguson continuously 240 Darlington drivers, a hefty 24V switching tinkers with Programblue, supply, and necessary logic to talk with the Programblue software Ferguson wrote. adding new flourishes and Ferguson’s “blue box” enhances the operations making the program more of his show, making the robots operate more user-friendly. Thus far, he’s accurately to the music.

Operating the Bots

Ferguson adjusts an air cylinder on Fatz. Keeping the robots in top operating condition requires regular maintenance.

added copy-and-paste capabilities for the character movements; worked using universal protocols (so that Programblue works with both his blue box and the original control computer); studio-type functionalities like rewind, fast forward, play, and pause that assist in setting movements; and created a 48-channel “microbox” — a smaller unit that allows users with partial shows to run the programs.

The Future Ferguson hopes to use his Rock-afire set as a springboard into a robotics career; the larger concept of animatronics and control systems used to create toys, or possibly enter the home Halloween décor industry. He hopes his experiences with his set will launch his company — DSF Robots — as a viable means of making a living, with a certain band fronted by a gorilla and a country bear as his muse. For now, he markets components to those he knows (Ferguson estimates that eight to 10 people around the country own a full set of the robots, with four of those up and running, while several more own individual pieces), and hopes he can help lead a revitalization of the animatronic entertainment industry. “The Rock-afire Explosion is a tool of inspiration,” he said. “I’m a dreamer, and when I sit and watch the show, I dream up new ideas. It takes me to a place where I feel like I can do anything.” SV SERVO 10.2009 53

Build A Building

Block:

By Martin Weiss

A Dual Serial Motor Controller When I got started in hobby robotics a couple of years back, my robots (probably like those of most beginners) were single microcontroller designs. While I had a fair bit of success tinkering with “one-chip wonders,” lately I’ve been steering more toward designs involving multiple controllers.

Using a single microcontroller to control all aspects of a robot is often impractical. For example, a low-level task like motor control can tie up a significant amount of resources driving PWM channels, speed control algorithms, etc. Consider, on the other hand, a robot comprised of several microcontrollers — one that serves as the “master” and controls high-level decision making, and one (or more) additional controllers dedicated to specific tasks like motor control. This latter “distributed” approach allows each individual microcontroller to be better optimized for its particular task, in principle making the overall system more capable (albeit at the cost of more hardware). This article will focus on creating one of the core components of this architecture: a dedicated motor controller. A serial interface will be used to facilitate communication between the master and the motor controller making this project useful as a generic building

block in a wide variety of applications.

The Key Ingredients

I’ve chosen to use Atmel’s ATtiny2313 microcontroller as the brain of the motor controller. Although the ATtiny2313 is indeed relatively tiny — with only 2K of Flash and 128 bytes of SRAM — it does have a full duplex USART and four PWM channels which makes it ideally suited for our purposes here. The “brawn” to actually drive the motors will be provided by the Toshiba TA8428K5S H-bridge which is a little beefier than some of the more commonly used H-bridges like the SN754410, LM293D, and TA8050P. The TA8428K5S can source a fair bit of current (1.5 amps average, 3.0 amps peak) and should work great for controlling small motors. It comes in a seven-pin in-line package which allows easy mounting on a printed circuit board (PCB), as well as attachment of a heatsink. Each FIGURE 1. The TA8428K5S can control a single motor.

motor controller (represented by the components inside the red dashed rectangle) translates serial commands received from the master into PWM signals to drive the motors via the H-bridges.

54

SERVO 10.2009

Putting It Together Speaking of software, when we eventually get around to writing the code for this project, it would be handy if the hardware design lent itself to graceful software control without requiring undue complexity. Some H-bridges have direct inputs for speed and direction (i.e., rotate clockwise/counterclockwise) which simplifies the software design. Unfortunately, the TA8428K5S — like

many common H-bridges — simply has the more traditional two logic inputs. Driving one of the inputs high and the other low causes the motor to spin in one direction. Reversing the logic causes the motor to spin in the other direction. Varying motor speed requires chopping the inputs with a pulse width modulation (PWM) scheme. As such, it takes a little more work to control this type of H-bridge. The approach I’ve taken here is to drive each of the H-bridge’s logic inputs with separate PWM channels from the microcontroller. This method entails applying a PWM signal to one of the inputs while holding the other low (i.e., 0% duty cycle PWM signal). Normally, this would be a bit expensive in terms of microcontroller hardware resources since it requires using two PWM channels to control each motor. However, we can afford to be a bit more liberal in how we deploy the PWM capabilities of our ATtiny2313 since we’re using it as a dedicated motor controller. Figure 1 shows a high-level system diagram with the motor controller represented by the components inside the red rectangle. An alternative to the above scheme would be to insert additional logic gates between the ATtiny2313 and the

H-bridges to effectively decode the H-bridge logic inputs into speed and direction. This approach would provide the ability to control up to four motors (since the ATtiny2313 has four PWM channels). However, the requirement for an extra logic gate translates into a penalty in board size and routing complexity when designing the circuit board layout.

Circuit Schematic Figure 2 shows the complete schematic for the serial motor controller. At the heart of this design is the ATtiny2313 microcontroller. Although the ATtiny2313 is capable of running at up to 20 MHz, I’ve chosen instead to operate it at 14.7456 MHz. This is one of the “magic” frequencies that enables the USART to operate with 0% error rate — an important part of this project. The timer0 PWM outputs (OC0A and OC0B) from the ATtiny2313 are used to control the H-bridge logic inputs for motor 1 while the timer1 PWM outputs (OC1A and OC1B) are used to control the H-bridge logic inputs for motor 2; 100 kΩ pull-down resistors are attached to the PWM lines to put the H-bridges into stop mode when the PWM isn’t active.

FIGURE 2. Schematic layout for the serial motor driver.

SERVO 10.2009

55

FIGURE 3. Component layout for the motor controller.

Three spare pins on the ATtiny2313 are available as additional digital I/O. The three remaining unused pins are tied to ground. LEDs on the regulator output and USART RX/TX lines serve as status indicators. A six-pin ISP header is included to enable in-circuit programming using an AVRISP2 or similar programmer. In this layout, electrical noise is a concern since the motors, H-bridge logic, and microcontroller all share a common power supply. In general, it would be preferable to isolate the microcontroller from current spikes and voltage sags caused by the motors by providing separate power supplies for each. In this case, having two separate power supplies seemed impracticable as this controller is intended to be a relatively compact subcomponent of a larger project. Instead, a low drop-out regulator (U4) is used to tap five volts off of the main battery with capacitors on both input (C6, C7) and output (C4, C5) to smooth out the power supply to the microcontroller.

FIGURE 4. The completed serial motor controller. The ATtiny2313 chip and crystal are in the lower left. The MAX232 is in the lower right. The Toshiba H-bridges are seen in the upper left, just in front of the motor and battery connections (blue).

56

SERVO 10.2009

Similarly, 10 µF capacitors (C8, C9) are attached to the Vcc pins of the H-bridges to protect them from glitches caused by motor noise. Lastly, the motors (not shown) will each be fitted with the standard trio of 0.1 µF noise suppression capacitors. I’ve also incorporated a MAX232 serial driver (U5) and a DB9 connector (J6) in this design to allow direct connection to a PC via a standard serial cable. I hadn’t initially intended to include this since I was mainly thinking of this project as a subcomponent to be controlled by another microcontroller via the USART. In thinking it through though, I (wisely) came to the conclusion that enabling serial communication between the controller board and a PC would be tremendously beneficial for initial hardware and software debugging. Plus, having the ability for a PC to control a couple of motors is useful in its own right.

Board Design and Assembly I used ExpressPCB’s mini-board service for this project. The combination of easy-to-use (and free!) layout software plus small minimum order size and price were perfect for initial development. Board size is fixed at 3.8” x 2.5” which was a little larger than I needed, but allowed me to easily fit all of the components in. The traces connecting the H-bridge outputs to the motors are large to ensure they can handle a few amps of current. Ground planes are placed under the ATtiny2313 and around the crystal oscillator for noise protection. The ground traces are placed on the top side of board, primarily to enable improved heat dissipation for the H-bridges and voltage regulator. The power traces are placed on the bottom side of the board to minimize the risk of power-to-ground shorts. I purposely used slightly larger vias (~0.035” for standard components) to ensure parts fit smoothly and upsized the component pads where possible to make the soldering a bit easier. To assemble the board, refer to the silkscreen layout in Figure 3 for component placement. First, install the various DIP sockets, switches, and connectors for the motors, battery, DB9, ISP (J5), etc., followed by the passive components (resistors and capacitors). Be sure to follow the polarities shown in Figure 3 when installing the capacitors. Then, install the 14.7456 MHz crystal (X1), being careful not to short its metal case to ground. Next, solder in the voltage regulator (U4). At this point, it’s a good idea to put down the soldering iron and do some quick testing. Connect a battery (six to nine volts) to J4 and flip on switch SW1. Hopefully, you should see LED D1 turn on, confirming the connections from the battery to the

regulator are working. Also, test the regulator Update motor speed output with a voltmeter to confirm you’re getting Main loop the expected five volts. If either test fails, there may Calculate new motor speed be a solder bridge shorting power to ground, a Read character component installed in the wrong location and/or from the buffer Set both H-bridge inputs to 0 for orientation, or some similar problem that will need 1 msec if changing directions to be corrected before proceeding. Is the character “{“ Once you’ve got the LED lit and a five volt no ? Compute PWM needed reading on the regulator, flip switch SW1 off, for desired motor speed yes disconnect the battery, and fire the soldering iron Read 3 more characters back up. Install the motor drivers U2 and U3. Solder from the buffer Is new speed > 0 ? the motor drivers directly to the board to improve yes no thermal conduction. Lastly, fit the ATtiny2313 and Is the last character “}“ PWM H-bridge Set H-bridge ? no input A input A low MAX232 chips, U1 and U5 respectively, into their yes sockets. Connect the motors to J1 and J2. Figure 4 Set H-bridge PWM H-bridge input B low input B Update motor speed shows the completed motor controller board. It’s clear the components could be placed FIGURE 5. Flow charts of (a) the main loop and slightly closer together — I intentionally spaced (b) the motor control function. them a little further apart than needed to ensure everything fit. As such, there is potential to make overruns the tail — which would result in loss of data. Data future revisions to the board such as making it smaller overrun can be avoided by properly sizing the array. by optimizing component placement. In addition, the We create a 32 character ring buffer for the USART to through-hole resistors, capacitors, and LEDs could be receive incoming data by globally defining: replaced with surface-mount devices. Some of the larger surface-mount packages like the 1206 series seem fairly #define RxBufferSize 32 approachable at the hobbyist level. The main benefit #define RxBufferMask (RxBufferSize - 1) offered by switching to surface-mount components is that char RxBuffer[RxBufferSize]; it would eliminate the vias associated with each part, volatile char RxBuffer_head=0, RxBuffer_tail=0; thereby enabling easier trace routing and corresponding board size reduction. We then use the UART receive vector to trigger an interrupt each time the ATtiny2313 receives a new character. During the interrupt routine, we store each new Now that the hardware is built, it’s time to dive into character in the ring buffer and update the head index. the software coding. This project is written in C using AVR Studio 4.12 with the WinAVR/GCC plug-in. As described ISR(UART_RX_vect) { earlier, the ATtiny2313’s USART is employed to receive unsigned char RxByte, tmphead; incoming serial messages. One challenge here is that we have to deal with a continuous stream of incoming //store received byte... characters. We’ll deal with this using a special type of RxByte = UDR; storage array called a ring buffer. The ring buffer concept //calculate index to store it in in the was covered by Fred Eady in several previous articles in //ring buffer... Nuts & Volts and SERVO, so I won’t go into too much tmphead = (RxBuffer_head + 1) & depth here. Briefly, the ring buffer is really just a regular RxBufferMask; linear array, accessed through two indices known as the RxBuffer_head = tmphead; head and tail “Head” defines the index that new data is //store in ring buffer, ensure head never written to. “Tail” defines the index that data is read from. //catches up to tail... Head and tail are incremented as data is written to/read if (tmphead != RxBuffer_tail){ from the ring buffer, respectively. The trick here (enabled by RxBuffer[tmphead] = RxByte; some Boolean algebra) is that when either index exceeds } the length of the array, it wraps around to the beginning of } the array. We do need to be careful that the head never

And Now for the Code

SERVO 10.2009

57

500

250 deadband

0 -250

-150

-50

50

150

250

-250 PWM motor speed (rpm)

-500

desired speed (arb. units)

FIGURE 6. Motor response using PWM directly proportional to the desired speed.

UDR is a pre-defined register in the ATtiny2313 that stores the incoming character received by the USART. Note that the head index RxBuffer_head has to be declared as a volatile variable since it’s updated during the interrupt service routine (ISR). The serial communication approach provides a generic interface for the motor controller, allowing it to be easily integrated into larger systems. However, it carries with it the risk that the motor controller may receive random garbage characters due to noise on the serial line. We need to ensure that the motor controller ignores the garbage and only responds to real commands. Otherwise, we risk having noise on the serial line trigger unexpected motor motion. To accomplish this, we’ll implement a data packet approach in the software.

PARTS LIST ITEM

DESCRIPTION

Resistors (1/8W, 5%)

❑ R1 10 KΩ ❑ R2, R7, R8 1 KΩ ❑ R3, R4, R5, R6 100 KΩ Capacitors (35V unless specified; all 0.1” lead spacing) 22 pF 200V 0.1 µF 0.1 µF 100 µF 10 µF 1 µF

❑ C1, C2 ❑ C3, C4, C6 ❑ C10, C11 ❑ C5, C7 ❑ C8, C9 ❑ C12-15

58

SERVO 10.2009

The data packet used here is defined as a four character sequence where the first and last characters are “{“ and “},” respectively. The remaining two characters identify the motor (1, 2) and the desired command. Three commands are currently supported: “” cause the motor to accelerate either clockwise or counterclockwise, while “0” sets motor speed to zero. For example, sending the character sequence {2>} to the controller causes motor 2 to accelerate, whereas sending the sequence {10} causes motor 1 to coast to a halt. Any received characters that don’t form a packet according to the above format are simply ignored. Figure 5(a) shows a flow chart of the main loop to illustrate this logic. Using this packet approach makes it highly unlikely that a random collection of garbage characters will be mistaken for a legitimate motor command. Once a valid packet is received, the code computes a new motor speed and corresponding PWM duty cycle as shown in Figure 5(b). Note that the sign of the motor speed determines which of the H-bridge inputs is pulsed vs. driven low. To comply with the TA8428K5S datasheet, plus reduce wear and tear on the motors, the H-bridge is set to briefly coast (i.e., both inputs driven low) when changing directions. The motors themselves are driven using eight-bit fast PWM mode at 7.2 kHz. The H-bridges operate fine at this frequency, although the motors do make a discernable whine.

Wind It Up and Let It Go Okay, now that everything’s in place, it’s time to test it out. Hook up the motor controller to a PC with a serial cable. You’ll need to run a pair of jumper wires from J7 to J3 on the board — refer to the labels in Figure 3 for the Semiconductors

❑ D1, D2, D3 ❑ U1 ❑ U2, U3 ❑ U4 ❑ U5

LEDs, any color, 0.1” lead spacing Atmel ATtiny2313 Toshiba TA8428K5S LM2940 voltage regulator MAX232

Misc.

❑ SW1 ❑ SW2 ❑ X1 ❑ J1, J2, J4 ❑ J3, J7 ❑ J5

Toggle switch Reset switch 14.7456 MHz crystal Two terminal connectors for motors Two terminal connectors Six-pin ISP header (two rows of three pins; 0.1” spacing) ❑ J6 DB9 connector, female ❑ 20-pin DIP socket for U1 ❑ 16-pin DIP socket for U5

correct orientation (recall the inclusion of the MAX232 section was something of an after-thought). Establish a connection between the PC and the motor controller using a terminal emulator like Windows/HyperTerminal or Bray’s Terminal (available from www.smileymicros.com). Connect using 28.8K baud, eight bit, no parity. Start sending valid packets (i.e., “{1},” etc.) and you should see the motors start to spin. Send a stop command (i.e., “{10}”) and the motor should coast to a halt. You should see the current speed of the selected motor echoed back to the PC screen. For my own testing, I used a small gear motor from www.banebots.com (40:1 ratio, 25 mm spur gear motor). Initially, I set up the code to drive the H-bridge logic inputs with a PWM signal whose duty cycle was directly proportional to the desired motor speed. However, I immediately noticed my motor had a large dead band. When the PWM duty cycle fell below some limit (though still non-zero), the motor shaft stopped rotating, presumably due to frictional losses in the motor gear train. Figure 6 shows plots of the PWM signal used to drive the motor, as well as corresponding motor speed. This large non-linear motor response probably isn’t an issue for your basic “wander-and-avoid-obstacles” type of robots. However, it would be quite problematic for applications that use feedback control loops to maintain position, like the ever-popular two wheel balancing platform. To overcome the dead band problem, I devised the following code to translate desired motor speed into PWM duty cycle: If ( abs(desired speed) < minimum_ speed) PWM duty cycle = 0 else PWM duty cycle = ((desired speed * 255 - deadband_cal)) / 255) + sgn(desired speed) * deadband_cal

The software constant minimum_speed provides a software-controlled deadband to ensure the motor can be stopped. The software constant deadband_cal is used to eliminate the physical deadband of the motor by scaling PWM duty cycle into a range that causes the motor to spin when desired speed exceeds minimum_speed. After some experimentation, I found that setting deadband_cal to 75 worked best for this motor. As you can see from Figure 7, the flat spot in the

500

250

0 -250

-150

-50

50

150

250

-250 PWM motor speed (rpm)

-500

desired speed(arb. units)

FIGURE 7. Motor response with modified PWM duty cycle calculation, with the software constant deadband_cal set to 75.

motor response is virtually eliminated. Essentially, what the new code does is to distort the relation between the desired speed and PWM duty cycle to compensate for the physical deadband of the motor. While the response still isn’t quite linear, it’s vastly improved over the original one in Figure 6. Notice it also doesn’t cost much in terms of resources to implement this motor speed calibration since we’re working with a dedicated motor controller.

Room to Grow Hopefully, you’ve found this project to be useful. It’s pretty basic, yet at the same time broadly applicable to a wide range of uses. There’s certainly room to do more with the ATtiny2313 microcontroller. For example, we could tie the three available I/O pins (PB0, PB1, PD6) to various combinations of Vcc or ground, and treat this as a three-bit address for the board. We could then include this address in the data packets and have a given controller board only respond if the incoming packet contains the correct board address. This would allow us to daisy-chain up to eight of these boards together. Of course, the real next step is to incorporate this “building block” into a larger project. The C code and ExpressPCB files for the motor controller will be posted to the SERVO website (www.servomagazine.com) to allow further tinkering. Enjoy! SV

SERVO 10.2009

59

Robotics

Software ngineering EE Part 2 By Fulvio Mastrogiovanni

In the previous article, we addressed what is one of the most important topics in robotics these days: the fundamental role played by software engineering (SE for short) in designing and implementing efficient, reliable, and robust robotic systems. First, we defined the fundamental requirements that must be met when building robots for real-world scenarios: The on-board software must be concurrent, distributed, embedded, real-time, and data-intensive. Second, we discussed the problems related to the actual code written for implementing software control architectures, and the underlying relevant guidelines to be strictly followed by programmers, such as maintainability, interoperability, and reusability. Finally, we introduced a simple reference scenario of service robots (or automated guided vehicles; AGV for short) in warehouses or similar static environments where the robot workspace can be defined in advance with great precision, and every detail can be represented by the system since it will not vary at run-time. In such a setting, we showed how software engineering reduces to a domain-engineering process that is basically unidirectional design flow starting from domain analysis (a study about the fundamental requirements imposed by the operating environment), continuing with domain design (an actual design phase where the non-technical requirements imposed by the previous analysis are formalized in order to be implemented), and concluding with domain implementation (a phase when the robotic system is finally implemented and deployed). Summarizing, the key idea of the previous article was that every aspect of a real-world robotic system ultimately depends on the characteristics of the robot operating environment. From mechanics to control laws, from HW to SW layers, up to artificial intelligence techniques possibly implemented as actual code, each part of the whole architecture depends on the operating environment. The scenario that we assumed in the previous article is fairly simple from the perspective of robotics engineering. Since every detail of the environment where the robot usually operates is known or can be easily determined beforehand, it is not difficult — at least in principle — to provide the robot with the necessary knowledge to operate at its best in each possible situation (and this is indeed a

60

SERVO 10.2009

very hot topic of active research these days). At the software level, this assumption is particularly useful. In fact, we noticed that in these cases object oriented programming (OOP) is particularly intriguing. OOP allows robotics engineers to design the complete system starting from a well-defined conceptual model of the operating environment that — as we just noticed — is literally available. When each relevant object in the operating environment is modelled (as long as it is relevant for robot operations), the implementation of the final system is straightforward. As a matter of fact, in the previous article we showed that the overall system can be reduced to three main subsystems: Human-Computer Interface; Communication; and Robot Control software. This is

possible not only because the operating environment is assumed (or simply is) static from the robot perspective, but also because all the possible interactions between a robot and its surroundings are static and well-defined. So much so, in fact, that use cases are usually adopted to model these interactions. In this article, I would like to unleash an onslaught of terror over this idyllic view of robotics as the life of robotics engineers is not so easy. Let’s examine all of our previous assumptions in a more critical way.

Thinking About Our Assumptions All of our assumptions can be summarized by the following two examples: Static environments. Do we really think that humanpopulated environments are static? Maybe we are not going to deploy our robots in the middle of New Delhi or at Times Square, but I can assure you that a warehouse is an ever-changing and highly dynamic environment, especially during working days. Other robots, human personnel, boxes, and other objects to stock or transport are nearby, possibly manipulated in ways far independently from the robot’s tasks. At the same time — and also for these reasons — the shape of the environment continuously changes. We are not speaking about obstacles located over pre-programmed robot paths, but about big impacts over the robot operating environment, for instance, the impossibility of following such a path, thereby requiring the robot to think about a detour. Static interaction with the environment. How do you interact with your environment? Human behavior (which I assume to be highly intelligent, right?) is opportunistic and not programmed in advance; to such an extent that we are not even aware of this. To us, it seems that we perform the same action many times (and we get annoyed by them), but there are slight differences that count — different speed, different trajectories followed by our hands, different precisions, and so on — which ultimately depend on our perceptions, possibly in a way that is not even conscious. To instil these slight differences in robot behavior is the hard task. What if the object the robot is supposed to load from a given place is missing or slightly misplaced? Or, what if it weighs too much for the robotic arm? If I (the robotic engineer) considered these cases during the design phase, everything

— maybe — will be fine. Otherwise, many funny things will happen, but in spite of the laugh, the system is not going to work. If the validity of these two assumptions cannot be guaranteed anymore and if the fundamental requirements that every robotic system must exhibit must still hold, it is immediately evident that such methodologies as domainengineering are not suited anymore to design and deploy an actual system. In fact, if either the environment or the modalities of interaction between robots and the operating environment (or both) are no longer known or predictable in advance, it is not possible to consider a static domain to analyze. Every relevant aspect is in question: maps, paths, goals, schedules, operating conditions, just to name a few. As a consequence, the OOP framework cannot help anymore, since its modelling process requires the complete knowledge of the domain to be modelled. In particular, the following aspects of a robotic architecture are affected if we relax the previous assumptions: Real-time operations. A system able to adapt to its dynamic environment must be extremely versatile. This requirement is usually implemented by providing the robot with many modules that can be activated/deactivated at run-time, since if all of them were scheduled concurrently the required on-board processing power would increase too much (on its turn, imposing impractical restrictions over energy consumption). Scheduling policies able to manage the execution of different modules in different situations are therefore fundamental. This kind of behavior, on its turn, requires the robot to be able to understand different situations, and therefore to be endowed with the necessary sensing and reasoning capabilities. In a sense, such a

FIGURE 1. A robot operating in an unstructured and highly dynamic environment.

SERVO 10.2009

61

methodologies cannot be used. •Functional, as well as nonfunctional, requirements greatly vary according to the specific scenario where the actual robot must be deployed. •Such a complex robotic system could involve the use of a large variety of platforms and devices, possibly to be programmed with different programming languages and paradigms. •Given the heterogeneous and potentially complex system, it is mandatory to adopt commercial off-the-shelf (COTS) components. The need arises for a design cycle and architectural framework able to avoid any particular architectural and infrastructural model in order to define different architectures in a dynamic and agile fashion to fit the specific application at hand, such as enforce code reuse or separate design and implementation of modules and components in order to have the choice of implementing them either in HW or SW. The solution is to adopt what is known in software engineering as component-based development (CBD) paradigm [1]. The main idea underlying CBD is that development must be achieved by connecting independent parts which are called components. At this point, I guess there is great confusion about the notion of a “component.” Isn’t it an object? The key point is that, different from objects in OOP, components are provided with semantics — which between you and me is a complex word for “meaning.” How can we provide components with meaning? The answer is that we refer to a component model which classifies components into two classes:

FIGURE 2. Dependability is a fundamental issue for robots in the real world.

robotic system must be rendered more autonomous and smart. Communication. In the previous article, we assumed reliable and unlimited communication capabilities between the robots and other computational devices. In other words, we assumed the robot to be part of a network. However, in the presence of a dynamic system this communication coverage cannot be guaranteed anymore, since external factors can have (in principle) a dramatic impact over the system. In particular, it cannot be assumed any longer that the robot is able to receive direct commands and goals to carry out all the time, for instance when tele-operated. On the contrary, the robot must be provided with the necessary intelligence to identify goals, subgoals, and to reason upon what to do in case connection is lost or absent. Again, this can be achieved only by enforcing autonomous sensing and reasoning mechanisms. Dependability. This is a complex concept involving safety, robustness, and reliability. Obviously enough, this must be guaranteed all the time, in spite of missing communication, change of contexts, and real-time requirements. What is usually implemented is a priority-based mechanism among all the modules that constitute the system; execution is (in some way) guided and prioritized according to the current situation. For instance, a battery monitoring module must have higher priority over routine operations since the latter ultimately depends on the sufficient energy level.

Component-Based Software Development for Robotics Keeping all the previously introduced concepts in mind, designing software architectures for autonomous robots operating in unstructured and highly dynamic environments poses the following difficulties: •The simple architecture based on design-engineering

62

SERVO 10.2009

•Classes or objects, similar to those developed in OOP, which can be indifferently JavaBeans [2], .NET [3], or Corba Component models [4]. This class is directly supported by current technology since the corresponding components can be directly executed by their operating systems (compilers or virtual machines). •Architectural units, such those available in UML or KobrA [5] frameworks. This class includes frameworks that entail the manual or automated implementation of components. As you may have guessed, component composition is the central issue in CBD. Flexibility and reliability of an actual real-world robotics application are directly influenced by the compositionality of the used components, and therefore components of the second class are easily preferred. In other words, components replace objects to implement modules of a complete robotic architecture. In

particular, it is widespread in the robotics community to think about components as architectural units, enabling the robotics engineer to: •Specify very precisely both requirements and services that characterize a given component. In particular, with “requirements” we refer to the information needed to operate, whereas with “services” we refer to the information that can be provided by the component. If you recall our previous example of a battery monitoring module, the requirement is the batteries voltage level, whereas the service provided is — upon request — an estimate of the charge level or the time left for operations. •Define the composition of many components in a dynamic way. In fact, it is possible — given a certain high-level goal or task to accomplish — to compute what components are needed on the basis of their offered services. Since they have requirements, in order for them to operate other components are needed which services match the previous requirements. This, of course, can be done on-line to allow software reconfiguration. This mechanism allows robots to overcome the limitations that affect real-time requirements, communication, and dependability in case of incomplete knowledge about their environments. Real-time can be guaranteed again, since components can be scheduled on the basis of well-defined computational requirements; the proper functioning of the entire system can be managed also in case of communication failures, since the proper components can be activated to overcome the lack of information. Finally, dependability is enforced, since specific components can be activated on the basis of well-defined (also dynamically) priorities. The previous features cannot be directly obtained using OOP since objects only publish their services through the mechanism of method invocation; that is, a static link between objects. During the past few years, the CBD paradigm has been at the basis of many successful frameworks for robot development, such as Orocos [6] and ORCA [7]. As a result, these frameworks exhibit a high rate of usability and ease of use. However, so far little flexibility has been gained with respect to the implementation platform, which is invariably the couple Linux/C++. So, what do you expect? Download that Linux distribution and pick up the old C++ book from the shelf!

Resources [1] http://en.wikipedia.org/wiki/Component-based_ software_engineering [2] http://java.sun.com/javase/technologies/desktop/ javabeans/index.jsp [3] www.microsoft.com/NET/ [4] www.omg.org/technology/documents/formal/ components.htm [5] wiki.lassy.uni.lu/se2c-bib_download.php?id=700 [6] www.orocos.org/ [7] http://orca-robotics.sourceforge.net/orca/index.html

part series describing general current trends in software development for robots. Some useful comments can be made: 1. Software architectures depend greatly on both the robot operating environment and the tasks that must be performed; that is, the interaction with the environment. 2. Object Oriented Programming (OOP) is a powerful design and programming paradigm that can be used when things are fairly simple: static environment and static interaction with the environment. 3. If you want to take more complex scenarios into account, OOP is no longer suitable. You need the ability to quickly reconfigure your system to deal with sudden needs. This leads to novel solutions on the software side of robotics and, in particular, the adoption of componentbased software development. Obviously, this does not ease the life of designers in the short term, but it will in the long run. Stay tuned! SV FIGURE 3. A robot is a complex system made up of many parts: sensors, actuators, and computational devices.

Conclusion This article concludes a two-

SERVO 10.2009

63

The SERVO Webstore Attention Subscribers ask about your discount on prices marked with an *

“EDITOR’S PICKS”

ELECTRONIC NEWBIE DIY Design Electronics Kit

125 Physics Projects for the Evil Genius Getting Started in Electronics by Forrest Mims

To get really good at electronics, you have to have an excellent grasp of the basics. Short of a college degree in physics which can be dry and unrelated to reality there are a number of excellent introductoThe title says it all. I grew up reading ry texts, including 125 Physics Projects for books on electronics by the author, Forrest the Evil Genius. This is an excellent Mims, and they're still the best for learning overview of physics with a practical bent. about — and reviewing — the basics. If No quantum theory here, but practical you're new to electronics, this is a mustphysics that you can apply to your next have for your bookshelf. mechanical/electronics project. $19.95 $24.95 Editor Bryan Bergeron’s recommended reads. Find these and many more great titles in the SERVO Magazine Webstore!

NEW ! This great kit contains everything you need to learn the basics of electronic circuit design. It contains all of the most common electronics components as well as a prototyping breadboard for you to get started right away. The kit has over 130 parts! No soldering is required and the included 32 page illustrated manual guides you through each of the projects. After you build all of the projects, you can use the parts for your own designs. For a complete product detail, please visit: http://store.nutsvolts.com $49.95*

ROBOTICS PIC Robotics by John Iovine Here's everything the robotics hobbyist needs to harness the power of the PICMicro MCU! In this heavily-illustrated resource, author John Iovine provides plans and complete parts lists for 11 easy-to-build robots each with a PICMicro "brain.” The expertly written coverage of the PIC Basic Computer makes programming a snap -- and lots of fun. $24.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

64

SERVO 10.2009

Robot Building for Dummies by Roger Arrick / Nancy Stevenson Discover what robots can do and how they work. Find out how to build your own robot and program it to perform tasks. Ready to enter the robot world? This book is your passport! It walks you through building your very own little metal assistant from a kit, dressing it up, giving it a brain, programming it to do things, even making it talk. Along the way, you’ll gather some tidbits about robot history, enthusiasts’ groups, and more. $24.95

Build Your Own Humanoid Robots by Karl Williams GREAT 'DROIDS, INDEED! This unique guide to sophisticated robotics projects brings humanoid robot construction home to the hobbyist. Written by a well-known figure in the robotics community, Build Your Own Humanoid Robots provides step-by-step directions for six exciting projects, each costing less than $300. Together, they form the essential ingredients for making your own humanoid robot. $24.95*

Robot 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

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.

To order call 1-800-783-4624 RobotBASIC Projects For Beginners byJohn Blankenship, Samuel Mishal If you want to learn how to program, this is the book for you. Most texts on programming offer dry, boring examples that are difficult to follow. In this book, a wide variety of interesting and relevant subjects are explored using a problem-solving methodology that develops logical thinking skills while making learning fun. RobotBASIC a powerful, yet extremely easy-to-use, computer language available for any Windows-based PC is used throughout the text. $14.95

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, 07, and 08.

$57

Happy Halloween Everyone! 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

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

SERVO 10.2009

65

Or order online www.servomagazine.com SPECIAL OFFERS

Proto Buddy Kit & Book Combo For those just getting started in electronics as a hobby, a solderless breadboard (SBB) is the perfect platform for building those first circuits. Attach a Proto Buddy to an SBB, include a battery or two, and you will have a combo that has a lot of the same functionalities as more expensive units. Combo includes PCB & Components, 830 point SBB, and Do-It-Yourself Circuitbuilding For Dummies.

Combo Price $57.95 Plus S/H Limited time offer.

FIRST Robots: Rack 'N' Roll: Behind the Design by Vince Wilczynski, Stephanie Slezycki More than 750 photographs! The second annual book highlighting the creativity and process behind 30 winning robot designs from the 18th annual,nternational FIRST Robotics Competition. The FIRST organization, founded by Dean Kamen (inventor of the Segway) promotes education in the sciences, technology and engineering. Reg $39.95 Sale Price $29.95

Making PIC Microcontroller Instruments and Controllers by Harprit Sandhu Harness the power of the PIC microcontroller unit with practical, common-sense instruction from an engineering expert. Through eight realworld projects, clear illustrations, and detailed schematics, Making PIC Microcontroller Instruments and Controllers shows you step-by-step how to design and build versatile PIC-based devices. Reg $49.95 Sale Price $42.95

PROJECTS

Das Blinkenboard Kit As seen in Nuts & Volts June issue, Personal Robotics. by Vern Graner This kit includes a pre-programmed ATtiny84 microcontroller that sports eight software PWM channels to control motor speed and light brightness. Jumper selectable patterns can be used to operate motors, solenoid valves, relays, or any DC load up to 24V/500 mA per channel! Expand your board with GNU/GPL software updates featured in upcoming articles.

Subscriber’s Price $32.45 Non-Subscriber’s Price $35.95 PCBs can be bought separately.

66

SERVO 10.2009

Talking Skull Kit

Tankbot Kit & Brain Alpha Kit

I’m Back !

Get ready for a tech-scary Halloween! New for 2009, optional circuitry can be added to this kit. See Talking Skull Updates in Nuts & Volts September issue. For more information, please visit http://store.servomagazine.com Subscriber’s Price $69.95 Non-Subscriber’s Price $73.75

As seen in the Sept. issue Tankbot/ Brain Alpha by Ron Hackett A series filled with projects and experiments to challenge you through your learning process while you grow your fully expandable Brain Alpha PCB!

The brain is a PICAXE-14A! For more info & pictures, visit the SERVO Webstore. Tankbot and the Brain Alpha Kit can be purchased separately. Combo Price $ 138.95

by William Smith

PICkit 1 Programmer I often like to visit antique shops to look at old tools and equipment that people used before electricity was so common. Now that electronics have been around for so long, I’m starting to see the beginnings of electronic antiques. Old computers and circuit boards can be interesting to look at; many of the components are so much larger compared to today’s units. Sometimes electronic development tools can still be functional but considered outdated to experienced users. When you are a beginner, however, it’s all new to you. Sometimes an old development board might be very useful to a beginner. The PICkit 1 programmer falls into this category quite nicely. f you are new to using Microchip PIC microcontrollers, then you have probably seen many different PIC programmer modules to load a software program into a PIC. Microchip has numerous versions, of course, and they recently released a PICkit 3 programmer to replace the PICkit 2. The PICkit 2 was released to replace the PICkit 1. Along the way, however, some things were left off the new designs. The PICkit 1 only supports a handful of parts, but it also includes an extra circuit board to build a design from. None of the replacement programmers offer that. The PICkit 1 is a leaded design so you can see all the components that make up the programmer, so things can easily be fixed if something fails on the board. The manual even includes a schematic so you can try and build one yourself which is a great home project for the more aggressive beginner. I had a PICkit 1 sitting on a shelf and frankly I never did much with it. After looking it over though, I thought this could be a great starter platform. So, let’s take a look at this future electronic antique and see what we can do with it. Figure 1 shows the PICkit 1 in its complete form with the extra development board on the side. The programmer circuit occupies the left side of the main board and

I

the right side has some LEDs, a switch, and a potentiometer prewired to the 14 pin socket. The board comes with an eight pin PIC12F675 microcontroller. A 14 pin PIC and an eight pin PIC share the same location of many pins, so a 12F675 eight pin microcontroller works in the same 14 pin socket. Figure 1 has the 12F675 installed. Even though this programmer is an older model, you can still purchase it from MicrochipDirect.com under part Figure 1. PICkit 1 Programmer Board.

SERVO 10.2009

67

number DV164101. The package you receive includes the following: • PICkit 1 Circuit Board with eight-pin PIC12F675 • PICkit 1 Flash Starter Kit CD-ROM, including the HI-TECH PICC™ LITE C Compiler • MPLAB® Integrated Development Environment CD-ROM • Software and Hardware “Tips ‘n Tricks” Booklet for eight-pin Flash PIC Microcontrollers • USB Interface Cable The programmer can be controlled from the Microchip MPLAB IDE or from standalone GUI software. When you install the PICkit 1 software on your PC, these various version are installed within your Start>Programs menu in Windows. The first version is the PICkit Classic interface that supports the parts below: PICkit Classic V1.74 supports these mid-range Flash PIC® microcontrollers: • PIC12F629, 635, 675, 683, • PIC16F630, 636, 676, • PIC16F684, 685, 687, 688, 689, 690, 785 • PIC16F913, 914, 916, 917, 946 Another version is the Baseline Flash version that supports the parts listed below: PICkit Baseline Flash V1.30 supports nine Baseline Flash PIC® microcontrollers: • PIC10F 200*, 202*, 204*, 206*, 220, 222 • PIC12F508, 509, 510 Figure 2. MPLAB Select Device Screen.

• PIC16F54*, 57*, 59* • PIC16F505, 506 * Some devices require an adapter for compatibility. See TB079 for complete details I copied this information from the Microchip website and you’ll notice the disclaimer about needing an adapter. What is interesting is some of the parts listed for the V1.74 or the V1.30 don’t fit in the 14 pin socket. This can add further confusion for a beginner. I prefer to use MPLAB so I can write my code and program the part from one central interface. I believe that is a better path for the beginner, as well. When you are running MPLAB — which you can download and install for free from microchip.com/mplab — you can find out if a part is supported by MPLAB/PICkit 1 by going to the configure>select device menu choice and then select your part from the drop-down menu. I selected the PIC12F675 as seen in the screenshot in Figure 2. It shows a green dot for the PICkit 1 meaning the PICkit 1 and MPLAB support that part. The full list of MPLAB/PICkit 1 supported eight and 14 pin parts are: Eight Pin 12F508 12F509 12F629 12F635 12F675 12F683

14 Pin 16F688 16F684 16F676 16F636 16F630 16F505

Tutorial The PICkit 1 manual is on the included CD and can also be downloaded at the Microchip. com/pickit1 website. The manual has a tutorial section in it that steps you through seven different projects. The projects below are: Lesson Lesson Lesson Lesson

1 2 3 4

— Switch Debouncing — State Machines — Interrupts — Analog-to-Digital Converters and Comparators Lesson 5 — Data Tables in Program Memory Lesson 6 — Using EEPROM Memory Lesson 7 — Frequency Counting with Timer1 Gate Each of these lessons has the code included on the CD (you can also download all of them as a complete .zip file). Personally, I found the instructions for these projects a bit difficult for the beginner to understand, but it’s nice to see that both assembly and C versions of the code are included. Also included is a .hex file so you don’t even have to compile or assemble the code. You can just program the code

68

SERVO 10.2009

directly in with those .hex files.

PICkit 1 Schematics When you are ready to write your own programs, you can refer to the schematics for the PICkit 1 which are included in the manual. You’ll need these to understand how the LEDs are wired on the board. They are set up to connect between two ports so you have to have one port pin low and the other port pin high just to light a single LED. What this allows, though, is fewer I/O pins needed to control multiple LEDs since they share some of these pins in a multiplexed arrangement. Getting a program to drive LEDs, read a switch, and read a potentiometer is a great way for a beginner to start programming. Since I found the tutorial a little confusing, I decided to write a few programs of my own using the sample version of the PICBASIC PRO Basic language compiler available from microEngineering Labs (www.melabs.com). This compiler only supports the eight pin 12F683 and the 14 pin 16F688. I decided to use the 16F688 to get the most I/O possible, though the projects could just as easily be completed with the eight pin 12F683. This is because all the component connect to the upper eight pins of the microcontroller socket. I’ll show you three projects that: 1) drive the LEDs; 2) read the switch; and 3) read the potentiometer on the PICkit 1 board. You will need to install the PICBASIC PRO Basic compiler sample version prior to installing MPLAB. You can download that software for free at melabs.com/pbp demo.htm. Instructions for installing it within MPLAB are included in a readme file that is part of the download. You can also get details on this from melabs.com/ support/mplab.htm.

Figure 3. PICkit 1 Board LED Schematic. TRIS_D2_D3 con %00101011 TRIS_D4_D5 con %00011011 TRIS_D6_D7 con %00111001

Project 1 Software ‘ PICBASIC PRO Example program to light each LED ‘ with a PIC16F688 ANSEL =

0

‘Intialize A/D ports off

TRIS_D0_D1 con %00001111

‘TRISIO setting for

D1 setting for D3 setting for D5 setting for D7

main: TRISA = TRIS_D0_D1 PORTA = %00010000 Pause 500 PORTA = %00100000 Pause 500 TRISA = TRIS_D2_D3 PORTA = %00010000 Pause 500 PORTA = %00000100 Pause 500

TRISA = TRIS_D4_D5 PORTA = %00100000 Pause 500 PORTA = %00000100 Pause 500

Project 1: Driving LEDs This first project will scroll through the LEDs, lighting each one in sequence. The trick is to drive the I/O correctly to light the LEDs with a high at one end and a low at the other. The schematic for the LEDs is shown in Figure 3. The eight LEDs are multiplexed between four I/O pins so the software requires more than just driving the port high or low. Only two of the I/Os can be active outputs at a time. The others need to be in high impedance input mode so they won’t light the wrong LED. I use both a TRIS command line to set the input/output state and direct writes to the port pins.

‘D0 and ‘TRISIO ‘D2 and ‘TRISIO ‘D4 and ‘TRISIO ‘D6 and

TRISA = TRIS_D6_D7 PORTA = %00000100 Pause 500 PORTA = %00000010 Pause 500 Goto main

‘ ‘ ‘ ‘ ‘ ‘

D0 LED Delay for .5 seconds D1 LED Delay for .5 seconds

‘ ‘ ‘ ‘ ‘ ‘

D2 LED Delay for .5 seconds D3 LED Delay for .5 seconds

‘ ‘ ‘ ‘ ‘ ‘

D4 LED Delay for .5 seconds D5 LED Delay for .5 seconds

‘ ‘ ‘ ‘ ‘ ‘

D6 LED Delay for .5 seconds D7 LED Delay for .5 seconds

‘ Go back to loop and blink ‘ LED forever

End

Project 2: Sensing a Switch In this project, when the switch is idle, the D0 LED will light. When the switch is pressed, then the D1 LED will light. It’s that simple and is a great example of how to read the PICkit 1 switch. Figure 4 shows the schematic for the switch SW1. The switch on the PICkit 1 board is connected to the RA3 pin which is also the MCLR or reset pin on the 16F688. To make this project work and read the switch properly, SERVO 10.2009

69

‘D2 and D3 TRIS_D4_D5 con %00011011 TRIS_D6_D7 con %00111001 D6 and D7

‘TRISIO setting for D4 and D5 ‘TRISIO setting for

main: TRISA = TRIS_D0_D1 IF PORTA.3 = 1 then PORTA = %00010000 Else PORTA = %00100000 ENDIF Goto main

‘ D0 LED ‘ D1 LED ‘ Go back to loop ‘ and blink LED ‘ forever

End

Figure 4. PICkit 1 Board Switch Schematic.

the configuration setting has to be set up to put the MCLR pin into internal mode and the RA3 pin in to I/O mode. In PICBASIC PRO, that is handled in a separate file 16F688.INC. The second line in that file is for the MPASM assembler used by MPLAB. The line will probably look like this: __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF

You need to change it to the line below where MCLRE is changed from ON to OFF: __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF

Save the file and then compile your program. The part should get the proper configuration programmed in and should run fine.

Project 3: Sensing a Potentiometer This final project will light an LED based on the position of the potentiometer. Figure 5 shows the schematic. As you turn the potentiometer left of center, the D6 LED will light up. If you turn it right of center, the D7 LED will light up. The PICBASIC PRO ADCIN command will work well here to read the potentiometer. We also have to set up the RA0 pin to be an analog port.

Project 3 Software ‘ ‘ ‘ ‘ ‘

PicBasic Pro program to test postion of Potentiometer connected to analog input to channel-0 (RA0) Light D6 LED if POT is right of center Light D7 LED if POT is left of center

‘ Define ADCIN parameters Define ADC_BITS 8 Define ADC_CLOCK

3

Project 2 Software

Define ADC_SAMPLEUS

50

‘ PICBASIC PRO Example program to light D0 LED ‘ if switch is pressed ‘ and light D1 LED if the switch is left open.

adval

ANSEL =

0

‘Intialize A/D ports off

TRIS_D0_D1 con %00001111 TRIS_D2_D3 con %00101011

Figure 5. PICkit 1 Board Potentiometer Schematic.

var

byte

TRISA = %00111001

‘TRISIO setting for ‘D0 and D1 ‘TRISIO setting for

‘ ‘ ‘ ‘ ‘ ‘

Set number of bits in result Set clock source 3=rc) Set sampling time in uS

‘ Create adval to ‘ store result

ADCON1 = %00000001

‘ Set PORTA to all ‘ input ‘ Set PORTA analog

Pause 500

‘ Wait .5 second

ADCIN 0, adval

‘ Read channel 0 to ‘ adval

Main:

If adval > 127 then PORTA = %00000100 ELSE PORTA = %00000010 ENDIF

‘ D6 LED ‘ D7 LED

Pause 100

‘ Wait .1 second

Goto Main End

‘ Do it forever

Conclusion These were very simple projects but actually gave me a

70

SERVO 10.2009

few issues while trying to make them work. I would prefer to have the LEDs on separate I/O pins instead of the multiplexed arrangement because it can get very confusing trying to make sure the TRIS settings are correct for each set of LEDs you want to drive. I also would prefer the switch was on a standard I/O pin instead of the MCLR pin to eliminate the configuration setting confusion. Despite these few changes, I found the PICkit 1 a very reliable programming board. A beginner could really learn a lot just using this simple, low cost platform. The PICkit 2 or PICkit 3 are more universal because they can plug into any board with a six pin programming header, so I see why many people prefer to use these programmers instead for development. If you are just getting started though, the PICkit 1 is a great little board to have. You could also try to write the projects I created using the HI-TECH C compiler included with the board or the MPASM assembly language assembler built into MPLAB. The challenge would be to re-write the projects in assembly language or C. If you can complete those projects, you are well on your way to becoming an experienced programmer and you’ll probably find yourself putting the PICkit 1 on the shelf and moving on to more advanced development boards. At some point, maybe we’ll see a PICkit 1 sitting in an antique shop. You just never know. SV

What is the missing component?

Industry guru Forrest M. Mims III has created a stumper. Video game designer Bob Wheels needed an inexpensive, counter-clockwise rotation detector for a radio-controlled car that could withstand the busy hands of a teenaged game player and endure lots of punishment. Can you figure out what's missing? Go to www.Jameco.com/unfurl to see if you are correct and while you are there, sign-up for our free full color catalog.

1-800-831-4242 SERVO 10.2009

71

Tune in each month for a heads-up on where to get all of your “robotics resources” for the best prices!

Here Come the (Paper?) Robots! t least once a month, I get email from a mom or grandparent asking for my advice about the best robot kit for their seven year old. Oh, and they don’t have much money to spend, so can the kit be under $20, and preferably under $10? Having had my own kids and grandkids, I know the excitement they feel at the prospect of building a robot, but expectations run high in an adult population that has no experience in constructing robots. A single new RC servo motor costs at least $10. Even the most thrifty builder is hard-pressed to not spend at least $100, assuming they’re not raiding their own junk box (which a seven year old child probably doesn’t have, am I right?!). Turns out kids are a lot more willing to consider the alternatives than building the latest Robonova. To them, the process of building a robot is less about the mechanical construction than it is the fantasy and game-play that goes through their heads while doing it. If you’ve got young kids interested in robots — and especially if you don’t have a lot of pocket change to indulge them — there’s always paper robots. That’s right, robots made out of paper. And why not? Kids (and even adults) have been building paper models for centuries. Why should robots be any different? You’d be surprised at the resources — free and otherwise — for making paper robots.

A

72

SERVO 10.2009

Paper Bot Anatomy Paper robots are so simple they hardly need an introduction, let alone a description. But for the sake of completeness, let’s quickly review the two main types so you can decide which is best for you and your robotloving kids. The most basic paper robot is a 2D affair (just like a paper doll) except it’s of Robby the Robot rather than Sally the Schoolgirl. With paper dolls, you overlay paper clothes on top of a paper person, and the same idea is extended to robots. Most of the 2D paper robot designs you’ll see are intended to be humorous. You mix and match funny-looking robot parts, like a decidedly male robot head with the body of a female robot maid — dress and all. Far more common in robotland is the 3D paper bot. These are constructed by cutting out the various body pieces, folding along prescribed lines, then sticking the parts together using glue, pins, and other assorted hardware. Since robots are intended to be moving mechanical creatures, it’s not uncommon for their 3D paper facsimiles to be articulated, at least at the elbow and knee joints. Depending on the model, the articulation can be quite elaborate. You’d be amazed at what some of the paper robot designers have dreamed up.

Print, Color, and Cut Out You’ll find lots and lots of

preprinted collections of paper dolls already colored, and maybe even laser cut so you don’t need scissors. With a few exceptions, most of the paper robots you’ll find require you to print them out. If you have a color printer, you can add color from your PC or, if you’re printing in black and white you can color them in. Most of the paper robot resources are free, where people share their 2D and 3D designs. Often the designs are produced as PDF files, so you need Adobe Acrobat, Foxit, or another PDF reader. For example, wander over to www.paperrobots1999.com and you’ll find a dozen or so premade robot paper cutout designs. All are free, in color, delivered on PDFs, and have instructions included with them. Use an inkjet or other color printer to print them, cut ‘em out, and start gluing. Arms and legs are articulated using fine string or fishing line. This allows the joints to move without adding a lot of extra weight to the model. A good example of the simple-isbetter approach is the 2D design found at the Family Craft blog www.ourbigearth.com/2009/01/27 /family-craft-paper-robots. Using only colored construction paper, brass paper fasteners, and plastic beads, the blog entry shows how easy it is to captivate the imagination of small children in building simple mechanical devices. The “girl” version of the robot has a girl’s head with blonde hair; the head on the “boy” version is a

menacing attack-o-bot with articulated jaws and serrated teeth. Naturally. Not all paper robots are constructed out of flat or folded paper. There’s rolled paper, too, deftly demonstrated in the Piperoid line from Japan (and available elsewhere through distributors; check out their Web page at piperoid.jp/en /index.html and click the Distributors link). Piperoids are made out of paper rolled into tubes, or pipes. Holes and slots are placed at certain points to facilitate construction. The pipes are then crimped or folded to make various shapes, like shoulders, arms, legs, and bodies.

Book With CD: Build Your Own Paper Robots If you’re looking for the complete packaged plan, look no further than a new book titled Build Your Own Paper Robots. This is one of those “wish I had thought of it” books. The book is authored by professional animators and modelers. It’s 96 pages and comes with a CD with all the design patterns. The disc contains 14 customizable robot templates for some 250 variations. All designs print on letter-size paper; with or without color. The construction plans are step-by-step isometric views, showing how to fold the pieces to make the constituent body parts and put it all together. Seems like a lot of fun.

and scrap booking. Not all of these materials are kid safe, though, so read the cautions on the package and provide adult supervision if necessary. Just as an example, many craft stores dedicate an entire section to just art glitter and glitter paints. Some of this stuff is high-tech (made of highly refractive glass). Some of it is even ground-up semiprecious gems, like amethyst and specialty quartz. The glitter is held in a suspension that dries clear. If you apply it correctly, it’s hard to rub off. Then there are the wide assortments of inks and pens with different and interesting properties. I already mentioned blacklight pens; under ordinary light the color is normal, but under a blacklight the color glows, or changes completely. You may want to opt for the water soluble inks if your kids tend to get more on themselves and their clothes rather than on their project. The waterproof kind is semi-permanent which means the marks will stay for a few days on skin; likely for weeks, months, or even years on clothes and furniture, though! Unless you’re a purist, there’s no rule that says a paper robot must be

100% made out of paper. It’s okay to mix and match mediums. If the paper can hold the weight (use heavy or stiff paper, or print two copies and sandwich them), consider adding wooden ice cream sticks, colored pipe cleaners, neon colored frilly fringe, felt and rubber bits, and googly eyes to your robot designs. How about the electronic guts to an old musical Christmas card that played Santa Claus is Coming to Town? Anyone up for making a maniac robot Saint Nick? And, of course, look around the house for free stuff that you might otherwise think of as filler for the garbage can. How about robot bodies made out of empty bathroom or paper towel rolls, plastic bottle caps from packaged beverages, or straws. If you need some heavy paper, look no further than the empty cereal box from this morning’s breakfast. Cut the box apart and cover it with your robot pattern. After you’ve assembled one or two paper robots, you get the idea how it’s done. 3D robot bodies are constructed using tried-and-true papermaking techniques involving tabs and fold lines. There are books you can

Paper Robots 1999 offers a dozen free paper robot designs. Just download, print, cut out, and glue together.

Embellishing and Making Your Own As good as many of these paper robots designs are, there’s no need to exactly duplicate everything just the way you find it. This stuff is made out of paper, after all, and if it’s paper, you can draw on it with anything from wax crayons to blacklight sensitive fluorescent paints; glue stuff to it; even add sprinkles of magic robot dust. In case you don’t have all this stuff in your house already, merely walk down the aisles of any craft store and you can easily spend your next paycheck buying all the cool stuff made for other paper craft hobbies SERVO 10.2009

73

find explaining the mechanics. Some schools require students to make solid geometric shapes. You can find various polyhedra models (dodecahedron, icosahedron, and many others) and practice an art form that literally goes back several thousand years. Paper models for these shapes aptly demonstrate the principles of construction. Before long, you’ll be able to easily replicate these techniques with most any robot design, especially if you stick with cube shapes. Curves and even semispherical shapes are a bit harder, but they’re still doable with practice. If you’re into origami, you can combine traditional paper model construction with folded paper effects. Rather than a robot head made out of a cube, for instance, how about the graceful shape of a falcon or flamingo. You can draw the designs out by hand, but if you have a vector graphics drawing program you can draft out your designs. There are even commercial and open source programs designed just for the purpose of making 3D paper shapes. For example, paper-model.com offers a free, open source software called PaperCut that allows you to design various kinds of geometric shapes on your computer,

and it generates the tabs, cuts, and folds for you. You can adapt many of these shapes to make robot bodies, heads, and other parts. It’s for Windows, and was written in Visual Studio 2005. Out of Japan (where paper modeling is a fairly popular past time), there’s Pepakura Designer at www.tamasoft.co.jp/pepakura-en. It’s shareware (under $40). The software is able to take many shapes from 3D data files (3D Studio, Lightwave, Autocad), “unfold” them to 2D, and provide a constructible paper model. You can manually add or alter tabs, resize elements, and add additional fold lines and coloring. Aspex Software (www.aspexsoftware. com) offers numerous shape-modeling programs. Their Tabs program lets you break out a 3D shape and make foldable patterns for constructing paper models. Basic 3D building block shapes are included — like the square or cone — which you can then incorporate into other more elaborate designs.

factors, you may not want to leave them to tackle the job on their own. It can be fun to help your kids build a paper robot, but just remember that they should be the ones doing the heavy lifting. Don’t be concerned about mistakes; it’s easy to print a replacement sheet and start over. Kids should be encouraged to try it themselves, even if they don’t get it right the first time. If you’re worried about your child using scissors, do the cutting yourself, and hand off the folding and gluing to them. Most white glues (like Glue-All or Borden’s) are nontoxic and washable. However, it can take several minutes to dry, especially if the paper has a slick surface. While there are faster setting glues, many of them are not kid-safe, either because they contain toxic chemicals or can cement little fingers together. Who knows. Maybe it will be paper robots today but the “real thing” tomorrow.

Time With the Kids, or Kids Alone

Arts & Crafts Sources

Paper robot making is a safe and fun activity for children five and older, but depending on their age and other

Pepakura Designer helps you create 3D paper models from solid shapes.

Following are online sources for paper, arts, and craft goods that go into the making of enhanced paper robots. Activa Products, Inc. www.activaproducts.com Arts and crafts supplies. Includes casting and mold making supplies. ArtSuppliesOnline.com www.artsuppliesonline.com Art supplies: craft boards (such as foam board), plastics, adhesives, and lots more. Their online store lets you browse by category or search for specific products by name or brand. Art Supply Warehouse www.aswexpress.com Artists accessories, brushes, foam boards, and paints. Clotilde, Inc. www.clotilde.com Online and mail order (printed

74

SERVO 10.2009

COOL RESOURCE OF THE MONTH Mark III Robot www.junun.org While the Mini Sumo Mark III robot is the center of their product lineup, Junun offers a bevy of parts and accessories to complement any robot design. First, the Mark III: This kit complies with the mini Sumo design restrictions that limit the size of the robot to 10 cm by 10 cm, and the weight to under half a kilogram. The robot comes with the motors and all hardware necessary for construction, and it includes a controller board with a preprogrammed PIC microcontroller. Price is $92. You can purchase just the chassis or mechanical parts if you already have the servo motors and controller board. Junun is also known as a low cost source for the popular Sharp infrared sensors, such as the GP2D12 and GP2D15. They even provide the hard-to-find connection cables for these sensors — also a discounted price. You’ll find the full Devantech lineup of electronic compass and ultrasonic sensors, voice synthesizer chips and development boards, rate gyros, and a selection of GWS servos, from micro to standard size. Filling out their product line is the MEGAbitty controller and sensor boards for constructing robots in the ant weight class.

catalog) for sewing and quilting supplies. Look over things like fusing tape (partially melts when heated), small tools, rotary cutters (useful for foam board and other lightweight laminates), and elastic material.

general art supplies. Fastech of Jacksonville, Inc. www.hookandloop.com Velcro distributor. Online sales. FLAX Art & Design www.flaxart.com Art supplies: adhesives, paints, substrates, craft, and drafting. Hobby Lobby www.hobbylobby.com Hobby Lobby (a chain of arts and crafts stores) is not to be confused with Hobby Lobby International (a mail order retailer of hobby R/C components). Hobby Lobby locations are throughout the central United States. Hygloss Products, Inc. www.hygloss.com Manufacturer of children’s arts and craft supplies. These include specialty paper, pre-cut Styrofoam pieces, and foam sheets. Michaels Stores, Inc. www.michaels.com Michaels sells arts and crafts, both online and in some stores across

North America and Puerto Rico — they’re the largest such retailer, in fact. MisterArt www.misterart.com The site bills itself as the “World’s largest online discount art supply store.” Looks to be true — they have a lot of stuff! Quite a bit of supplies for paint artists, as well as foam core, precision tools, and adhesives. Nancy’s Notions www.nancysnotions.com Online and mail order (printed catalog available) of sewing supplies. Let your imagination run wild. Quincy www.quincyshop.com Art supplies, craft kits, tin toys (Futurama), and miscellaneous toys that can be hacked apart to make robots. Reuel’s www.reuels.com Art and framing supply store. Local and online. Products include: adhesives, airbrushes, craft supplies, sculpting supplies, and foam board. SV

Michael’s provides an online store, as well as local stores in many areas of the country.

Crafter’s Market www.craftersmarket.net Crafts, including knitting and needlepoint. Use the plastic needlepoint “canvas” for making grilles, bumpers, and other parts for your robot. Local and online stores. Dick Blick Art Materials www.dickblick.com Complete line of craft materials and art supplies. Also local stores (predominately in the Midwest and Great Lakes areas of the United States). Dixie Art & Airbrush Supplies www.dixieart.com Airbrushes and compressors; SERVO 10.2009

75

a n d

Then NOW ROBOT ANIMALS STRIVE TO MATCH HUMANOIDS IN REALISM b t didn’t take inventive designers and experimenters long to determine that creating realistic robot human beings was close to impossible. David Hanson has come as close as anybody in creating very realistic robotic human faces and heads, and the Japanese and Koreans have made some fairly realistic complete human robot bodies. But they are still a bit far off to be considered identical to humans. Animals, on the other hand, seem to be what most robot experimenters try to build when attempting to

I

FIGURE 1. The Electric Dog.

FIGURE 2. Electric Dog being controlled by a flashlight.

76

SERVO 10.2009

y

T

o

m

replicate life forms. Everything from baby harp seals, hamsters, deer and moose, fish, birds, snakes, and virtually every other type of living creature has been re-created in some form or another. It is still cats and dogs that most experimenters and potential manufacturers want to create and distribute to the general public. We’ve been inundated with some very sophisticated robotic pets for several years now. Christmas will soon be upon us and many Christmas wish lists will include one or more of these electronic marvels. Simple semi-mechanical animals with movable articulated legs, heads, and mouths were constructed many centuries ago, but it was not until the age of spring-wound automata that these devices actually became a bit more realistic. In the 1700s and 1800s, most of the more sophisticated automata were formed in the image of humans and were ornately dressed and coiffed. Many of today’s automata that are intended to look like human beings are very much in the form of humanoid robots, whereas the animal automata are becoming more animal-like with realistic fur, motions, and sounds. In this article, I’d like to examine more of why we have created the many types of robot animals we have rather than what has been produced. Some were created as more of a test platform to prove control techniques such as

C

a

r

r

o

l

l

the electric dog we’ll discuss in a moment. Many were intended to be unique toys such as Pleo the dinosaur, alien creatures such as the Furby, and even flying robot insects. But still, robot dogs seem to be the most popular. Sony did deviate a bit in the Aibo line when it created a cat instead of a dog, but quickly went back to canine production.

The Electric Dog of 1912 The original ‘electric dog’ was more of a proof of concept device or scientific curiosity than a functional synthetic pet as it was first called an ‘orientation mechanism.’ Designed by US researchers John Hammond, Jr. and Benjamin Miessner in 1912, this anything-but-a-dog shown in Figure 1 allowed the men to perfect their homing system for later use in weapons. I’ve included this unique device, not because it was a true artificial animal, but because it was one of the first determined efforts by an experimenter to use simple AI techniques to direct an autonomous vehicle. Figure 2 shows the robot being controlled by a flashlight. It was known as a ‘phototrophic selfdirecting robot’ in that it followed a light using selenium photocells and a simple relay circuit. The media people of the day were amazed at the device, especially when Miessner told them “The electric dog, initially a ‘scientific curiosity,’ may within the very near

future become in truth a real ‘dog of war,’ without fear, without heart, without the human element so often susceptible to trickery, with but one purpose: to overtake and slay whatever comes within range of its senses at the will of its master.” Their work in the field of radiodynamics entailed the wireless control of mobile torpedoes and they hoped that these early test beds such as the ‘dog’ would end with perfection of teleautomata or even self-directing automata, which we now call artificial intelligence. In 1915, a radio-controlled torpedo was developed using the simple self-directing mechanism of their electric dog. In 1916, a variation of their torpedo (a dirigible torpedo) was described in that an enemy could turn a spot light on it and it would automatically be guided towards the light and the enemy. Figure 3 is a schematic of the electric dog — a most interesting circuit. Using a single wheel Ackermann steering drive system in the rear, solenoids are used to do the actual steering and a single DC motor is used for the propulsion. When a light was shone at one side of the robot’s front, the selenium photo cell on that side would drop in resistance — much like the later cadmium sulfide cells used today — and trigger the relay to close the larger pony relay. If the right photo cell was actuated, the two right side relays would cause the solenoid on the right to swing the back of the wheel to the right, thus turning the robot to the right; its the opposite for a left turn. Provide sufficient light to both photocells and the robot would run straight ahead. It is also interesting to note that all four relays have their own battery, and a main ‘storage battery’ drives the motor and solenoids. The schematic symbols are similar to today’s electronic symbols except for the pony relays. This is terminology not used since the 1920s. This is a forward-only robot, years before the indispensible H-bridge circuits that we use today to reverse motor current,

and obviously before the common use of DPDT relays. There was a DPDT switch in the motor circuit on the robot that would allow it to move in reverse in the presence of light. This reverse control was not under any sort of light-following mode but just to allow an operator to back it out of a tight space. The electric dog could only turn a hard right or left, or move straight forward at about three feet per second — a pretty good speed for a robot that size. The electric dog was not intended to resemble any sort of real pooch, but was called that by the media and the two researchers as a simple way of describing the light-following technique. The wheeled rectangular box was about three feet long and a foot high with two large five inch lenses on the front separated by a screen to prevent light from one side entering the lens on the other side. Biologists of that time compared it to a moth that follows a light. Two variations of the dog were conceived that used two radio antennas that utilized ‘Hertzian wave interference in the place of the cell-lens assemblies,’ and two microphones in another variation, though I personally haven’t seen how they accomplished it. Benjamin Miessner had several weapon ideas in mind when he wrote the book The Wireless Control of Torpedoes and other Mechanisms, describing his inventions in this manner: “This same type of automatic director is suitable for use with aerial torpedoes, explosiveladen mechanical moths, which will sweep down upon the ships of the air with a sting that will blow them into a thousand pieces.”

FIGURE 3. Electric Dog circuit.

The “Catsters” were touted as being “obedient, frisky, attentive, and always ready to play. Petster is the electronic pet with a microprocessor brain — housebroken, trained, and waiting for your companionship. Just like a real pet, Petster thinks with a mind of its own — responding to comFIGURE 4. Axlon Catsters.

Bushnell’s Petsters Jumping ahead to the mid 80s, Nolan Bushnell’s Petsters were called the “Smart, New Breed” in Axlon’s (his company) marketing program. Bushnell was better known for his Pong, Atari, Topo, and Bob robots, Teddy Ruxpin robot teddy bear, and Chuck E. Cheese restaurants. SERVO 10.2009

77

different robot animals: one that looked nothing like an animal and the other being more of a caricature of a cat. As I mentioned, the term electric dog was given by the media and adopted by the two experimenters for simplicity’s sake. It may have been more appropriate to call it a robot moth on wheels, but the term robot did not exist in 1912. When Bushnell created his Petster series over 70 years later, FIGURE 5. Hiroshi Ishiguro and ‘friend.’ FIGURE 6. Einstein atop Hubo. robots had long been in factories and there were many of us robot experimenters mands, playing games with you, and top of the round base that contained around. He and his design team letting you know that it’s having fun.” two C cell battery holders with the wisely did not try to build a robot Someone in our Robotics Society circuit board mounted on top (see cat or dog that looked exactly like of Southern California group managed Figure 4). the real animal. to have several hundred of the basic The rather flimsy dual gearmotor Walking gaits for robots back in Petster cats given to him quite cheaply /wheel assemblies were between the the early 80s were stilted and very and a bunch of us ended up with batteries. The “fur” cloth (seen sitting unrealistic due to the lack of decent about 10 each. Most were rejects but to the right) was slipped over the servos to construct multi-axis legs. we usually got about four or five body shell and a spring held the tail A lady bug beetle, turtle, or snail running out of the bunch, mostly by out. The eyes and nose lit up and were the only creatures that crawled trading parts. The body of this basic there was a speaker in the top for around with a shell-like body, and ‘cat model’ consisted of an eight-inch meowing and two electret micromany experimenters built robots black plastic shell top that snapped on phones (seen removed in the front) on of one of these creatures. The each side of the lower body. hemispheric shell was used for the A loud noise or a clap would FIGURE 7. A Fleshless Kitty on a Hasbro tour. popular turtle robots of that era, so turn the cat on. Another clap or Bushnell’s designers used that loud noise would send the cat on design concept for his robot cats. a mission to find the noise. Other The caricature cat face was a perfect clap commands would have the match for the non-cat body. cat meow, move forward or When Sony came out with the reverse, or go right or left. It Aibo robot dog in the 90s, they used would even purr if stroked or just no fake fur, the head was ‘futuristic,’ wander around on its own. and the ears were plastic rings on These goofy-looking cats some models. Some owners managed to endear the hearts immediately bonded with the robot of many, but not enough for like one would with a live pet while continued sales. The gearmotors others took a more distant stance. stripped their cheap gears and a Even with the multiple axes of leg lot of cats ended up in household motion and powerful processor, trash cans. A penguin, puppy, hiding the fact that Aibo was a spider, and a hamster were among robot made no sense at all. Tiger other Petsters that died a quiet Electronics’ less expensive I-Cybie was death. Despite their goofy facial also intended to be a robot dog first look, they still have admirers and and foremost, not a synthetic pet. It collectors. was made to partially resemble a dog by its body shape, but not be a true dog look-alike. Japanese robotics researcher Hiroshi Ishiguro is shown in Figure 5 I’ve discussed two entirely

‘Look and Feel’ of an Animal

78

SERVO 10.2009

FIGURE 8. The Uncanny Valley.

with his robotic twin. I don’t have to tell you which one is Ishiguro and which is the robot. The robot’s skin was cast from a mold made from the scientist’s face, the hair is real, and the clothes are, well, human clothes. We instantly recognize the real Hiroshi by those subtle nuances in facial expression, even from this still photograph. Just as we are more familiar with our own species, it is also easy for us to distinguish a synthetic robot animal from a living creature.

The Creepy Feeling of the Uncanny Valley

Figure 6 seems to be about as creepy as a robot can get, yet, does an amazing job of demonstrating two amazing facts. David Hanson’s very lifelike robotic head is world-class, and the Hubo body is also one of the world’s best life-size humanoid robots. The animal version of the Hubo-Einstein robot is the “Hasbro Tour Fleshless Kitty” shown in Figure 7. It tops the creepiness factor, possibly edging towards sicko, in my opinion. In the graphs in Figure 8, the dip in ‘likeability’ was nicknamed the ‘uncanny valley.’ It’s the point

FIGURE 9. Robot dogs.

when something rising to perceived perfection suddenly becomes very imperfect. You can see from the solid line in the graph that a stuffed animal quickly takes a dive into the valley when too much realism is applied to make it a true animal-appearing robot. The same applies to synthetic animals; this is why Sony, Tiger, and Axlon steered away from trying to make their pets very realistic, besides the great expense to develop the FIGURE 11. Wrex the Dawg.

FIGURE 10. Robot Cat from Meladom’s Blogspot.

Back in 1978, another Japanese robotics experimenter — Masahiro Mori — noticed a unique situation when people saw a series of robots, from barely human looking to more and more human appearing. The more humanlike the robots appeared, the more people were attracted to them — up to a point. When it became too realistic, people suddenly found them creepy and disgusting. The Einstein head atop the Korean Hubo in SERVO 10.2009

79

many more axes of motion. The two spindly-legged, antenna-eared robot dogs in Figure 9 appear quite cute. The robot cat in Figure 10 is a cat version of the space dogs. Wrex the Dawg in Figure 11 (made by WowWee) took the approach of adding wheels to the hind legs to thoroughly distinguish it from a real dog and give it a true robot look. It’s available for about $150.

Andrew Chase’s Cheetah One last amazing animal-lookalike I’d like to cover is Andrew Chase’s cheetah sculptures from Wired.com shown in Figures 12a and 12b. These works of art are not robots, though they can be positioned and posed in many variations. It took Chase over 60 hours to create this unique 40 inch

Tom Carroll can be reached at [email protected].

tall, 50 inch long animal from many scrounged parts. “She’s constructed out of electrical conduit, used transmission parts, disemboweled household appliances, 20-gauge steel, and a lot of fender washers,” says Chase. Weighing in at 40 pounds, all of the joints mimic the movements and articulations of the real animal. Andrew has made several other ‘robot’ sculptures, including an elephant and a giraffe.

Final Thoughts Just how real should we make our robots? Do robot animals and humanoid robots need to be indistinguishable from the real living things? Do we have to fear replicants in the future, as depicted in movies like Blade Runner? There is no doubt that robot experimenters and engineers will continue to strive to bridge the Uncanny Valley and produce both synthetic animals and humans that don’t give us the willies. SV FIGURE 12a and 12b. Andrew Chase’s cheetah.

80

SERVO 10.2009

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

with Loaded wer! o brainp www.NanoCore12.com

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

Onl y $29 !

Electronic Parts & Supplies Since 1967

Advertiser Index All Electronics Corp. .................19, 81 Digilent ................................................9 Robotic Education Expo ................17 AP Circuits ........................................16 Integrated Ideas & Tech ..................16 Robotis ..............................................17 A-Wit/www.c-stamp.com ........19, 81 Jameco .............................................71 RobotShop, Inc ...............................83 Basic Micro .........................................2 Lynxmotion, Inc. .................................3 Solarbotics/HVW ..............................7 BiPOM Electronics ...........................81 Maxbotix ...........................................81 superbrightleds.com ......................81 BotBrain ............................................13 Parallax ..............................................80 Technological Arts ...........................81 Budget Robotics ..............................80 Custom Computer Services ............81 PCB Pool .....................................43, 81 The Robot Report ............................81 CipherLinx Technologies .................81 Pololu Robotics & Electronics ..43, 81 Trossen Robotics ...............................7 CrustCrawler ....................................82 Robonica ..........................Back Cover Vantec ...............................................17 SERVO 10.2009

81

“Build Smarter.”

Your #1 Choice for Robotic Arms and Free Open Source Software

SG5-UT Robotic Arm   

‡ ‡ ‡ ‡

D[LV ´ 5HDFK  R] OLIWLQJ FD 6WDUWLQJ IURP 

SG6-UT Robotic Arm 

‡ ‡ ‡ ‡

D[LV ´ 5HDFK  R] OLIWLQJ FDSDFLW\ 6WDUWLQJ IURP 

AX-12 Smart Robotic    

‡ ‡ ‡ ‡ ‡

D[LV ´ 5HDFK  OE OLIWLQJ FDSD )XOO )HHEDFN &DS 6WDUWLQJ IURP 

SG-Gripper ‡ +LJK 5HVROXWLRQ  7RRWK *HDUWUDLQ  ‡ (QJLQHHUHG IRU VHQVRUV  ‡ 6WDUWLQJ IURP 

AX-12 Big Grip ‡  *ULSSHUV LQ 2QH ‡ )XOO IHHGEDFN FDSDELOLW\ ‡ 6WDUWLQJ IURP 

Test drive the AX-12 Smart Arm over the internet. See our website for details! See our web site for pictures, videos and more!

www.CrustCrawler.com

Or call us at:

480-577-5557
Servo Magazine 10-2009

Related documents

84 Pages • 41,106 Words • PDF • 11.8 MB

4 Pages • 1,054 Words • PDF • 77.6 KB

5 Pages • 1,356 Words • PDF • 3.4 MB

82 Pages • PDF • 36.5 MB

116 Pages • 40,486 Words • PDF • 33.2 MB

73 Pages • 21,212 Words • PDF • 10.1 MB

29 Pages • PDF • 23.2 MB

5 Pages • 1,636 Words • PDF • 387.3 KB

60 Pages • 832 Words • PDF • 6.1 MB

94 Pages • 49,913 Words • PDF • 58.8 MB

101 Pages • 39,410 Words • PDF • 23.3 MB

322 Pages • 59,717 Words • PDF • 5.5 MB