|
Title Page |
2 |
|
|
Copyright Page |
3 |
|
|
Dedication Page |
4 |
|
|
Contents at a Glance |
5 |
|
|
Table of Contents |
6 |
|
|
About the Authors |
20 |
|
|
About the Technical Reviewers |
22 |
|
|
Acknowledgments |
23 |
|
|
Introduction |
25 |
|
|
Prerequisites |
25 |
|
|
CHAPTER 1 The Basics |
26 |
|
|
Electricity |
27 |
|
|
Electrical Analogy |
28 |
|
|
Electrical Basics |
29 |
|
|
Circuits |
31 |
|
|
Measuring Electricity |
32 |
|
|
Multi-Meters |
32 |
|
|
Measuring Voltage |
33 |
|
|
Measuring Amperage |
34 |
|
|
Measuring Capacitance |
34 |
|
|
Measuring Resistance |
35 |
|
|
Calculating Resistor Power Using Ohm’s Law |
36 |
|
|
Oscilloscope |
37 |
|
|
Loads |
38 |
|
|
Inductive Loads |
38 |
|
|
Resistive Loads |
38 |
|
|
Electrical Connections |
39 |
|
|
Series Connections |
39 |
|
|
Parallel Connections |
39 |
|
|
Series and Parallel Connection |
40 |
|
|
Electronics |
40 |
|
|
Semi-Conductors |
41 |
|
|
Datasheets |
41 |
|
|
Integrated Circuits |
42 |
|
|
Packages |
43 |
|
|
Through-Hole Components |
43 |
|
|
IC Sockets |
44 |
|
|
Surface-Mount Components (SMT or SMD) |
44 |
|
|
Arduino Primer |
45 |
|
|
Arduino Variants |
45 |
|
|
Standard Arduino |
46 |
|
|
Arduino Mega |
47 |
|
|
Clones |
47 |
|
|
Arduino IDE |
48 |
|
|
The Sketch |
49 |
|
|
Variable Declaration |
49 |
|
|
The Setup Function |
49 |
|
|
The Loop Function |
50 |
|
|
Signals |
51 |
|
|
Digital Signals |
52 |
|
|
Digital Inputs |
52 |
|
|
Digital Outputs |
52 |
|
|
Special Case: External Interrupts |
53 |
|
|
Analog Signals |
55 |
|
|
Analog Inputs |
55 |
|
|
Analog Outputs (PWM) |
56 |
|
|
Duty-Cycle |
57 |
|
|
Frequency |
58 |
|
|
Homemade PWM Example |
59 |
|
|
Building Circuits |
60 |
|
|
Circuit Design |
60 |
|
|
Schematics |
61 |
|
|
Prototyping |
65 |
|
|
Breadboard |
65 |
|
|
Perforated Prototyping Board (Perf-Board) |
66 |
|
|
Printed Circuit Boards |
67 |
|
|
Soldering |
68 |
|
|
Soldering Shortcuts |
70 |
|
|
Building a Robot |
71 |
|
|
Hardware |
71 |
|
|
Basic Building Tools |
71 |
|
|
Materials |
73 |
|
|
Work Area |
73 |
|
|
Summary |
74 |
|
|
CHAPTER 2 Arduino for Robotics |
75 |
|
|
Interfacing Arduino |
75 |
|
|
Relays |
76 |
|
|
Types of Relays |
76 |
|
|
Relay Configurations |
77 |
|
|
Uses |
79 |
|
|
Calculating Current Draw |
79 |
|
|
Back-EMF Considerations |
81 |
|
|
Solid-State switches |
81 |
|
|
Transistors |
82 |
|
|
Bipolar Junction Transistor (BJT) |
82 |
|
|
Mosfets |
84 |
|
|
Logic-Level vs. Standard |
85 |
|
|
Mosfet Capacitance |
85 |
|
|
On-State Resistance—Rds(On) |
86 |
|
|
Calculating heat using Rds(On) and amperage of DC motor |
86 |
|
|
Parallel Mosfets |
87 |
|
|
Photo-Transistors |
88 |
|
|
Interfacing a Motor-Controller |
89 |
|
|
Motor-controller ICs |
89 |
|
|
Electronic Speed Controllers (ESCs) |
90 |
|
|
User Control |
92 |
|
|
Tethered (Wired) Control |
92 |
|
|
Infrared Control (IR) |
92 |
|
|
Radio Control Systems |
93 |
|
|
Amplitude Modulation (AM) |
94 |
|
|
Frequency Modulation (FM) |
94 |
|
|
Spread Spectrum 2.4gHz |
95 |
|
|
Xbee |
95 |
|
|
Sensor Navigation |
96 |
|
|
Contact Sensing |
96 |
|
|
Bump Switch |
96 |
|
|
Distance and Reflection Sensing |
97 |
|
|
IR Sensor |
97 |
|
|
Ultrasonic Range Finder |
99 |
|
|
Laser Range Finder |
99 |
|
|
Orientation (Positioning) |
100 |
|
|
Accelerometer |
100 |
|
|
Gyroscope |
101 |
|
|
Inertial Measurement Unit (IMU) |
101 |
|
|
Global Positioning Satellite (GPS) |
102 |
|
|
Real Time Kinetic (RTK) GPS |
102 |
|
|
Non-Autonomous Sensors |
103 |
|
|
Camera |
103 |
|
|
Current Sensor |
104 |
|
|
Summary |
105 |
|
|
CHAPTER 3 Let’s Get Moving |
107 |
|
|
Electric Motors |
107 |
|
|
Brushed DC Motor (Permanent Magnet Type) |
108 |
|
|
Brushless Motors |
109 |
|
|
Stepper Motors |
110 |
|
|
Gear Motors |
112 |
|
|
Servo Motors |
112 |
|
|
Continuous Rotation |
114 |
|
|
Linear Actuators |
114 |
|
|
Calculating Power |
115 |
|
|
Driving |
115 |
|
|
Finding the Right Motor |
116 |
|
|
The H-Bridge |
116 |
|
|
Generating a Brake |
117 |
|
|
Implementation |
118 |
|
|
Method 1: Simple Switches |
119 |
|
|
Method 2: DPDT Relay with Simple |
120 |
|
|
Method 3: P-Channel and N-Channel Mosfets |
121 |
|
|
Method 4: N-Channel H-Bridge |
122 |
|
|
H-Bridge ICs |
122 |
|
|
Changing PWM Frequencies |
123 |
|
|
Back EMF |
125 |
|
|
Current Sensing |
127 |
|
|
Commercial H-Bridges (Motor-Controllers) |
128 |
|
|
Small (Up to 3amps) |
128 |
|
|
Medium (Up to 10amps) |
129 |
|
|
Large (Over 10amps) |
130 |
|
|
The Open Source Motor Controller (OSMC) |
130 |
|
|
Batteries |
131 |
|
|
Nickel Cadmium (NiCad) |
131 |
|
|
Nickel Metal Hydride (NiMH) |
132 |
|
|
Lithium Polymer (LiPo) |
133 |
|
|
Lead-Acid |
134 |
|
|
Charging |
137 |
|
|
Materials |
138 |
|
|
Wood |
138 |
|
|
Metals |
138 |
|
|
Nuts and Bolts |
139 |
|
|
Plastics |
140 |
|
|
Chain and Sprockets |
140 |
|
|
Wheels |
140 |
|
|
Summary |
140 |
|
|
Chapter 4 Linus the Line-Bot |
142 |
|
|
Parts List for Linus |
143 |
|
|
How Linus Works |
145 |
|
|
The Track |
146 |
|
|
Building the IR Sensor Board |
146 |
|
|
Modifying a Servo for Continuous Rotation |
155 |
|
|
Method 1: Direct DC Drive with External Speed Controller |
156 |
|
|
Method 2: Servo Pulse Drive with Internal Motor Driving Circuitry |
158 |
|
|
Fitting the Drive wheels |
160 |
|
|
Making a Frame |
164 |
|
|
Making Connections |
171 |
|
|
Installing Batteries |
173 |
|
|
Install Power Switch |
173 |
|
|
Loading the Code |
173 |
|
|
Making the Track |
179 |
|
|
Testing |
180 |
|
|
Add-ons |
181 |
|
|
LED Lights |
181 |
|
|
Painting |
183 |
|
|
Adding Speed Regulator (Potentiometer) |
187 |
|
|
Summary |
190 |
|
|
CHAPTER 5 Wally the Wall-Bot |
191 |
|
|
How Wally Works |
192 |
|
|
Parts List for Wally |
194 |
|
|
The Motor-Controller |
195 |
|
|
The High-Side Switches |
196 |
|
|
The Low-Side Switches |
196 |
|
|
Building the Circuit |
198 |
|
|
Building the Frame |
204 |
|
|
Installing the Sensors |
209 |
|
|
Installing the Battery and Power Switch |
212 |
|
|
Installing a Power Switch |
213 |
|
|
The Code |
214 |
|
|
Code Objectives |
215 |
|
|
Summary |
223 |
|
|
CHAPTER 6 Making PCBs |
224 |
|
|
PCB Basics |
224 |
|
|
What You Need to Get Started |
225 |
|
|
Circuit Design |
227 |
|
|
Searching for Open-Source Designs |
228 |
|
|
Making Your Own Designs |
229 |
|
|
Schematics |
229 |
|
|
Board Layouts |
229 |
|
|
Working with the Schematic Editor |
232 |
|
|
Working with the Board Editor |
237 |
|
|
Transferring the Design |
247 |
|
|
Let’s Make an Arduino Clone: the Jduino |
248 |
|
|
Making the Transfer |
249 |
|
|
Etching |
257 |
|
|
Measuring the Solution |
258 |
|
|
Etching: Method 1 |
259 |
|
|
Etching: Method 2 |
260 |
|
|
Removing the Toner |
263 |
|
|
Drilling |
266 |
|
|
Soldering |
267 |
|
|
Building the Arduino Clone |
268 |
|
|
Building the BJT H-Bridge |
271 |
|
|
Testing |
274 |
|
|
Summary |
277 |
|
|
CHAPTER 7 The Bug-Bot |
278 |
|
|
Reading a Switch with Arduino |
279 |
|
|
How the Bug-bot Works |
280 |
|
|
Antennae Sensors |
280 |
|
|
Bumper Sensors |
281 |
|
|
Parts List for the Bug-bot |
281 |
|
|
The Motors |
282 |
|
|
Modifying the Servo Motors |
282 |
|
|
Controlling the Servo Motors |
285 |
|
|
Converting the Pulse Value to Degrees |
286 |
|
|
Mounting the Wheels to the Servos |
287 |
|
|
Building the Frame |
288 |
|
|
Marking the PlexiGlass |
288 |
|
|
Cutting the PlexiGlass |
290 |
|
|
Mounting the Motors |
292 |
|
|
Mounting the Caster Wheels |
293 |
|
|
Mounting the Arduino |
295 |
|
|
Installing the Battery |
296 |
|
|
Making the Sensors |
298 |
|
|
The Front Antennae Sensors |
298 |
|
|
The Rear Bump Sensors |
299 |
|
|
Making Wire Connections |
302 |
|
|
Loading the Code |
304 |
|
|
Creating a Delay |
304 |
|
|
Variables |
305 |
|
|
The Code |
306 |
|
|
Making a Top Hat |
313 |
|
|
Summary |
315 |
|
|
CHAPTER 8 Explorer-Bot |
316 |
|
|
How the Explorer-Bot Works |
317 |
|
|
R/C Control |
317 |
|
|
Powerful Motors |
318 |
|
|
Current Sensing |
318 |
|
|
Video-Enabled |
318 |
|
|
Xbee-Enabled |
318 |
|
|
Parts List for the Explorer-Bot |
319 |
|
|
Building the Frame |
321 |
|
|
Specs |
321 |
|
|
Adding Battery Bracket |
322 |
|
|
Cut Top Frame Brackets |
324 |
|
|
Cut Top Frame Braces |
324 |
|
|
Cut and Bend Main Frame Piece |
325 |
|
|
Add Crossbar and Mount Caster Wheel |
327 |
|
|
Plexiglass Deck (Optional) |
329 |
|
|
Building the Motor Controller |
329 |
|
|
Current Sensing and Limiting |
330 |
|
|
H-bridge Design |
330 |
|
|
Setting Up the Arduino |
334 |
|
|
Connecting the H-Bridges |
335 |
|
|
Setting Up Xbee |
336 |
|
|
Testing the Xbees |
338 |
|
|
Adding a Camera |
339 |
|
|
Pan and Tilt |
340 |
|
|
Make First Bracket |
340 |
|
|
Make Second Bracket |
342 |
|
|
Loading the Code |
342 |
|
|
Summary |
350 |
|
|
CHAPTER 9 RoboBoat |
352 |
|
|
Some Words in Advance |
353 |
|
|
Parts List for the RoboBoat |
353 |
|
|
Polystyrene Foam |
356 |
|
|
Epoxy Resin |
357 |
|
|
Gloves |
357 |
|
|
Fiberglass Fabric |
357 |
|
|
Glue |
359 |
|
|
Styrofoam Cutter and Razor Knife |
359 |
|
|
Miscellaneous |
359 |
|
|
The RoboBoat Design |
359 |
|
|
Assembling the Boat |
361 |
|
|
The Templates |
361 |
|
|
Gluing the Templates on the EPS/XPS Board |
363 |
|
|
Cutting Out the Segments |
364 |
|
|
Gluing the Segments Together |
367 |
|
|
Inserting the Foam Anchors |
368 |
|
|
The Coating |
369 |
|
|
Applying the Finish |
371 |
|
|
The Fins |
371 |
|
|
Painting |
372 |
|
|
The Deck |
372 |
|
|
Completing the Assembly |
373 |
|
|
The Propulsion Assembly |
377 |
|
|
The Baseplate |
378 |
|
|
The Pivot |
379 |
|
|
The Tube |
380 |
|
|
The Rudder Horns |
381 |
|
|
The Motor |
381 |
|
|
The Servo |
382 |
|
|
The Pushrods |
382 |
|
|
Electronics |
382 |
|
|
The Heart of the System: The ArduPilot PCB |
383 |
|
|
The GPS Module |
384 |
|
|
The Electronic Speed Controller (ESC) |
385 |
|
|
The Motor |
386 |
|
|
The Rudder Servo |
386 |
|
|
The Battery Pack |
386 |
|
|
Assembling the Electronics |
386 |
|
|
The Programming Adapter |
388 |
|
|
Software and Mission Planning |
389 |
|
|
GPS Receivers |
389 |
|
|
The Software |
390 |
|
|
AP_RoboBoat Module |
391 |
|
|
Debug Module |
393 |
|
|
Init Module |
395 |
|
|
Navigation Module |
396 |
|
|
PID_control Module |
403 |
|
|
Servo_control Module |
405 |
|
|
Header Files |
407 |
|
|
Installing the Software |
408 |
|
|
Installing the Arduino IDE |
408 |
|
|
Configuring the Arduino IDE |
409 |
|
|
Compiling and Uploading the Code |
410 |
|
|
Customizing the Code |
411 |
|
|
Customizing the Rudder Control |
412 |
|
|
Customizing the PID Constants |
412 |
|
|
Customizing the Motor Speed |
412 |
|
|
Customizing the Waypoint Timeout |
413 |
|
|
Customizing the Waypoint Radius |
413 |
|
|
Customizing the Rudder Extents |
413 |
|
|
Mission Planning |
413 |
|
|
Employing Google Earth for the Coordinates |
414 |
|
|
Putting It All Together |
417 |
|
|
Integrating the System |
418 |
|
|
Ships Ahoy! |
420 |
|
|
Troubleshooting |
421 |
|
|
The Thrust of the Motor/Propeller Is Not Sufficient |
421 |
|
|
The Motor Does Not Start |
422 |
|
|
Summary |
423 |
|
|
CHAPTER 10 Lawn-Bot 400 |
424 |
|
|
How the Lawn-bot 400 Works |
425 |
|
|
Lawn Mower Deck |
426 |
|
|
High-Capacity Batteries |
427 |
|
|
Steel Frame |
427 |
|
|
Dump-Bucket |
427 |
|
|
Pneumatic Tires |
427 |
|
|
Headlights |
427 |
|
|
Failsafe |
428 |
|
|
Tools and Parts List |
428 |
|
|
Lawnmower |
428 |
|
|
Parts Lists |
428 |
|
|
The Wheels |
429 |
|
|
Front Caster Wheels |
430 |
|
|
Rear Drive Wheels |
430 |
|
|
Installing Sprockets |
431 |
|
|
The Frame |
433 |
|
|
The Drive-Train |
441 |
|
|
Motor Mount Brackets |
441 |
|
|
Installing the Chain |
445 |
|
|
The Motor Controller |
448 |
|
|
Buying a Motor Controller |
448 |
|
|
Sabertooth 2x25 |
448 |
|
|
Cooling Fans |
450 |
|
|
Motor Controller feedback |
450 |
|
|
Current sensor IC |
451 |
|
|
The Arduino |
451 |
|
|
Securing Connections for a Bumpy Ride |
452 |
|
|
Building a Breakout Board |
452 |
|
|
The Failsafe |
456 |
|
|
R/C Toggle Switch |
457 |
|
|
Power Relays |
460 |
|
|
Avoiding an R/C Failsafe |
461 |
|
|
Making Connections |
462 |
|
|
The Code |
463 |
|
|
Adding Cosmetics and Accessories |
468 |
|
|
Painting |
468 |
|
|
Headlights |
469 |
|
|
Dump Bucket |
470 |
|
|
Lawnmower Kill-Switch |
472 |
|
|
Summary |
472 |
|
|
CHAPTER 11 The Seg-Bot |
474 |
|
|
How the Seg-Bot Works |
476 |
|
|
Inertial Measurement Unit |
476 |
|
|
Steering and Gain |
476 |
|
|
Engage Switch |
476 |
|
|
Parts List for the Seg-Bot |
477 |
|
|
Selecting the Right Sensors |
478 |
|
|
3.3v Power |
480 |
|
|
Accelerometer |
480 |
|
|
Gyroscope |
482 |
|
|
Cycle Time |
483 |
|
|
Gyro Starting Point |
483 |
|
|
Gyroscope Drift |
483 |
|
|
Gyroscope Versus Accelerometer Summary |
484 |
|
|
Filtering the Angle |
484 |
|
|
Weighted Average |
484 |
|
|
Making the IMU Adapter Board |
485 |
|
|
Selecting the Motors |
486 |
|
|
Electric Brake Removal |
488 |
|
|
Motor Mounting Position |
492 |
|
|
Selecting the Motor Controller |
493 |
|
|
SoftwareSerial Library |
494 |
|
|
Sabertooth Simplified Serial |
495 |
|
|
The Batteries |
496 |
|
|
Sealed Lead-Acid |
496 |
|
|
Charging |
497 |
|
|
12v Supply |
497 |
|
|
The Frame |
498 |
|
|
Frame Design |
499 |
|
|
Building the Frame |
500 |
|
|
Inputs |
504 |
|
|
Steering |
504 |
|
|
Gain |
504 |
|
|
Engage Switch |
504 |
|
|
Level-Start |
504 |
|
|
Mounting the Inputs to the Frame |
505 |
|
|
Installing the Electronics |
509 |
|
|
Soldering the Inputs |
512 |
|
|
Wiring the Connections |
513 |
|
|
Reviewing the Code |
514 |
|
|
Checking the Angle Readings |
517 |
|
|
The read_pots() Function |
518 |
|
|
The auto_level() Function |
519 |
|
|
The update_motor_speed() Function |
520 |
|
|
The time_stamp() Function |
522 |
|
|
The serial_print_stuff() Function |
523 |
|
|
The Full Code |
524 |
|
|
Testing |
530 |
|
|
Summary |
532 |
|
|
References |
532 |
|
|
CHAPTER 12 The Battle-Bot |
533 |
|
|
Robotic Combat Is Born |
535 |
|
|
Battle-Bot Rules and Regulations |
535 |
|
|
No Price Limit! |
536 |
|
|
Is This Going to Be Expensive? |
537 |
|
|
Parts List for the Battle-Bot |
537 |
|
|
Input Control |
540 |
|
|
Fly Sky CT-6: The $32, 5-ch*, 2.4GHz Radio Alternative |
540 |
|
|
Attention Hackers |
543 |
|
|
The Electronics |
543 |
|
|
The Arduino |
543 |
|
|
The Motor Controllers |
544 |
|
|
The Frame |
545 |
|
|
To Buy or Build? |
546 |
|
|
Modifying the Wheels |
547 |
|
|
Building the Frame |
548 |
|
|
The Drive Train |
552 |
|
|
Gearing |
553 |
|
|
Calculating Gear Ratio |
553 |
|
|
Modifications |
553 |
|
|
Chain Tensioning Nut |
554 |
|
|
Threading Sequence |
555 |
|
|
Measuring the Chain |
556 |
|
|
Adding Spacers |
557 |
|
|
Batteries |
558 |
|
|
Securing Electronics |
560 |
|
|
Protecting Your Brains |
561 |
|
|
Making Connections |
562 |
|
|
The Code |
565 |
|
|
Armor |
570 |
|
|
Weapons |
572 |
|
|
Additional Information |
581 |
|
|
Summary |
582 |
|
|
CHAPTER 13 Alternate Control |
583 |
|
|
Using Processing to Decode the Signals |
583 |
|
|
Parts List for Alternate Control |
584 |
|
|
Selecting the Input |
585 |
|
|
Processing Prerequisites |
586 |
|
|
Following Protocol |
586 |
|
|
Examining the Processing Sketch |
587 |
|
|
Explanation |
590 |
|
|
Testing Processing |
592 |
|
|
Examining the Arduino Sketch |
594 |
|
|
Summary |
599 |
|
|
Index |
601 |
|