make: projects making things talk making projects making things talk practical methods for...

Download Make: PROJECTS Making Things Talk Making PROJECTS Making Things Talk Practical Methods for Connecting Physical Objects PROJECTS AND IDEAS TO CREATE ... rangers like the Sharp GP2D12,

Post on 04-May-2018

215 views

Category:

Documents

3 download

Embed Size (px)

TRANSCRIPT

  • Tom Igoe

    Make: PROJECTS

    MakingThings Talk

    PracticalMethods forConnecting

    Physical Objects

    PROJECTSAND IDEAS TO CREATE

    TALKINGOBJECTS FROM

    ANYTHING

    Hardware/General

    y(7IA5J6*PLKPLK( +,!?!;!;!} US $29.99 CAN $35.99ISBN10: 0-596-51051-9ISBN13: 978-0-596-51051-0

    Microcontrollers, personal computers, and web servers talking to each other.

    This book is perfect for people with little technical

    training but a lot of interest. Maybe youre a science

    teacher who wants to show students how to

    monitor weather conditions at several locations at

    once, or a sculptor who wants to stage a room of

    choreographed mechanical sculptures.

    Whether you need to plug some sensors in your home

    to the Internet or create a device that can interact

    wirelessly with other creations, Making Things Talk

    explains exactly what you need.

    You will:

    Make your pets bed send you email.

    Make your own game controllers that communicate over a network.

    Use ZigBee, Bluetooth, Infrared, and plain old radio to transmit sensor data wirelessly.

    Work with three easy-to-program, open source environments: Arduino/Wiring, Processing, and PHP.

    Write programs to send data across the Internet based on physical activity in your home, offi ce, or backyard.

    Tom Igoe teaches courses in physical computing and networking at the Interactive Telecommunications Program in the Tisch School of the Arts at New York University. In his teaching and research, he explores ways to allow digital technologies to sense and respond to a wider range of human physical expression. He co-authored Physical Computing: Sensing and Controlling the Physical World with Computers with Dan OSullivan, which has been adopted by numerous digital art and design schools around the world. He is a contributorto MAKE magazine and a collaborator on the Arduino open source micro-controller project. He hopes someday to work with monkeys, as well.

    Through twenty-six simple projects, Making Things Talk shows how to get your creations to talk with one another by forming networks of smart devices that carry on conversations with you and your environment. Here are just a few of the projects:

    Blink Your very fi rst program.

    Monski pongControl a video game with a fl uffy pink monkey.

    Networked Air Quality MeterDownload and display the latest report for your city.

    XBee Toxic Sensor Use ZigBee, sensors, and a cymbal monkey to warn of toxic vapors.

    Bluetooth GPSBuild a battery-powered GPS that reports its location over Bluetooth.

    RFID Reader BowlTurn your lights off when you leave the home or offi ce.

    Building electronic projects that interact with the physical world is good fun. But when devices that youve built start to talk to each other, things really start to get interesting. Making Things Talk demonstrates that once you fi gure out how objects communicate whether theyre microcontroller-powered devices, email programs, or networked databases you can get them to interact.

    www.oreilly.com

    Making Things TalkMake: PROJECTS Make: PR

    OJEC

    TSTom

    IgoeM

    aking Things Talk

  • This excerpt is protected by copyright law. It is your

    responsibility to obtain permissions necessary for any

    proposed use of this material. Please direct your

    inquiries to permissions@oreilly.com.

    mailto:permissions@oreilly.com

  • Making Things TalkFirst Edition

    Tom Igoe

    BEIJING CAMBRIDGE FARNHAM KLN PARIS SEBASTOPOL TAIPEI TOKYO

    !""#$%&'()*+,-).//0001!""#$%&'()*+,-).//0001 234535600078498:90;!234535600078498:90;!

  • Making Things Talk

    The OReilly logo is a registered trademark of OReilly Media, Inc. The MAKE: Projects series

    designations, Making Things Talk, and related trade dress are trademarks of OReilly 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 OReilly Media, Inc. was aware of

    the trademark claim, the designations have been printed in caps or initial caps.

    While every precaution has been taken in the preparation of this book, the publisher and authors

    assume no responsibility for errors or omissions, or for damages resulting from the use of the

    information contained herein.

    Please note: Technology, and the laws and limitations imposed by manufacturers and content owners,

    are constantly changing. Thus, some of the projects described may not work, may be inconsistent

    with current laws or user agreements, or may damage or adversely affect some equipment.

    Your safety is your own responsibility, including proper use of equipment and safety gear, and

    determining whether you have adequate skill and experience. Power tools, electricity, and other

    resources used for these projects are dangerous unless used properly and with adequate precautions,

    including safety gear. Some illustrative photos do not depict safety precautions or equipment, in

    order to show the project steps more clearly. These projects are not intended for use by children.

    Use of the instructions and suggestions in Making Things Talk is at your own risk. OReilly Media, Inc.,

    disclaims 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.

    ISBN-10: 0-596-51051-9

    ISBN-13: 978-0-596-51051-0

    by Tom Igoe

    Copyright 2007 OReilly Media, Inc. All rights reserved. Printed in U.S.A.

    Published by Make:Books, an imprint of Maker Media, a division of OReilly Media, Inc.

    1005 Gravenstein Highway North, Sebastopol, CA 95472.

    OReilly books may be purchased for educational, business, or sales promotional use.

    For more information, contact our corporate/institutional sales department:

    800-998-9938 or corporate@oreilly.com.

    Print History

    September 2007

    First Edition

    Publisher: Dale Dougherty

    Associate Publisher and Executive Editor: Dan Woods

    Editor: Brian Jepson

    Copy Editor: Nancy Kotary

    Creative Director: Daniel Carter

    Designer: Katie Wilson

    Production Manager: Terry Bronson

    Indexer: Patti Schiendelman

    Cover Photograph: Tom Igoe

    !""#$%&'()*+,-).//00011!""#$%&'()*+,-).//00011 234535600078468590:!234535600078468590:!

  • Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .VIIIWho This Book Is For . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XWhat You Need To Know . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .XIContents of This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .XIOn Buying Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XIIUsing Code Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XIIIUsing Circuit Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XIIIAcknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XIVWed Like to Hear from You . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XV

    Chapter 1: The Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16It Starts with the Stuff You Touch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Its About Pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Computers of All Shapes and Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Good Habits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Using the Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28It Ends with the Stuff You Touch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    Chapter 2: The Simplest Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48Layers of Agreement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50Making the Connection: The Lower Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52S