Wednesday, March 9, 2011

TikiriDB: Compiling, Running and Exploring !


TikiriDB, the database abstraction for wireless sensor networks is an ongoing research work in our SCoRe lab. It's an application program written to the Contiki operating system which is a very powerful operating system used in wireless sensor networks. Initially TikiriDB was written completely in C language. The latest release of it was version 0.2 and it's a considerable time ago. However with different modifications to its architecture, TikiriDB is changing its shape. Currently most of it's parts has rewritten in Java language and under further development.
When testing and working with TikiriDB system, we have two options. First one is to use real hardware while second one is to use sensor network simulators. On development stages it's better to use simulators since if we use real hardware, we will be burning their memory modules over and over again for testing and debugging. These sensor network hardware costs thousands of money and it's better to keep them safe until a well tested, working version of program is available.

TikiriDB High level Overview 



Compiling and Running TikiriDB
Here I write the way to compile and run TikiriDB on a real sensor hardware. This description is about the currently released TikiriDB 0.2 version. I use MSB430 sensor nodes which are supported by the Contiki operating system. The first thing to do is downloading the software. We need TikiriDB 0.2 source which can be obtained from here (http://score.ucsc.lk). We also have to download the daily snapshot of the Contiki 2.x operating system source from here (http://www.sics.se/contiki/).

Create a new directory in a linux machine and put the two downloaded directories inside it. Let's say we have the following set up.
 

TikiriDB is here--> /[path to my directory]/0.2
Contiki is here--> /[path to my directory]/contiki-2.x

Open the make file in test-apps directory of TikiriDB and check whether it's attribute CONTIKI contains the correct path to the Contiki operating systems source directory. In our case, it should be just like below.

CONTIKI = ../../contiki-2.x

Now open this header file in Contiki, located at the path,
/[path to my directory]/contiki-2.x/platform/MSB430/contiki-conf.h
There you have to edit it's content at line numbers 9 to 11 and make those lines similar to the given below.

1:  #define NETSTACK_CONF_RADIO cc1020_driver  
2:  #define NETSTACK_CONF_RDC nullrdc_driver  
3:  #define NETSTACK_CONF_MAC nullmac_driver  

   

It's time to compile and upload TikiriDB and Contiki to sensor mote. We need a special compiler to compile tikiriDB to the MSP430 MCU platform. To install the compiler tool chain, follow this procedure.
Add this line to the software sources list of you Ubuntu machine,

deb http://wyper.ca/debian i686/ 

Then give this command from the terminal,
apt-get update
apt-get install binutils-msp430 gcc-msp430 msp430-libc msp430-jtag
 
Now you have to plug a MSB430 mote to the serial port of the PC with the provided cable. Then from a linux terminal, goto the test-apps directory in TikiriDB and apply this command.

chmod o+rw /dev/parport0
make TARGET=msb430 test-app.u

If everything went fine, TikiriDB application and the Contiki operating system will be compiled and uploaded to the MSB430 sensor mote. When it's done, remove the mote and plug another mote to the serial port. Apply the command again. By this way we can prepare all the motes that we hope to use in the sensor network. It's very important to remember that the motes should be equipped with batteries while programming, which I always forget.

Now we should compile and start the serial forwarder. Therefore goto the following directory and issue a “make” command.

/[path to my directory]/0.2/gateway/serial-forwarder-cpp

Then serial forwarder will get compiled. Now plug in a mote which will be our gateway node to the PC with the USB cable provided and put it's switch into USB mode. That means the mote receives a power supply from the PC through the USB cable and batteries are not necessary. Put other motes to the Battery mode and keep near the gateway node.

From the terminal where we issued make command, issue the following command to start serial forwarder.

./sf -s /dev/ttyUSB1 -b 115200 -p 10000

If this command give some errors, try using a different serial device like ttyUSB0 or something.

Now we need our TikiriDB client program to issue queries. Therefore goto the following directory from a different terminal window and issue the following commands.

cd /[path to my directory]/0.2/gateway/tikirisql
make
./tikirisql -H localhost -P 10000

Now we can issue queries to this prompt and get the data from it. For a help and example queries, type “help” or “\h” (without quotes) on the prompt.

No comments:

Post a Comment