logo资料库

Building Wireless Sensor Network.pdf

第1页 / 共321页
第2页 / 共321页
第3页 / 共321页
第4页 / 共321页
第5页 / 共321页
第6页 / 共321页
第7页 / 共321页
第8页 / 共321页
资料共321页,剩余部分请下载后查看
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
Tera Term
ZTerm
screen
Others
Summary
Chapter 2. Up and Running
Radio Basics
Electromagnetic Spectrum
Inverse Square Law
Introduction to ZigBee
Network Topology
Addressing Basics
PAN Addresses
Channels
All Together Now
XBee Firmware Updates
Reading Current Firmware and Configuration
Configuring XBee
Settings
Connecting from Windows
Connecting from Macintosh
Command Mode and Transparent Mode
AT Commands (Are Your Friend)
Using AT Commands
Basic ZigBee Chat
Parts
Addresses
Coordinator
Router
Two Computers
One Computer
Chat
Troubleshooting
Success!
Chapter 3. Build a Better Doorbell
ZigBee and Arduino
About Arduino
Arduino Basics
Buying an Arduino
Don’t forget the cable
Downloading the software
Using the Arduino IDE
Selecting the board and port
Code structure
Buying electronics supplies
Connecting to Arduino
Doorbell Projects
Parts
Prepare Your Radios
Connect Power from Arduino to Breadboard
XBee Breakout Board
XBee Connections
Doorbell Introduction
Switch Input...
...and Buzzer Output
Configure Your XBees
Program the Arduino Doorbell
Troubleshooting
Feedback Doorbell
Feedback Light
Program the Arduino Feedback Doorbell
Extra: Nap Doorbells and More
Chapter 4. Ins and Outs
The Story of Data
Direct, Indirect, Subtext
I/O Concepts
Why XBee Direct?
XBee Direct Limitations
XBee I/O Features
AT Configuration I/O Commands
Advanced I/O Commands
Romantic Lighting Sensor
Basic Romantic Lighting Sensor
Parts
Prepare your coordinator radio
Prepare your router radio
Prepare the Sensor Board
Configure your router XBee
Connect power from battery to breadboard
Router XBee connection to battery
Photoresistor input
Prepare the Base Station
Connect power from Arduino to breadboard
Coordinator XBee connection to Arduino
Light output
Program the romantic lighting sensor base station
Troubleshooting
Romantic Lighting Sensor with Feedback
Add light output to the sensor
Configure your router XBee
Program the romantic lighting sensor with feedback base station
API Ahead
Chapter 5. API and a Sensor Network
What’s an API?
Protocols
Humans
Computers
Start bytes
Length byte
Contents ID
XBee API Protocol
Start Delimiter
Length Bytes
Frame Data Bytes
Checksum
API Frame Types
AT Commands
Frame type
Frame ID
AT command
Parameter value
Checksum
AT Responses
Frame type
Frame ID
AT command
Command status
Command data
ZigBee Transmit Request
64-bit destination address
16-bit destination network address
ZigBee Transmit Status
Transmit retry count
Delivery status
Discovery status
ZigBee Receive Packet
64-bit source address
16-bit source network address
Receive options
Received data
I/O Data Sample Rx Indicator
Number of samples
Digital channel mask
Analog channel mask
Digital samples
Analog samples
Remote AT Command Request
Remote command options
Remote Command Response
Using What You Need
Libraries
Simple Sensor Network
Parts
Prepare Your Coordinator Radio
Prepare Your Router Radios
Prepare the Sensor Boards
Connect voltage regulator circuit and power jack to breadboard
Router XBee connection to power
Temperature input
Second sensor board
Prepare the Base Station
Connect to computer
Program the Base Station
Simple Sensor Network display code in Processing
Troubleshooting
Yay!
Chapter 6. Sleeping, Then Changing the World
Sleep Mode
End Devices
Storing and forwarding
Constraints
Advantages
Configuring Sleep
Sleep Mode
Sleep Period
Time Before Sleep
Advanced commands
Easy Sleeping
Simple Sensor with Sleep Project
Parts
Prepare Your End Device Radios
Configure Your End Device XBees
Add sensor nodes...
...or replace sensor nodes
Direct Actuation
Direct Actuation Example
Parts
Prepare Your Coordinator Radio
Prepare Your Router Radios
Prepare the Actuator Boards
Configure Your Router XBees
Connect voltage regulator circuit and power jack to breadboard
Router XBee connection to power
Transistor and relay output
Second actuator board
PowerSwitch Tail A/C relay
Prepare the Base Station
Connect to your computer
Program the actuator network base station
Simple Actuator Node Code in Processing
Summary
Chapter 7. Over the Borders
Gateways
XBee as Embedded Gateway
Other Embedded Gateways
Internet Gateways
Internet Media
Computers Versus Dedicated Devices
ConnectPorts
Selecting a ConnectPort
Setting Up a ConnectPort
Troubleshooting
Configuring a ConnectPort
Remote Management
iDigi Connectivity Server
iDigi Features
Adding a ConnectPort
Viewing Configurations
Firmware Updates and Remote Reboot
Viewing an XBee Network
XBee Internet Gateway (XIG)
Installing and Configuring XIG
Testing XIG
XIG Example
XIG download example in PHP
Twitter Reader
Parts
Prepare Your ConnectPort with XBee Internet Gateway
Prepare Your Router Radio
Configure Your Router Radio
Prepare the Twitter Reader Board
Connect power from Arduino to breadboard
XBee connection to Arduino
Liquid crystal display (LCD) output
Program the Arduino
Installing the NewSoftSerial library
Twitter Reader code
Troubleshooting
Moving Forward
Chapter 8. More to Love
Advanced ZigBee
ZigBee Stack Layers
Application Support Layer
Profiles
Endpoints
Clusters
Next steps
Routing
Next steps
Security
Network and link keys
Technical details
Fast guide to turning on XBee network security
Using optional APS encryption
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
Troubleshooting
The Future of ZigBee
Next Steps for You
Making Stuff
Sharing Your Work
Appendix. Resource Guide
Arduino Resources
Processing Resources
Python Resources
ZigBee Resources Online
Standards Organizations
Digi International Resources
Additional Online Resource Lists
Recommended Books
Sidewalk Telescopes
Troubleshooting
Common XBee Mistakes
XBee Arduino Mistakes
Reference Tables
Other ZigBee Modules
ZigBee Packet Sniffers
Digi XBee Radio Modules
XBee Connectors and Shields
Hex, Decimal, and Binary
ASCII Codes
XBee Command Reference
Index
Building Wireless Sensor Networks
Building Wireless Sensor Networks Robert Faludi Beijing•Cambridge•Farnham•Köln•Sebastopol•Tokyo
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. This book uses RepKover™, a durable and flexible lay-flat binding. ISBN: 978-0-596-80773-3 [M] 1292271061 TM
Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Buying an Adapter Buying an XBee Radio Hardware Antennas Vendors 1. Getting Ready . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 4 6 6 7 7 10 12 15 15 17 17 20 Digi Evaluation Board USB Adapters Breakout Boards Arduino Board Adapter Hack What Are All Those Pins? Choosing a Terminal Program Firmware Update Software Terminal Software for Configuring Settings Summary Radio Basics Electromagnetic Spectrum Inverse Square Law Introduction to ZigBee Network Topology Addressing Basics PAN Addresses Channels All Together Now 2. Up and Running . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 23 24 24 25 27 28 29 29 29 32 35 40 Reading Current Firmware and Configuration XBee Firmware Updates Configuring XBee v
Settings Connecting from Windows Connecting from Macintosh Command Mode and Transparent Mode AT Commands (Are Your Friend) Using AT Commands Basic ZigBee Chat Parts Addresses Coordinator Router Two Computers One Computer Chat Troubleshooting Success! 40 41 43 46 47 49 50 50 50 51 53 53 54 54 55 56 Doorbell Projects ZigBee and Arduino About Arduino Arduino Basics Connecting to Arduino 3. Build a Better Doorbell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 57 57 59 65 67 67 68 68 68 69 72 72 73 75 77 80 81 81 83 Parts Prepare Your Radios Connect Power from Arduino to Breadboard XBee Breakout Board XBee Connections Doorbell Introduction Switch Input... ...and Buzzer Output Configure Your XBees Program the Arduino Doorbell Feedback Doorbell Feedback Light Program the Arduino Feedback Doorbell Extra: Nap Doorbells and More 4. Ins and Outs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 85 The Story of Data 85 87 88 Direct, Indirect, Subtext Why XBee Direct? I/O Concepts vi | Table of Contents
分享到:
收藏