1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Hướng dẫn điều khiển Robot bằng Arduino

622 982 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 622
Dung lượng 20,96 MB

Nội dung

For your convenience Apress has placed some of the front matter material after the index Please use the Bookmarks and Contents at a Glance links to access them Contents at a Glance  About the Authors xix  About the Technical Reviewers xxi  Acknowledgments xxii  Introduction xxiv  Chapter 1: Introducing Oracle APEX .1  Chapter 1: The Basics .1  Chapter 2: Arduino for Robotics 51  Chapter 3: Let’s Get Moving 83  Chapter 4: Linus the Line-Bot .119  Chapter 5: Wally the Wall-Bot 169  Chapter 6: Making PCBs .203  Chapter 7: The Bug-Bot .257  Chapter 8: Explorer-Bot 295  Chapter 9: RoboBoat 331  Chapter 10: Lawn-Bot 400 403  Chapter 11: The Seg-Bot .453  Chapter 12: The Battle-Bot 513  Chapter 13: Alternate Control .563  Index 581 iv Introduction This book was written for anyone interested in learning more about the Arduino and robotics in general Though some projects are geared toward college students and adults, several early chapters cover robotics projects suitable for middle-school to high-school students I will not, however, place an age restriction on the material in this book, since I have seen some absolutely awesome projects created by makers both young and old Prerequisites Ultimately, you will need to be able to use some basic power tools, hand tools, a voltage meter, and soldering iron Do not worry if you are not yet experienced in these areas, as your first experience will get you well on your way (you have to start somewhere)! Just like riding a bike, you will get better at it the more you it If you are an experienced robot builder, you will likely be able to improve upon some of my methods If, however, you are a beginner, you might end up with a few extra holes drilled in the wrong spot, a wheel that is not mounted perfectly straight, or a downright ugly robot Do not worry about trying to complete every step perfectly the first time; your best the first time around and then go back and improve upon it later It is better to have an imperfect robot that you can work on than no robot at all because you were too afraid to try! In conclusion, this book is intended to provide fun projects for those interested in the Arduino If you are working on one of these projects and you aren’t having fun, you’re doing it wrong If you get stuck on a project, please ask for help—nobody wants you to be frustrated, but learning something new can sometimes make you want to drive your head through a wall don’t that Just keep with it, and you will eventually figure out your problem I have created a Google web site to host the files for each project and provide a place to ask questions and get help: https://sites.google.com/site/arduinorobotics/ If you would like to try some other Arduino projects, dealing with various types of sensors, LEDs, home automation, and various other projects, you might consider the following Arduino books from Apress: Practical Arduino by Jonathan Oxer and Hugh Blemings (2009) Beginning Arduino by Michael McRoberts (2010) John-David Warren xxiv CHAPTER   The Basics The Arduino microcontroller (Figure 1-1) is like a little command center that is awaiting your orders With a few lines of code, you can make your Arduino turn a light on or off, read a sensor value and display it on your computer screen, or even use it to build a homemade circuit to repair a broken kitchen appliance Because of the versatility of the Arduino and the massive support available from the online community of Arduino users, it has attracted a new breed of electronics hobbyists who have never before touched a microcontroller, let alone programmed one Figure 1-1 An Arduino Duemilanove microcontroller The basic idea of the Arduino is to create an atmosphere where anyone who is interested can participate and contribute with little upfront cost A basic Arduino board can be found online for around $20, and all of the software needed to program the Arduino is open-source (free to use and modify) You need only a computer and a standard USB cable In addition to being inexpensive, the creators of CHAPTER  THE BASICS Arduino came up with an easy-to-learn programming language (derived from C++) that incorporates various complex programming functions into simple commands that are much easier for a beginner to learn This book integrates some basic robot-building techniques with the simplicity of the Arduino to create bots that you can modify and improve with a clear understanding of your work This book is not intended to simply “show” you how to build a bot, but rather to educate the beginning robot builder and hopefully inspire creativity so that you can design, build, and modify your own robots One unavoidable obstacle that most people encounter when building a robot is cost Obviously we can spend thousands of dollars adding top-of-the-line parts and expensive commercial products, but most hobby builders have neither the time nor the money to build such a robot With that in mind, this book takes every opportunity to show you how to build a part from scratch—or as inexpensively as possible to get the job done If any of these methods seem too involved, not worry because there are substitute parts listed for you to purchase Please understand that each project in this book requires multiple tries before working—some of them even take weeks of “debugging.” I can tell you from experience that when you are persistent, you will eventually solve your problem—and this will make the experience that much more rewarding Figuring out why a robot is not working often requires a lot of troubleshooting Troubleshooting requires understanding each step in the process from start to finish, and inspecting each step for errors The more you tinker with something, the better you will understand it Lastly, not be discouraged if some of the information in this book appears to be over your head We try to assume that you are new to robotics and programming, and we focus on providing a practical working knowledge of the parts and code used in each project, rather than loading you down with electronics theory and complicated instructions It is best to take a positive “I can it” attitude before you start—this will be your greatest tool To better understand what is happening inside an Arduino, we should first discuss electricity and other basics in general (i.e., electronics and circuits) Although levels found in your Arduino (+5 DCV) are relatively harmless, if you don’t know how electricity works you won’t know at what point it becomes dangerous As it turns out, the projects covered in this book not use electrical levels high enough to conduct through your body, but electricity should still be handled with caution Electricity Electricity is nothing more than harnessed heat This heat can be used to a variety of different things like lighting up a lightbulb, spinning a motor, or simply heating a room If electricity can transfer through an object easily, it is called a “conductor” (like copper wire) Every conductor has an internal resistance to the electricity that keeps it from transferring 100% of the power Even a copper wire has some resistance that slows the flow of electricity, thereby generating heat Conductors also have a maximum amount of power that they can transfer before “overheating” (if the conductor is a copper wire, that means melting) With regard to electricity, total power can also be referred to as total heat This is why you might see a lightbulb or microwave that has its heat rating in watts A watt is not only a measurement of heat, but of electrical power Some electrical devices (like the Arduino) consume little electricity therefore producing little heat, so no attention is given to heat dissipation Other devices are made specifically to transfer large amounts of electricity (like a motor-controller) and must use metal heat-sinks or fans to aid in removing heat from the device In either case, it is helpful to be able to determine the amount of heat that an electrical device produces so we know how to properly handle it CHAPTER  THE BASICS Electrical Analogy Electricity is not usually seen (except maybe in a lightning storm), so it is difficult to understand what is happening inside of a wire when you turn on a lamp or kitchen appliance For ease of illustration, consider an electrical system to be a tank of water with an outlet pipe at the bottom (see Figure 1-2) Figure 1-2 An analogous electrical system The four images illustrate how resistance and pressure affect the water output from the tank A higher resistance yields less water output, whereas a higher pressure yields more water output You can also see that as the resistance is lowered, much more water is allowed to exit the tank, even with a lower pressure The more water that is in the tank, the faster (higher pressure) it pushes the water through the outlet pipe If there were no outlet pipe, the tank of water would simply be a reservoir The fact that there is an outlet pipe at the bottom of the tank enables water to exit, but only at a rate determined by the size of the pipe The size of the outlet pipe determines the resistance to the water leaving the tank—so increasing or decreasing the size of the outlet pipe inversely increases or decreases the resistance to the water leaving the tank (i.e., smaller pipe = more resistance = less water exiting the tank) Both the level (or pressure) of the water and the resistance (or size of the outlet pipe) can be measured, and using these measurements, you can calculate the amount of water exiting the tank at a given point in time The difference in the water analogy and electricity flow is that the electricity must complete its path back to the source before it can be used CHAPTER  THE BASICS Electrical Basics Notice that a higher water pressure yields a higher water output (keeping resistance the same) The same is true with the electrical equivalent of pressure, called “voltage” (V), which represents the potential energy that can be found in an electrical system A higher system voltage has more energy to drive the components in the system The amount of “resistance“(R) found in a system impedes (slow) the flow of electricity, just as the resistance caused by the outlet pipe slows the flow of water from the tank This means that as the resistance increases, the voltage (pressure) must also increase to maintain the same amount of output power The amount of electrical charge (in coulombs) that is passed through an electrical system each second is called the “amperage” (I) or “current,” and can be calculated using the voltage, resistance, and Ohm’s law A “watt” (P) is a measure of electrical power that is calculated by multiplying the voltage times the amperage In this chapter, we further discuss voltage, resistance, and amperage First, let’s look at the relationship among them, Ohm’s law According to Wikipedia (Source: http://en.wikipedia.org/wiki/Ohm's_law), Ohm’s law states that the current through a conductor between two points is directly proportional to the potential difference or voltage across the two points, and inversely proportional to the resistance between them There is a simple relationship among voltage, resistance, and amperage (current) that can be calculated mathematically Given any two of the variables and Ohm’s law, you can calculate the third A watt is a measure of electrical power—it is related to Ohm’s law because it can also be calculated using the same variables See the formulas in Figure 1-3 where V = voltage, R = resistance, I = amperage, and P = watts  Note The pie chart in Figure 3-1 is used courtesy of www.electronics-tutorials.ws If you are interested in learning more about electronics, you should definitely visit this website —it has some helpful illustrations and descriptions The different views of Ohm’s law include the following: V=I*R I=V/R R=V/I Use the following formulas to calculate total power: P=V*I P=I²*R CHAPTER  THE BASICS Figure 1-3 Ohm’s law to calculate power There are several other terms that you might come across when working on an electrical system; we discuss a few here As you might know, an electrical system usually has a “power” wire and a “common” wire to complete the circuit Depending on what you are reading, these two sides can be called different things To help avoid the confusion that I experienced when I was learning, Table 1-1 provides a quick comparison of the various names for the positive and negative ends of an electrical system Table 1-1 Common Names That Refer to the Positive and Negative Ends of an Electrical System Voltage Bias Polarized Terminal Electrical Current Flow Schematic Label Common Name Positive Anode Source VCC Power Negative Cathode Sink VSS Ground (GND) We discussed Ohm’s law and the common measurements that are used to describe the various properties of electrical current flow Table 1-2 provides a list of standard electrical units and their symbols These are used in every subsequent chapter of this book, so it is a good idea to get familiar with them Table 1-2 Common Electrical Measurement Terms with Their Symbols Measurement Unit Symbol Voltage (energy) Volt V or E Amperage (current) Ampere (amp) I or A Resistance Ohm R or Ω CHAPTER  THE BASICS Measurement Unit Symbol Power (electrical heat) Watt P or W Capacitance Farad F Frequency Hertz Hz Let’s now talk more about the different parts of an electrical system Circuits The starting point of the electricity in a system is called the “source” and usually refers to the positive battery lead or power supply The electricity flows from the source, through the system, and to the sink, which is usually the negative battery terminal or ground wire (GND) For electricity to flow, the circuit must be “closed,” which means that the electrical current can get back to its starting point The term “ground” comes from the practice of connecting the return path of an AC circuit, directly into the ground outside using a copper rod You might notice that most electrical meters also have a ground rod nearby that is clamped to a wire leading into the fuse-box This ground wire gives the returning electrical current a path to exit the system Even though the DC equivalent of GND is the negative battery terminal, we still call it GND  Note the actual electron-flow of electrical current travels from negative to positive, but unless you are a physicist, that is not relevant here For learning purposes, we assume the conventional electron-flow theory, which suggests that electrical current flows from Positive (+) > Negative (-) in a system An electrical system is called a “circuit,” and can be simple like a string of Christmas lights plugged into a power outlet or very intricate like the motherboard in your PC Now consider that in a circuit, the electricity flows only if something is there to complete the circuit, called a “load” (see Figure 1-6) In general, the load in a circuit is the device you intend to provide with electricity This can be a lightbulb, electric motor, heater coil, loud speaker, computer CPU, or any other device that the circuit is intended to power There are three general types of circuits: open-circuit, closed-circuit, and short-circuit Basically, an open-circuit is one that is turned off, a closed-circuit is one that is turned on, and a short-circuit is one that needs repair (unless you used a fuse) This is because a short-circuit implies that the electricity has found a path that bypasses the load and connects the positive battery terminal to the negative battery terminal This is always bad and usually results in sparks and a cloud of smoke, with the occasional loud popping sound In Figure 1-4, the lightbulb is the load in this circuit and the switch on the left determines whether the circuit is open or closed The image on the left shows an open-circuit with no electricity flowing through the load, whereas the image on the right shows a closed-circuit supplying power to the load  CONTENTS Adding Speed Regulator (Potentiometer) 164 Summary .167  Chapter 5: Wally the Wall-Bot 169 How Wally Works 170 Parts List for Wally .172 The Motor-Controller .173 The High-Side Switches 174 The Low-Side Switches 174 Building the Circuit 176 Building the Frame 182 Installing the Sensors 187 Installing the Battery and Power Switch 190 Installing a Power Switch 191 The Code 192 Code Objectives 193 Summary .201  Chapter 6: Making PCBs .203 PCB Basics 203 What You Need to Get Started .204 Circuit Design 206 Searching for Open-Source Designs 207 Making Your Own Designs 208 Working with the Schematic Editor 211 Working with the Board Editor 216 Transferring the Design 226 Let’s Make an Arduino Clone: the Jduino 227 Making the Transfer 228 ix  CONTENTS Etching 236 Measuring the Solution 237 Etching: Method 238 Etching: Method 239 Removing the Toner 242 Drilling 245 Soldering .246 Building the Arduino Clone 247 Building the BJT H-Bridge 250 Testing 253 Summary .256  Chapter 7: The Bug-Bot .257 Reading a Switch with Arduino .258 How the Bug-bot Works .259 Antennae Sensors 259 Bumper Sensors 260 Parts List for the Bug-bot 260 The Motors 261 Modifying the Servo Motors 261 Controlling the Servo Motors 264 Converting the Pulse Value to Degrees 265 Mounting the Wheels to the Servos 266 Building the Frame 267 Marking the PlexiGlass 267 Cutting the PlexiGlass 269 Mounting the Motors 271 Mounting the Caster Wheels 272 x  CONTENTS Mounting the Arduino 274 Installing the Battery 275 Making the Sensors .277 The Front Antennae Sensors 277 The Rear Bump Sensors 278 Making Wire Connections 281 Loading the Code 283 Creating a Delay 283 Variables 284 The Code 285 Making a Top Hat 292 Summary .294  Chapter 8: Explorer-Bot 295 How the Explorer-Bot Works 296 R/C Control 296 Powerful Motors 297 Current Sensing 297 Video-Enabled 297 Xbee-Enabled 297 Parts List for the Explorer-Bot .298 Building the Frame 300 Specs 300 Adding Battery Bracket 301 Cut Top Frame Brackets 303 Cut Top Frame Braces 303 Cut and Bend Main Frame Piece 304 Add Crossbar and Mount Caster Wheel 306 xi  CONTENTS Building the Motor Controller .308 Current Sensing and Limiting 309 H-bridge Design 309 Setting Up the Arduino 313 Connecting the H-Bridges 314 Setting Up Xbee .315 Testing the Xbees 317 Adding a Camera 318 Pan and Tilt 319 Make First Bracket 319 Make Second Bracket 321 Loading the Code 321 Summary .329  Chapter 9: RoboBoat 331 Some Words in Advance 332 Parts List for the RoboBoat 332 Polystyrene Foam 335 Epoxy Resin 336 Gloves 336 Fiberglass Fabric 336 Glue 338 Styrofoam Cutter and Razor Knife 338 Miscellaneous 338 The RoboBoat Design 338 Assembling the Boat 340 The Templates 340 Gluing the Templates on the EPS/XPS Board 342 xii  CONTENTS Cutting Out the Segments 343 Gluing the Segments Together 346 Inserting the Foam Anchors 347 The Coating 348 Applying the Finish 350 The Fins 350 Painting 351 The Deck 351 Completing the Assembly 352 The Propulsion Assembly .356 The Baseplate 357 The Pivot 358 The Tube 359 The Rudder Horns 360 The Motor 360 The Servo 361 The Pushrods 361 Electronics .361 The Heart of the System: The ArduPilot PCB 362 The GPS Module 363 The Electronic Speed Controller (ESC) 364 The Motor 365 The Rudder Servo 365 The Battery Pack 365 Assembling the Electronics 365 Software and Mission Planning .368 GPS Receivers 368 The Software 369 xiii  CONTENTS Installing the Software 387 Mission Planning 392 Putting It All Together 396 Integrating the System 397 Ships Ahoy! 399 Troubleshooting 400 The Thrust of the Motor/Propeller Is Not Sufficient 400 The Motor Does Not Start 401 Summary .402  Chapter 10: Lawn-Bot 400 403 How the Lawn-bot 400 Works .404 Lawn Mower Deck 405 High-Capacity Batteries 406 Steel Frame 406 Dump-Bucket 406 Pneumatic Tires 406 Headlights 406 Failsafe 407 Tools and Parts List .407 Lawnmower 407 Parts Lists 407 The Wheels 408 Front Caster Wheels 409 Rear Drive Wheels 409 Installing Sprockets 410 The Frame 412 The Drive-Train 420 xiv  CONTENTS Motor Mount Brackets 420 Installing the Chain 424 The Motor Controller 427 Buying a Motor Controller 427 Cooling Fans 429 Motor Controller feedback 429 The Arduino 430 Securing Connections for a Bumpy Ride 431 The Failsafe 435 R/C Toggle Switch 436 Power Relays 439 Avoiding an R/C Failsafe 440 Making Connections 441 The Code 442 Adding Cosmetics and Accessories .447 Painting 447 Headlights 448 Dump Bucket 449 Lawnmower Kill-Switch 451 Summary .451  Chapter 11: The Seg-Bot .453 How the Seg-Bot Works .455 Inertial Measurement Unit 455 Steering and Gain 455 Engage Switch 455 Parts List for the Seg-Bot 456 Selecting the Right Sensors 457 xv  CONTENTS 3.3v Power 459 Accelerometer 459 Gyroscope 461 Gyroscope Versus Accelerometer Summary 463 Filtering the Angle 463 Making the IMU Adapter Board 464 Selecting the Motors 465 Electric Brake Removal 467 Motor Mounting Position 471 Selecting the Motor Controller .472 SoftwareSerial Library 473 Sabertooth Simplified Serial 474 The Batteries 475 Sealed Lead-Acid 475 Charging 476 12v Supply 476 The Frame 477 Frame Design 478 Building the Frame 479 Inputs 483 Steering 483 Gain 483 Engage Switch 483 Level-Start 483 Mounting the Inputs to the Frame 484 Installing the Electronics .488 Soldering the Inputs 491 Wiring the Connections 492 xvi  CONTENTS Reviewing the Code .493 The sample_accel() Function 494 The sample_gyro() Function 494 Checking the Angle Readings 496 The calculate_angle() Function 496 The read_pots() Function 497 The auto_level() Function 498 The update_motor_speed() Function 499 The time_stamp() Function 501 The serial_print_stuff() Function 502 The Full Code 503 Testing 509 Summary .511 References 511  Chapter 12: The Battle-Bot 513 Robotic Combat Is Born 515 Battle-Bot Rules and Regulations 515 No Price Limit! 516 Parts List for the Battle-Bot 517 Input Control 520 Fly Sky CT-6: The $32, 5-ch*, 2.4GHz Radio Alternative 520 The Electronics 523 The Arduino 523 The Motor Controllers 524 The Frame 525 To Buy or Build? 526 Modifying the Wheels 527 xvii  CONTENTS Building the Frame 528 The Drive Train 532 Gearing 533 Chain Tensioning Nut 534 Batteries 538 Securing Electronics 540 Protecting Your Brains 541 Making Connections 542 The Code 545 Armor 550 Weapons 552 Additional Information 561 Summary .562  Chapter 13: Alternate Control .563 Using Processing to Decode the Signals .563 Parts List for Alternate Control 564 Selecting the Input .565 Processing Prerequisites .566 Following Protocol 566 Examining the Processing Sketch 567 Explanation 570 Testing Processing 572 Examining the Arduino Sketch .574 Summary .579  Index 581 xviii About the Authors  J-D is an electronics hobbyist, builder, and relentless tinkerer As a child, he took apart everything he owned to figure out how it worked Since then he has built many different projects ranging from an electric fishing pole to a remote-controlled lawn mower, which was featured on the cover of MAKE magazine in April 2010 Having worked as a builder doing carpentry, plumbing, and electrical work for eight years, his knowledge is founded on real-world experience rather than text-book recitation In addition to building robots and remote-controlled toys, he enjoys automating everyday tasks, blinking LEDs, designing and etching PCBs, and lots of random things in between Much of his time has been spent researching, building, and testing various motor-controllers to make his bots move As a self-proclaimed “poor man’s roboticist,” he will always try to find the cheapest way to something—usually by building it himself J-D graduated from the University of Alabama at Birmingham with a degree in business management He currently lives in Birmingham, Alabama with his beautiful wife, Melissa, and their growing flock of animals  Josh Adams is a software developer with over ten years of professional experience building production-quality software and managing projects He built a Tesla coil for a high-school science project that shot >27" bolts of lightning Josh is Isotope Eleven’s lead architect, and is responsible for overseeing architectural decisions and translating customer requirements into working software Josh graduated from the University of Alabama at Birmingham (UAB) with Bachelor of Science degrees in both mathematics and philosophy When he’s not working, Josh enjoys spending time with his family xix  ABOUT THE AUTHORS  Harald Molle has been a computer engineer since 1984 He started his career by becoming a researcher at a university in the southwest of Germany before cofounding an embedded systems company Harald is also an expert scuba diver, a passion he is trying to combine with his work by developing a GPS-controlled robot to survey lakes He is happily married to Jacqueline, who knows that an interest in robotics requires substantial amounts of time And he owns a cat xx About the Technical Reviewers  Josh Adams is a software developer with over ten years of professional experience building production-quality software and managing projects He built a Tesla coil for a high-school science project that shot >27" bolts of lightning Josh is Isotope Eleven’s lead architect, and is responsible for overseeing architectural decisions and translating customer requirements into working software Josh graduated from the University of Alabama at Birmingham (UAB) with Bachelor of Science degrees in both mathematics and philosophy When he’s not working, Josh enjoys spending time with his family Guilherme Martins was born in Lisbon in 1977 He has always been interested in many forms of art and started early to experiment with various mediums—photography, video, drawing, and painting Guilherme has worked for several design studios and advertising agencies in Lisbon since 2000 and has been freelancing visual projects, usually related to motion graphics, visual effects, and web design In 2007 he started to collaborate with the choreographer Rui Horta on visual content to be projected on stage during dance, theater, and opera performances As a tinkerer and inventor, he has a particular interest in experimenting with robotics and electronics in order to create innovative interactive experiences Most of his research and professional work is online at http://guilhermemartins.net xxi Acknowledgments Co-authors: I would like to thank my friend and fellow hacker, Josh Adams, for his assistance in several of my projects as well as his constant support and ideas, and for introducing me to the Arduino in the first place He also wrote a chapter in this book on alternate control (Chapter 13), using your PC with a game-pad and wireless serial link to control a large robot (Arduino + Processing) Josh makes my projects more awesome with his mad coding skills and by keeping up with all the latest hacks Thanks for all of your help—you are a true friend I would also like to thank a fellow Arduino hacker, Harald Molle, for contributing his time and the details of his complex project, the GPS-guided RoboBoat (Chapter 9) Harald graciously took time out of his schedule to write a chapter that I was having issues with I made three (unsuccessful) boat hulls before finding Harald’s project on the Arduino forums and discovering that he had already been through the same pitfalls that I was encountering He concocted a brilliant design for a catamaran-style boat that is easy to build and holds a straight line in the water Upon realizing that he knew far more about this project than I could hope to learn, I was thrilled that he was willing to share his experience Tech editors: A special thanks to Guilherme Martins and Josh Adams for their time reviewing the book—your suggestions and feedback were greatly appreciated Editors: A big thanks to Michelle Lowman for giving me the opportunity to write this book, Anita Castro for being patient despite the extra time needed to complete the book, James Markham, Frank Pohlmann, and Dominic Shakeshaft for their help and guidance, and the rest of the Apress team that helped make this book happen—writing your first book is not easy Family: I would like to thank my wife, Melissa, for being so understanding and helpful during this process I could not have written this book without your support—I love you! Lastly, I would like to thank my family for their support and prayers during this project The Arduino community: The Arduino community was the single largest source of inspiration for the various projects in this book When I first started learning about the Arduino and physical computing (back in 2008), I had never touched a microcontroller or programmed a computer before, and I was welcomed with open arms Random people gave me code examples, project advice, ideas for additional features, and, most of all, support In a society where everyone is trying to make a buck, it is nice to be a part of something awesome that you know you can participate in without spending any money (other than the inexpensive Arduino board itself) xxii  ACKNOWLEDGMENTS I would like to call out a few specific robotics enthusiasts, makers, and electronics gurus that have contributed to my learning and consequently this book: thanks to Massimo Banzi, Tom Igoe, and the rest of the Arduino development team, Limor Fried (Ladyada.net), Nathan Seidle (SparkFun.com), David Cood (Robotroom.com), and Jordi Munoz and Chris Anderson (DIYdrones.com) for their excellent Arduino tutorials, projects, and contributions to the open source community There are a few people who were personally helpful with specific questions, projects, and parts: Larry Barello, John Dingley, Shane Colton, and Bob Blick Thanks to my common-thread friends that listened to my ranting ideas and nonsense, checked out my prototypes, offered suggestions, and even supplied me with parts to test when I could not afford my own: Josh Adams, Anthony DiGiovanni, and Laird Foret Though I took many photos for this book of various parts and procedures, there were some that did not turn out as well as I hoped, and for those I had help The following photos originated from my various parts suppliers, and I would like to thank them for their help: SparkFun.com: 1-10, 1-21, 1-30, 2-22, 2-24, 2-26, 2-27, 2-28, 2-29, 3-20 Digikey.com: 1-15, 1-16, 1-17 PartsForScooters.com: 10-4, 12-8, 12-18 DimensionEngineering.com: 10-20, 11-14 Adafruit.com: 2-16 Pololu.com: 10-22 Electronics-Tutorials.ws: 1-3 DannyG.com: 1-9 RobotMarketplace.com: 12-7 DFRobots.com: 5-11 HarborFreightTools.com: 10-3 John-David Warren My wife, Kristen, who has been so patient with me fiddling with robots; my son, Matthew, who just wants to play with them; and my daughter, Gracie, who I’ll meet in person real soon now Josh Adams Thanks to Chris Anderson and Jordi Munoz, from DIYdrones.com, for their excellent pioneering work in building autopilots, Jean Margail from http://water.resist.free.fr for his plans of the catamaran hulls, Matthias Wolbert for making a 3D model out of these plans, and Robert Herrmann for his troubleshooting advice Lastly, I dedicate this to my wife, Jacqueline—she knows why Harald Molle xxiii [...]... what Arduino you buy to get started with this book–as long as it mentions Arduino, it should work just fine We specifically use the standard Arduino for several projects, an Arduino mega for one project, an Ardupilot (GPS enabled Arduino) for one chapter, and several homemade Arduino clones Now let’s look at the Arduino IDE to get a better understanding of how it works 22 CHAPTER 1  THE BASICS Arduino. .. required to be compatible with the Arduino, is that it uses the Arduino IDE software to upload the Arduino code There are even clones that stray away from the standard hardware specifications, but are still supported by the Arduino IDE, like the Arduino Pro Mini that operates at 3.3v and 8MHz instead of 5v and 16MHz as the standard You can use any of the Arduino clones with the Arduino IDE software, but you... reference pages These pages show each Arduino command and how to use it with an example snippet of code You can either visit the Arduino website to view these pages, or check the Arduino IDE under “Help > Reference”: http://www .arduino. cc/en/Reference/HomePage Because the Arduino language is an open source project, it is constantly being improved and updated New versions of the Arduino IDE are released often,... downloaded at the Arduino homepage Arduino Variants The Arduino comes in many different shapes and sizes, but there are only two models that use completely different chips: the Standard and the Mega The Standard is the basic Arduino and refers to the Atmega8/168/328 chip, whereas the Mega is a different Arduino board with more I/O pins and uses the beefier Atmega1280 chip Because the Arduino design is... with a new one–they are about $5.50 each and you can buy them with the Arduino bootloader preinstalled from Sparkfun.com (part #DEV-09217) I have had this happen several times and am still using my first Arduino board! Arduino Mega The Arduino Mega is the other model that uses a beefier Atmega1280 chip, which is like a standard Arduino on steroids, featuring 70 total I/O pins (see Figure 1-16—right)... Check out the “Getting Started” section of the Arduino home page to see step-by-step instructions for installing the Arduino software to your specific operating system: http:/ /arduino. cc/en/Guide/HomePage The Arduino software is referred to as an Integrated Development Environment (IDE) This is the programming software that is used to upload code to the Arduino micro-controller The IDE contains a text-editor... of Arduino boards Note that a homemade variation on the left uses the same Atmega168 chip as the Standard Arduino but is programmed using an FTDI programming cable; the center board is a Standard Arduino Duemilanove; and the last board on the right is an Arduino Mega Standard Arduino The standard Arduino was originally based on the Atmel Atmega8 chip, a 28-pin microcontroller with 20 total available... values If the input value is HIGH, the Arduino sets the my_led pin LOW (Off) If the input value is LOW, the Arduino sets the my_led pin HIGH (On) To learn more about if/else statements with examples, see the Arduino Reference pages at http:/ /arduino. cc/en/Reference/Else Special Case: External Interrupts When using the digitalRead() command for an input pin on the Arduino, you receive only the value that... available The same software is used for all Arduino models and each command in the Arduino language works on each device This model is available only with the Atmega1280 surface mounted to the board and cannot be removed, thus limiting its versatility compared to the standard Arduino The initial cost of this board was around $75 but several companies have introduced Arduino Mega clones that can be found... $45 If you can afford an extra Arduino, it is nice to have around when more I/O pins are needed without changing any hardware Clones Although there are only two models that use different base processing chips, there is an endless number of Arduino clones circulating around the Internet for you to build or buy in many cases An Arduino clone, is not an officially supported Arduino board, but instead each ... following Arduino books from Apress: Practical Arduino by Jonathan Oxer and Hugh Blemings (2009) Beginning Arduino by Michael McRoberts (2010) John-David Warren xxiv CHAPTER   The Basics The Arduino. .. the Arduino reference pages These pages show each Arduino command and how to use it with an example snippet of code You can either visit the Arduino website to view these pages, or check the Arduino. .. programming cable; the center board is a Standard Arduino Duemilanove; and the last board on the right is an Arduino Mega Standard Arduino The standard Arduino was originally based on the Atmel Atmega8

Ngày đăng: 03/01/2016, 16:44

TỪ KHÓA LIÊN QUAN

w