Implementing Wireless Sensor Network
October 18, 2011 Leave a comment
Couple of months ago had an opportunity to implement a Wireless Sensor Network to implement building environment monitoring system. One of the major difficulty encountered while implementing a wireless sensor network using the MicaZ platform was the relative lack of documentation available to implement the network and for coding. After trying a bunch of technologies and methodologies ended up with an implementation based of Labview and Crossbow technologies. Here in the blog I have mainly concentrated on the Labview based implementation.
Video of my final project:
Which technology to use to implement WSN?
This is one of the first questions you might need to answer when implementing WSN. This question can be divided mainly into two parts, viz.
a) How to configure the motes?
b) How to display the result from the motes?
How to configure the motes?
As you might be aware the OS used to embed into the motes uses the NesC programming language which is an component-based event driven programming language which can be implemented using the tinyOS platform. NesC can either be installed into the motes by using the open source TinyOS available for free download at http://www.tinyos.net/ or by using the Moteworks platform which is owned by Crossbow(Not sure if this is still supported by them).
You can find information about installing the programming into the motes by using the link below. Please note that for my version of the project I had installed mesh network codes into the motes.
Main page: http://www.tinyos.net/
How to download and install TinyOS: http://docs.tinyos.net/tinywiki/index.php/Main_Page
Source code hosting: http://code.google.com/p/tinyos-main/
NesC tutorial: A link to many tutorials are available at the wiki: http://docs.tinyos.net/tinywiki/index.php/Main_Page
My whole project was implemented with the Moteworks package which worked on the Windows platform. The main reason I did this is because I wanted the display to be in the windows platform and hence didn’t want to shift between Linux and Windows for installation and running. Please note that Moteworks was owned by Crossbow.
b) How to display the result from the motes?
This was the trickier part for me because I wanted to get the implementation on the windows platform. There are many platforms that are available in linux that can give a decent display which works on the Java programming language. For my display I used Labview to get the raw packets from the motes as a packet (array) and separated the various mote packets with node id as the primary key. Separating motes with node id as the unique id is useful as we can then easily separate data when scaling the system. You might also need to write individual codes to display the various sensor packets; for me personally had to do a lot of trial and error to get this right.
Steps involved where:
1) Connect the programming board with the motes attached into into the USB port.
2) Install the simulator which allows us to access the USB device(assuming that the WSN programming board has USB port) the same way as a COM port in your pc. The simulator is available for download at http://www.ftdichip.com/Drivers/VCP.htm .
3) Download and install NI Visa from the link http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav:du,n8:3.1637,ssnav:sup/
4) National Instruments provides a set of libraries which will help you get the wireless sensor network up and running soon. You can download the libraries from here : http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=1FB66B354ED149C7E0440003BA230ECF
The detailed steps for downloading and installing the above library can be found here : http://digital.ni.com/public.nsf/allkb/FD238ED75B22740B86257315004E35FE .
6) When all the above steps are completed make the connection of the sensor network as you desire and select the appropriate com port for input in the vi. Usually there will be one virtual port for programming the motes and another one for getting data from the programming board. For example for programming the motes we can use com2 and for receiving signal it would be com3.
After installing the above you can either use the downloaded libraries or use raw data from the motes and display the data, here the former option is useful if you already have the libraries for the said motes and the later can be used if you plan to use motes or sensor board in a non-traditional way.In my case for the implementation the hardware I used was MIB520(programming board), MICAz mote(node), MTS310(sensor) and MDA300(sensor).
In short the flow of data where as follows:
Sensors -> Motes (hopping b/w them) -> Base node -> Programming Board -> USB port -> NI Visa -> Differentiate b/w packets -> Display results.
Hope this helped. Have fun!