ROBOT BUILDER’S
BONANZA
ABOUT THE AUTHOR
Gordon McComb has written 65 books and thousands of magazine articles—over a million
copies of his books are in print, in more than a dozen languages. For 13 years, Gordon wrote
a weekly syndicated newspaper column on computers and high technology, which reached
several million readers worldwide. He’s a regular contributor to SERVO Magazine and other
publications, and maintains an active Web site dedicated to teaching the art and science of
robot building.
ROBOT BUILDER’S
BONANZA
GORDON McCOMB
FOURTH EDITION
McGraw-Hill
New York Chicago San Francisco Lisbon London Madrid
Mexico City Milan New Delhi San Juan Seoul
Singapore Sydney Toronto
Copyright © 2011, 2001, 1987 by Gordon McComb. All rights reserved. Except as permitted under the United States
Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a
database or retrieval system, without the prior written permission of the publisher.
ISBN: 978-0-07-175035-6
MHID: 0-07-175035-5
The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-175036-3,
MHID: 0-07-175036-3.
All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a
trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of
infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.
McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate
training programs. To contact a representative please e-mail us at
Information contained in this work has been obtained by The McGraw- Hill Companies, Inc. (”McGraw- Hill”) from
sources believed to be reliable. However, neither McGraw- Hill nor its authors guarantee the accuracy or completeness of any
information published herein, and neither McGraw- Hill nor its authors shall be responsible for any errors, omissions, or
damages arising out of use of this information. This work is published with the understanding that McGraw- Hill and its
authors are supplying information but are not attempting to render engineering or other professional services. If such services are
required, the assistance of an appropriate professional should be sought.
TERMS OF USE
This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGrawHill”) and its licensors reserve all rights in and
to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to
store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create
derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without
McGraw-Hill’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly
prohibited. Your right to use the work may be terminated if you fail to comply with these terms.
THE WORK IS PROVIDED “AS IS.” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR
WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED
FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK
VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work
will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors
shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages
resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no
circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or
similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility
of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in
contract, tort or otherwise.
For Lane and Firen,
keeping the legacy alive
This page intentionally left blank
CONTENTS
Acknowledgments
Photo and Illustration Credits
Introduction
xxi
xxiii
xxv
Part 1—The Art and Science of Robot Building
Chapter 1—Welcome to the Wonderful World of Robotics!
3
What the Adventure Holds
3
Why Build Robots?
4
The Building-Block Approach
6
Lower Costs, Better Bots
6
Skills You Need
7
Do It Yourself, Kits, or Ready-Made?
9
Thinking Like a Robot Builder
12
Chapter 2—Anatomy of a Robot
13
Stationary versus Mobile Robots
13
Autonomous versus Teleoperated Robots
14
Tethered versus Self-Contained Robots
15
So, What’s a Robot, Anyway?
16
The Body of the Robot
17
Locomotion Systems
22
Power Systems
24
Sensing Devices
25
Output Devices
27
Where the Word “Robot” Comes From
27
Chapter 3—Getting Parts
29
Local Electronics Stores
30
Online Electronics Outlets
30
Using FindChips.com to Locate Parts
30
vii
viii
CONTENTS
Specialty Online Robotics Retailers
31
Hobby and Model Stores
31
Craft Stores
32
Hardware and Home Improvement Stores
33
Samples from Electronics Manufacturers
33
Finding What You Need on the Internet
33
Shop Once, Shop Smart
34
Haunting the Surplus Store
34
Getting Parts from Specialty Stores
35
Scavenging: Making Do with What You Already Have
36
Getting Organized
37
Part 2—Robot Construction
Chapter 4—Safety First (and Always)
43
Project Safety
43
Battery Safety
44
Soldering Safety
44
Fire Safety
44
Avoiding Damage by Static Discharge
45
Working with House Current
47
First Aid
47
Use Common Sense—and Enjoy Your Robot Hobby
48
Chapter 5—Building Robot Bodies—the Basics
49
Picking the Right Construction Material
49
In Review: Selecting the Right Material
52
Robots from “Found” Parts
53
Basic Tools for Constructing Robots
54
Optional Tools
57
Hardware Supplies
57
Setting Up Shop
58
Chapter 6—Mechanical Construction Techniques
59
First Things First: Eye and Ear Protection
59
Plan, Sketch, Measure, Mark
60
Drilling Holes in Things
60
Cutting Things to Size
64
Using Portable Power Tools
67
Getting Work Done Fast with Air Tools
68
CONTENTS
Chapter 7—Working with Wood
ix
69
Hardwood versus Softwood
69
Planks or Ply
69
The Woodcutter’s Art
72
Chapter 8—Build a Motorized Wooden Platform
80
Making the Base
80
Building and Attaching the Motors
83
Building and Mounting the Wheels
84
Attaching the Ball Caster
84
Using the PlyBot
85
Variations on a Theme
85
Chapter 9—Working with Plastic
87
Main Kinds of Plastics for Bots
87
Best Plastics for Robotics
89
Where to Buy Plastic
89
The Ins and Outs of Rigid Expanded PVC
90
How to Cut Plastic
91
How to Drill Plastic
93
Making Plastic Bases
93
Making Plastic Frames
95
How to Bend and Form Plastic
96
How to Smooth the Edges of Plastic
96
How to Glue Plastic
96
Using Hot Glue with Plastics
98
How to Paint Plastics
98
Household Plastics for Bot Constructions
98
Chapter 10—Build a Motorized Plastic Platform
Making the Base
100
100
Attaching the Motors
102
Fitting the Wheels
104
Attaching the Ball Caster
104
Using the PlastoBot
104
Altering the PlastoBot Design
105
Chapter 11—Working with Metal
107
All About Metal for Robots
107
Measuring the Thickness of Metal
109
x
CONTENTS
What’s This about Heat Treatments?
110
Where to Get Metal for Robots
110
Recap of Metals for Robotics
110
Metal from Your Home Improvement Store
111
Metal from Craft and Hobby Stores
113
The Metalsmith’s Art
114
Chapter 12—Build a Motorized Metal Platform
122
Making the Base
122
Using the TinBot
127
Chapter 13—Assembly Techniques
129
Screws, Nuts, and Other Fasteners
129
Brackets
135
Selecting and Using Adhesives
136
Chapter 14—Rapid Prototyping Methods
144
Selecting Lightweight Robot Materials
144
Cutting and Drilling Substrate Sheets
146
Rapid Construction with Semipermanent Fasteners
147
Chapter 15—Drafting Bots with Computer-Aided Design
Making Drilling and Cutting Layouts
152
152
File Formats for Vector Graphics
158
Using Laser-Cutting Services
158
Producing “Quick-Turn” Metal and Plastic Prototypes
159
Chapter 16—Constructing High-Tech Robots from Toys
160
Erector Sets
160
Fischertechnik
161
K’NEX
162
Other Construction Sets to Try
162
Construction with Snap-Together Components
163
Specialty Toys for Robot Hacking
165
Making Robots from Converted Toy Vehicles
166
Chapter 17—Building Bots from Found Parts
170
A Dozen Ideas to Get You Started
170
Experimenting with “No-Cut” Metal Platform Designs
171
Using Wood and Plastic Samples
175
Keep Your Eyes Peeled and Your Tape Measure Out
176
CONTENTS
xi
Part 3—Power, Motors, and Locomotion
Chapter 18—All about Batteries
179
An Overview of Power Sources
179
Batteries for Your Robots
180
Understanding Battery Ratings
183
Recharging Batteries
187
Robot Batteries at a Glance
187
Common Battery Sizes
187
Increasing Battery Ratings
189
Chapter 19—Robot Power Systems
190
Power and Battery Circuit Symbols
190
Using a Premade Battery Pack
191
Making Your Own Rechargeable Battery Pack
192
Using Battery Cells in a Battery Holder
193
Best Battery Placement Practices
195
Wiring Batteries to Your Robot
196
Preventing Reverse Battery Polarity
197
On the Web: How to Solder a Barrel Plug onto a Battery Holder
or DC Wall Transformer
198
Adding Fuse Protection
198
Providing Multiple Voltages
199
Regulating Voltage
201
Dealing with Power Brownouts
207
Battery Voltage Monitors
208
Chapter 20—Moving Your Robot
209
Choosing a Locomotion System
209
Locomotion Using Wheels
211
Locomotion Using Tracks
215
Locomotion Using Legs
216
Locomotion Using Other Methods
217
On the Web: Managing the Weight of Your Robot
218
Chapter 21—Choosing the Right Motor
AC or DC Motor?
219
219
Continuous or Stepping Motor?
220
Servo Motors
220
Motor Specs
221
xii
CONTENTS
Testing Current Draw of a Motor
224
Dealing with Voltage Drops
228
Avoiding Electrical Noise
229
Chapter 22—Using DC Motors
230
The Fundamentals of DC Motors
230
Reviewing DC Motor Ratings
232
Controlling a DC Motor
232
Motor Control by Switch
232
Motor Control by Relay
234
Motor Control by Bipolar Transistor
239
Motor Control by Power MOSFET Transistor
241
Motor Control by Bridge Module
244
Controlling the Speed of a DC Motor
247
Bonus Projects: Interfacing to Motor Bridge Modules
248
Chapter 23—Using Servo Motors
249
How R/C Servos Work
249
Control Signals for R/C Servos
251
The Role of the Potentiometer
253
Special-Purpose Servo Types and Sizes
253
Gear Trains and Power Drives
254
Output Shaft Bushings and Bearings
254
Typical Servo Specs
255
Connector Styles and Wiring
256
Analog Versus Digital Servos
257
Electronics for Controlling a Servo
258
Using Continuously Rotating Servos
260
Modifying a Standard Servo for Continuous Rotation
261
Using Servo Motors for Sensor Turrets
265
Chapter 24—Mounting Motors and Wheels
266
Mounting DC Motors
266
Mounting and Aligning Motors with Aluminum Channel
269
Mounting R/C Servos
270
Mounting Drivetrain Components to Shafts
272
Mounting Wheels to DC Gear Motors
273
Mounting Wheels to R/C Servos
274
CONTENTS
xiii
Attaching Mechanical Linkages to Servos
276
Drivetrain Components for Robotics
277
Using Rigid Flexible Couplers
278
Working with Different Shaft Types
282
Everything You Always Wanted to Know about Gears
283
Chapter 25—Robot Movement with Shape Memory Alloy
287
Shape Memory Alloy Comes to Robotics
287
Basics of Shape Memory Alloy
287
Using Shape Memory Alloy
288
Operating SMA Using a Microcontroller
290
Experimenting with SMA Mechanisms
291
Using Ready-Made SMA Mechanisms
292
Part 4—Hands-on Robotic Projects
Chapter 26—Build Robots with Wheels and Tracks
Basic Design Principles of Rolling Robots
297
297
Two-Motor BasicBot
304
Bonus Project: Double-Decker RoverBot
306
Building 4WD Robots
306
Building Tank-Style Robots
309
Chapter 27—Build Robots with Legs
318
An Overview of Leggy Robots
318
Selecting the Best Construction Material
321
Scratch Build or Parts Kits
322
Leg Power
324
Walking Gaits for Legged Robots
327
Build a 3-Servo Hexapod
328
Creating X-Y Servo Joints
335
Bonus Project: Build a 12-Servo Hexapod
338
Chapter 28—Experimenting with Robotic Arms
The Human Arm
339
339
Degrees of Freedom in a Typical Robotic Arm
340
Arm Types
340
Actuation Techniques
343
Build a Robotic Wrist
344
xiv
CONTENTS
Build a Functional Revolute Coordinate Arm
345
Build a Robotic Arm from a Kit
350
Chapter 29—Experimenting with Robotic Grippers
352
Concept of the Basic Gripper
352
Two-Pincher Gripper
353
Tool Clamp Gripper
355
On the Web: More Gripper Plans
359
Part 5—Robot Electronics
Chapter 30—Building Robot Electronics—the Basics
363
Tools for Electronics You Should Have
363
Making Electronic Circuits—the Basics
370
Understanding Wires and Wiring
370
How to Solder
371
Using Headers and Connectors
375
Using Clip-on Jumpers
377
Good Design Principles
377
RoHS Demystified
379
Chapter 31—Common Electronic Components for Robotics
381
But First, a Word about Electronics Symbols
381
Fixed Resistors
382
Potentiometers
388
Capacitors
390
Diodes
394
Light-Emitting Diodes (LEDs)
396
Transistors
399
Integrated Circuits
400
Switches
402
Relays
404
. . . And the Rest
405
On the Web: Stocking Up on Parts
406
Chapter 32—Using Solderless Breadboards
407
Anatomy of a Solderless Breadboard
407
Steps in Constructing a Solderless Breadboard Circuit
411
CONTENTS
xv
Making Long-Lasting Solderless Circuits
411
Mounting the Breadboard to Your Robot
412
Tips for Using a Solderless Breadboard
413
Chapter 33—Making Circuit Boards
414
Overview of Your Primary Circuit Board Options
414
Clean It First!
415
Making Permanent Circuits on Solder Breadboards
415
Using Point-to-Point Perforated Board Construction
416
Using Predrilled Stripboards
417
Creating Electronic Circuit Boards with PCB CAD
418
Producing Arduino-Specific Boards with Fritzing
420
On the Web: Etching Your Own Printed Circuit Board
421
Using Custom Prototyping Boards
422
Making Semipermanent Circuits with Wire Wrapping
422
Effective Use of Plug-in Headers
424
Part 6—Computers and Electronic Control
Chapter 34—An Overview of Robot “Brains”
425
Brains for the Brawn
427
Igor, Pull the Switch!
428
Brains from Discrete Components
428
Programmed Brains
429
Of Inputs and Outputs
434
Chapter 35—Understanding Microcontrollers
All about Microcontroller Categories
437
437
Microcontroller Shapes and Sizes
440
Under the Hood of the Typical Microcontroller Chip
441
Microcontroller Programmers
444
All about Microcontroller Speed
445
Chapter 36—Programming Concepts: The Fundamentals
446
Important Programming Concepts
446
Understanding Data Types
450
Lucky Seven Most Common Programming Statements
452
Variables, Expressions, and Operators
455
On the Web: More Programming Fundamentals
459
xvi
CONTENTS
Part 7—Microcontroller Brains
Chapter 37—Using the Arduino
463
Arduino under the Hood
463
Many Variations on a Theme
464
Ready Expansion via Shields
465
USB Connection and Power
466
Arduino Pin Mapping
467
Programming the Arduino
467
Programming for Robots
469
Using Servos
473
Creating Your Own Functions
474
On the Web: Operating Two Servos
475
Flow Control Structures
476
Using the Serial Monitor Window
477
Some Common Robotic Functions
478
Using Switches and Other Digital Inputs
479
Interfacing to DC Motors
479
Chapter 38—Using the PICAXE
482
Understanding the PICAXE Family
482
Programming the PICAXE
487
Core Language Syntax
488
PICAXE Functions for Robotics
492
Example: Controlling an RC Servo with the PICAXE
493
Example: Reading Buttons and Controlling Outputs
494
Chapter 39—Using the BASIC Stamp
496
Inside the BASIC Stamp
496
Stamp Alone or Developer’s Kit
498
Physical Layout of the BS2
498
Hooking Up: Connecting the BASIC Stamp to a PC
499
Understanding and Using PBasic
500
Interfacing Switches and Other Digital Inputs
506
Interfacing DC Motors to the BASIC Stamp
507
Interfacing RC Servo Motors to the BASIC Stamp
508
Additions in PBasic 2.5
509
CONTENTS
Chapter 40—Interfacing Hardware with Your
Microcontroller or Computer
xvii
512
Sensors as Inputs
512
Motors and Other Outputs
514
Input and Output Architectures
516
Interfacing Outputs
519
Interfacing Digital Inputs
520
Interfacing Analog Input
522
Connecting with USB
525
Using Analog-to-Digital Conversion
526
Using Digital-to-Analog Conversion
527
Expanding Available I/O Lines
528
Understanding Port Changing
531
On the Web: Understanding Bitwise Port Programming
533
Chapter 41—Remote Control Systems
534
Build a Joystick “Teaching Pendant”
534
Commanding a Robot with Infrared Remote Control
537
On the Web: Control by Radio Signal
543
Broadcasting Video
543
Part 8—Sensors, Navigation, and Feedback
Chapter 42—Adding the Sense of Touch
547
Understanding Touch
547
Mechanical Switch
548
Using a Button Debounce Circuit
555
Debouncing Switches in Software
556
Programming for Bumper Contacts
557
Mechanical Pressure Sensors
558
Experimenting with Piezoelectric Touch Sensors
563
Experimenting with Piezo Film
565
On the Web: Build a Piezo Bumper Bar
568
Other Types of “Touch” Sensors
568
Chapter 43—Proximity and Distance Sensing
570
Design Overview
570
Simple Infrared Light Proximity Sensor
572
xviii
CONTENTS
Modulated Infrared Proximity Detector
574
Infrared Distance Measurement
580
On the Web: Passive Infrared Detection
585
Ultrasonic Distance Measurement
585
Chapter 44—Robotic Eyes
590
Simple Sensors for Robotic Eyes
590
Building a One-Cell Cyclops Eye
594
Building a Multiple-Cell Robotic Eye
596
Using Lenses and Filters with Light-Sensitive Sensors
600
Video Vision Systems: An Introduction
600
Chapter 45—Navigating Your Robot
603
Tracing a Predefined Path: Line Following
603
Wall Following
608
Odometry: Calculating Your Robot’s Distance of Travel
609
Compass Bearings
617
Experimenting with Tilt and Gravity Sensors
619
More Navigational Systems for Robots
624
Chapter 46—Making and Listening to Sound
Preprogrammed Sound Modules
625
625
Commercial Electronic Sound Effects Kits
627
Making Sirens and Other Warning Sounds
627
Using a Microcontroller to Produce Sound and Music
628
Using Audio Amplifiers
630
Sound and Music Playback with a Microcontroller
631
Speech Synthesis: Getting Your Robot to Talk
632
Listening for Sound
634
On the Web: More Sound Projects
637
Chapter 47—Interacting with Your Creation
639
Using LEDs and LED Displays for Feedback
639
Feedback via Simple Sounds
646
Using LCD Panels
646
Robot-Human Interaction with Lighting Effects
649
Chapter 48—Danger, Will Robinson!
655
Flame Detection
655
Smoke Detection
657
CONTENTS
xix
Detecting Dangerous Gas
661
Heat Sensing
664
Robotic Firefighting Contests
665
Finally, Go Out and Do!
665
Appendix A—RBB Online Support
You’ll Find . . .
667
667
Backup Support Site
668
Sources for Special Parts, Web Sites
668
Appendix B—Internet Parts Sources
669
Robotics
669
Electronics
670
Hobby
670
Forums and Blogs
671
More on the Web!
671
Appendix C—Mechanical Reference
672
Decimal Fractions
672
Drill Bit and Tap Sizes—Imperial
673
Drill Bit and Tap Sizes—Metric
674
Numbered and Fractional Inch Drill Bit Comparison
675
Fasteners: Standard (Imperial) Threads at a Glance
675
Comparison of Decimal Inch, Fractional Inch, Mil, and Gauge
676
More on the Web!
676
Appendix D—Electronic Reference
Formulas
677
677
Abbreviations
679
Letter Symbols Used in Electronics
681
Numbering Units in Electronics
681
The Six Most Common Units of Measure in Electronics
682
Resistor Color Coding
683
Wire Gauge
684
Index
685
This page intentionally left blank
ACKNOWLEDGMENTS
Once more I’ve climbed the mountain. And once more I look back to those who have helped
me turn my vision into reality.
To my friends at the San Diego robotics group; to John Boisvert and his amazing robotics
emporium; to Mike Keesling, Alex Brown, and Tony Ellis; to those I’ve met over the years on
the comp.robotics.misc newsgroup for their great ideas, wisdom, support, and advice; and to
Frits Lyneborg and the entire LetsMakeRobots.com community;
To Russell Cameron, roboteer extraordinaire, and to Jan Malasek of Pololu, Mario Tremblay of Robotshop, Clive Seager of Revolution Education, Jim Frye of Lynxmotion, Nathan
Seidle of SparkFun, Gerry Coe of Devantech, and Claudia and the crew at DAGU;
To the makers and keepers of the Arduino, PICAXE, BASIC Stamp, FIRST CAD Library,
and Fritzing for great tools, great software, and great art;
To Judy Bass and the editors at McGraw-Hill, who’ve put up with me all these years; to my
agents at Waterside Productions; and to Bill Gladstone who first helped me take on this project way back in 1985 (how time flies!);
And last but certainly not least, to my wife, Jennifer.
I offer my heartfelt thanks, one and all.
xxi
This page intentionally left blank
PHOTO AND
ILLUSTRATION CREDITS
Adafruit Industries (www.adafruit.com): Figures 37-2, 37-3, 37-10
Christopher Schantz (www.expressionimage.com): Figure 2-14
Cooper Industries (www.cooperhandtools.com): Figure 30-4
Devantech (www.robot-electronics.co.uk).: Figure 48-2
General Electric: Figure 2-4
Hitec RCD (www.hitecrcd.com): Figure 23-1
Lynxmotion (www.lynxmotion.com): Figures 1-1, 2-6, 2-7, 20-10, 27-2, 28-13
iRobot Corporation (www.irobot.com): Figures 1-6, 2-3
Maxbotics Inc (www.maxbotics.com): Figure 43-14
Miga Motor Company (www.migamotors.com): Figure 25-7
Parallax Inc (www.parallax.com): Figures 2-10, 34-2, 39-1, 43-3, 48-6
Pitsco Education (www.pitsco.com): Figures 1-7
RoboRealm (www.roborealm.com): Figure 44-12
Pololu (www.pololu.com): Figures 10-4, 10-7, 45-5, 45-19
Russell Cameron/DAGU Hi-Tech Electronic: Figures 1-1, 44-10
Scott Edwards Electronics (www.seetron.com): Figure 27-6
SparkFun Electronics (www.sparkfun.com): Figures 42-14, 46-7, 46-9, 46-10
The author expresses his deepest gratitude for the use of 3D CAD objects developed by Ed
Sparks at FirstCadLibrary.com; to the developers and contributors of the Fritzing project
(www.fritzing.org); for public domain art developed by Wikipedia user Inductiveload, and others; and to the talented artists of the 3D models used throughout this book.
This publication contains images used under license from Corel Corporation, Hemera
Technologies, Shutterstock.com, and other licensors.
xxiii
This page intentionally left blank