Table Of ContentIntermediate Robot
Building
Second Edition
(cid:2) (cid:2) (cid:2)
David Cook
Intermediate Robot Building, Second Edition
Copyright © 2010 by David Cook
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information storage or
retrieval system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-2754-0
ISBN-13 (electronic): 978-1-4302-2755-7
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of
the trademark owner, with no intention of infringement of the trademark.
President and Publisher: Paul Manning
Lead Editor: Steve Anglin
Technical Reviewer: Scott Parsons
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell,
Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes,
Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft,
Matt Wade, Tom Welsh
Coordinating Editor: Jim Markham
Copy Editor: Ralph Moore
Compositor: Bytheway Publishing Services
Indexer: Potomac Indexing, LLC
Artist: April Milne
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th
Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-
sbm.com, or visit www.springeronline.com.
For information on translations, please e-mail rights@apress.com, or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional
use. eBook versions and licenses are also available for most titles. For more information, reference our
Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales.
The information in this book is distributed on an “as is” basis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have
any liability to any person or entity with respect to any loss or damage caused or alleged to be caused
directly or indirectly by the information contained in this work.
The source code for this book is available to readers at www.robotroom.com/IRBGoodies.html#SOURCE.
(cid:2) CONTENTS
Contents
(cid:2) Contents.................................................................................................................iii
(cid:2) About the Author................................................................................................xxiv
(cid:2) About the Technical Reviewer............................................................................xxv
(cid:2) Acknowledgments.............................................................................................xxvi
Appreciating Technical Editors......................................................................................xxvi
Getting Support at Work................................................................................................xxvi
Getting Support from the Field......................................................................................xxvi
Support at Home...........................................................................................................xxvii
(cid:2) Introduction.....................................................................................................xxviii
Intended Audience.......................................................................................................xxviii
Prerequisites...........................................................................................................................................xxviii
Required Electronics and Machine Shop Experience.........................................................................xxviii
Required Software Development Experience.......................................................................................xxix
Preferred Robot Building Experience.....................................................................................................xxx
Would LEGO MindStorms Be Better For You?.............................................................................................xxx
Would BEAM Robots Be Better For You?....................................................................................................xxx
No Remote-Controlled Armageddon...........................................................................................................xxx
Volatile Parts..................................................................................................................xxxi
Safety Rules...................................................................................................................xxxi
Preferring the Metric System........................................................................................xxxii
Getting Updates and Seeing What’s New.....................................................................xxxii
iii
(cid:2) CONTENTS
(cid:2) Chapter 1: Assembling a Modular Robot................................................................1
Building Modules...............................................................................................................1
Assembling Roundabout, or Not....................................................................................................................2
Arranging Chapters........................................................................................................................................2
Getting Comfortable with Machining.................................................................................3
Stocking Your Machine Shop.........................................................................................................................3
Looking at a Miniature Milling Machine........................................................................................................5
Using a Milling Machine...........................................................................................................................5
Admitting a Bias Toward Milling...............................................................................................................7
Putting It All Together........................................................................................................7
Grouping Machining Parts.............................................................................................................................8
Grouping Stand-Alone Electronic Modules....................................................................................................8
Assembling and Testing a Robot...................................................................................................................8
Applying Parts and Techniques to Other Robots...............................................................9
(cid:2) Chapter 2: Comparing Two Types of Homemade Motor Couplers and Common
Errors to Avoid......................................................................................................11
Comparing Two Homemade Coupler Technologies.........................................................12
Examining Telescoping-Tube Couplers.......................................................................................................12
Comparing with Solid-Rod Couplers............................................................................................................13
Identifying Desired Results in Coupler Drill Holes,
Along with Common Errors and Their Effects..................................................................14
Connecting the Setscrew Hole to the Motor Shaft Hole..............................................................................15
Aligning the Hole Angles and Hole Centers.................................................................................................16
Accepting Parallel Offset Between the Holes and the Coupler Body......................................................16
Avoiding Parallel Offset Between the Holes Themselves.......................................................................18
Avoiding Angular Offset Between the Holes Themselves.......................................................................19
Reiterating the Advantages of Telescoping Tubing................................................................................21
Getting Ready to Make a Solid-Rod Coupler....................................................................21
iv
(cid:2) CONTENTS
(cid:2) Chapter 3: Making a Fixture and Drilling Solid Rods for a Coupler......................23
Gathering Tools and Parts...............................................................................................23
Preparing Lengths of Solid Rod for the Couplers.............................................................24
Measuring the Motor and Axle....................................................................................................................24
Selecting a Solid Rod for the Coupler Body.................................................................................................25
Calculating the Coupler Length..............................................................................................................25
Calculating the Coupler Diameter...........................................................................................................25
Selecting the Coupler Material...............................................................................................................25
Cutting the Solid Rod into Coupler-Size Pieces...........................................................................................26
Smoothing the Ends of the Coupler Body Pieces.........................................................................................27
Setting Aside the Lengths of Rod................................................................................................................30
Making a Coupler Fixture.................................................................................................30
Cutting the Coupler Fixture Block................................................................................................................31
Drilling the Coupler Fixture Setscrew Hole..................................................................................................33
Tapping the Coupler Fixture Setscrew Hole................................................................................................35
Drilling the Coupler Rod Hole in the Coupler Fixture...................................................................................35
Selecting Drills.......................................................................................................................................36
Fixing the Depth.....................................................................................................................................37
Drilling....................................................................................................................................................40
Getting the Money Shot...................................................................................................41
Enlarging Tight Fits......................................................................................................................................42
Adding a Setscrew to the Coupler Fixture...................................................................................................42
Repositioning the Coupler Fixture...............................................................................................................43
Drilling the Motor-Shaft and LEGO Axle Coupler Holes....................................................43
Swapping Drills, Not Coupler Rods..............................................................................................................46
Add the Finishing Touch: Squaring the Ends...............................................................................................46
Examining the Coupler So Far.........................................................................................46
v
(cid:2) CONTENTS
(cid:2) Chapter 4: Finishing the Solid-Rod Motor Coupler...............................................49
Installing the Coupler Setscrew.......................................................................................49
Determining the Location for the Coupler Setscrew....................................................................................49
Drilling the Coupler Setscrew Hole..............................................................................................................50
Tapping the Coupler Setscrew Hole............................................................................................................51
Selecting a Bottom-Style Tap.................................................................................................................51
Comparing to a Taper-Style Tap.............................................................................................................52
Tapping Tips...........................................................................................................................................53
Selecting a Setscrew...................................................................................................................................53
Adding the LEGO Axle......................................................................................................55
Summary.........................................................................................................................57
(cid:2) Chapter 5: Building a Motor Inside a Wheel.........................................................59
Encountering Danger: Bent Shafts Ahead........................................................................60
Driving Properly with Bearings....................................................................................................................60
Protecting Against Bumps and Falls.......................................................................................................60
Shifting Against the Coupler, Laterally...................................................................................................61
Bending Without Support........................................................................................................................61
Making a Hub-Adapter Coupler.......................................................................................61
Adapting the Motor Shaft’s Outer Diameter to the LEGO Wheel’s Inner Diameter......................................62
Starting Simply with the Coupler Rod..........................................................................................................63
Making the Inner and Outer Hub-Adapter Discs..........................................................................................65
Choosing a Shape...................................................................................................................................65
Determining the Size..............................................................................................................................65
Choosing the Raw Material.....................................................................................................................66
Cutting the Raw Sheet Down to Size......................................................................................................66
Drilling the 1(cid:2)-Inch in Diameter Center Hole...........................................................................................67
4
Again, Why Measure Oversize?..............................................................................................................69
Milling Circles with a Rotary Table.........................................................................................................69
vi
(cid:2) CONTENTS
Drilling Screw Holes in the Discs............................................................................................................73
Finishing the Inner and Outer Hub-Adapter Discs..................................................................................76
Coring the LEGO Hubs..................................................................................................................................78
Securing the Hub During Machining.......................................................................................................79
Selecting a Silver & Deming Drill............................................................................................................80
Drilling Out the Center of the Hub...........................................................................................................80
Sanding Away the Remains of the Center of the Hub.............................................................................81
Fitting and Gluing the Parts Together..........................................................................................................82
Fitting and Gluing the Outer Disc into the Hub.......................................................................................82
Fitting and Gluing the Inner Disc onto the Rod.......................................................................................82
Waiting for Glue to Dry...........................................................................................................................84
Summary.........................................................................................................................84
(cid:2) Chapter 6: Understanding the Standards and Setup for Electronic
Experiments..........................................................................................................85
Reading Schematics........................................................................................................85
Connecting Wires.........................................................................................................................................86
Designating Parts........................................................................................................................................87
Lettering Designations............................................................................................................................87
Numbering Designations........................................................................................................................88
Labeling Parts..............................................................................................................................................88
Labeling Resistors..................................................................................................................................89
Labeling Capacitors................................................................................................................................91
Labeling LEDs and IEDs..........................................................................................................................93
Labeling Other Parts...............................................................................................................................94
Specifying Power Supply.............................................................................................................................94
Simplifying the Positive Voltage Supply Label........................................................................................94
Symbolizing Ground and Simplifying Wiring...........................................................................................94
Using Solderless Breadboards.........................................................................................95
Selecting a Solderless Breadboard.............................................................................................................96
vii
(cid:2) CONTENTS
Setting Up a Solderless Breadboard to Match the Photographs.................................................................97
Powering a Solderless Breadboard........................................................................................................98
Selecting an AC Power Adapter..............................................................................................................98
Adding a Few Amenities.......................................................................................................................100
Understanding Oscilloscope Traces...............................................................................101
Riding the Bandwagon of Modern Electronics...............................................................102
Getting Past the Learning Curve Barrier....................................................................................................102
Avoiding Obsolete Technology...................................................................................................................102
Using Surface-Mount Components............................................................................................................102
Sizing Down Surface-Mount.................................................................................................................103
Saying “Good-Bye” to Through-Hole....................................................................................................104
Working with Surface-Mount Components..........................................................................................104
Converting Surface-Mount Components to Through-Hole....................................................................104
Mixing and Matching Package Technologies.......................................................................................106
Shrinking Below Hand-Labor Level......................................................................................................106
Summary.......................................................................................................................106
(cid:2) Chapter 7: Creating a Linear Voltage- Regulated Power Supply........................107
Understanding Voltage Regulators................................................................................107
Understanding Linear Voltage-Regulated Power Supplies............................................108
The 7805 Linear Voltage Regulator...........................................................................................................108
Introducing a 7805-Based 5 V Power Supply.......................................................................................109
Building the 7805-Based Power Supply...............................................................................................111
Improving the Power Supply by Reducing the Minimum Required Unregulated Voltage..........................113
Substituting an LM2940, MCP1702, or LP2954 for the 7805................................................................114
Substituting a Power MOSFET for the 1N5817.....................................................................................115
Increasing Resistance at Lower Voltages.............................................................................................117
Selecting a Low-Resistance P-Channel Power MOSFET......................................................................117
Analyzing the Minimum Input Voltage of Various Linear Regulator Circuits.........................................118
Presenting the Input/Output Voltage Results of Three 5 V Linear Voltage Regulators.........................122
viii
(cid:2) CONTENTS
Considering Various Factors in Linear Voltage Regulators........................................................................124
Protecting Against a Reverse Battery...................................................................................................124
Protecting Against Short Circuits..........................................................................................................124
Protecting Against Thermal Overload...................................................................................................125
Simplicity and Low Cost of a Complete Circuit.....................................................................................126
Consuming Quiescent Current..............................................................................................................126
Isolating Power and Noise....................................................................................................................126
Selecting a Linear Voltage Regulator for Your Robot............................................................................128
Changing Marketplace Is Limiting 5 V Linear Regulator Selection............................................................129
Heading into Optimizations............................................................................................130
(cid:2) Chapter 8: Making Robot Power Supply Improvements.....................................131
Bulking Up the Input and Output Capacitors..................................................................131
Increasing Battery Lifetime with Bulk Capacitors.....................................................................................133
Delayed Power-Off Because of Bulk Capacitors........................................................................................133
Using a DPDT Power Switch to Reduce Turn-Off Time..............................................................................135
Selecting Bulk Capacitors..........................................................................................................................136
Implementing Higher Margins of Safety for Tantalum Capacitors.............................................................136
Adding Voodoo Capacitors.............................................................................................137
Sprinkling with Bypass/Decoupling Capacitors.............................................................138
Bypassing the Long Path to the Power Supply.....................................................................................139
Decoupling Noise at Each Source.........................................................................................................140
Selecting Bypass/Decoupling Capacitors.............................................................................................140
Preventing Damage from Short Circuits or Overcurrent................................................141
Deciding If Overcurrent Protection Is Required.........................................................................................141
Protecting with a Fuse...............................................................................................................................141
Protecting with a Manually Reset Circuit Breaker.....................................................................................142
Protecting Robots from Short Circuits and Overcurrents with a
Solid-State Auto-Resetting PPTC Device...................................................................................................142
Greatly Increasing Resistance to Greatly Reduce Current....................................................................142
ix
(cid:2) CONTENTS
Installing PPTC Overcurrent-Protection Devices...................................................................................143
Selecting PPTC Overcurrent-Protection Devices..................................................................................145
Preventing Damage from Overvoltage in a Regulated Circuit........................................146
Introducing the Zener Diode......................................................................................................................146
Using a Zener Diode to Short Circuit Power Upon Overvoltage.................................................................147
Tripping Overcurrent Protection with the Overvoltage Short Circuit....................................................148
Taking One for the Team: The Sacrificial Death of Mr. Zener...............................................................149
Choosing an Appropriate Breakdown Voltage...........................................................................................149
Purchasing Zener Diodes...........................................................................................................................149
Putting It All Together for a Robust Robot Power Supply..............................................150
(cid:2) Chapter 9: Driving Miss Motor............................................................................153
Why a Motor Driver?......................................................................................................153
Running Motors at Higher Voltages Than Logic Chips Can Provide...........................................................154
Supplying More Current to Motors Than Logic Chips Can Provide............................................................154
Causing Logic Errors with Motor Noise.....................................................................................................154
Supplying Motor Power from Unregulated vs. Regulated Power...............................................................154
Demonstrating the Four Modes of a Motor....................................................................155
Rotating Clockwise....................................................................................................................................156
Rotating Counterclockwise........................................................................................................................157
Rotating Freely/Coasting (Slow Decay).....................................................................................................157
Braking/Stopping (Fast Decay)..................................................................................................................157
Using Up More Energy..........................................................................................................................157
Braking by Fast Decay..........................................................................................................................158
Driving Simply with a Single Transistor.........................................................................158
Introducing the NPN Bipolar Single-Transistor Motor-Driver Circuit.........................................................160
Switching with a Transistor..................................................................................................................161
Using Transistors As Off/On Switches, Not Amplifiers, in Motor-Driver Circuits..................................161
Limiting Base Current with a Resistor..................................................................................................161
Protecting the Transistor with a Diode.................................................................................................162
x
Description:occurrence of a trademarked name, we use the names only in an editorial fashion The Definitive Guide to Building Java Robots (Apress, 2005), and co- Tom Gavin (first edition), Don Kerste (both editions), and Scott Preston.