<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wsn.cse.wustl.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bowen</id>
	<title>Cyber-Physical Systems Laboratory - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wsn.cse.wustl.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bowen"/>
	<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=Special:Contributions/Bowen"/>
	<updated>2026-11-16T04:18:13Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.4</generator>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4239</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4239"/>
		<updated>2017-09-18T16:40:18Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
FREE&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;br /&gt;
* [[First Project on Zolertia Firefly]]&lt;br /&gt;
* [[Send data from server to node using serial forwarder]]&lt;br /&gt;
* [[Send data from node to server using serial forwarder]]&lt;br /&gt;
* [[TinyOS 2 Serial Communication Mechanism port on contiki]]&lt;br /&gt;
* [[CPSL serial communication protocol on testbed/contiki]]&lt;br /&gt;
* [[Glossy on contiki]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=Send_data_from_node_to_server_using_serial_forwarder&amp;diff=4238</id>
		<title>Send data from node to server using serial forwarder</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=Send_data_from_node_to_server_using_serial_forwarder&amp;diff=4238"/>
		<updated>2017-09-14T18:11:35Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to send data from node to server using serial forwarder?&lt;br /&gt;
&lt;br /&gt;
Sending data from node to server is more straightforward than the other way.&lt;br /&gt;
&lt;br /&gt;
To send data to server, you need to send the full packet of TOS2 packet, this means your packet&lt;br /&gt;
will include:&lt;br /&gt;
&lt;br /&gt;
frame byte(0x7E)&lt;br /&gt;
&lt;br /&gt;
protocol type(currently)&lt;br /&gt;
&lt;br /&gt;
CRC16&lt;br /&gt;
&lt;br /&gt;
The standard packet format for TinyOS 2 is in last wiki page.&lt;br /&gt;
&lt;br /&gt;
You need to package the data packet on node and also calculate CRC for them.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Suppose you have a payload which contains 3 number: {2,2,2}&lt;br /&gt;
&lt;br /&gt;
Then the format you need to send to the serial port using uart1_writeb() is:&lt;br /&gt;
&lt;br /&gt;
{126, 68, 1, 0, 0, 0, 0, 102, 3, 0, 0, 2, 2, 2, 151, 168, 126}&lt;br /&gt;
&lt;br /&gt;
The length of this packet is 17 bytes.&lt;br /&gt;
&lt;br /&gt;
Note that you need to skip the packet if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to receive the data from node on server?'''&lt;br /&gt;
&lt;br /&gt;
Suppose you have a python script on the server. The python script need a socket to connect&lt;br /&gt;
&lt;br /&gt;
to port 9002 on the server(localhost). Then send handshake signal {85, 32}. This step&lt;br /&gt;
&lt;br /&gt;
is the same as sendig data from server.&lt;br /&gt;
&lt;br /&gt;
Using the example packet above, when the node send this packet to server, the python script&lt;br /&gt;
&lt;br /&gt;
that has already been connected to port 9002 will first receive a number indicate the length&lt;br /&gt;
&lt;br /&gt;
of the incoming packet. Notice here, the length isn't for the whole packet.&lt;br /&gt;
&lt;br /&gt;
Data send from node:&lt;br /&gt;
&lt;br /&gt;
{126, 68, 1, 0, 0, 0, 0, 102, 3, 0, 0, 2, 2, 2, 151, 168, 126}&lt;br /&gt;
&lt;br /&gt;
Data received at server python script:&lt;br /&gt;
&lt;br /&gt;
{15, 1, 0, 0, 0, 0, 102, 3, 0, 0, 2, 2, 2, 151, 168, 126}&lt;br /&gt;
&lt;br /&gt;
The first byte 15 indicates that the packet is 15-byte-long. The serial forwarder&lt;br /&gt;
&lt;br /&gt;
won't forward the first frame byte and the protocol type byte. So the 17-byte-long original&lt;br /&gt;
&lt;br /&gt;
is forwarder as a 15-byte-long packet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOTICE:'''&lt;br /&gt;
&lt;br /&gt;
Don't send any debug information during the sending of packet, or the transmission will be disrupted, the serial forwarder won't be &lt;br /&gt;
able to recognize the packet.&lt;br /&gt;
&lt;br /&gt;
'''My understanding of the code''':&lt;br /&gt;
&lt;br /&gt;
The code for handling serial packet on the node is in /sw/python/wsntestbed/clientlib/handler.py&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=TinyOS_2_Serial_Communication_Mechanism_port_on_contiki&amp;diff=4237</id>
		<title>TinyOS 2 Serial Communication Mechanism port on contiki</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=TinyOS_2_Serial_Communication_Mechanism_port_on_contiki&amp;diff=4237"/>
		<updated>2017-09-14T17:50:02Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The source files for the TinyOS 2 serial communication mechanism on contiki:&lt;br /&gt;
&lt;br /&gt;
'''core/dev/CPSL-tinyos-2x-serial.h'''&lt;br /&gt;
'''core/dev/CPSL-tinyos-2x-serial.c'''&lt;br /&gt;
'''core/dev/CPSL-tinyos2x-serial-header.h'''&lt;br /&gt;
&lt;br /&gt;
My principle when implement this feature is try not to touch the original contiki source code.&lt;br /&gt;
&lt;br /&gt;
To add the TinyOS 2 serial communication mechanism:&lt;br /&gt;
&lt;br /&gt;
'''Step 1:'''&lt;br /&gt;
&lt;br /&gt;
In '''core/dev/serial-line.h''', add the following definition:&lt;br /&gt;
&lt;br /&gt;
#ifdef TINYOS_2X_SERIAL_PACKET&lt;br /&gt;
#include &amp;quot;CPSL-tinyos-2x-serial.h&amp;quot;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'''Step 2:'''&lt;br /&gt;
&lt;br /&gt;
In '''core/dev/serial-line.c''', modify the function '''serial_line_input_byte''',&lt;br /&gt;
&lt;br /&gt;
this function is invoked every time a character come in through the serial port.&lt;br /&gt;
&lt;br /&gt;
In the function, add the following statements:&lt;br /&gt;
&lt;br /&gt;
#ifdef TINYOS_2X_SERIAL_PACKET&lt;br /&gt;
  tinyos2x_serial_dispatcher(c);&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
Some note about the implementation:&lt;br /&gt;
&lt;br /&gt;
There are 2 processes in this implementation:&lt;br /&gt;
&lt;br /&gt;
'''tinyos2x_serial_unescape_process''', this process is invoked every time a packet has been&lt;br /&gt;
&lt;br /&gt;
taken out from the byte stream. It will unescape the byte array received.&lt;br /&gt;
&lt;br /&gt;
'''tinyos2x_serial_ack_send_process''', this process is invoked every time unescaping of the&lt;br /&gt;
&lt;br /&gt;
byte array has been done, it will send ack packet to the server.&lt;br /&gt;
&lt;br /&gt;
'''Send data to the server:'''&lt;br /&gt;
&lt;br /&gt;
Suppose you have a data array called payload, its length is len. Just pass the data array and its&lt;br /&gt;
&lt;br /&gt;
length to function '''send_data_to_server''' in CPSL-tinyos-2x-serial.c. Remember that the data&lt;br /&gt;
&lt;br /&gt;
array only need to contain the payload, all other stuff in the packet will be automatically set&lt;br /&gt;
&lt;br /&gt;
by this function.&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=TinyOS_2_Serial_Communication_Mechanism_port_on_contiki&amp;diff=4236</id>
		<title>TinyOS 2 Serial Communication Mechanism port on contiki</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=TinyOS_2_Serial_Communication_Mechanism_port_on_contiki&amp;diff=4236"/>
		<updated>2017-09-14T17:49:36Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The source files for the TinyOS 2 serial communication mechanism on contiki:&lt;br /&gt;
&lt;br /&gt;
'''core/dev/CPSL-tinyos-2x-serial.h'''&lt;br /&gt;
'''core/dev/CPSL-tinyos-2x-serial.c'''&lt;br /&gt;
'''core/dev/CPSL-tinyos2x-serial-header.h'''&lt;br /&gt;
&lt;br /&gt;
My principle when implement this feature is try not to touch the original contiki source code.&lt;br /&gt;
&lt;br /&gt;
To add the TinyOS 2 serial communication mechanism:&lt;br /&gt;
&lt;br /&gt;
'''Step 1:'''&lt;br /&gt;
&lt;br /&gt;
In '''core/dev/serial-line.h''', add the following definition:&lt;br /&gt;
&lt;br /&gt;
\#ifdef TINYOS_2X_SERIAL_PACKET&lt;br /&gt;
\#include &amp;quot;CPSL-tinyos-2x-serial.h&amp;quot;&lt;br /&gt;
\#endif&lt;br /&gt;
&lt;br /&gt;
'''Step 2:'''&lt;br /&gt;
&lt;br /&gt;
In '''core/dev/serial-line.c''', modify the function '''serial_line_input_byte''',&lt;br /&gt;
&lt;br /&gt;
this function is invoked every time a character come in through the serial port.&lt;br /&gt;
&lt;br /&gt;
In the function, add the following statements:&lt;br /&gt;
&lt;br /&gt;
\#ifdef TINYOS_2X_SERIAL_PACKET&lt;br /&gt;
  tinyos2x_serial_dispatcher(c);&lt;br /&gt;
\#endif&lt;br /&gt;
&lt;br /&gt;
Some note about the implementation:&lt;br /&gt;
&lt;br /&gt;
There are 2 processes in this implementation:&lt;br /&gt;
&lt;br /&gt;
'''tinyos2x_serial_unescape_process''', this process is invoked every time a packet has been&lt;br /&gt;
&lt;br /&gt;
taken out from the byte stream. It will unescape the byte array received.&lt;br /&gt;
&lt;br /&gt;
'''tinyos2x_serial_ack_send_process''', this process is invoked every time unescaping of the&lt;br /&gt;
&lt;br /&gt;
byte array has been done, it will send ack packet to the server.&lt;br /&gt;
&lt;br /&gt;
'''Send data to the server:'''&lt;br /&gt;
&lt;br /&gt;
Suppose you have a data array called payload, its length is len. Just pass the data array and its&lt;br /&gt;
&lt;br /&gt;
length to function '''send_data_to_server''' in CPSL-tinyos-2x-serial.c. Remember that the data&lt;br /&gt;
&lt;br /&gt;
array only need to contain the payload, all other stuff in the packet will be automatically set&lt;br /&gt;
&lt;br /&gt;
by this function.&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=TinyOS_2_Serial_Communication_Mechanism_port_on_contiki&amp;diff=4235</id>
		<title>TinyOS 2 Serial Communication Mechanism port on contiki</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=TinyOS_2_Serial_Communication_Mechanism_port_on_contiki&amp;diff=4235"/>
		<updated>2017-09-14T17:48:54Z</updated>

		<summary type="html">&lt;p&gt;Bowen: Created page with &amp;quot;The source files for the TinyOS 2 serial communication mechanism on contiki:  '''core/dev/CPSL-tinyos-2x-serial.h''' '''core/dev/CPSL-tinyos-2x-serial.c''' '''core/dev/CPSL-ti...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The source files for the TinyOS 2 serial communication mechanism on contiki:&lt;br /&gt;
&lt;br /&gt;
'''core/dev/CPSL-tinyos-2x-serial.h'''&lt;br /&gt;
'''core/dev/CPSL-tinyos-2x-serial.c'''&lt;br /&gt;
'''core/dev/CPSL-tinyos2x-serial-header.h'''&lt;br /&gt;
&lt;br /&gt;
My principle when implement this feature is try not to touch the original contiki source code.&lt;br /&gt;
&lt;br /&gt;
To add the TinyOS 2 serial communication mechanism:&lt;br /&gt;
&lt;br /&gt;
'''Step 1:'''&lt;br /&gt;
&lt;br /&gt;
In '''core/dev/serial-line.h''', add the following definition:&lt;br /&gt;
&lt;br /&gt;
#ifdef TINYOS_2X_SERIAL_PACKET&lt;br /&gt;
#include &amp;quot;CPSL-tinyos-2x-serial.h&amp;quot;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'''Step 2:'''&lt;br /&gt;
In '''core/dev/serial-line.c''', modify the function '''serial_line_input_byte''',&lt;br /&gt;
&lt;br /&gt;
this function is invoked every time a character come in through the serial port.&lt;br /&gt;
&lt;br /&gt;
In the function, add the following statements:&lt;br /&gt;
&lt;br /&gt;
#ifdef TINYOS_2X_SERIAL_PACKET&lt;br /&gt;
  tinyos2x_serial_dispatcher(c);&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
Some note about the implementation:&lt;br /&gt;
&lt;br /&gt;
There are 2 processes in this implementation:&lt;br /&gt;
&lt;br /&gt;
'''tinyos2x_serial_unescape_process''', this process is invoked every time a packet has been&lt;br /&gt;
&lt;br /&gt;
taken out from the byte stream. It will unescape the byte array received.&lt;br /&gt;
&lt;br /&gt;
'''tinyos2x_serial_ack_send_process''', this process is invoked every time unescaping of the&lt;br /&gt;
&lt;br /&gt;
byte array has been done, it will send ack packet to the server.&lt;br /&gt;
&lt;br /&gt;
'''Send data to the server:'''&lt;br /&gt;
&lt;br /&gt;
Suppose you have a data array called payload, its length is len. Just pass the data array and its&lt;br /&gt;
&lt;br /&gt;
length to function '''send_data_to_server''' in CPSL-tinyos-2x-serial.c. Remember that the data&lt;br /&gt;
&lt;br /&gt;
array only need to contain the payload, all other stuff in the packet will be automatically set&lt;br /&gt;
&lt;br /&gt;
by this function.&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4234</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4234"/>
		<updated>2017-09-14T17:35:16Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
FREE&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;br /&gt;
* [[First Project on Zolertia Firefly]]&lt;br /&gt;
* [[Send data from server to node using serial forwarder]]&lt;br /&gt;
* [[Send data from node to server using serial forwarder]]&lt;br /&gt;
* [[TinyOS 2 Serial Communication Mechanism port on contiki]]&lt;br /&gt;
* [[Glossy on contiki]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=Send_data_from_node_to_server_using_serial_forwarder&amp;diff=4230</id>
		<title>Send data from node to server using serial forwarder</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=Send_data_from_node_to_server_using_serial_forwarder&amp;diff=4230"/>
		<updated>2017-09-14T08:56:41Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to send data from node to server using serial forwarder?&lt;br /&gt;
&lt;br /&gt;
Sending data from node to server is more straightforward than the other way.&lt;br /&gt;
&lt;br /&gt;
To send data to server, you need to send the full packet of TOS2 packet, this means your packet&lt;br /&gt;
will include:&lt;br /&gt;
&lt;br /&gt;
frame byte(0x7E)&lt;br /&gt;
&lt;br /&gt;
protocol type(currently)&lt;br /&gt;
&lt;br /&gt;
CRC16&lt;br /&gt;
&lt;br /&gt;
The standard packet format for TinyOS 2 is in last wiki page.&lt;br /&gt;
&lt;br /&gt;
You need to package the data packet on node and also calculate CRC for them.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Suppose you have a payload which contains 3 number: {2,2,2}&lt;br /&gt;
&lt;br /&gt;
Then the format you need to send to the serial port using uart1_writeb() is:&lt;br /&gt;
&lt;br /&gt;
{126, 68, 1, 0, 0, 0, 0, 102, 3, 0, 0, 2, 2, 2, 151, 168, 126}&lt;br /&gt;
&lt;br /&gt;
The length of this packet is 17 bytes.&lt;br /&gt;
&lt;br /&gt;
Note that you need to skip the packet if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to receive the data from node on server?'''&lt;br /&gt;
&lt;br /&gt;
Suppose you have a python script on the server. The python script need a socket to connect&lt;br /&gt;
&lt;br /&gt;
to port 9002 on the server(localhost). Then send handshake signal {85, 32}. This step&lt;br /&gt;
&lt;br /&gt;
is the same as sendig data from server.&lt;br /&gt;
&lt;br /&gt;
Using the example packet above, when the node send this packet to server, the python script&lt;br /&gt;
&lt;br /&gt;
that has already been connected to port 9002 will first receive a number indicate the length&lt;br /&gt;
&lt;br /&gt;
of the incoming packet. Notice here, the length isn't for the whole packet.&lt;br /&gt;
&lt;br /&gt;
Data send from node:&lt;br /&gt;
&lt;br /&gt;
{126, 68, 1, 0, 0, 0, 0, 102, 3, 0, 0, 2, 2, 2, 151, 168, 126}&lt;br /&gt;
&lt;br /&gt;
Data received at server python script:&lt;br /&gt;
&lt;br /&gt;
{15, 1, 0, 0, 0, 0, 102, 3, 0, 0, 2, 2, 2, 151, 168, 126}&lt;br /&gt;
&lt;br /&gt;
The first byte 15 indicates that the packet is 15-byte-long. The serial forwarder&lt;br /&gt;
&lt;br /&gt;
won't forward the first frame byte and the protocol type byte. So the 17-byte-long original&lt;br /&gt;
&lt;br /&gt;
is forwarder as a 15-byte-long packet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''My understanding of the code''':&lt;br /&gt;
&lt;br /&gt;
The code for handling serial packet on the node is in /sw/python/wsntestbed/clientlib/handler.py&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=Send_data_from_node_to_server_using_serial_forwarder&amp;diff=4229</id>
		<title>Send data from node to server using serial forwarder</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=Send_data_from_node_to_server_using_serial_forwarder&amp;diff=4229"/>
		<updated>2017-09-14T08:56:13Z</updated>

		<summary type="html">&lt;p&gt;Bowen: Created page with &amp;quot;How to send data from node to server using serial forwarder?  Sending data from node to server is more straightforward than the other way.  To send data to server, you need to...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to send data from node to server using serial forwarder?&lt;br /&gt;
&lt;br /&gt;
Sending data from node to server is more straightforward than the other way.&lt;br /&gt;
&lt;br /&gt;
To send data to server, you need to send the full packet of TOS2 packet, this means your packet&lt;br /&gt;
will include:&lt;br /&gt;
&lt;br /&gt;
frame byte(0x7E)&lt;br /&gt;
&lt;br /&gt;
protocol type(currently)&lt;br /&gt;
&lt;br /&gt;
CRC16&lt;br /&gt;
&lt;br /&gt;
The standard packet format for TinyOS 2 is in last wiki page.&lt;br /&gt;
&lt;br /&gt;
You need to package the data packet on node and also calculate CRC for them.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Suppose you have a payload which contains 3 number: {2,2,2}&lt;br /&gt;
&lt;br /&gt;
Then the format you need to send to the serial port using uart1_writeb() is:&lt;br /&gt;
&lt;br /&gt;
{126, 68, 1, 0, 0, 0, 0, 102, 3, 0, 0, 2, 2, 2, 151, 168, 126}&lt;br /&gt;
&lt;br /&gt;
The length of this packet is 17 bytes.&lt;br /&gt;
&lt;br /&gt;
Note that you need to skip the packet if necessary.&lt;br /&gt;
&lt;br /&gt;
'''How to receive the data from node on server?'''&lt;br /&gt;
&lt;br /&gt;
Suppose you have a python script on the server. The python script need a socket to connect&lt;br /&gt;
&lt;br /&gt;
to port 9002 on the server(localhost). Then send handshake signal {85, 32}. This step&lt;br /&gt;
&lt;br /&gt;
is the same as sendig data from server.&lt;br /&gt;
&lt;br /&gt;
Using the example packet above, when the node send this packet to server, the python script&lt;br /&gt;
&lt;br /&gt;
that has already been connected to port 9002 will first receive a number indicate the length&lt;br /&gt;
&lt;br /&gt;
of the incoming packet. Notice here, the length isn't for the whole packet.&lt;br /&gt;
&lt;br /&gt;
Data send from node:&lt;br /&gt;
&lt;br /&gt;
{126, 68, 1, 0, 0, 0, 0, 102, 3, 0, 0, 2, 2, 2, 151, 168, 126}&lt;br /&gt;
&lt;br /&gt;
Data received at server python script:&lt;br /&gt;
&lt;br /&gt;
{15, 1, 0, 0, 0, 0, 102, 3, 0, 0, 2, 2, 2, 151, 168, 126}&lt;br /&gt;
&lt;br /&gt;
The first byte 15 indicates that the packet is 15-byte-long. The serial forwarder&lt;br /&gt;
&lt;br /&gt;
won't forward the first frame byte and the protocol type byte. So the 17-byte-long original&lt;br /&gt;
&lt;br /&gt;
is forwarder as a 15-byte-long packet.&lt;br /&gt;
&lt;br /&gt;
My understanding of the code:&lt;br /&gt;
&lt;br /&gt;
The code for handling serial packet on the node is in /sw/python/wsntestbed/clientlib/handler.py&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4228</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4228"/>
		<updated>2017-09-14T08:53:24Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
FREE&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;br /&gt;
* [[First Project on Zolertia Firefly]]&lt;br /&gt;
* [[Send data from server to node using serial forwarder]]&lt;br /&gt;
* [[Send data from node to server using serial forwarder]]&lt;br /&gt;
* [[Glossy on contiki]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=Send_data_from_server_to_node_using_serial_forwarder&amp;diff=4227</id>
		<title>Send data from server to node using serial forwarder</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=Send_data_from_server_to_node_using_serial_forwarder&amp;diff=4227"/>
		<updated>2017-09-14T07:55:19Z</updated>

		<summary type="html">&lt;p&gt;Bowen: Created page with &amp;quot;Send data from server to node using serial forwarder  Note: this wiki page is only for TinyOS 2.x serial packet standard  1. To open the serial forwarder on testbed, run the c...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Send data from server to node using serial forwarder&lt;br /&gt;
&lt;br /&gt;
Note: this wiki page is only for TinyOS 2.x serial packet standard&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;br /&gt;
&lt;br /&gt;
7. The process of using the serial forwarder&lt;br /&gt;
&lt;br /&gt;
7.1 First create a socket, and connect the socket to the server at port 9002&lt;br /&gt;
&lt;br /&gt;
7.2 Send [0x55, 0x20] to the server. This is a handshake signal used by the serial forwarder. The handshake signal for Tos2 is 'U ', it is uppercase U followed by a whitespace.&lt;br /&gt;
&lt;br /&gt;
7.3 Calculate the length of the local packet, send the length to the server(should be one byte, so the maximum length of the serial packet won't exceed 256 byte)&lt;br /&gt;
&lt;br /&gt;
7.4 Send the local packet to server&lt;br /&gt;
&lt;br /&gt;
Note: The handshake signal, the length of the local packet, and the local packet itself don't need to be escaped, the serial forwarder will do the escaping itself&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
&lt;br /&gt;
'''Step 1'''&lt;br /&gt;
Suppose you want to send some information to node 155, then according to the '''tospacket.py''', you need to set up the local packet as bellow:&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence Number, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte, '''0x9B'''&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length, '''0x08'''&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type, '''0x67'''&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload, give some example payload here:&lt;br /&gt;
&lt;br /&gt;
'''0x00, 0x95, 0x00,0x9B, 0x00, 0x03, 0x00, 0x0C'''&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E), no need, given by server&lt;br /&gt;
&lt;br /&gt;
The array view of local packet:&lt;br /&gt;
&lt;br /&gt;
['''0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 2'''&lt;br /&gt;
&lt;br /&gt;
We can get the length of the local packet, it is '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 3'''&lt;br /&gt;
&lt;br /&gt;
Create the socket, connect the socket to server at port 9002 using TCP, send ['''0x55, 0x20'''] first as hand shake signal&lt;br /&gt;
&lt;br /&gt;
'''Step 4'''&lt;br /&gt;
&lt;br /&gt;
Still using that connected socket, send the length of the local packet '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 5'''&lt;br /&gt;
&lt;br /&gt;
Use the socket to send the local packet&lt;br /&gt;
&lt;br /&gt;
So the final data sent to the serial forwarder is:&lt;br /&gt;
&lt;br /&gt;
['''0x55, 0x20, 0x10, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 6'''&lt;br /&gt;
&lt;br /&gt;
When the serial forwarder server received all the stuff, it will do the calculation, and add essential information for the packet, calculate the CRC&lt;br /&gt;
&lt;br /&gt;
Suppose we get:&lt;br /&gt;
&lt;br /&gt;
protocol type as PACKET_ACK('''0x44''')&lt;br /&gt;
&lt;br /&gt;
sequence number as 48('''0x30''')&lt;br /&gt;
&lt;br /&gt;
the CRC as 246 130('''0xF6 0x82''')&lt;br /&gt;
&lt;br /&gt;
The final forward packet that received by the mote would be&lt;br /&gt;
&lt;br /&gt;
['''0x7E, 0x44, 0x30, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C, 0xF6, 0x82, 0x7E''']&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Notes about serial forwarder server code:'''&lt;br /&gt;
&lt;br /&gt;
The most important code is in '''sfserver.py''':&lt;br /&gt;
&lt;br /&gt;
1. In the class '''BaseTosHandler''', the function '''handle()''' define what to do when received data&lt;br /&gt;
&lt;br /&gt;
2. '''handle()''' will first invoke '''handle_handshake()''' to process the handshake signal&lt;br /&gt;
&lt;br /&gt;
3. then '''handle()''' read the byte for length of packet&lt;br /&gt;
&lt;br /&gt;
4. '''handle()''' read the local packet&lt;br /&gt;
&lt;br /&gt;
5. '''handle()''' invokes '''self.server.send(bytes_)''' to send packet to mote&lt;br /&gt;
&lt;br /&gt;
6. all the work such as escaping the data, giving delimiter, protocol type and sequence number, and CRC calculation is done in the '''send()''' function&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4226</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4226"/>
		<updated>2017-09-14T07:54:05Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
FREE&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;br /&gt;
* [[First Project on Zolertia Firefly]]&lt;br /&gt;
* [[Send data from server to node using serial forwarder]]&lt;br /&gt;
* [[Glossy on contiki]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4225</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4225"/>
		<updated>2017-09-14T07:52:32Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Send data from server to node using serial forwarder&lt;br /&gt;
&lt;br /&gt;
Note: this wiki page is only for TinyOS 2.x serial packet standard&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;br /&gt;
&lt;br /&gt;
7. The process of using the serial forwarder&lt;br /&gt;
&lt;br /&gt;
7.1 First create a socket, and connect the socket to the server at port 9002&lt;br /&gt;
&lt;br /&gt;
7.2 Send [0x55, 0x20] to the server. This is a handshake signal used by the serial forwarder. The handshake signal for Tos2 is 'U ', it is uppercase U followed by a whitespace.&lt;br /&gt;
&lt;br /&gt;
7.3 Calculate the length of the local packet, send the length to the server(should be one byte, so the maximum length of the serial packet won't exceed 256 byte)&lt;br /&gt;
&lt;br /&gt;
7.4 Send the local packet to server&lt;br /&gt;
&lt;br /&gt;
Note: The handshake signal, the length of the local packet, and the local packet itself don't need to be escaped, the serial forwarder will do the escaping itself&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
&lt;br /&gt;
'''Step 1'''&lt;br /&gt;
Suppose you want to send some information to node 155, then according to the '''tospacket.py''', you need to set up the local packet as bellow:&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence Number, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte, '''0x9B'''&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length, '''0x08'''&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type, '''0x67'''&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload, give some example payload here:&lt;br /&gt;
&lt;br /&gt;
'''0x00, 0x95, 0x00,0x9B, 0x00, 0x03, 0x00, 0x0C'''&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E), no need, given by server&lt;br /&gt;
&lt;br /&gt;
The array view of local packet:&lt;br /&gt;
&lt;br /&gt;
['''0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 2'''&lt;br /&gt;
&lt;br /&gt;
We can get the length of the local packet, it is '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 3'''&lt;br /&gt;
&lt;br /&gt;
Create the socket, connect the socket to server at port 9002 using TCP, send ['''0x55, 0x20'''] first as hand shake signal&lt;br /&gt;
&lt;br /&gt;
'''Step 4'''&lt;br /&gt;
&lt;br /&gt;
Still using that connected socket, send the length of the local packet '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 5'''&lt;br /&gt;
&lt;br /&gt;
Use the socket to send the local packet&lt;br /&gt;
&lt;br /&gt;
So the final data sent to the serial forwarder is:&lt;br /&gt;
&lt;br /&gt;
['''0x55, 0x20, 0x10, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 6'''&lt;br /&gt;
&lt;br /&gt;
When the serial forwarder server received all the stuff, it will do the calculation, and add essential information for the packet, calculate the CRC&lt;br /&gt;
&lt;br /&gt;
Suppose we get:&lt;br /&gt;
&lt;br /&gt;
protocol type as PACKET_ACK('''0x44''')&lt;br /&gt;
&lt;br /&gt;
sequence number as 48('''0x30''')&lt;br /&gt;
&lt;br /&gt;
the CRC as 246 130('''0xF6 0x82''')&lt;br /&gt;
&lt;br /&gt;
The final forward packet that received by the mote would be&lt;br /&gt;
&lt;br /&gt;
['''0x7E, 0x44, 0x30, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C, 0xF6, 0x82, 0x7E''']&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Notes about serial forwarder server code:'''&lt;br /&gt;
&lt;br /&gt;
The most important code is in '''sfserver.py''':&lt;br /&gt;
&lt;br /&gt;
1. In the class '''BaseTosHandler''', the function '''handle()''' define what to do when received data&lt;br /&gt;
&lt;br /&gt;
2. '''handle()''' will first invoke '''handle_handshake()''' to process the handshake signal&lt;br /&gt;
&lt;br /&gt;
3. then '''handle()''' read the byte for length of packet&lt;br /&gt;
&lt;br /&gt;
4. '''handle()''' read the local packet&lt;br /&gt;
&lt;br /&gt;
5. '''handle()''' invokes '''self.server.send(bytes_)''' to send packet to mote&lt;br /&gt;
&lt;br /&gt;
6. all the work such as escaping the data, giving delimiter, protocol type and sequence number, and CRC calculation is done in the '''send()''' function&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4212</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4212"/>
		<updated>2017-09-07T07:26:58Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
FREE&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;br /&gt;
* [[First Project on Zolertia Firefly]]&lt;br /&gt;
* [[How to use serial forwarder on testbed]]&lt;br /&gt;
* [[Glossy on contiki]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4211</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4211"/>
		<updated>2017-08-31T06:34:43Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
Note: this wiki page is only for TinyOS 2.x serial packet standard&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;br /&gt;
&lt;br /&gt;
7. The process of using the serial forwarder&lt;br /&gt;
&lt;br /&gt;
7.1 First create a socket, and connect the socket to the server at port 9002&lt;br /&gt;
&lt;br /&gt;
7.2 Send [0x55, 0x20] to the server. This is a handshake signal used by the serial forwarder. The handshake signal for Tos2 is 'U ', it is uppercase U followed by a whitespace.&lt;br /&gt;
&lt;br /&gt;
7.3 Calculate the length of the local packet, send the length to the server(should be one byte, so the maximum length of the serial packet won't exceed 256 byte)&lt;br /&gt;
&lt;br /&gt;
7.4 Send the local packet to server&lt;br /&gt;
&lt;br /&gt;
Note: The handshake signal, the length of the local packet, and the local packet itself don't need to be escaped, the serial forwarder will do the escaping itself&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
&lt;br /&gt;
'''Step 1'''&lt;br /&gt;
Suppose you want to send some information to node 155, then according to the '''tospacket.py''', you need to set up the local packet as bellow:&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence Number, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte, '''0x9B'''&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length, '''0x08'''&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type, '''0x67'''&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload, give some example payload here:&lt;br /&gt;
&lt;br /&gt;
'''0x00, 0x95, 0x00,0x9B, 0x00, 0x03, 0x00, 0x0C'''&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E), no need, given by server&lt;br /&gt;
&lt;br /&gt;
The array view of local packet:&lt;br /&gt;
&lt;br /&gt;
['''0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 2'''&lt;br /&gt;
&lt;br /&gt;
We can get the length of the local packet, it is '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 3'''&lt;br /&gt;
&lt;br /&gt;
Create the socket, connect the socket to server at port 9002 using TCP, send ['''0x55, 0x20'''] first as hand shake signal&lt;br /&gt;
&lt;br /&gt;
'''Step 4'''&lt;br /&gt;
&lt;br /&gt;
Still using that connected socket, send the length of the local packet '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 5'''&lt;br /&gt;
&lt;br /&gt;
Use the socket to send the local packet&lt;br /&gt;
&lt;br /&gt;
So the final data sent to the serial forwarder is:&lt;br /&gt;
&lt;br /&gt;
['''0x55, 0x20, 0x10, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 6'''&lt;br /&gt;
&lt;br /&gt;
When the serial forwarder server received all the stuff, it will do the calculation, and add essential information for the packet, calculate the CRC&lt;br /&gt;
&lt;br /&gt;
Suppose we get:&lt;br /&gt;
&lt;br /&gt;
protocol type as PACKET_ACK('''0x44''')&lt;br /&gt;
&lt;br /&gt;
sequence number as 48('''0x30''')&lt;br /&gt;
&lt;br /&gt;
the CRC as 246 130('''0xF6 0x82''')&lt;br /&gt;
&lt;br /&gt;
The final forward packet that received by the mote would be&lt;br /&gt;
&lt;br /&gt;
['''0x7E, 0x44, 0x30, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C, 0xF6, 0x82, 0x7E''']&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Notes about serial forwarder server code:'''&lt;br /&gt;
&lt;br /&gt;
The most important code is in '''sfserver.py''':&lt;br /&gt;
&lt;br /&gt;
1. In the class '''BaseTosHandler''', the function '''handle()''' define what to do when received data&lt;br /&gt;
&lt;br /&gt;
2. '''handle()''' will first invoke '''handle_handshake()''' to process the handshake signal&lt;br /&gt;
&lt;br /&gt;
3. then '''handle()''' read the byte for length of packet&lt;br /&gt;
&lt;br /&gt;
4. '''handle()''' read the local packet&lt;br /&gt;
&lt;br /&gt;
5. '''handle()''' invokes '''self.server.send(bytes_)''' to send packet to mote&lt;br /&gt;
&lt;br /&gt;
6. all the work such as escaping the data, giving delimiter, protocol type and sequence number, and CRC calculation is done in the '''send()''' function&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4210</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4210"/>
		<updated>2017-08-31T06:32:35Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
Note: this wiki page is only for TinyOS 2.x serial packet standard&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;br /&gt;
&lt;br /&gt;
7. The process of using the serial forwarder&lt;br /&gt;
&lt;br /&gt;
7.1 First create a socket, and connect the socket to the server at port 9002&lt;br /&gt;
&lt;br /&gt;
7.2 Send [0x55, 0x20] to the server. This is a handshake signal used by the serial forwarder. The handshake signal for Tos2 is 'U ', it is uppercase U followed by a whitespace.&lt;br /&gt;
&lt;br /&gt;
7.3 Calculate the length of the local packet, send the length to the server(should be one byte, so the maximum length of the serial packet won't exceed 256 byte)&lt;br /&gt;
&lt;br /&gt;
7.4 Send the local packet to server&lt;br /&gt;
&lt;br /&gt;
Note: The handshake signal, the length of the local packet, and the local packet itself don't need to be escaped, the serial forwarder will do the escaping itself&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
&lt;br /&gt;
'''Step 1'''&lt;br /&gt;
Suppose you want to send some information to node 155, then according to the '''tospacket.py''', you need to set up the local packet as bellow:&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence Number, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte, '''0x9B'''&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length, '''0x08'''&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type, '''0x67'''&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload, give some example payload here:&lt;br /&gt;
&lt;br /&gt;
'''0x00, 0x95, 0x00,0x9B, 0x00, 0x03, 0x00, 0x0C'''&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E), no need, given by server&lt;br /&gt;
&lt;br /&gt;
The array view of local packet:&lt;br /&gt;
&lt;br /&gt;
['''0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 2'''&lt;br /&gt;
&lt;br /&gt;
We can get the length of the local packet, it is '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 3'''&lt;br /&gt;
&lt;br /&gt;
Create the socket, connect the socket to server at port 9002 using TCP, send ['''0x55, 0x20'''] first as hand shake signal&lt;br /&gt;
&lt;br /&gt;
'''Step 4'''&lt;br /&gt;
&lt;br /&gt;
Still using that connected socket, send the length of the local packet '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 5'''&lt;br /&gt;
&lt;br /&gt;
Use the socket to send the local packet&lt;br /&gt;
&lt;br /&gt;
So the final data sent to the serial forwarder is:&lt;br /&gt;
&lt;br /&gt;
['''0x55, 0x20, 0x10, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 6'''&lt;br /&gt;
&lt;br /&gt;
When the serial forwarder server received all the stuff, it will do the calculation, and add essential information for the packet, calculate the CRC&lt;br /&gt;
&lt;br /&gt;
Suppose we get:&lt;br /&gt;
&lt;br /&gt;
protocol type as PACKET_ACK('''0x44''')&lt;br /&gt;
&lt;br /&gt;
sequence number as 48('''0x30''')&lt;br /&gt;
&lt;br /&gt;
the CRC as 246 130('''0xF6 0x82''')&lt;br /&gt;
&lt;br /&gt;
The final forward packet that received by the mote would be&lt;br /&gt;
&lt;br /&gt;
['''0x7E, 0x44, 0x30, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C, 0xF6, 0x82, 0x7E''']&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Notes about serial forwarder server code:'''&lt;br /&gt;
&lt;br /&gt;
The most important code is in '''sfserver.py''':&lt;br /&gt;
&lt;br /&gt;
1. In the class '''BaseTosHandler''', the function '''handle()''' define what to do when received data&lt;br /&gt;
&lt;br /&gt;
2. '''handle()''' will first invoke '''handle_handshake()''' to process the handshake signal&lt;br /&gt;
&lt;br /&gt;
3. then '''handle()''' read the byte for length of packet&lt;br /&gt;
&lt;br /&gt;
4. '''handle()''' read the local packet&lt;br /&gt;
&lt;br /&gt;
5. '''handle()''' invokes '''self.server.send(bytes_)''' to send packet to mote&lt;br /&gt;
&lt;br /&gt;
6. all the work such as escaping the data, giving delimiter, protocol type and sequence number, and CRC calculation is done in the '''send()''' function&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4209</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4209"/>
		<updated>2017-08-31T06:30:28Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
Note: this wiki page is only for TinyOS 2.x serial packet standard&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;br /&gt;
&lt;br /&gt;
7. The process of using the serial forwarder&lt;br /&gt;
&lt;br /&gt;
7.1 First create a socket, and connect the socket to the server at port 9002&lt;br /&gt;
&lt;br /&gt;
7.2 Send [0x55, 0x20] to the server. This is a handshake signal used by the serial forwarder. The handshake signal for Tos2 is 'U ', it is uppercase U followed by a whitespace.&lt;br /&gt;
&lt;br /&gt;
7.3 Calculate the length of the local packet, send the length to the server(should be one byte, so the maximum length of the serial packet won't exceed 256 byte)&lt;br /&gt;
&lt;br /&gt;
7.4 Send the local packet to server&lt;br /&gt;
&lt;br /&gt;
Note: The handshake signal, the length of the local packet, and the local packet itself don't need to be escaped, the serial forwarder will do the escaping itself&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
&lt;br /&gt;
'''Step 1'''&lt;br /&gt;
Suppose you want to send some information to node 155, then according to the '''tospacket.py''', you need to set up the local packet as bellow:&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence Number, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte, '''0x9B'''&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length, '''0x08'''&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type, '''0x67'''&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload, give some example payload here:&lt;br /&gt;
&lt;br /&gt;
'''0x00, 0x95, 0x00,0x9B, 0x00, 0x03, 0x00, 0x0C'''&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E), no need, given by server&lt;br /&gt;
&lt;br /&gt;
The array view of local packet:&lt;br /&gt;
&lt;br /&gt;
['''0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 2'''&lt;br /&gt;
&lt;br /&gt;
We can get the length of the local packet, it is '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 3'''&lt;br /&gt;
&lt;br /&gt;
Create the socket, connect the socket to server at port 9002 using TCP, send ['''0x55, 0x20'''] first as hand shake signal&lt;br /&gt;
&lt;br /&gt;
'''Step 4'''&lt;br /&gt;
&lt;br /&gt;
Still using that connected socket, send the length of the local packet '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 5'''&lt;br /&gt;
&lt;br /&gt;
Use the socket to send the local packet&lt;br /&gt;
&lt;br /&gt;
So the final data sent to the serial forwarder is:&lt;br /&gt;
&lt;br /&gt;
['''0x55, 0x20, 0x10, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 6'''&lt;br /&gt;
&lt;br /&gt;
When the serial forwarder server received all the stuff, it will do the calculation, and add essential information for the packet, calculate the CRC&lt;br /&gt;
&lt;br /&gt;
Suppose we get:&lt;br /&gt;
&lt;br /&gt;
protocol type as PACKET_ACK('''0x44''')&lt;br /&gt;
&lt;br /&gt;
sequence number as 48('''0x30''')&lt;br /&gt;
&lt;br /&gt;
the CRC as 246 130('''0xF6 0x82''')&lt;br /&gt;
&lt;br /&gt;
The final forward packet that received by the mote would be&lt;br /&gt;
&lt;br /&gt;
['''0x7E, 0x44, 0x30, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C, 0xF6, 0x82, 0x7E''']&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Notes about serial forwarder server code:'''&lt;br /&gt;
&lt;br /&gt;
The most important code is in '''sfserver.py''':&lt;br /&gt;
&lt;br /&gt;
1. In the class '''BaseTosHandler''', the function '''handle()''' define what to do when received data&lt;br /&gt;
&lt;br /&gt;
2. '''handle()''' will first invoke '''handle_handshake()''' to process the handshake signal&lt;br /&gt;
&lt;br /&gt;
3. then '''handle()''' read the byte for length of packet&lt;br /&gt;
&lt;br /&gt;
4. '''handle()''' read the local packet&lt;br /&gt;
&lt;br /&gt;
5. '''handle()''' invokes '''self.server.send(bytes_)''' to send packet to mote&lt;br /&gt;
&lt;br /&gt;
6. all the work such as escaping the data, giving delimiter, protocol type and sequence number, and CRC calculation is done in the '''send()''' function&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4208</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4208"/>
		<updated>2017-08-31T06:24:31Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;br /&gt;
&lt;br /&gt;
7. The process of using the serial forwarder&lt;br /&gt;
&lt;br /&gt;
7.1 First create a socket, and connect the socket to the server at port 9002&lt;br /&gt;
&lt;br /&gt;
7.2 Send [0x55, 0x20] to the server. This is a handshake signal used by the serial forwarder. The handshake signal for Tos2 is 'U ', it is uppercase U followed by a whitespace.&lt;br /&gt;
&lt;br /&gt;
7.3 Calculate the length of the local packet, send the length to the server(should be one byte, so the maximum length of the serial packet won't exceed 256 byte)&lt;br /&gt;
&lt;br /&gt;
7.4 Send the local packet to server&lt;br /&gt;
&lt;br /&gt;
Note: The handshake signal, the length of the local packet, and the local packet itself don't need to be escaped, the serial forwarder will do the escaping itself&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
&lt;br /&gt;
'''Step 1'''&lt;br /&gt;
Suppose you want to send some information to node 155, then according to the '''tospacket.py''', you need to set up the local packet as bellow:&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence Number, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte, '''0x9B'''&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length, '''0x08'''&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type, '''0x67'''&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload, give some example payload here:&lt;br /&gt;
&lt;br /&gt;
'''0x00, 0x95, 0x00,0x9B, 0x00, 0x03, 0x00, 0x0C'''&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E), no need, given by server&lt;br /&gt;
&lt;br /&gt;
The array view of local packet:&lt;br /&gt;
&lt;br /&gt;
['''0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 2'''&lt;br /&gt;
&lt;br /&gt;
We can get the length of the local packet, it is '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 3'''&lt;br /&gt;
&lt;br /&gt;
Create the socket, connect the socket to server at port 9002 using TCP, send ['''0x55, 0x20'''] first as hand shake signal&lt;br /&gt;
&lt;br /&gt;
'''Step 4'''&lt;br /&gt;
&lt;br /&gt;
Still using that connected socket, send the length of the local packet '''16'''&lt;br /&gt;
&lt;br /&gt;
'''Step 5'''&lt;br /&gt;
&lt;br /&gt;
Use the socket to send the local packet&lt;br /&gt;
&lt;br /&gt;
So the final data sent to the serial forwarder is:&lt;br /&gt;
&lt;br /&gt;
['''0x55, 0x20, 0x10, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;br /&gt;
&lt;br /&gt;
'''Step 6'''&lt;br /&gt;
&lt;br /&gt;
When the serial forwarder server received all the stuff, it will do the calculation, and add essential information for the packet, calculate the CRC&lt;br /&gt;
&lt;br /&gt;
Suppose we get:&lt;br /&gt;
&lt;br /&gt;
protocol type as PACKET_ACK('''0x44''')&lt;br /&gt;
&lt;br /&gt;
sequence number as 48('''0x30''')&lt;br /&gt;
&lt;br /&gt;
the CRC as 246 130('''0xF6 0x82''')&lt;br /&gt;
&lt;br /&gt;
The final forward packet that received by the mote would be&lt;br /&gt;
&lt;br /&gt;
['''0x7E, 0x44, 0x30, 0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C, 0xF6, 0x82, 0x7E''']&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4207</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4207"/>
		<updated>2017-08-31T06:15:34Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;br /&gt;
&lt;br /&gt;
7. The process of using the serial forwarder&lt;br /&gt;
&lt;br /&gt;
7.1 First create a socket, and connect the socket to the server at port 9002&lt;br /&gt;
&lt;br /&gt;
7.2 Send [0x55, 0x20] to the server. This is a handshake signal used by the serial forwarder. The handshake signal for Tos2 is 'U ', it is uppercase U followed by a whitespace.&lt;br /&gt;
&lt;br /&gt;
7.3 Calculate the length of the local packet, send the length to the server(should be one byte, so the maximum length of the serial packet won't exceed 256 byte)&lt;br /&gt;
&lt;br /&gt;
7.4 Send the local packet to server&lt;br /&gt;
&lt;br /&gt;
Note: The handshake signal, the length of the local packet, and the local packet itself don't need to be escaped, the serial forwarder will do the escaping itself&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
&lt;br /&gt;
Suppose you want to send some information to node 155, then according to the '''tospacket.py''', you need to set up the local packet as bellow:&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence Number, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte, '''0x9B'''&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length, '''0x08'''&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type, '''0x67'''&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload, give some example payload here:&lt;br /&gt;
&lt;br /&gt;
'''0x00, 0x95, 0x00,0x9B, 0x00, 0x03, 0x00, 0x0C'''&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte, no need, calculated by server&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E), no need, given by server&lt;br /&gt;
&lt;br /&gt;
The array view of local packet:&lt;br /&gt;
&lt;br /&gt;
['''0x00, 0x00, 0x9B, 0x00, 0x00, 0x08, 0x00, 0x67,  0x00, 0x95, 0x00, 0x00, 0x9B, 0x00, 0x03, 0x00, 0x0C''']&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4206</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4206"/>
		<updated>2017-08-31T06:12:58Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;br /&gt;
&lt;br /&gt;
7. The process of using the serial forwarder&lt;br /&gt;
&lt;br /&gt;
7.1 First create a socket, and connect the socket to the server at port 9002&lt;br /&gt;
&lt;br /&gt;
7.2 Send [0x55, 0x20] to the server. This is a handshake signal used by the serial forwarder. The handshake signal for Tos2 is 'U ', it is uppercase U followed by a whitespace.&lt;br /&gt;
&lt;br /&gt;
7.3 Calculate the length of the local packet, send the length to the server(should be one byte, so the maximum length of the serial packet won't exceed 256 byte)&lt;br /&gt;
&lt;br /&gt;
7.4 Send the local packet to server&lt;br /&gt;
&lt;br /&gt;
Note: The handshake signal, the length of the local packet, and the local packet itself don't need to be escaped, the serial forwarder will do the escaping itself&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
&lt;br /&gt;
Suppose you want to send some information to node 155, then according to the '''tospacket.py''', you need to set up the local packet as bellow:&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence Number, no need, given by the serial forwarder server&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte, '''0x9B'''&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length, '''0x08'''&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group, '''0x00'''&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type, '''0x67'''&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload, give some example payload here:&lt;br /&gt;
&lt;br /&gt;
'''0x00, 0x95, 0x00,0x9B, 0x00, 0x03, 0x00, 0x0C'''&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4205</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4205"/>
		<updated>2017-08-31T06:02:54Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;br /&gt;
&lt;br /&gt;
7. The process of using the serial forwarder&lt;br /&gt;
&lt;br /&gt;
7.1 First create a socket, and connect the socket to the server at port 9002&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4204</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4204"/>
		<updated>2017-08-31T06:01:25Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. In tinyos standard, the delimiter character is '''0x7E''', the escape character is '''0x7D'''&lt;br /&gt;
&lt;br /&gt;
4. But we don't need the whole Tos packet as above to use the serial forwarder, the serial forwarder will do a lot of things for us.&lt;br /&gt;
&lt;br /&gt;
5. what we don't need to send to the serial forwarder:&lt;br /&gt;
&lt;br /&gt;
byte 0 and byte n-1: Delimiter(added by serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 1             : Protocol Type(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte 2             : Sequence Number(this byte should be given by the serial forwarder server)&lt;br /&gt;
&lt;br /&gt;
byte n-2 and n-3   : the two-byte-CRC is calculated by the serial forwarder&lt;br /&gt;
&lt;br /&gt;
6. Next we will name the packet we sent to the serial forwarder server as '''local packet''', and the packet sent by serial forwarder server to the mote as '''forward packet'''&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4203</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4203"/>
		<updated>2017-08-31T05:56:20Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
byte 1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
byte 2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
byte 3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte 11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
byte n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
byte n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
byte n-1: Delimiter (0x7E)&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4202</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4202"/>
		<updated>2017-08-31T05:54:05Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
        1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
        2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
        3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
        n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
        n-1: Delimiter (0x7E)&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4201</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4201"/>
		<updated>2017-08-31T05:53:50Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
    byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
        1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
        2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
        3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
        n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
        n-1: Delimiter (0x7E)&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4200</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4200"/>
		<updated>2017-08-31T05:53:31Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
        byte 0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
        1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
        2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
        3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
        n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
        n-1: Delimiter (0x7E)&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4199</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4199"/>
		<updated>2017-08-31T05:52:59Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
'''forwarder.py -2 -a telosb'''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in '''tospacket.py''':&lt;br /&gt;
&lt;br /&gt;
        0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
        1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
        2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
        3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
        n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
        n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
        n-1: Delimiter (0x7E)&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4198</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4198"/>
		<updated>2017-08-31T05:52:10Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
''''forwarder.py -2 -a telosb''''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in ''''tospacket.py'''':&lt;br /&gt;
&lt;br /&gt;
       0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
       1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
       2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
       3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
       n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
       n-1: Delimiter (0x7E)&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4197</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4197"/>
		<updated>2017-08-31T05:50:50Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
''''forwarder.py -2 -a telosb''''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in ''''tospacket.py'''':&lt;br /&gt;
&lt;br /&gt;
       0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
       1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
       2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
	3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
	4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
	5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
	6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
	7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
	8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
	9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
	10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
	11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
       n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
       n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
       n-1: Delimiter (0x7E)&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4196</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4196"/>
		<updated>2017-08-31T05:50:10Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
&lt;br /&gt;
''''forwarder.py -2 -a telosb''''&lt;br /&gt;
&lt;br /&gt;
2. We can get the packet format used by the serial forwarder in ''''tospacket.py'''':&lt;br /&gt;
&lt;br /&gt;
#       0: Delimiter (0x7E)&lt;br /&gt;
&lt;br /&gt;
#       1: Protocol: ACK (0x43), PACKET_ACK (0x44) or PACKET_NOACK (0x45)&lt;br /&gt;
&lt;br /&gt;
#       2: Sequence number (omitted if protocol is PACKET_NOACK)&lt;br /&gt;
&lt;br /&gt;
#	3: Packet type (0x00, omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
#	4: Destination high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
#	5: Destination low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
#	6: Source high byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
#	7: Source low byte (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
#	8: Payload length (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
#	9: Destination PAN group (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
#	10: Packet AM type (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
#	11 .. n-4: Payload (omitted if protocol is ACK)&lt;br /&gt;
&lt;br /&gt;
#       n-3: CRC-16 low byte&lt;br /&gt;
&lt;br /&gt;
#       n-2: CRC-16 high byte&lt;br /&gt;
&lt;br /&gt;
#       n-1: Delimiter (0x7E)&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4195</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4195"/>
		<updated>2017-08-31T05:42:30Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
''''forwarder.py -2 -a telosb''''&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4194</id>
		<title>How to use serial forwarder on testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=How_to_use_serial_forwarder_on_testbed&amp;diff=4194"/>
		<updated>2017-08-31T05:41:23Z</updated>

		<summary type="html">&lt;p&gt;Bowen: Created page with &amp;quot;How to use the serial forwarder on testbed? 1. To open the serial forwarder on testbed, run the command **forwarder.py -2 -a telosb**&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use the serial forwarder on testbed?&lt;br /&gt;
1. To open the serial forwarder on testbed, run the command&lt;br /&gt;
**forwarder.py -2 -a telosb**&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4193</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4193"/>
		<updated>2017-08-31T05:40:25Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
FREE&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;br /&gt;
* [[First Project on Zolertia Firefly]]&lt;br /&gt;
* [[How to use serial forwarder on testbed]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4120</id>
		<title>First Project on Zolertia Firefly</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4120"/>
		<updated>2017-06-22T03:06:46Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Step 1. Install tools:'''&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi&lt;br /&gt;
&lt;br /&gt;
'''Step 2. Clone Contiki Repo:'''&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/contiki-os/contiki.git&lt;br /&gt;
&lt;br /&gt;
'''Step 3. Update the dependencies:'''&lt;br /&gt;
&lt;br /&gt;
cd contiki&lt;br /&gt;
&lt;br /&gt;
git submodule update --init&lt;br /&gt;
&lt;br /&gt;
'''Step 4. Compile and download the program:'''&lt;br /&gt;
&lt;br /&gt;
make all TARGET=zoul BOARD=firefly&lt;br /&gt;
&lt;br /&gt;
python contiki/tools/cc2538-bsl/cc2538-bsl.py -e -w -v -p /dev/ttyUSB0 image.bin&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4119</id>
		<title>First Project on Zolertia Firefly</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4119"/>
		<updated>2017-06-22T03:02:00Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Step 1. Install tools:'''&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi&lt;br /&gt;
&lt;br /&gt;
'''Step 2. Clone Contiki Repo:'''&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/contiki-os/contiki.git&lt;br /&gt;
&lt;br /&gt;
'''Step 3. Update the dependencies:'''&lt;br /&gt;
&lt;br /&gt;
cd contiki&lt;br /&gt;
&lt;br /&gt;
git submodule update --init&lt;br /&gt;
'''&lt;br /&gt;
Step 4. Compile and download the program:'''&lt;br /&gt;
&lt;br /&gt;
make all TARGET=zoul BOARD=firefly&lt;br /&gt;
&lt;br /&gt;
python contiki/tools/cc2538-bsl/cc2538-bsl.py -e -w -v -p /dev/ttyUSB0 image.bin&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4118</id>
		<title>First Project on Zolertia Firefly</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4118"/>
		<updated>2017-06-22T02:37:05Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Step 0. Install tools:'''&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi&lt;br /&gt;
&lt;br /&gt;
'''Step 1. Clone Contiki Repo:'''&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/contiki-os/contiki.git&lt;br /&gt;
&lt;br /&gt;
'''Step 3. Update the dependencies:'''&lt;br /&gt;
&lt;br /&gt;
cd contiki&lt;br /&gt;
&lt;br /&gt;
git submodule update --init&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4117</id>
		<title>First Project on Zolertia Firefly</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4117"/>
		<updated>2017-06-22T02:36:36Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Step 0. Install tools:'''&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi&lt;br /&gt;
'''Step 1. Clone Contiki Repo:'''&lt;br /&gt;
git clone https://github.com/contiki-os/contiki.git&lt;br /&gt;
'''Step 3. Update the dependencies:'''&lt;br /&gt;
cd contiki&lt;br /&gt;
git submodule update --init&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4116</id>
		<title>First Project on Zolertia Firefly</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4116"/>
		<updated>2017-06-22T02:34:58Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Step 0. Install tools:'''\&lt;br /&gt;
sudo apt-get update\&lt;br /&gt;
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi\&lt;br /&gt;
'''Step 1. Clone Contiki Repo:'''&lt;br /&gt;
git clone https://github.com/contiki-os/contiki.git&lt;br /&gt;
'''Step 3. Update the dependencies:'''&lt;br /&gt;
cd contiki&lt;br /&gt;
git submodule update --init&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4115</id>
		<title>First Project on Zolertia Firefly</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=First_Project_on_Zolertia_Firefly&amp;diff=4115"/>
		<updated>2017-06-22T02:34:18Z</updated>

		<summary type="html">&lt;p&gt;Bowen: Created page with &amp;quot;'''Step 0. Install tools:''' sudo apt-get update sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi '''Step 1. Clone Contiki Repo:''' git clone https://github.com/contik...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Step 0. Install tools:'''&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi&lt;br /&gt;
'''Step 1. Clone Contiki Repo:'''&lt;br /&gt;
git clone https://github.com/contiki-os/contiki.git&lt;br /&gt;
'''Step 3. Update the dependencies:'''&lt;br /&gt;
cd contiki&lt;br /&gt;
git submodule update --init&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4114</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4114"/>
		<updated>2017-06-22T02:11:17Z</updated>

		<summary type="html">&lt;p&gt;Bowen: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
FREE&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;br /&gt;
* [[First Project on Zolertia Firefly]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4021</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4021"/>
		<updated>2017-04-17T15:10:55Z</updated>

		<summary type="html">&lt;p&gt;Bowen: /* Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
FREE&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4020</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4020"/>
		<updated>2017-04-17T03:11:19Z</updated>

		<summary type="html">&lt;p&gt;Bowen: /* Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
IN USE by Bowen&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4015</id>
		<title>The WUSTL Wireless Sensor Network Testbed</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=The_WUSTL_Wireless_Sensor_Network_Testbed&amp;diff=4015"/>
		<updated>2017-04-05T17:10:24Z</updated>

		<summary type="html">&lt;p&gt;Bowen: /* Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | [[Image:wsn-wustl-logo.png]]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align = &amp;quot;center&amp;quot;&lt;br /&gt;
 | Contact: [mailto:msha@wustl.edu Mo Sha]&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
 | __TOC__&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
To facilitate advanced research in wireless sensor network technology, we are currently in the process of deploying a wireless sensor network testbed at Washington University in St. Louis.  The testbed currently consists of 79 wireless sensor nodes (motes) placed throughout several office areas in Jolley and Bryan Hall -- i.e., several grad student offices, the graduate student lounge, several labs, and the two conference rooms.&lt;br /&gt;
&lt;br /&gt;
This document serves as an overview of the testbed setup and its current deployment.  It is a living document in the sense that it will be updated as changes to the testbed continue to be made.  In the end it will serve as a source of reference for anyone using the testbed to run sensornet related experiments. &lt;br /&gt;
&lt;br /&gt;
Having a testbed of this size is important for a number of reasons:&lt;br /&gt;
&lt;br /&gt;
* '''Only a handful of testbeds of this size exist in the world today.'''  By being one of the first to have such a testbed, we will be able to conduct experiments that others have previously been unable to run.  Our eventual goal is to make the testbed accessible through a simple web interface, opening it to users across the globe.&lt;br /&gt;
* '''Running large scale wireless sensor network experiments is hard.'''  Programming a single mote can take up to five minutes depending on the size of the binary it is being programmed with.  Without a testbed to streamline the process of programming a large number of motes, programming each mote individually can quickly become a significant bottleneck.  Furthermore, as programming typically takes place by physically attaching a mote to your local machine, deploying them afterwards also takes a significant amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=&amp;quot;+1&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Please keep in mind that the motes deployed in the testbed only contain sensors for light, radiation, temperature, and humidity.  There are no microphones or cameras, and there is no plan to EVER include such sensors in the future. The purpose of the testbed is primarily for measuring communication characteristics of the motes and not evaluating the sensitivity or accuracy of its sensors. If you have any privacy concerns about including the testbed in your office please direct any questions to [mailto:wsn@cse.wustl.edu wsn@cse.wustl.edu].&lt;br /&gt;
&lt;br /&gt;
==Testbed Setup==&lt;br /&gt;
Our testbed deployment is based on the [http://www.tkn.tu-berlin.de/publications/papers/real04f-handziski.pdf TWIST architecture] originally developed by the telecommunications group ([http://www.tkn.tu-berlin.de/ TKN]) at the Technical University of Berlin.  The acronmym TWIST stands for &amp;quot;TKN Wireless Indoor Sensor network Testbed&amp;quot;.  It is hierarchical in nature, consisting of three different levels of deployment: sensor nodes, microservers, and a desktop class host/server machine.  A high level view of this three tiered architecture can be seen in the figure below.&lt;br /&gt;
At the lowest tier, sensor nodes are placed throughout the physical environment in order to take sensor readings and/or perform actuation.  They are connected to microservers at the second tier through a USB infrastructure consisting of USB 2.0 compliant hubs and a set of active/passive USB cables.  Messages can be exchanged between sensor nodes and microservers over this interface in both directions.  At the third and final tier exists a dedicated server which connects to all of the microservers over an Ethernet backbone.  The server machine is used to host, among other things, a database containing information about the different sensor nodes and the microservers they are connected to.  This database minimally contains information about the connections that have been established between the sensor nodes and microservers, as well as their current locations.  The server machine is also used to provide a workable interface between the testbed and any end-users.  Users may log onto the server to gain access to the information contained in the testbed database, as well as exchange messages with nodes contained in the testbed.  The entire TWIST architecture is based on cheap, off-the-shelf hardware and uses open-source software at every tier of its deployment.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-architecture.jpg|thumb|left|300px|TWIST architecture]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Having such an architecture enables one to perform tasks not feasible in other WSN deployments. For example, debug messages from individual sensor nodes can be sent to the control station over the USB interface without interfering with a WSN application running in the network.  The USB infrastructure essentially provides an out of band means for collecting important information from each node without clogging up the wireless channel and adversely affecting any experiments being run.  This debug information can also be time stamped by the micorservers using NTP (Network Time Protocol) in order to gather statistics about what is going on at each individual point in the network at any given time.&lt;br /&gt;
&lt;br /&gt;
Programming of sensor nodes in the testbed is also made easier using the three tiered architecture, as a user simply tells the control station which sensor nodes it would like to program, and the control station does the work of distributing this request to the proper microserver.  Information about which sensor node is attached to which microserver can be obtained from the testbed database, and each request can be sent to the proper microserver using a dedicated thread of control.  These requests can then be processed by each microserver in parallel, speeding up the time required to program the entire testbed significantly.&lt;br /&gt;
&lt;br /&gt;
Individual sensor nodes in the testbed can also be disabled or enabled the USB interface.  This capability allows node failures to be simulated in the testbed environment, as well as fine tune the density of the network itself when running certain types of experiments.  The introduction of new nodes into the network can also be simulated by enabling nodes at specific times during the run of an experiment.&lt;br /&gt;
&lt;br /&gt;
All of the features described above really boil down to just one thing.  It is possible to run sophisticated experiments in the WSN testbed without ever having to physically change the layout of the testbed or interact with the individual sensor nodes that make it up.  Everything is controllable from the central server, and scripts can be written to perform countless numbers of operations involving each of the capabilites described above.&lt;br /&gt;
&lt;br /&gt;
==Existing Deployment==&lt;br /&gt;
Currently the testbed consists of 79 [http://www.xbow.com/Products/productdetails.aspx?sid=252 TelosB] motes placed throughout Bryan (48 nodes) and Jolley Hall (31 nodes).  The figure below shows the placement of these motes in the testbed.  Two motes are connected to each microserver, typically with one microserver per room.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-deployment.png|thumb|left|600px|Existing deployment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testbed Software==&lt;br /&gt;
&lt;br /&gt;
The testbed software has a client/server architecture, plus a set of user applications that interact with the wireless testbed.  The client runs on the microservers and manages finding, programming, and communicating with the attached motes.  The server coordinates the clients and the user applications.  The user applications help the user to program, list, and communicate with motes in the system.&lt;br /&gt;
&lt;br /&gt;
The client, server, and user application software has been written mostly in Python, with some performance-critical sections written in C.  In addition, the server application interacts with a PostgreSQL database which lists the active microservers and motes.  The PostgreSQL backend is also available for user applications to store experimental data.&lt;br /&gt;
&lt;br /&gt;
===Startup===&lt;br /&gt;
The server software is automatically started as a Linux service on the testbed server machine.  The client software is also installed as a service on the microservers but is not automatically started.  A script is provided to the user which connects to the server and requests that the client be started on one or more microservers.&lt;br /&gt;
&lt;br /&gt;
When the client service is brought up, it sends a status message to the server, which marks the microserver as &amp;quot;up&amp;quot; in the database.  The microserver will also send messages listing the motes attached to its USB ports, which are likewise stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
To program a set of motes, the user runs the &amp;quot;program.py&amp;quot; script, passing it the program binary and a description of the motes to program.  The user can select to program specific motes, all the motes attached to specific microservers, or the entire testbed.  &lt;br /&gt;
The server converts this request into a list of targeted motes.&lt;br /&gt;
&lt;br /&gt;
Once the set of motes has been determined, the server creates a binary file for each mote.  The server copies the original binary, imprints it with the mote's network address (stored in the database), and moves the new binary to the home directory of the microserver the mote is attached to.  The server then passes a request to the microserver to flash the binary onto the mote.&lt;br /&gt;
&lt;br /&gt;
When the programming completes, the microserver informs the server whether it was successful or not.  The server collects this status for every mote in the programming set, and informs the &amp;quot;program.py&amp;quot; script when the job is complete.&lt;br /&gt;
&lt;br /&gt;
The slowest part of programming a mote is flashing the binary onto the mote.  Because the flashing takes place on the microserver, we can program motes on different microservers in parallel, allowing us to program the entire testbed in the time it takes to program the motes on a single microserver.&lt;br /&gt;
&lt;br /&gt;
===Serial Communication===&lt;br /&gt;
The testbed software allows the user to send and receive serial packets through the motes' USB ports.  When a microserver discovers a new mote attached to one of its USB ports, it opens a connection to the mote's serial port.  Whenever a new serial packet is ready, the microserver reads the packet and sends it to the testbed server over the Ethernet backbone.  The testbed server forwards each packet to end-user applications which subscribe to this data.  Conversely, users may send the server requests to write a serial packet to a specific mote, which the server will forward to the corresponding microserver.&lt;br /&gt;
&lt;br /&gt;
The TinyOS SDK normally provides a &amp;quot;Serial Forwarder&amp;quot; component that allows PC applications to collect data from a locally-attached mote.  To interact with the testbed instead, the user runs the provided &amp;quot;forwarder.py&amp;quot; script, which acts as a drop-in replacement for the Serial Forwarder.  Thus, existing applications developed using the standard TinyOS SDK can be used on the testbed without modifications.&lt;br /&gt;
&lt;br /&gt;
Users may optionally use a testbed-specific Python API in place of the &amp;quot;forwarder.py&amp;quot; script.  This Python API offers new features which are not provided by the standard TinyOS SDK, such as the ability to remotely reboot motes.&lt;br /&gt;
&lt;br /&gt;
==Current Services==&lt;br /&gt;
&lt;br /&gt;
===Localization===&lt;br /&gt;
We currently have a localization service implemented in which all of the motes in the testbed act as anchor nodes in order to help localize a beacon node roaming throughout the network.  Below is a snapshot of a GUI application we have developed to visualize this localization service in action.  With the denser deployment of motes in the proposed testbed, we hope to become extremely accurate in determining the location of these beacon nodes in the network.&lt;br /&gt;
&lt;br /&gt;
[[Image:wsn-localization.png|thumb|left|300px|WSN localization application]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this figure we see two beacon nodes (102 and 103) being localized to rooms (519 and 534) respectively.  The purple dots represent anchor nodes deployed in the testbed and the green lines depict which anchors have heard a message sent by one of the beacons.  The localization algorithm used is based on particle filters -- a well understood method of localization used in robotics.  We have expanded the use of the particle filter to the wireless sensor network domain.  &lt;br /&gt;
&lt;br /&gt;
==Status==&lt;br /&gt;
&lt;br /&gt;
FREE&lt;br /&gt;
&lt;br /&gt;
==Acknowledgments==&lt;br /&gt;
This work is supported by the NSF under a CRI grant (CNS-0708460) and an ITR grant (CCR-0325529).&lt;br /&gt;
&lt;br /&gt;
* [[Equipment for course projects]]&lt;/div&gt;</summary>
		<author><name>Bowen</name></author>
		
	</entry>
</feed>