ebook img

Arduino Workshop PDF

394 Pages·2013·10.14 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 Arduino Workshop

LLEEAARRNN TTHHEE BBAASSIICCSS,, AARRDDUUIINNOO BBUUIILLDD TTHHEE PPRROOJJEECCTTSS,, CCRREEAATTEE YYOOUURR OOWWNN AA WWOORRKKSSHHOOPP RR DD The Arduino is a cheap, flexible, open source micro- • A handy tester that lets you check the voltage of any A H A N D S - O N I N T R O D U C T I O N UU controller platform designed to make it easy for hobbyists single-cell battery W I T H 6 5 P R O J E C T S to use electronics in homemade projects. With an almost • A keypad-controlled lock that requires a secret code II unlimited range of input and output add-ons, sensors, indi- to open NN cators, displays, motors, and more, the Arduino offers you You’ll also learn to build Arduino toys and games like: J O H N B O X A L L countless ways to create devices that interact with the OO world around you. • An electronic version of the classic six-sided die In Arduino Workshop, you’ll learn how these add-ons • A binary quiz game that challenges your number work and how to integrate them into your own projects. conversion skills WW You’ll start off with an overview of the Arduino system but quickly move on to coverage of various electronic • A motorized remote control tank with collision detection components and concepts. Hands-on projects throughout to keep it from crashing OO the book reinforce what you’ve learned and show you Arduino Workshop will teach you the tricks and design how to apply that knowledge. As your understanding grows, principles of a master craftsman. Whatever your skill level, RR the projects increase in complexity and sophistication. you’ll have fun as you learn to harness the power of the Among the book’s 65 projects are useful devices like: Arduino for your own DIY projects. KK • A digital thermometer that charts temperature changes ABOUT THE AUTHOR SS on an LCD John Boxall (http://www.tronixstuff.com/) has been • A GPS logger that records data from your travels, which HH writing Arduino tutorials, projects, and kit and accessory can be displayed on Google Maps reviews for years. Arduino Workshop is his first book. OO PP THE FINEST IN GEEK ENTERTAINMENT™ www.nostarch.com B O X “I LIE FLAT.” $29.95($31.95CDN) A L This book uses RepKover—a durable binding that won’t snap shut. HARDWARE/ELECTROSHELVE IN: L N ICS Arduino Workshop A r d u i n o W o r k s h o p A hands-on introduction with 65 projects by John Boxall San Francisco Arduino Workshop. Copyright © 2013 by John Boxall. 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. Printed in USA First printing 17 16 15 14 13 1 2 3 4 5 6 7 8 9 ISBN-10: 1-59327-448-3 ISBN-13: 978-1-59327-448-1 Publisher: William Pollock Production Editor: Serena Yang Cover Illustration: Charlie Wylie Interior Design: Octopod Studios Developmental Editor: William Pollock Technical Reviewer: Marc Alexander Copyeditor: Lisa Theobald Compositor: Susan Glinert Stevens Proofreader: Emelie Battaglia Circuit diagrams made using Fritzing (http://fritzing.org/) For information on distribution, translations, or bulk sales, please contact No Starch Press, Inc. directly: No Starch Press, Inc. 38 Ringold Street, San Francisco, CA 94103 phone: 415.863.9900; fax: 415.863.9950; [email protected]; www.nostarch.com Library of Congress Cataloging-in-Publication Data A catalog record of this book is available from the Library of Congress. No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. 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 infor- mation contained in it. For the two people who have always believed in me: my mother and my dearest Kathleen Brief Contents Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Chapter 1: Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 2: Exploring the Arduino Board and the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Chapter 3: First Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 Chapter 4: Building Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Chapter 5: Working with Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Chapter 6: Numbers, Variables, and Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 Chapter 7: Liquid Crystal Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147 Chapter 8: Expanding Your Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Chapter 9: Numeric Keypads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Chapter 10: Accepting User Input with Touchscreens . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Chapter 11: Meet the Arduino Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207 Chapter 12: Motors and Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 Chapter 13: Using GPS with Your Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Chapter 14: Wireless Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271 Chapter 15: Infrared Remote Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Chapter 16: Reading RFID Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295 Chapter 17: Data Buses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Chapter 18: Real-time Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 Chapter 19: The Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337 Chapter 20: Cellular Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 viii Brief Contents Contents in d e tAil AcknoWledgments xix 1 getting stArted 1 The Possibilities Are Endless . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Strength in Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Parts and Accessories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Required Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Windows XP and Later . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Ubuntu Linux 9 .04 and Later . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2 exploring the Arduino BoArd And the ide 19 The Arduino Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Taking a Look Around the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 The Command Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 The Text Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 The Message Window Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Creating Your First Sketch in the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 The Setup Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Controlling the Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 The Loop Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Verifying Your Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Uploading and Running Your Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Modifying Your Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 3 First steps 33 Planning Your Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 About Electricity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Electronic Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 The Resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 The Light-Emitting Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 The Solderless Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Project #1: Creating a Blinking LED Wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

Description:
W I T H 6 5 PROJECTS. A. R. D. U Arduino. Workshop. A hands-on introduction with 65 projects Timing Applications with millis() and micros().
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.