ebook img

T Practical Arduino PDF

444 Pages·2010·7.88 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview T Practical Arduino

CYAN YELLOW MAGENTA BLACK PANTONE 123 C Practical Arduino Cool Projects for Open Source Hardware TECHNOLOGY IN ACTION™ P r T a his book was written to demonstrate a variety of Arduino techniques in a practical c Practical context, giving you an opportunity to learn how the theory and reference material already available online applies to real-world projects. t If you’ve come as far as picking up a whole book about Arduino, you’re ready for i c 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 a Arduino it was designed that way in the first place. That’s what this book will give you: you won’t l 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. A 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 r with inspiration and new ideas that put ours to shame. And we hope that you’ll then d 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 u Cool Projects for Open Source Hardware world around us. i n o LEARN IN-DEPTH ARDUINO Also available: TECHNIQUES USING REAL-WORLD PROJECTS B l e m ISBN 978-1-4302-2477-8 US $39.99 inOx 53999 ge Shelve in Hardware sr User level: Beginning–Advanced Jonathan Oxer Hugh Blemings SOURCE CODE ONLINE 9 781430 224778 www.apress.com this print for content only—size & color not accurate trim size = 7.5" x 9.25" spine = 0.859" 448 page count Practical Arduino Cool Projects for Open Source Hardware (cid:132) (cid:132) (cid:132) Jonathan Oxer Hugh Blemings Practical Arduino: Cool Projects for Open Source Hardware Copyright © 2009 by Jonathan Oxer and Hugh Blemings All rights reserved. No part of this work may be reproduced 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 States 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 Penrose, Marc Alexander, Philip Lindsay Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, 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 trade 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 http://www.springeronline.com. For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk 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 http://www.apress.com/info/bulksales. 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 http://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 (cid:132) Contents at a Glance..............................................................................................iv (cid:132) Contents..................................................................................................................v (cid:132) About the Authors................................................................................................xvi (cid:132) About the Technical Reviewers..........................................................................xvii (cid:132) Acknowledgments...............................................................................................xix (cid:132) Introduction..........................................................................................................xx (cid:132) Chapter 1: Introduction...........................................................................................1 (cid:132) Chapter 2: Appliance Remote Control...................................................................17 (cid:132) Chapter 3: Time-Lapse Camera Controller............................................................37 (cid:132) Chapter 4: Virtual USB Keyboard..........................................................................51 (cid:132) Chapter 5: PS/2 Keyboard or Mouse Input...........................................................63 (cid:132) Chapter 6: Security/Automation Sensors.............................................................81 (cid:132) Chapter 7: Online Thermometer..........................................................................101 (cid:132) Chapter 8: Touch Control Panel..........................................................................121 (cid:132) Chapter 9: Speech Synthesizer...........................................................................139 (cid:132) Chapter 10: Water Flow Gauge...........................................................................163 (cid:132) Chapter 11: Oscilloscope/Logic Analyzer...........................................................185 (cid:132) Chapter 12: Water Tank Depth Sensor................................................................209 (cid:132) Chapter 13: Weather Station Receiver................................................................239 (cid:132) Chapter 14: RFID Access Control System...........................................................269 (cid:132) Chapter 15: Vehicle Telemetry Platform.............................................................295 (cid:132) Chapter 16: Resources........................................................................................383 (cid:132) Index...................................................................................................................405 iv Contents (cid:132) Contents at a Glance..............................................................................................iv (cid:132) Contents..................................................................................................................v (cid:132) About the Authors................................................................................................xvi (cid:132) About the Technical Reviewers..........................................................................xvii (cid:132) Acknowledgments...............................................................................................xix (cid:132) Introduction..........................................................................................................xx (cid:132) 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 (cid:132) CONTENTS Capacitance and Capacitors...................................................................................................................11 Fundamentals....................................................................................................................................11 Capacitor Types.................................................................................................................................12 Power Supply Bypass........................................................................................................................13 ESD Precautions.....................................................................................................................................13 Tools.......................................................................................................................................................13 Parts.......................................................................................................................................................14 Further Reading......................................................................................................................................15 (cid:132) 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 (cid:132) 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 (cid:132) 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 (cid:132) 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 (cid:132) 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 (cid:132) CONTENTS Mouse Software.....................................................................................................................................76 Variations................................................................................................................................................79 Barcode Reader for a Stock Control System.....................................................................................79 Resources........................................................................................................................80 (cid:132) 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 (cid:132) 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 (cid:132) Chapter 8: Touch Control Panel..........................................................................121 Parts Required...............................................................................................................122 Instructions....................................................................................................................123 How Resistive Touch Screens Work.....................................................................................................123 viii (cid:132) CONTENTS Basic Touch Screen Connection Test...................................................................................................126 Arduino TouchScreen Library...............................................................................................................128 Controlling a “Processing” Program.....................................................................................................128 Construct Hardware for Home Automation Control Panel....................................................................131 Calibrate Hot Zones..............................................................................................................................134 Mount Arduino......................................................................................................................................137 (cid:132) Chapter 9: Speech Synthesizer...........................................................................139 Parts Required...............................................................................................................140 Instructions....................................................................................................................142 Speech Output Signal...........................................................................................................................142 Beginning Assembly.............................................................................................................................143 SpeakJet PWM "Audio" Output............................................................................................................144 Quick Test.............................................................................................................................................145 Fit Status Indicators..............................................................................................................................145 Making a Line-Level Output Cable........................................................................................................148 On-Board Amplifier...............................................................................................................................149 Speech Synthesizer Software...............................................................................................................151 Create Your Own Messages..................................................................................................................153 Variations.......................................................................................................................160 Read SpeakJet Status..........................................................................................................................160 Resources......................................................................................................................161 (cid:132) Chapter 10: Water Flow Gauge...........................................................................163 Parts Required...............................................................................................................164 Instructions....................................................................................................................165 Replace Sensor Connector...................................................................................................................165 Prepare Prototyping Shield...................................................................................................................166 Prepare LCD Module.............................................................................................................................168 Fit LCD to Case.....................................................................................................................................171 ix

Description:
being superconductors which remain a little out of reach. Common stranded “hookup wire” with a diameter of 1.25mm (AWG16) has a resistance of around. 0.014 ohms/meter. By way of example, say you use two 1m lengths of this wire to supply 5V to your. Arduino board consuming 100mA. The voltage
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.