Book Collection
Total Page:16
File Type:pdf, Size:1020Kb
EXPERimENTS EVIL GENIUS M' I ' OREN YOUR HEAD, ADD THE CONTENTS OF THIS BOOK STIR WITH YOUR IMAGINATION, AND BUILD SOME GREAT ROBOTICS TAB WAITAKERE LIBRARIES ROBOTICS 886605 7 PRINTED CIRCUIT BOARD IT1YKE PREDKD INCLUDED MASSEY LIBRARY 123 Robotics Experiments for the Evil Genius 123 Robotics Experiments for the Evil Genius MYKEPREDKO McGraw-Hill New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Tdronto Library of Congress < 'ataloging in-Publication Data Predko, Michael. 123 robotics expeiiments for the evil genius / Mvke Predko./ p. cm ISBN 0-07-141358-8 1 Robotics 1. Title: One hundred twenty-three robotics exeriments for the evil genius. 11. Title: One hundred twenty-three robotics experiment' for the evil genius. Ill Title. TJ2T1.P73 2003 629.8'92—dc22 2003066532 Copyright © 2004 by The McGraw Hill Consnipanies. Inc. All rights reserved. Printed in the United States of America. Except as permitted under the United States C opyright Act of 1976. no part of this publication may be reproduced or distributed m any form or by any means, or stored in a data base or reti ieval system, without the prior written permission of the publisher. I 2 3 4 5 6 7 8 9 0 QPD/QPD 0 9 8 7 6 5 4" 3 P'N 141359-6 PART OF ISBN 0-07-141358-8 The sponsoring editor for this hook was Judy Buss and the produc lion superv isor was Pamela A Felton. It wav set m Times Ten by Mat Alfister Publishing Services, LLC. Pruned and hound by Quehecor/Dubuque. This book is printed on recycled,acid free paper containing a minimum of 50 percent recycled de-inked fiber. McCIraw-Hill books are available at special quantity discounts to use as premiums and sales promo tionx, or for use in corporate training programs. For more information, please write to the Director of Special Sales, McC it aw Hill Professional, Two Penn Plaza, New York, NY' 10121-2298. Or contact your local bookstore. Information contained in this work has been obtained by The McGraw Hill Compa¬ nies, Inc ( McGraw Hill") from sources believed to be reliable However, neither McC iraw- Hill nor its authors guarantee the accuracy or completeness ol any informa lion published herein,and neither McGraw-Hill nor its authors shall be responsible tor any errors, omissions, or damages arising out of use of this information. Ibis work is published with the understanding that McGraw-Hill and its authors are supplying information but are not attempting to render professional services. If such services are required, the assistance ol an appropriate professional should be sought. o o Contents ■■ MB MBI BMi BBS BM BM Hi MB BBB H Mi £| (D 3 ft Mvke’s Rules of Robotics ix Experiment 15 Resistors and Voltage Drops 44 Section One Introduction to Robots 1 Experiment 16 Current Measurement and Ohm's Law 46 Experiment 1 Toilet Paper Roll Experiment, 17 Kirchoff’s Voltage Law M android 2 and Series Loads 48 Experiment 2 Pipe Cleaner Insect 5 Experiment 18 Variable Resistors 50 Experiment 3 LEGO Mobile Robots 7 Experiment 19 Kirchoff’s Current Law and Parallel Loads 53 Experiment 4 Cardboard Arm 10 Experiment 20 Thevinu.Cs Equivalency 55 Section Two Robot Structures 15 Experimi NT 21 Power 57 Experiment 5 Cutting Plywood 17 Experiment 22 Batteries 59 Experiment 6 Strengthening Structures 20 Section Four Magnetic Devices 63 Experiment 7 Finishing Wood 22 Experiment 23 Electromagnets 65 Experiment 8 A Gaggle of Glues 24 Experiment 24 Relays 67 Experiment 9 Nuts and Bolts 25 Experiment 25 Measuring the Earth’s Experiment 10 Soldering and Splicing Magnetic Field 69 Wires 28 Experiment 26 Direct Current ( DC) Experiment 11 Assembling the Included Motor 71 PCB 31 Section Five Drivetrains 75 Section Three Basic Electrical Theory 35 Exerimenf 27 Motor-Driven Crane 77 Experiment 12 Electrical Circuits and Experiment 28 Pulleys Added to Switches 37 Ciane 79 Electrical Circuits and Experiment 13 Experiment 29 Switch DC Motor 40 Switches MI Bridge" 80 Experiment 14 Voltage Measurement 41 Contents V Experiment 30 Differential Drive Experiment 48 Line Following Robot 135 Robot Chassis 82 Section Nine Audio Electronics 139 Experiment 31 Stepper Motors 85 Experiment 49 Buzzers 141 Experiment 32 Muscle Wire 88 Experiment 50 Basic Transistor Oscillator Section Six Semiconductors 91 Code Practice Tool 143 Experiment 33 Diodes 93 Experiment 51 Electronic Stethoscope 145 Experiment 34 Light-Emitting Diodes Experiment 52 Sound-Level Meter 148 (LEDs) 95 Section Ten Digital Logic 151 Experiment 35 NPN Transistor and Two- LED Lighting Control 97 Experiment 53 Basic Gate Operation 153 Experiment 36 Driving a Motor with a Experiment 54 CMOS Touch Switch 155 Transistor 99 Experiment 55 Bipolar Transistor-Based Experiment 37 Bipolar PNP Transistor TIL “N OP'Gate 158 Motor Control 102 Experiment 56 Sum of Product Circuits 161 Experiment 38 Transistor Motor H-Bridge 104 Experiment 57 Common l.ogie Built from the NOR Gate 163 Section Seven Our Friend, the 555 Chip 107 Experiment 58 XORs and Adders 166 Experiment 39 Blinking LEDs 109 Experiment 59 Pull-,y ps/Pu 11 - Downs 168 Experiment 40 555 Button Debounce .112 Experiment 60 Mickey Mouse Logic 170 Experiment 41 R/C Ser vo Control 114 Section Eleven Power Supplies 173 Experiment 42 Light-Seeking Robot 117 Experiment 61 Zenet Diodes 175 Section Eight Optoelectronics 121 Experiment 62 Linear Power Supply 177 Experiment 43 Different Color LEDs 124 Experiment 63 Switch Mode Power Supply 179 Experiment 44 Changing an LED s Brightness 126 Section Twelve Sequential Logic Circuits 183 Experiment 45 Multisegment LEDs 128 Experiment 64 RS Flip Flops 185 Experimeni 46 Optoisolator Lock and Key 131 Experiment 65 Edge-Triggered Flip Flops 187 Experiment 47 White/Black Surface Sensor 133 Experiment 66 Full D Flip Flop 189 Contents vi Contents Contents Experiment 67 Flip Flop Reset 191 Experiment 85 Creating Simple Program I .oops 232 Experiment 68 Parallel Data 193 Experiment 86 Conditionally Looping 233 Experiment 66 Traffic Lights 194 Experiment 87 ’■Power Off" Experiment 70 Shift Registers 198 Application 235 Experiment 71 Christmas Decoration 200 Experiment 88 Conditionally Executing Code 236 Experiment 72 Random Movement Robot 203 Experiment 89 Advanced Conditional Execution 238 Expf riment 73 Counters 205 Experiment 90 l Ring the “for" Loop Expi riment 74 Schmitt Trigger Inputs in Your Application 236 and Button 1 )ebounce 207 Experiment 9] Sa\ ing Code Space Experiment 75 PWM Generation 209 t Ring Subroutines 242 Section Thirteen Learning to Section Fourteen Interfacing Program Using the Parallax I lardware to the BASIC BASIC Stamp 2 213 Stamp 2 247 Experiment 76 Loading BASK ' Stamp Experiment 92 Controlling an LED 246 Windows Editor Software on Your PC’ 214 Experiment 93 Cylon Eye 250 Experiment 77 Connecting the PCB Experiment 94 Hitachi 44780-Controlled and BS2 to Your PC I iquid Crystal Display 252 and Running Your First Application 216 Experiment 95 Musical Tone Output 254 Experiment 78 Saving Your Applications Experiment 66 Electronic Dice 256 on Your PC 218 Experiment 67 Keypad Input 257 Experiment 79 The “Hello World!” Application Explained 220 Experimen r 68 Resistance Measurement 256 Experiment 80 Variables and Data Types 222 Experiment 66 PWM Analog Voltage Output 261 Experiment 81 Number Data Formats 224 Experiment 100 R-2R Digital-to- Experiment 82 ASCII Characters 226 Analog Converter 262 Experiment 83 Variable Arrays 228 Section Fifteen Sensors 265 Experiment 84 I Ring Mathematical Experiment 101 bLiza. the Snarky Operators in the Computer 267 Assignment Statement 230 Contents vii Experiment 102 Multiple Seven-segment Experiment 115 Robot Artist 305 Displays 271 Experiment 116 Parallax’s “GUI-Bot” Experiment 103 RCtime Light Sensor 273 Programming Interface 308 Experiment 104 Differential Light Sensors 275 Experiment 117 Stepper Motor Control 31 1 Experiment H)5 Sound Control 278 Experiment 118 Infrared Two-Way Comma nications 314 Experiment 106 Robot “Whiskers” 280 Section Seventeen Navigation 319 Experiment 107 [R Object Sensors 283 Experiment 119 Line-Following Robot 321 Section Sixteen Mobile Robots 287 Experiment 120 Wall Following Robot 324 Experiment 108 DC Motor Control Base with H-Bridge Experiment 121 Ultrasonic Distance Drivers 289 Measurement 326 Experiment 109 State Machine Experiment 122 Hall Effect Compass 330 Programming 292 Experiment 123 NMEA GPS Interface 332 Experiment 110 Robot Moth Example 294 PBASIC Reference 335 Experiment 111 Random Movement Explained 296 Acknowledgments 341 Remote-Control Car Experiment 112 Index 343 Robot Base 298 About the Author 357 Experiment 113 R/C Servo Setup 300 Experiment 114 Controlling Multiple Servos 303 Contents vi i i Contents Myke's Myke's Rules of Robotics Rules throughout Sis book, I will be keeping to my 10 6. The faster a robot runs, the more impressive it rules of robotics: is. 1. Start small. 7. Object detectors should detect objects far enough away from the robot so that it can 2. Design everything together. stop before damaging the object or itself. 3. Jerkiness in a robot is not a selling point. 8. Complexity adds weight. of 4. Protect your drivetrains from the environ¬ 9. Weight adds weight ment. ID. If the robot isn't doing anything, it shouldn't Robotics 5. Keep the robot’s center of mass in the center be expending any energy. of the robot. Myke's Rules of Rubntics 1 X Section One Introduction to Robots When you think of the term “robot,” what comes to actions automatically. 3 a person w ho works mind? Ihe following are some definitions that mechanically and efficiently but insensitively attempt to explain what a robot is: The Canadian Oxford Dictionary, 1998 Humans are the ultimate generalists, with a form A true robot is a machine that can be “taught,” designed by millions of years of evolution to programmed like a computer, to make different respond to a very wide variety of circumstances.