Simple sensor-network

11
Simple Sensor Network 7KLV SURMHFW FDQ VHUYH DV D PRGHO IRU DOPRVW DQ\ VHQVRU QHWZRUN \RX¦G OLNH WR EXLOG <RX ZLOO FUHDWH D VHW RI LQH[SHQVLYH WHPSHUDWXUH VHQVRUV WKDW DUH PHVKQHWZRUNHG WR JHWKHU WR VWUHDP WKHLU GDWD WR D EDVH VWDWLRQ UDGLR 7KLV EDVH VWDWLRQ ZLOO EH FRQQHFWHG WR D FRPSXWHU ZKHUH WKH UHDOWLPH WHPSHUDWXUH GDWD ZLOO EH YLVXDOL]HG RQ WKH VFUHHQ ,Q WKH QH[W FKDSWHU ZH ZLOO GLVFXVV PDNLQJ WKH VHQVRU QRGHV YHU\ SRZHUHIILFLHQW VR WKDW WKH\ FDQ EH UXQ HIIHFWLYHO\ IURP EDWWHULHV )RU QRZ WKHVH QRGHV FDQ EH SRZHUHG IURP ZDOO RXWOHWV VR ZH FDQ FRQFHQWUDWH RQ WKH EXVLQHVV RI EXLOGLQJ RXU ILUVW FRPSOHWH ZLUHOHVV VHQVRU QHWZRUN 7KH H[DPSOH SURMHFW LQ )LJXUH VKRZV WZR VHQVRU QRGHV DQG D EDVH VWDWLRQ 7KDW¦V WKUHH UDGLRV LQ WRWDO ,I \RX KDYH RQO\ WZR UDGLRV \RX FDQ EXLOG LW ZLWK D VLQJOH VHQVRU QRGH DQG WKH EDVH VWDWLRQ <RX FDQ DOVR FUHDWH PDQ\ PRUH VHQVRU QRGHV ,I \RXU QHWZRUN KDV PRUH WKDQ QRGHV UHPHPEHU WR H[WHQG WKH 3URFHVVLQJ FRGH WR FKDQJH WKH GLVSOD\ VL]H DQG OLPLWV VR WKDW LW FDQ VKRZ DOO WKH GDWD )LJXUH 6LPSOH VHQVRU QHWZRUN Parts 7ZR VROGHUOHVV EUHDGERDUGV $) '. 1' 6)( 357 +RRNXS ZLUH RU MXPSHU ZLUH NLW $) '. 1' 6)( 357 142 | Chapter 5: API and a Sensor Network

description

How to build a radio network

Transcript of Simple sensor-network

Page 1: Simple sensor-network

Simple Sensor Network

Parts

142 | Chapter 5: API and a Sensor Network

Page 2: Simple sensor-network

!!

Prepare Your Coordinator Radio

Simple Sensor Network | 143

Page 3: Simple sensor-network

Pan ID:

_____________________________

Prepare Your Router Radios

Prepare the Sensor Boards

144 | Chapter 5: API and a Sensor Network

Page 4: Simple sensor-network

+++

ATID

ATDH 0

ATDLATDL 0

ATJV1

ATD02

ATIR3E8

ATWR

ATDL

Connect voltage regulator circuit and power jack to breadboard

Simple Sensor Network | 145

Page 5: Simple sensor-network

!

!

!

146 | Chapter 5: API and a Sensor Network

Page 6: Simple sensor-network

Router XBee connection to power

Simple Sensor Network | 147

Page 7: Simple sensor-network

Temperature input

Second sensor board

Prepare the Base Station

Connect to computer

148 | Chapter 5: API and a Sensor Network

Page 8: Simple sensor-network

Simple Sensor Network | 149

Page 9: Simple sensor-network

Program the Base Station

152 | Chapter 5: API and a Sensor Network

Page 10: Simple sensor-network

Simple Sensor Network | 153

Page 11: Simple sensor-network

Simple Sensor Network display code in Processing

/* * Draws a set of thermometers for incoming XBee Sensor data * by Rob Faludi http://faludi.com */

// used for communication via xbee apiimport processing.serial.*;

// xbee api libraries available at http://code.google.com/p/xbee-api/// Download the zip file, extract it, and copy the xbee-api jar file// and the log4j.jar file (located in the lib folder) inside a "code"// folder under this Processing sketch's folder (save this sketch, then// click the Sketch menu and choose Show Sketch Folder).import com.rapplogic.xbee.api.ApiId;import com.rapplogic.xbee.api.PacketListener;import com.rapplogic.xbee.api.XBee;import com.rapplogic.xbee.api.XBeeResponse;import com.rapplogic.xbee.api.zigbee.ZNetRxIoSampleResponse;

String version = "1.01";

// *** REPLACE WITH THE SERIAL PORT (COM PORT) FOR YOUR LOCAL XBEE ***String mySerialPort = "/dev/tty.usbserial-A1000iMG";

// create and initialize a new xbee objectXBee xbee = new XBee();

// make an array list of thermometer objects for displayArrayList thermometers = new ArrayList();// create a font for displayPFont font;

void setup() { size(800, 600); // screen size smooth(); // anti-aliasing for graphic display

// You'll need to generate a font before you can run this sketch. // Click the Tools menu and choose Create Font. Click Sans Serif, // choose a size of 10, and click OK. font = loadFont("SansSerif-10.vlw"); textFont(font); // use the font for text

// The log4j.properties file is required by the xbee api library, and // needs to be in your data folder. You can find this file in the xbee // api library you downloaded earlier PropertyConfigurator.configure(dataPath("")+"log4j.properties"); // Print a list in case the selected one doesn't work out println("Available serial ports:");

154 | Chapter 5: API and a Sensor Network