Ebook.OREILLY-MAKE ARDUINO BOTS AND GADGETS SIX EMBEDDED PROJECTS WITH OPEN SOURCE HARDWARE AND SOFTWARE.pdf

(27197 KB) Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
845027016.007.png
845027016.008.png
Make: Arduino Bots and
Gadgets
Learning by Discovery
Kimmo and Tero Karvinen
with photographs and illustrations by the authors
Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
845027016.009.png 845027016.010.png 845027016.001.png 845027016.002.png 845027016.003.png 845027016.004.png
Make: Arduino Bots and Gadgets
by Kimmo and Tero Karvinen
Copyright © 2011 O’Reilly Media, Inc. All rights reserved.
Printed in Canada.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly Media books may be purchased for educational, business, or sales promotional use. Online editions are also avail-
able for most titles ( my.safaribooksonline.com ). For more information, contact our corporate/institutional sales department:
800-998-9938 or corporate@oreilly.com .
Development Editors: Brian Jepson and Brian Sawyer
Production Editor: Holly Bauer
Technical Editor: Joe Saavedra
Copyeditor: Rachel Monaghan
Proofreader: Jennifer Knight
Translator: Marko Tandefelt
Indexer: Ellen Troutman Zaig
Cover Designer: Mark Paglietti
Interior Designer: Ron Bilodeau
Illustrator/Photographer: Kimmo Karvinen
Cover Photographer: Kimmo Karvinen
Software Architect: Tero Karvinen
Print History:
March 2011: First Edition.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers
to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media,
Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps.
Important Message to Our Readers: The technologies discussed in this publication, the limitations on these technologies
that technology and content owners seek to impose, and the laws actually limiting the use of these technologies are con-
stantly changing. Thus, some of the projects described in this publication may not work, may cause unintended harm to
systems on which they are used, or may not be consistent with current laws or applicable user agreements.
Your safety is your own responsibility, including proper use of equipment and safety gear, and determining whether you
have adequate skill and experience. Electricity and other resources used for these projects are dangerous unless used prop-
erly and with adequate precautions, including safety gear. These projects are not intended for use by children. While every
precaution has been taken in the preparation of this book,
O’Reilly Media, Inc. and the authors assume no responsibility for errors or omissions. Use of the instructions and suggestions
in Make: Arduino: Bots and Gadgets is at your own risk. O’Reilly Media, Inc. and the authors disclaim all responsibility for any
resulting damage, injury, or expense. It is your responsibility to make sure that your activities comply with applicable laws,
including copyright.
This book uses Otabind™, a durable and flexible lay-flat binding.
ISBN: 978-1-449-38971-0
[TI]
845027016.005.png
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Building Philosophy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Reusing Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Buying Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Useful Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Electronic Circuit Theory Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2. Arduino: The Brains of an Embedded
System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Why Arduino? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Starting with Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Hello World with Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Structure of “Hello World” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Arduino Uno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Arduino Nano . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3. Stalker Guard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
What You’ll Learn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Tools and Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Solderless Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Jumper Wire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Ping Ultrasonic Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Vibration Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Combining Components to Make the Stalker Guard . . . . . . . . . . . . . . . . . . . . . . . 41
Making the Motor Vibrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Providing Power from a Battery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Making an Enclosure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
iii
845027016.006.png
 
Zgłoś jeśli naruszono regulamin