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

Practical Arduino Cool Projects for Open Source Hardware- P1 pot

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 (3.09 MB, 10 trang )

T
his book was written to demonstrate a variety of Arduino techniques in a practical
context, giving you an opportunity to learn how the theory and reference material
already available online applies to real-world projects.
If you’ve come as far as picking up a whole book about Arduino, you’re ready for
something more substantial than assembly instructions. You don’t want a simple series
of steps to follow: you want to understand not just how to assemble something, but why
it was designed that way in the first place. That’s what this book will give you: you won’t
just be a color-by-numbers painter; you’ll learn to be a true hardware craftsman and artist,
able to conceptualize, design, and assemble your own creations.
We want you to take these projects as inspiration and examples of applying a variety
of handy techniques and then adapt them to suit your own requirements, coming up
with inspiration and new ideas that put ours to shame. And we hope that you’ll then
share your creations with us and with the world, inspiring others in turn. By following
through the projects in this book, you will gain a number of insights into the flexibility of
Arduino as a platform for taking software and hardware and linking them to the physical
world around us.
Jonathan Oxer
Hugh Blemings
Practical Arduino Cool Projects for Open Source Hardware
Oxer
Blemings
TECHNOLOGY IN ACTION

this print for content only—size & color not accurate trim size = 7.5" x 9.25" spine = 0.859" 448 page count
CYAN
MAGENTA
YELLOW
BLACK
PANTONE 123 C
Practical


Arduino
www.apress.com
US $39.99
Shelve in Hardware
User level: Beginning–Advanced
ISBN 978-1-4302-2477-8
9 781430 224778
5 3 9 9 9
Practical
Arduino
Cool Projects for Open Source Hardware
SOURCE CODE ONLINE
LEARN IN-DEPTH ARDUINO
TECHNIQUES USING
REAL-WORLD PROJECTS
Also available:


Practical Arduino
Cool Projects for
Open Source Hardware












  
Jonathan Oxer
Hugh Blemings

Practical Arduino: Cool Projects for Open Source Hardware
Copyright © 2009 by Jonath
an Oxer and Hugh Blemings
All rights reserved. No part of this work may be r
eproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information storage or
retrieval system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-2477-8
ISBN-13 (electronic): 978-1-4302-2478-5
Printed and bound in the United Sta
tes of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather
than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of
the trademark owner, with no intention of infringement of the trademark.
Cover picture of Arduino Duemilanove used with permission of SparkFun Electronics.
President and Publisher: Paul Manning
Lead Editor: Michelle Lowman
Technical Reviewers: Nathan Seidle, Andy Gelme, Thomas Sprinkmeier, Trent Lloyd, Scott
Penros
e, Marc Alexander, Philip Lindsay
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell,
Jonathan Gen
nick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes,

Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft,
Matt Wade, Tom Welsh
Coordinating Editor: Jim Markham
Copy Editor: Vanessa Moore
Compositor: Bytheway Publishing Services
Indexer: Julie Grady
Artist: April Milne
Cover Designer: Kurt Krames
Distributed to the book tra
de worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th
Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-
sbm.com, or visit .
For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600,
Berk
eley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail info@a press.com, or visit
.
Apress and friends of ED books may be purchased in b
ulk for academic, corporate, or promotional
use. eBook versions and licenses are also available for most titles. For more information, reference our
Special Bulk Sales–eBook Licensing web page at
The information in this book is distributed on an “as
is” basis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have
any liability to any person or entity with respect to any loss or damage caused or alleged to be caused
directly or indirectly by the information contained in this work.
The source code for this book is available to readers at htt
p://www.apress.com.

For everyone who looks at the everyday objects around them and sees the potential of what they could
become.

ii
Contents at a Glance
 Contents at a Glance iv
 Contents v
 About the Authors xvi
 About the Technical Reviewers xvii
 Acknowledgments xix
 Introduction xx
 Chapter 1: Introduction 1
 Chapter 2: Appliance Remote Control 17
 Chapter 3: Time-Lapse Camera Controller 37
 Chapter 4: Virtual USB Keyboard 51
 Chapter 5: PS/2 Keyboard or Mouse Input 63
 Chapter 6: Security/Automation Sensors 81
 Chapter 7: Online Thermometer 101
 Chapter 8: Touch Control Panel 121
 Chapter 9: Speech Synthesizer 139
 Chapter 10: Water Flow Gauge 163
 Chapter 11: Oscilloscope/Logic Analyzer 185
 Chapter 12: Water Tank Depth Sensor 209
 Chapter 13: Weather Station Receiver 239
 Chapter 14: RFID Access Control System 269
 Chapter 15: Vehicle Telemetry Platform 295
 Chapter 16: Resources 383
 Index 405
iv
Contents
 Contents at a Glance iv
 Contents v
 About the Authors xvi

 About the Technical Reviewers xvii
 Acknowledgments xix
 Introduction xx
 Chapter 1: Introduction 1
Fundamentals 1
Sharing Your Work 1
Practical Electronics for Software Developers 1
Current, Voltage, and Power 2
Mains Is Nasty 2
Reading Schematics 3
Resistance and Resistors 6
Ohm’s Law and Current Limiting 7
Choosing Wire 8
Diodes 8
Power Supplies 9
USB Power 9
Batteries 10
Wall Warts/Plugpacks 11
v
 CONTENTS
Capacitance and Capacitors 11
Fundamentals 11
Capacitor Types 12
Power Supply Bypass 13
ESD Precautions 13
Tools 13
Parts 14
Further Reading 15
 Chapter 2: Appliance Remote Control 17
Parts Required 17

Instructions 19
Test and Investigate Appliance Remote 19
Assemble Reed Relay Shield 21
Connect Reed Relay Shield to Remote Control 25
Create Reed Relay Control Program 27
ApplianceRemoteControl 27
ApplianceRemoteControlCompact 30
Test Reed Relay Shield and Sketch 32
Variations 34
Wireless Link 34
Automatic Trigger 34
Socket Connections 35
 Chapter 3: Time-Lapse Camera Controller 37
Parts Required 37
Instructions 39
Assemble Prototyping Shield 39
Connect Camera Shutter Release 39
Remote Shutter Release Connector 40
vi
 CONTENTS
Infrared Remote Control 42
Modify Camera 43
Configure Camera 44
Calculate Photo Interval 44
Configure and Load Sketch 44
Check Memory Capacity 48
Set Up Your Shoot 48
Process the Images 48
Linux 48
Windows 48

Macintosh 49
Variations 49
 Chapter 4: Virtual USB Keyboard 51
Parts Required 51
Instructions 53
Populate Prototyping Shield 53
Prepare the UsbKeyboard Library 56
Compile and Upload Sketch 57
Variations 61
Chording Keyboard 61
 Chapter 5: PS/2 Keyboard or Mouse Input 63
Parts Required 63
Instructions 64
PS/2 Connections 65
Recycled 6-Pin Mini-DIN Sockets 66
6-Pin Mini-DIN Panel Sockets 67
PS/2 Extension Cable 69
Keyboard Software 73
vii
 CONTENTS
Mouse Software 76
Variations 79
Barcode Reader for a Stock Control System 79
Resources 80
 Chapter 6: Security/Automation Sensors 81
Parts Required 82
Instructions 84
Security Sensor Basics 84
Assemble Four-Channel Alarm Sensor Shield 87
Install End-of-Line Resistors on Sensor 92

Load Test Program 95
PIR Placement 98
Variations 98
Visual Display Written in Processing 98
Home Security System 99
Multiple Buttons on One Input 99
 Chapter 7: Online Thermometer 101
Parts Required 101
Instructions 103
Mount PCB Plugs on Shield 103
Connect Data Lines 105
Assemble Sensors 106
Load Program 108
Variations 119
 Chapter 8: Touch Control Panel 121
Parts Required 122
Instructions 123
How Resistive Touch Screens Work 123
viii

×