Tải bản đầy đủ (.pdf) (770 trang)

robot builders bonanza - gordon mccomb

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (10.97 MB, 770 trang )

ROBOT BUILDER’S
BONANZA
GORDON McCOMB
MYKE PREDKO
THIRD EDITION
McGraw-Hill
New York Chicago San Francisco Lisbon London Madrid
Mexico City Milan New Delhi San Juan Seoul
Singapore Sydney Toronto
Copyright © 2006, 2001, 1987 by The McGraw-Hill Companies, Inc. All rights reserved. Manufactured in the United States
of America. 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.
0-07-148698-4
The material in this eBook also appears in the print version of this title: 0-07-146893-5.
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. For more information, please contact George Hoare, Special Sales, at george_hoare@mcgraw-
hill.com or (212) 904-4069.
TERMS OF USE
This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) 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.
DOI: 10.1036/0071468935
We hope you enjoy this
McGraw-Hill eBook! If
you’d like more information about this book,
its author, or related books and websites,
please click here.
Professional
Want to learn more?
CONTENTS
Acknowledgments xxv
Introduction xxvii
I.1 Inside Robot Builder’s Bonanza xxvii
I.2 About the Third Edition xxviii
I.3 What You Will Learn xxviii
I.4 How to Use This Book xxix
I.5 Expertise You Need xxx
I.6 Conventions Used in This Book xxx
PART 1—ROBOT BASICS
Chapter 1—The Robot Experimenter 3

1.1 The Building-Block Approach 4
1.2 Basic Skills 4
1.2.1 Electronics Background 5
1.2.2 Programming Background 5
1.2.3 Mechanical Background 6
1.2.4 Workshop Aptitude 6
1.2.5 The Two Most Important Skills 6
1.3 Ready-Made, Kits, or Do-It-Yourself? 7
1.4 The Mind of the Robot Experimenter 7
1.5 From Here 8
Chapter 2—Anatomy of a Robot 9
2.1 Tethered versus Self-Contained 10
2.2 Mobile versus Stationary 10
2.3 Autonomous versus Teleoperated 11
2.4 The Body of the Robot 12
2.4.1 Skeletal Structures 12
2.4.2 Frame Construction 12
iii
For more information about this title, click here
2.4.3 Size and Shape 13
2.4.4 Flesh and Bone 13
2.5 Power Systems 15
2.5.1 Types of Batteries 15
2.5.2 Alternative Power Sources 16
2.5.3 Pressure Systems 16
2.6 Locomotion Systems 17
2.6.1 Wheels 17
2.6.2 Legs 17
2.6.3 Tracks 18
2.7 Arms and Hands 19

2.7.1 Stand-Alone or Built-On Manipulators 20
2.7.2 Grippers 20
2.8 Sensory Devices 20
2.9 Output Devices 21
2.10 Smart versus Dumb Robots 21
2.11 The Concept of Robot Work 22
2.12 From Here 23
Chapter 3—Structural Materials 25
3.1 Paper 26
3.2 Wood 27
3.3 Plastics 28
3.4 Metal Stock 29
3.4.1 Extruded Aluminum 29
3.4.2 Shelving Standards 29
3.4.3 Mending Plates 30
3.4.4 Rods and Squares 30
3.4.5 Iron Angle Brackets 30
3.5 Quick Turn Mechanical Prototypes 30
3.6 Fasteners 31
3.6.1 Nuts and Bolts 32
3.6.2 Washers 32
3.6.3 All-Thread Rod 32
3.6.4 Special Nuts 33
3.6.5 Rivets 33
iv CONTENTS
3.6.6 Adhesives 33
3.6.7 Miscellaneous Methods 33
3.7 Scavenging: Making Do with What You Already Have 35
3.8 Finishing Your Robot’s Structure 36
3.9 From Here 38

Chapter 4—Buying Parts 39
4.1 Hobby and Model Stores 39
4.2 Craft Stores 40
4.3 Hardware Stores 40
4.4 Electronic Stores 41
4.5 Electronics Wholesalers and Distributors 41
4.6 Samples from Electronics Manufacturers 42
4.7 Specialty Stores 42
4.8 Shopping the Surplus Store 43
4.8.1 What You Can Get Surplus 44
4.9 Finding Parts on the Internet 44
4.10 From Here 45
Chapter 5—Electronic Components 47
5.1 Cram Course in Electrical Theory 47
5.2 Wire Gauge 49
5.3 Fixed Resistors 52
5.4 Variable Resistors 53
5.5 Capacitors 54
5.6 Diodes 56
5.7 Transistors 57
5.8 Grounding Circuitry 60
5.9 Integrated Circuits 61
5.10 Schematics and Electronic Symbols 61
5.11 From Here 62
Chapter 6—Tools 63
6.1 Safety 64
6.2 Setting Up Shop 64
CONTENTS v
6.3 Basic Tools 65
6.3.1 Optional Tools 66

6.4 Electronic Tools 68
6.4.1 Static Control 69
6.4.2 Digital Multimeter 70
6.4.3 Logic Probes 73
6.4.4 Oscilloscope 74
6.5 From Here 78
Chapter 7—Electronic Construction Techniques 79
7.1 Soldering Tips and Techniques 79
7.1.1 Solder Safety 80
7.1.2 Tools and Equipment 81
7.1.3 How to Solder 83
7.1.4 Solder Tip Maintenance and Cleanup 83
7.2 Breadboards 84
7.3 Prototyping PCBs 85
7.4 Point-to-Point Prototyping Wiring 86
7.5 Wire-Wrapping 87
7.6 Quick Turn Prototype Printed Circuit Boards 87
7.7 Headers and Connectors 88
7.8 Eliminating Static Electricity 89
7.8.1 Storing Static-Sensitive Components 90
7.8.2 Tips to Reduce Static 90
7.9 Good Design Principles 91
7.9.1 Pull-Up Resistors 91
7.9.2 Use Bypass Capacitors 91
7.9.3 Keep Lead Lengths Short 91
7.9.4 Avoid Ground Loops 92
7.10 From Here 93
PART 2—ROBOT PLATFORM CONSTRUCTION
Chapter 8—Plastic Platforms 97
8.1 Types of Plastics 98

8.2 Working with Plastics 100
8.2.1 How to Cut Plastic 100
vi CONTENTS
8.2.2 How to Drill Plastic 101
8.2.3 How to Bend and Form Plastic 102
8.2.4 How to Polish the Edges of Plastic 102
8.2.5 How to Glue Plastic 103
8.2.6 Using Hot Glue with Plastics 104
8.2.7 How to Paint Plastics 104
8.2.8 Buying Plastic 105
8.2.9 Plastics around the House 105
8.3 Building the Minibot 105
8.3.1 Foundation or Base 106
8.3.2 Motor Mount 106
8.3.3 Top Shell 108
8.3.4 Battery Holder 108
8.3.5 Wiring Diagram 109
8.4 From Here 110
Chapter 9—Wooden Platforms 111
9.1 Choosing the Right Wood 111
9.1.1 Plywood 111
9.1.2 Planking 113
9.1.3 Balsa 113
9.1.4 Dowels 114
9.2 The Woodcutter’s Art 114
9.3 Cutting and Drilling 115
9.4 Finishing 115
9.5 Building a Wooden Motorized Platform 116
9.5.1 Attaching the Motors 118
9.5.2 Stabilizing Caster 118

9.5.3 Battery Holder 119
9.6 From Here 121
Chapter 10—Metal Platforms 123
10.1 Working with Metal 124
10.1.1 Marking Cut Lines and Drill Hole Centers 124
10.1.2 Cutting 124
10.1.3 Drilling 124
10.1.4 Bending 125
10.1.5 Finishing 125
CONTENTS vii
10.2 Build the Buggybot 125
10.2.1 Framework 126
10.2.2 Motors and Motor Mount 126
10.2.3 Support Caster 127
10.2.4 Battery Holder 128
10.2.5 Wiring Diagram 129
10.3 Test Run 130
10.4 From Here 130
Chapter 11—Hacking Toys 131
11.1 A Variety of Construction Sets 132
11.1.1 Erector Set 132
11.1.2 Robotix 133
11.1.3 LEGO 135
11.1.4 CAPSULA 135
11.1.5 Fischertechnik 135
11.1.6 K’Nex 136
11.1.7 Zoob 137
11.1.8 Chaos 137
11.1.9 Other Construction Toys 138
11.2 Specialty Toys for Robot Hacking 138

11.2.1 Robosapien 138
11.2.2 Tamiya 138
11.2.3 OWIKITS and MOVITS 139
11.2.4 Rokenbok 140
11.3 Robots from Converted Vehicles 140
11.3.1 Hacking a Toy into a Robot 141
11.4 From Here 147
PART 3—COMPUTERS AND ELECTRONIC CONTROL
Chapter 12—An Overview of Robot “Brains” 151
12.1 Brains from Discrete Components 152
12.1.1 BEAM Technology 153
12.2 Brains from Computers and Microcontrollers 154
12.3 Types of Computers for Robots 155
12.3.1 Microcontrollers 155
12.3.2 Personal Digital Assistants 159
12.3.3 Single-Board Computers 160
12.3.4 Personal Computers 161
viii CONTENTS
12.4 Inputs and Outputs 164
12.4.1 Serial Communications 164
12.4.2 Asynchronous Serial Communications 166
12.4.3 Digital-to-Analog Conversion 167
12.4.4 Pulse and Frequency Management 167
12.4.5 Special Functions 168
12.5 From Here 168
Chapter 13—Programming Fundamentals 169
13.1 Important Programming Concepts 170
13.1.1 Linear Program Execution 170
13.1.2 Flowcharts 171
13.1.3 Variables and I/O Ports 173

13.1.4 Assignment Statements 176
13.1.5 Arrays and Character Strings 180
13.1.6 Decision Structures 181
13.1.7 Subroutines and Functions 183
13.1.8 Console I/O 185
13.1.9 Comments 185
13.2 Robotics Programming 186
13.3 Graphical Programming 187
13.4 From Here 189
Chapter 14—Computer Peripherals 191
14.1 Sensors as Inputs 191
14.1.1 Types of Sensors 192
14.1.2 Examples of Sensors 192
14.2 Input and Output Methodologies 193
14.2.1 Parallel Interfacing 193
14.2.2 Serial Interfacing 194
14.3 Motors and Other Outputs 195
14.3.1 Other Common Types of Outputs 195
14.4 Sample Output Circuits 195
14.5 Digital Inputs 198
14.5.1 Interfacing from Different Voltage Levels 198
14.5.2 Using Opto-Isolators 199
14.5.3 Zener Diode Input Protection 201
14.6 Interfacing Analog Input 201
14.6.1 Voltage Comparator 201
14.6.2 Signal Amplification 202
CONTENTS ix
14.6.3 Signal Buffering 202
14.6.4 Other Signal Techniques for Op-Amps 203
14.6.5 Common Input Interfaces 204

14.7 Analog-to-Digital Converters 204
14.7.1 How Analog-to-Digital Conversion Works 205
14.7.2 Inside the Successive Approximation ADC 205
14.7.3 Analog-to-Digital Conversion ICs 206
14.7.4 Integrated Microcontroller ADCs 206
14.7.5 Sample Circuits 206
14.8 Digital-to-Analog Conversion 207
14.9 Expanding Available I/O Lines 208
14.10 Bitwise Port Programming 210
14.10.1 Masking Values by ANDing 210
14.10.2 Converting a Value into a Binary-Format String 211
14.10.3 Summing Bits into a Decimal Value 211
14.11 From Here 212
Chapter 15—The BASIC Stamp 2 Microcontroller 213
15.1 Choosing the Right Stamp for Your Application 214
15.2 Inside the BASIC Stamp 217
15.3 Developer’s Options 219
15.4 Understanding and Using PBASIC 220
15.4.1 Variable and Pin/Port Definitions 221
15.4.2 Assignment Statements and Arithmetic Expressions 224
15.4.3 Execution Flow and Decision Structures 226
15.4.4 Built-in Functions 231
15.5 Sample Interface Applications 232
15.5.1 Basic BS2 Setup 233
15.5.2 LED Outputs 236
15.5.3 Adding Switches and Other Digital Inputs 239
15.5.4 LCD Interface 241
15.5.5 I/O Port Simulator 245
15.6 BS2 Application Design Suggestions 252
15.7 From Here 253

Chapter 16—Remote Control Systems 255
16.1 Controlling Your Robot with a PC Joystick or Control Pad 255
16.2 Building a Joystick Teaching Pendant 259
16.2.1 Possible Enhancements 263
x CONTENTS
16.3 Commanding a Robot with Infrared Remote Control 264
16.3.1 A Typical Microcontroller Interface 265
16.3.2 BS2 Interface 268
16.3.3 Controlling Robot Motors with a Remote Control 270
16.3.4 Going Further 272
16.4 Using Radio Control Instead of Infrared 273
16.5 From Here 274
PART 4—POWER, MOTORS, AND LOCOMOTION
Chapter 17—Batteries and Robot Power Supplies 277
17.1 Remember: Safety First! 278
17.2 Increasing Robot Performance 278
17.3 Combining Batteries 279
17.4 Types of Batteries 280
17.4.1 Zinc 280
17.4.2 Alkaline 281
17.4.3 High-Tech Alkaline 281
17.4.4 Nickel Metal Hydride 281
17.4.5 Nickel-Cadmium 282
17.4.6 Lithium and Lithium-Ion 282
17.4.7 Lead-Acid 283
17.5 Battery Ratings 284
17.5.1 Voltage 284
17.5.2 Capacity 285
17.5.3 Recharge Rate 286
17.5.4 Nominal Cell Voltage 287

17.6 Battery Recharging 287
17.7 Recharging the Robot 288
17.8 Battery Care 288
17.9 Power Distribution 289
17.9.1 Fuse Protection 289
17.9.2 Multiple Voltage Requirements 290
17.9.3 Separate Battery Supplies 291
17.10 Voltage Regulation 292
17.10.1 Zener Diode Voltage Regulation 292
17.10.2 Linear Voltage Regulators 294
17.10.3 Switching Voltage Regulation 295
17.10.4 Power Distribution 297
CONTENTS xi
17.11 Battery Monitors 298
17.11.1 4.3 V Zener Battery Monitor 298
17.11.2 Zener/Comparator Battery Monitor 300
17.11.3 Using a Battery Monitor with a Microprocessor 300
17.12 A Robot Testing Power Supply 300
17.13 From Here 303
Chapter 18—Principles of Robot Locomotion 305
18.1 First Things First: Weight 305
18.2 Tips for Reducing Weight 306
18.3 Beware of the Heavy Frame 307
18.4 Construction Robots with Multiple Decks 307
18.5 Frame Sagging Caused by Weight 308
18.6 Horizontal Center of Balance 310
18.7 Vertical Center of Gravity 311
18.8 Locomotion Issues 311
18.8.1 Wheels and Tracks 311
18.8.2 Legs 312

18.9 Motor Drives 313
18.9.1 Centerline Drive Motor Mount 313
18.9.2 Front-Drive Motor Mount 313
18.9.3 Caster Choices 315
18.10 Steering Methods 318
18.10.1 Differential 318
18.10.2 Car-Type 318
18.10.3 Tricycle 319
18.10.4 Omnidirectional 320
18.11 Calculating the Speed of Robot Travel 320
18.12 Round Robots or Square? 322
18.13 From Here 322
Chapter 19—Choosing the Right Motor 325
19.1 AC or DC? 325
19.2 Continuous or Stepping? 326
19.3 Servo Motors 327
19.4 Other Motor Types 327
xii CONTENTS
19.5 Motor Specifications 328
19.5.1 Operating Voltage 328
19.5.2 Current Draw 329
19.5.3 Speed 330
19.5.4 Torque 331
19.5.5 Stall or Running Torque 331
19.6 Gears and Gear Reduction 333
19.6.1 Gears 101 333
19.6.2 Establishing Gear Reduction 333
19.6.3 Using Motors with Gear Reduction 335
19.6.4 Anatomy of a Gear 337
19.7 Pulleys, Belts, Sprockets, and Roller Chain 339

19.7.1 More about Pulleys and Belts 339
19.7.2 More about Sprockets and Roller Chain 339
19.8 Mounting the Motor 339
19.9 Connecting to the Motor Shaft 341
19.10 From Here 342
Chapter 20—Working with DC Motors 345
20.1 The Fundamentals of DC Motors 345
20.2 Reviewing DC Motor Ratings 347
20.3 Motor Control 348
20.3.1 Relay Control 348
20.3.2 Bipolar Transistor Control 351
20.3.3 Power MOSFET Control 355
20.3.4 Motor Bridge Control 357
20.3.5 Relay versus Bipolar versus FET Motor Drivers 359
20.4 Motor Speed Control 359
20.4.1 Not the Way to Do It 360
20.4.2 Basic PWM Speed Control 360
20.4.3 Counter-Based PWM Speed Control 365
20.5 Odometry: Measuring Distance of Travel 367
20.5.1 Anatomy of a Shaft Encoder 367
20.5.2 The Distance Counter 367
20.5.3 Making the Shaft Encoder 368
20.5.4 Mounting the Hardware 371
20.5.5 Quadrature Encoding 371
20.6 From Here 374
CONTENTS xiii
Chapter 21—Working with Stepper Motors 375
21.1 Inside a Stepper Motor 376
21.1.1 Wave Step Sequence 376
21.1.2 Four-Step Sequence 376

21.2 Design Considerations of Stepper Motors 378
21.2.1 Stepper Phasing 378
21.2.2 Step Angle 378
21.2.3 Pulse Rate 378
21.2.4 Running Torque 379
21.2.5 Braking Effect 379
21.2.6 Voltage, Current Ratings 380
21.3 Controlling a Stepper Motor 380
21.3.1 Using a Stepper Motor Controller Chip 382
21.3.2 Using Logic Gates to Control Stepper Motors 382
21.3.3 Translator Enhancements 383
21.3.4 Triggering the Translator Circuits 385
21.3.5 Using Bipolar Stepper Motors 386
21.3.6 Buying and Testing a Stepper Motor 387
21.3.7 Sources for Stepper Motors 387
21.3.8 Wiring Diagram 389
21.4 From Here 391
Chapter 22—Working with Servo Motors 393
22.1 How Servos Work 394
22.2 Servos and Pulse Width Modulation 395
22.3 The Role of the Potentiometer 396
22.4 Rotational Limits 397
22.5 Special-Purpose Servo Types and Sizes 397
22.6 Gear Trains and Power Drives 398
22.7 Typical Servo Specs 398
22.8 Connector Styles and Wiring 399
22.8.1 Connector Type 400
22.8.2 Pinout and Color Coding 401
22.9 Circuits for Controlling a Servo 401
22.9.1 Controlling a Servo via a 556 Timer Chip 402

22.9.2 Controlling a Servo via a BASIC Stamp 402
22.9.3 Using a Dedicated Controller 404
xiv CONTENTS
22.9.4 Servo Voltage Margins 405
22.9.5 Working with and Avoiding the Dead Band 405
22.9.6 Going beyond the 1 to 2 Millisecond Pulse Range 406
22.10 Modifying a Servo for Continuous Rotation 406
22.10.1 Basic Modification Instructions 406
22.10.2 Applying New Grease 407
22.10.3 Testing the Modified Servo 407
22.10.4 A Caution on Modifying Servos 408
22.10.5 Software for Running Modified Servos 408
22.10.6 Limitations of Modified Servos 408
22.10.7 Modifying by Removing the Servo Control Board 409
22.11 Attaching Mechanical Linkages to Servos 409
22.12 Attaching Wheels to Servos 410
22.13 Mounting Servos on the Body of the Robot 411
22.13.1 Attaching Servos with Glue 411
22.13.2 Attaching Servos with Screws or Bolts 411
22.14 From Here 413
PART 5—PRACTICAL ROBOTICS PROJECTS
Chapter 23—Building a Roverbot 417
23.1 Building the Base 418
23.2 Motors 420
23.3 Support Casters 424
23.4 Batteries 425
23.5 Riser Frame 426
23.6 Street Test 429
23.7 From Here 430
Chapter 24—Building a Heavy-Duty Six-Legged

Walking Robot 431
24.1 Frame 431
24.2 Legs 435
24.3 Motors 444
24.4 Batteries 449
24.5 Testing and Alignment 449
24.6 From Here 451
CONTENTS xv
Chapter 25—Advanced Robot Locomotion Systems 453
25.1 Making Tracks 453
25.2 Steering Wheel Systems 455
25.3 Six-Wheeled Robot Cart 457
25.4 Building Robots with Shape-Memory Alloy 458
25.4.1 Basics of SMA 458
25.4.2 Using SMA 459
25.4.3 Shape-Memory Alloy Mechanisms 462
25.4.4 Designing Robots for SMA Limitations 463
25.5 From Here 463
Chapter 26—Reaching Out with Robot Arms 465
26.1 The Human Arm 465
26.2 Arm Types 466
26.2.1 Revolute Coordinate 466
26.2.2 Polar Coordinate 467
26.2.3 Cylindrical Coordinate 468
26.2.4 Cartesian Coordinate 468
26.3 Activation Techniques 469
26.4 From Here 470
Chapter 27—Building a Revolute Coordinate Arm 471
27.1 Design Overview 471
27.2 Shoulder Joint and Upper Arm 472

27.3 Elbow and Forearm 474
27.4 Refinements 478
27.5 Position Control 479
27.5.1 Potentiometer 479
27.5.2 Incremental Shaft Encoders 480
27.6 From Here 481
Chapter 28—Experimenting with Gripper Designs 483
28.1 The Clapper 483
28.2 Two-Pincher Gripper 486
28.2.1 Basic Model 486
28.2.2. Advanced Model Number 1 487
28.2.3 Advanced Model Number 2 490
xvi CONTENTS
28.3 Flexible Finger Grippers 494
28.4 Wrist Rotation 496
28.5 From Here 497
PART 6—SENSORS AND NAVIGATION
Chapter 29—The Sense of Touch 501
29.1 Mechanical Switch 502
29.1.1 Microswitches 502
29.2 Switch Bouncing 503
29.2.1 Hardware Debounce 504
29.2.2 Software Debounce 505
29.3 Optical Sensors 507
29.4 Mechanical Pressure Sensors 508
29.4.1 Conductive Foam 508
29.4.2 Strain Gauges 510
29.4.3 Converting Pressure Data to Computer Data 510
29.5 Experimenting with Piezoelectric Touch Sensors 511
29.5.1 Experimenting with Ceramic Discs 512

29.5.2 Experimenting with Kynar Piezo Film 513
29.5.3 Attaching Leads to Kynar Piezo Film 514
29.5.4 Using Kynar Piezo Film as a Mechanical Transducer 515
29.5.5 Constructing a Kynar Piezo Film Bend Sensor 516
29.6 Other Types of Touch Sensors 516
29.7 From Here 517
Chapter 30—Object Detection 519
30.1 Design Overview 520
30.1.1 Near-Object Detection 520
30.1.2 Far-Object Detection 521
30.1.3 Remembering the KISS Principle 521
30.1.4 Redundancy 522
30.2 Noncontact Near-Object Detection 523
30.2.1 Simple Infrared Light Proximity Sensor 523
30.2.2 Better IR Proximity Sensor 524
30.2.3 Sharp Infrared Object Sensors 530
30.2.4 Passive Infrared Detection 534
CONTENTS xvii
30.2.5 Using a New or Removed-from-Circuit Detector 534
30.2.6 Hacking a Motion Detector Board 537
30.2.7 Using the Focusing Lens 537
30.2.8 Ultrasonic Sound 538
30.3 Contact Detection 541
30.3.1 Physical Contact Bumper Switch 541
30.3.2 Whisker 542
30.3.3 Spring Whiskers 543
30.3.4 Pressure Pad 544
30.3.5 Multiple Bumper Switches 545
30.4 Soft Touch and Compliant Collision Detection 548
30.4.1 Laser Fiber Whiskers 548

30.4.2 Piezo Disc Touch Bar 555
30.4.3 Other Approaches for Soft-Touch Sensors 558
30.5 From Here 558
Chapter 31—Sound Input and Output 559
31.1 Cassette Recorder Sound Output 559
31.2 Electronically Recorded Sound Output 561
31.2.1 Hacking a Toy Sound Recorder 561
31.2.2 Using the ISD Family of Voice-Sound Recorders 562
31.3 Sirens and Other Warning Sounds 566
31.4 Sound Control 567
31.5 Audio Amplifiers 568
31.6 Speech Recognition 570
31.7 Speech Synthesis 571
31.8 Sound Input Sensors 571
31.8.1 Microphone 571
31.8.2 Amplifier Input Stage 572
31.8.3 Tone Decoding Detection 573
31.8.4 Building a Sound Source 576
31.9 From Here 577
Chapter 32—Robot Vision 579
32.1 Simple Sensors for Vision 579
32.2 One-Cell Cyclops 581
32.3 Multiple-Cell Light Sensors 583
xviii CONTENTS
32.4 Using Lenses and Filters with Light-Sensitive Sensors 586
32.4.1 Using Lenses 586
32.4.2 Using Filters 588
32.5 Introduction to Video Vision Systems 588
32.5.1 Robot View Digital Camera 589
32.6 Vision by Laser Light 593

32.7 Going beyond Light-Sensitive Vision 595
32.7.1 Ultrasonics 595
32.7.2 Radar 595
32.7.3 Passive Infrared 596
32.7.4 Tactile Feedback 596
32.8 From Here 597
Chapter 33—Navigation 599
33.1 A Game of Goals 599
33.2 Following a Predefined Path: Line Tracing 601
33.2.1 Computer Controlled Line Following 603
33.3 Wall Following 607
33.3.1 Variations of Wall Following 608
33.3.2 Ultrasonic Wall Following 609
33.3.3 Soft-Contact Following with Foam Wheels 609
33.3.4 Dealing with Doorways and Objects 609
33.3.5 Coding Your Wall-Following Robot 610
33.4 Odometry: The Art of Dead Reckoning 612
33.4.1 Optical Encoders 612
33.4.2 Magnetic Encoders 612
33.4.3 The Function of Encoders in Odometry 613
33.4.4 Errors in Odometry 613
33.5 Compass Bearings 614
33.6 Ultrasonic Distance Measurement 616
33.6.1 Facts and Figures 617
33.6.2 Interfacing a Polaroid 6500 Ultrasonic Range Finder 618
33.7 “Where Am I?”: Sighting Landmarks 621
33.7.1 Infrared Beacon 621
33.7.2 Radio Frequency Identification 622
33.7.3 Landmark Recognition 623
33.7.4 Other Techniques for Beacons and Lighthouses 624

33.7.5 Coupled Sonar and IR Light 625
CONTENTS xix
33.8 Exploring Other Position-Referencing Systems 625
33.8.1 Global Positioning Satellite 626
33.8.2 Inertial Navigation 626
33.8.3 Map Matching 627
33.9 From Here 628
Chapter 34—Fire Detection Systems 629
34.1 Flame Detection 629
34.1.1 Detecting the Infrared Light from a Fire 629
34.1.2 Watching for the Flicker of Fire 631
34.2 Using a Pyroelectric Sensor to Detect Fire 631
34.3 Smoke Detection 632
34.3.1 Hacking a Smoke Alarm 632
34.3.2 Interfacing the Alarm to a Computer 634
34.3.3 Testing the Alarm 635
34.3.4 Limitations of Robots Detecting Smoke 635
34.3.5 Detecting Noxious Fumes 635
34.4 Heat Sensing 636
34.5 Firefighting 638
34.6 From Here 640
Chapter 35—Experimenting with Tilt and Gravity Sensors 641
35.1 Sensors to Measure Tilt 642
35.1.1 Building a Balance System with a Mercury Switch 643
35.1.2 Building a Balance System with a Ball-in-Cage Switch 643
35.2 Using an Accelerometer to Measure Tilt 644
35.2.1 What Is an Accelerometer? 644
35.2.2 Additional Uses for Accelerometers 645
35.2.3 Single- and Dual-Axis Sensing 645
35.2.4 The Analog Devices’ ADXL Accelerometer Family 645

35.3 Constructing a Dual-Axis Accelerometer Robotic Sensor 646
35.3.1 Wiring Diagram 647
35.3.2 Understanding the Output of the ADXL202 647
35.3.3 Orienting the Accelerometer 648
35.3.4 Control Interface and Software 648
35.3.5 Additional Uses 650
35.4 Alternatives to Store-Bought Accelerometers 650
35.4.1 Constructing the Piezo Disc Accelerometer 651
35.4.2 Limitations of the Piezo Disc Accelerometer 651
35.5 From Here 652
xx CONTENTS
Chapter 36—Home Robots and How Not
to Chew Up Your Furniture 653
36.1 Sensing the Environment: Protecting the Furniture
and the Robot 654
36.2 Movement Algorithms 655
36.3 Communicating with the Robot 657
36.4 From Here 659
PART 7—PUTTING IT ALL TOGETHER
Chapter 37—Robot Tasks, Operations, and Behaviors 663
37.1 “What Does My Robot Do?”: A Design Approach 664
37.1.1 An Itinerary of Functions 664
37.1.2 Additional Features 665
37.2 Reality versus Fantasy 666
37.3 Understanding and Using Robot Behaviors 666
37.3.1 When a Behavior Is Just a Simple Action 667
37.3.2 Wall Following: A Common Behavior? 667
37.3.3 The Walt Disney Effect 668
37.3.4 Robotic Functions and Error Correction 668
37.3.5 Analyzing Sensor Data to Define Behaviors 669

37.4 Multiple Robot Interaction 669
37.5 The Role of Subsumption Architecture 670
37.6 From Here 671
Chapter 38—Integrating the Blocks 673
38.1 Basic Program Structure 673
38.2 Allocating Resources 674
38.2.1 I/O Pins 674
38.2.2 Internal Features 675
38.3 Getting a Program’s Attention Via Hardware 675
38.3.1 Timer Interrupt 676
38.3.2 Hardware Interrupt 676
38.3.3 Glass Half-Empty, Half-Full 676
38.4 Task-Oriented Robot Control 677
38.4.1 Programming for Tasks 677
38.4.2 Multitasking Error Modes for Optimal Flexibility 677
38.5 From Here 678
CONTENTS xxi
Chapter 39—Failure Analysis 679
39.1 Types of Failures 679
39.1.1 Mechanical Failure 680
39.1.2 Electrical Failure 680
39.1.3 Programming Failure 681
39.2 The Process of Fixing Problems 681
39.2.1 Documenting the Expected State 682
39.2.2 Characterizing the Problem 682
39.2.3 Hypothesizing about the Problem 684
39.2.4 Proposing Corrective Actions 685
39.2.5 Testing Fixes 686
39.2.6 Implementing and Releasing the Solution 686
39.3 From Here 687

Chapter 40—Setting Up Workshops, Demonstrations,
and Competitions 689
40.1 Choosing the Venue 689
40.1.1 Venue Needs 690
40.2 Competition Events 691
40.2.1 Scrounging for Prizes 693
40.3 Alerting the Public and the Media 693
40.4 From Here 694
Appendix A—Further Reading 695
A.1 Hobby Robotics 696
A.2 LEGO Robotics and LEGO Building 696
A.3 Technical Robotics, Theory, and Design 697
A.4 Artificial Intelligence and Behavior-Based Robotics 697
A.5 Mechanical Design 698
A.6 Electronic Components 698
A.7 Microcontroller/Microprocessor Programming
and Interfacing 699
A.8 Electronics How-To and Theory 700
A.9 Power Supply Design and Construction 701
A.10 Lasers and Fiber Optics 701
A.11 Interfacing to Computer Systems 701
A.12 Magazines 702
A.13 Classic Robot Fiction 703
xxii CONTENTS
Appendix B—Sources 705
B.1 Selected Specialty Parts and Sources 706
B.2 General Robotics Kits and Parts 707
B.3 Electronics/Mechanical: New, Used, and Surplus 709
B.4 Microcontrollers, Single-Board Computers, Programmers 712
B.5 Radio Control (R/C) Retailers 713

B.6 Servo and Stepper Motors, Controllers 713
B.7 Ready-Made Personal and Educational Robots 714
B.8 Construction Kits, Toys, and Parts 714
B.9 Miscellaneous 714
Appendix C—Robot Information on the Internet 715
C.1 Electronics Manufacturers 716
C.2 Shape-Memory Alloy 716
C.3 Microcontroller Design 716
C.4 Robotics User Groups 717
C.5 General Robotics Information 718
C.6 Books, Literature, and Magazines 720
C.7 Surplus Resources 720
C.8 Commercial Robots 720
C.9 Video Cameras 721
C.10 Ultrasonic Range Finders 721
C.11 LEGO Mindstorms Sources on the Web 721
C.12 Servo and Stepper Motor Information 722
C.13 Quick Turn Mechanical and Electronics Parts
Manufacturers 723
Index 725
CONTENTS xxiii

×