Robot Building for Beginners (cid:132) (cid:132) (cid:132) David Cook Robot Building for Beginners Copyright © 2009 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-2748-9 ISBN-13 (electronic): 978-1-4302-2749-6 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 Preston 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 Compositors Indexer: Potomac Indexers Artist: April Milne Cover Designer: Kurt Krames 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 http://www.springeronline.com. For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://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 http://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. For everyone who looks at the everyday objects around them and sees the potential of what they could become. Contents at a Glance (cid:132) Contents at a Glance..............................................................................................iv (cid:132) Contents.................................................................................................................vI (cid:132) About the Authors...............................................................................................xxx (cid:132) About the Technical Reviewers.........................................................................xxxi (cid:132) Acknowledgments............................................................................................xxxii (cid:132) Introduction.....................................................................................................xxxiii (cid:132) Chapter 1: Welcome Robot Inventor!......................................................................1 (cid:132) Chapter 2: Where to Obtain Tools and Parts.........................................................15 (cid:132) Chapter 3: Safety..................................................................................................21 (cid:132) Chapter 4: Digital Multimeter...............................................................................33 (cid:132) Chapter 5: Numbers and Units..............................................................................53 (cid:132) Chapter 6: Robot Line-Following ..........................................................................63 (cid:132) Chapter 7: Nine-Volt Batteries..............................................................................79 (cid:132) Chapter 8: Clips and Test Leads............................................................................93 (cid:132) Chapter 9: Resistors...........................................................................................101 (cid:132) Chapter 10: LEDs.................................................................................................111 (cid:132) Chapter 11: Power on!........................................................................................127 (cid:132) Chapter 12: Solderless Prototyping....................................................................143 (cid:132) Chapter 13: Solderless Breadboard Setup..........................................................161 (cid:132) Chapter 14: Variable Resistors...........................................................................173 (cid:132) Chapter 15: Comparators....................................................................................193 iv (cid:132) CONTENTS AT A GLANCE (cid:132) Chapter 16: Transistor Switches........................................................................207 (cid:132) Chapter 17: DC Motors........................................................................................223 (cid:132) Chapter 18: Adding Gearhead Motors.................................................................255 (cid:132) Chapter 19: Wheels.............................................................................................265 (cid:132) Chapter 20: Coupler............................................................................................283 (cid:132) Chapter 21: Soldering Equipment.......................................................................303 (cid:132) Chapter 22: Soldering and Connecting...............................................................313 (cid:132) Chapter 23: The Motherboard.............................................................................339 (cid:132) Chapter 24: Body Building..................................................................................359 (cid:132) Chapter 25: Launching the Line-Follower...........................................................385 (cid:132) Chapter 26: Encore.............................................................................................405 (cid:132) Chapter 27: Appendix.........................................................................................431 (cid:132) Index...................................................................................................................439 v (cid:132) CONTENTS Contents (cid:132) Contents at a Glance..............................................................................................iv (cid:132) Contents.................................................................................................................vI (cid:132) About the Authors...............................................................................................xxx (cid:132) About the Technical Reviewers.........................................................................xxxi (cid:132) Acknowledgments............................................................................................xxxii (cid:132) Introduction.....................................................................................................xxxiii (cid:132) Chapter 1: Welcome Robot Inventor!......................................................................1 Four Disciplines.................................................................................................................1 Anatomy of a Homemade Robot........................................................................................1 Brains.......................................................................................................................................................3 Electrical Power........................................................................................................................................3 Power Source......................................................................................................................................4 Power Regulation................................................................................................................................4 On/Off Switch......................................................................................................................................5 Sensors.....................................................................................................................................................5 Pushbuttons.........................................................................................................................................7 Action and Feedback................................................................................................................................7 Movement............................................................................................................................................7 Indicator Lights....................................................................................................................................9 Miscellaneous Components......................................................................................................................9 Body..........................................................................................................................................................9 Aesthetics..........................................................................................................................................10 vi (cid:132) CONTENTS Building Up......................................................................................................................10 Taking Small Bites..................................................................................................................................10 Making Modules.....................................................................................................................................11 Keeping It Fun and Keeping It Light........................................................................................................12 Finding Camaraderie and Support..........................................................................................................13 Onward and Upward........................................................................................................13 (cid:132) Chapter 2: Where to Obtain Tools and Parts.........................................................15 Ordering Free Information...............................................................................................15 Discovering Hidden Messages.........................................................................................17 Considering Columns..............................................................................................................................17 Counting Pages.......................................................................................................................................17 Comparing Prices...................................................................................................................................17 Saving Money..................................................................................................................18 (cid:132) Chapter 3: Safety..................................................................................................21 Benefiting from Age and Experience...............................................................................21 Following Instructions.....................................................................................................21 Reading Chemical Labels................................................................................................22 Donning Safety Glasses...................................................................................................22 Hanging Glasses and Placing Them Face Up..........................................................................................22 Wearing Other Safety Clothes..........................................................................................23 Insuring Adequate Ventilation..........................................................................................24 Storing Properly...............................................................................................................24 Talking About Your Activities, Materials, and Tools...............................................................................24 Washing Before Eating....................................................................................................24 Avoiding Nasty Elements.................................................................................................25 Lead........................................................................................................................................................25 Mercury..................................................................................................................................................26 vii (cid:132) CONTENTS Cadmium................................................................................................................................................27 Purchasing Safer Parts Labeled RoHS....................................................................................................27 Shocking..........................................................................................................................27 AC vs. DC................................................................................................................................................27 Using Rechargeable Batteries and Professional Transformers..............................................................27 Connecting Through Circuit Breakers and GFCI Outlets.........................................................................28 Saving the Ground Prong........................................................................................................................30 Disconnecting Power..............................................................................................................................31 Steering Clear of Dangerous Robots................................................................................31 Sizing Up Motors..............................................................................................................31 Lighting Up.......................................................................................................................32 Staying Rested and Level-Headed...................................................................................32 (cid:132) Chapter 4: Digital Multimeter...............................................................................33 Must-Have Features........................................................................................................33 Digital.....................................................................................................................................................34 Digits......................................................................................................................................................34 DC Voltage..............................................................................................................................................35 DC Current..............................................................................................................................................35 Resistance..............................................................................................................................................35 Probes or Leads......................................................................................................................................35 Overload/Fuse Protection.......................................................................................................................35 Nice-To-Have Features....................................................................................................36 Capacitance............................................................................................................................................36 Diode......................................................................................................................................................37 Continuity...............................................................................................................................................37 Frequency...............................................................................................................................................37 Duty Cycle...............................................................................................................................................37 Autoranging............................................................................................................................................38 viii (cid:132) CONTENTS Auto Power Off........................................................................................................................................38 Transistor...............................................................................................................................................39 Dual Display............................................................................................................................................39 Maximum................................................................................................................................................39 Minimum................................................................................................................................................40 Stand......................................................................................................................................................40 Optional Features.............................................................................................................40 Inductance..............................................................................................................................................40 RS-232/USB Data Interface....................................................................................................................41 Scope......................................................................................................................................................42 Backlight.................................................................................................................................................42 Stopwatch/Single Pulse Width...............................................................................................................42 Temperature...........................................................................................................................................42 Sound.....................................................................................................................................................42 Count......................................................................................................................................................42 Bar Graph................................................................................................................................................42 Data Hold................................................................................................................................................43 Data Auto................................................................................................................................................43 High/Low/Logic.......................................................................................................................................43 Memory..................................................................................................................................................43 Relative...................................................................................................................................................44 Offset......................................................................................................................................................44 Limit Testing/Compare...........................................................................................................................44 Holster or Rubber Boot...........................................................................................................................44 AC Features.....................................................................................................................44 AC Voltage..............................................................................................................................................45 True RMS................................................................................................................................................45 AC Current..............................................................................................................................................45 Obtaining Hook Probe Adaptors.......................................................................................45 ix