building wireless sensor networks

321 666 0
building wireless sensor networks

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

cảm biến

www.it-ebooks.info www.it-ebooks.info Building Wireless Sensor Networks www.it-ebooks.info www.it-ebooks.info Building Wireless Sensor Networks Robert Faludi Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo www.it-ebooks.info Building Wireless Sensor Networks by Robert Faludi Copyright © 2011 Robert Faludi. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com. Editor: Brian Jepson Production Editor: Adam Zaremba Copyeditor: Sharon Terdeman Technical Editors: Kate Hartman and Jordan Husney Proofreader: Sada Preisch Indexer: Angela Howard Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano Printing History: December 2010: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Building Wireless Sensor Networks, the image of dachshunds, and related trade dress are trademarks 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. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. TM This book uses RepKover™, a durable and flexible lay-flat binding. ISBN: 978-0-596-80773-3 [M] 1292271061 www.it-ebooks.info Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi 1. Getting Ready . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Buying an XBee Radio 1 Hardware 1 Antennas 4 Vendors 6 Buying an Adapter 6 Digi Evaluation Board 7 USB Adapters 7 Breakout Boards 10 Arduino Board Adapter Hack 12 What Are All Those Pins? 15 Choosing a Terminal Program 15 Firmware Update Software 17 Terminal Software for Configuring Settings 17 Summary 20 2. Up and Running . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Radio Basics 23 Electromagnetic Spectrum 24 Inverse Square Law 24 Introduction to ZigBee 25 Network Topology 27 Addressing Basics 28 PAN Addresses 29 Channels 29 All Together Now 29 XBee Firmware Updates 32 Reading Current Firmware and Configuration 35 Configuring XBee 40 v www.it-ebooks.info Settings 40 Connecting from Windows 41 Connecting from Macintosh 43 Command Mode and Transparent Mode 46 AT Commands (Are Your Friend) 47 Using AT Commands 49 Basic ZigBee Chat 50 Parts 50 Addresses 50 Coordinator 51 Router 53 Two Computers 53 One Computer 54 Chat 54 Troubleshooting 55 Success! 56 3. Build a Better Doorbell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 ZigBee and Arduino 57 About Arduino 57 Arduino Basics 59 Connecting to Arduino 65 Doorbell Projects 67 Parts 67 Prepare Your Radios 68 Connect Power from Arduino to Breadboard 68 XBee Breakout Board 68 XBee Connections 69 Doorbell Introduction 72 Switch Input 72 and Buzzer Output 73 Configure Your XBees 75 Program the Arduino Doorbell 77 Feedback Doorbell 80 Feedback Light 81 Program the Arduino Feedback Doorbell 81 Extra: Nap Doorbells and More 83 4. Ins and Outs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 The Story of Data 85 Direct, Indirect, Subtext 85 I/O Concepts 87 Why XBee Direct? 88 vi | Table of Contents www.it-ebooks.info XBee Direct Limitations 88 XBee I/O Features 89 AT Configuration I/O Commands 90 Advanced I/O Commands 93 Romantic Lighting Sensor 93 Basic Romantic Lighting Sensor 93 Prepare the Sensor Board 97 Prepare the Base Station 99 Romantic Lighting Sensor with Feedback 104 API Ahead 109 5. API and a Sensor Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 What’s an API? 111 Protocols 113 Humans 113 Computers 113 XBee API Protocol 116 Start Delimiter 117 Length Bytes 118 Frame Data Bytes 118 Checksum 118 API Frame Types 119 AT Commands 120 AT Responses 122 ZigBee Transmit Request 124 ZigBee Transmit Status 127 ZigBee Receive Packet 129 I/O Data Sample Rx Indicator 131 Remote AT Command Request 135 Remote Command Response 137 Using What You Need 138 Libraries 141 Simple Sensor Network 142 Parts 142 Prepare Your Coordinator Radio 143 Prepare Your Router Radios 144 Prepare the Sensor Boards 144 Prepare the Base Station 148 Program the Base Station 152 Yay! 160 6. Sleeping, Then Changing the World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Sleep Mode 161 Table of Contents | vii www.it-ebooks.info End Devices 161 Configuring Sleep 163 Easy Sleeping 167 Simple Sensor with Sleep Project 167 Parts 168 Prepare Your End Device Radios 168 Configure Your End Device XBees 168 Direct Actuation 171 Direct Actuation Example 172 Parts 172 Prepare Your Coordinator Radio 173 Prepare Your Router Radios 174 Prepare the Actuator Boards 174 Configure Your Router XBees 174 Prepare the Base Station 177 Simple Actuator Node Code in Processing 180 Summary 187 7. Over the Borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Gateways 189 XBee as Embedded Gateway 190 Other Embedded Gateways 190 Internet Gateways 192 Internet Media 194 Computers Versus Dedicated Devices 194 ConnectPorts 195 Selecting a ConnectPort 196 Setting Up a ConnectPort 197 Configuring a ConnectPort 198 Remote Management 203 iDigi Connectivity Server 204 iDigi Features 204 Adding a ConnectPort 206 Viewing Configurations 209 Firmware Updates and Remote Reboot 210 Viewing an XBee Network 212 XBee Internet Gateway (XIG) 214 Installing and Configuring XIG 216 Testing XIG 218 XIG Example 220 Twitter Reader 221 Parts 222 Prepare Your ConnectPort with XBee Internet Gateway 223 viii | Table of Contents www.it-ebooks.info [...]... 293 Table of Contents | ix www.it-ebooks.info www.it-ebooks.info Preface Building Wireless Sensor Networks is an essential guide for anyone interested in wireless communications for sensor networks, home networking, or device hacking It is a first step in becoming proficient in making these systems It is not a textbook on protocols... chained to the wall or to each other Sensors can be attached to people or animals in a humane manner that doesn’t hinder their movement In short, lots of data can move freely from where it is gathered to where it can do the most good That’s why wireless is worth it The ZigBee protocol is a very popular way of creating radio sensor networks for a number of reasons Wireless networks and connected devices in... scientists, can develop these systems A number of full sensor networks, an array of doorbells, a two-way lighting detector, a household control system, and several types of Internet-connected contraptions will be demonstrated step by step for you to build After reading this book you’ll have a solid understanding of what it takes to create scalable sensor and device networks because you’ll have brought a variety... Here you’ll take a closer look at the unique features of the XBee-brand ZigBee radios so we can start building fully scalable sensor networks You’ll begin with input/output concepts and commands, then immediately put these to use in a small set of progressively intricate projects Chapter 5, API and a Sensor Network At this point you have everything you need to conquer the XBee’s application programming... xiii www.it-ebooks.info connectors, shields, hexadecimals, binary numbers, ASCII codes, and finally a complete guide to XBee AT commands About the Title You will notice that for a book called Building Wireless Sensor Networks, we spend quite a bit of time talking about actuation: outputs that make things happen in the physical world The source of this is a deep-seated point of view that is backed up by... into your product’s documentation does require permission We appreciate, but do not require, attribution An attribution usually includes the title, author, publisher, and ISBN For example: Building Wireless Sensor Networks by Robert Faludi Copyright 2011 Robert Faludi, 978-0-596-80773-3.” Preface | xv www.it-ebooks.info If you feel your use of code examples falls outside fair use or the permission given... chapters from his perch at 35,000 feet His deep knowledge of the ZigBee protocol is matched only by his competence as a wordsmith Thanks to both for their efforts and uncommon friendships Building Wireless Sensor Networks is loosely structured around the Sociable Objects class I created at NYU’s ITP graduate program in media and technology There, Tom Igoe loaned me my first ZigBee radio, encouraged... just the midpoint of the perception-action chain The real action starts with our sensory systems We see, smell, and feel, then we process those sensations for the purpose of choosing and executing our next move Sensing never happens in a vacuum for its own sake There’s always a physical purpose This is as true for wireless networks as it is for living organisms The data we collect is always aimed at an... ZigBee Stack Layers Application Support Layer Routing Security ZigBee Protocol References Serial Flow Control RTS and CTS Sharing Data Pachube Simple Sensor Network with Pachube API Key Build the Simple Sensor Network in Chapter 5 Program the Base Station Simple Sensor Network Pachube Code in Processing The Future of ZigBee Next Steps for You Making Stuff Sharing Your Work 235 236 237 240 242 243 244 244... projects you’ll create in this book use radio signals that pass invisibly through the air This “wirelessness” is essential whenever you want to place sensors where no cables can be installed, or where such tethering is undesirable With radio, you can employ sensing and actuation in pristine natural settings, minimalist building interiors, or complex urban environments Mobile devices like children’s toys can . www.it-ebooks.info www.it-ebooks.info Building Wireless Sensor Networks www.it-ebooks.info www.it-ebooks.info Building Wireless Sensor Networks Robert Faludi Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo www.it-ebooks.info Building. ix www.it-ebooks.info www.it-ebooks.info Preface Building Wireless Sensor Networks is an essential guide for anyone interested in wireless communications for sensor networks, home networking, or device hacking 93 Romantic Lighting Sensor 93 Basic Romantic Lighting Sensor 93 Prepare the Sensor Board 97 Prepare the Base Station 99 Romantic Lighting Sensor with Feedback 104 API Ahead 109 5. API and a Sensor Network

Ngày đăng: 08/05/2014, 12:09

Từ khóa liên quan

Mục lục

  • Table of Contents

  • Preface

    • How This Book Is Organized

    • About the Title

    • About the Examples

    • Conventions Used in This Book

    • Using Code Examples

    • Safari® Books Online

    • How to Contact Us

    • Acknowledgments

    • Chapter 1. Getting Ready

      • Buying an XBee Radio

        • Hardware

        • Antennas

        • Vendors

        • Buying an Adapter

          • Digi Evaluation Board

          • USB Adapters

          • Breakout Boards

          • Arduino Board Adapter Hack

          • What Are All Those Pins?

          • Choosing a Terminal Program

            • Firmware Update Software

              • X-CTU

              • Terminal Software for Configuring Settings

                • CoolTerm

                • HyperTerminal

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan