Thursday, August 14, 2014

Hands on Antelpe database on Contiki

Contiki operating system for small low powered devices such as sensor nodes introduced many features of the resource-rich world to the resource constrained world. Among many of those things, in the year 2011, they included a small database management system to run on sensor nodes which is called 'Antelope'. When we download Contiki OS, we receive Antelope with it. Until today, I didn't get a chance to tryout Antelope. Here is a little note on the basics.

I assume that the reader has downloaded Contiki-2.7, installed Tmote Sky tool chain and configured Cooja simulator. With this setup, we can try different examples in contiki-2.7/examples directory such as hello-world example. An Antelope example can be found in contiki-2.7/examples/antelope/netdb. In this example, there is a client program and a server program. The client program provides a serial interface to the user to enter different queries. Once a query is received, client program transmit the query to the Antelope server program running on a particular node in the network. A saved simulation is available here named as netdb.csc in the same directory. By running this saved simulation, client program starts running in the node id 51 and the server starts running on all the other nodes. However, the client program is configured to send queries only to the server program instance running in node id 4.

We can try the example as follows. Start the Cooja simulator by typing 'ant run' in the directory contiki-2.7/tools/cooja. From the file menu in the Cooja simulator, File->Open simulation->Browse and select the simulation file /contiki-2.7/examples/antelope/netdb. The interface of Cooja will be like the the following.


Mote interface viewer is providing the facility to send some text strings to the node id 51 through its serial port. Mote output interface together with a filter will show the output of the mote id 4. Start the simulation from the simulation controller and then we can enter different queries to the serial interface and see the response from the Antelope database on mote 4. Given below are some sample queries we can enter in the interface to play with the database and the responses received from node id 4.

Rime started with address 51.0
MAC 33:00:00:00:00:00:00:00 Contiki 2.7 started. Node id is set to 51.
CSMA nullrdc, channel check rate 128 Hz, radio channel 16
Starting 'NetDB'
NetDB client
> create relation foobar;
865 Transmitting query "create relation foobar;" to node 4
1077 Reply received from 4.0 (2 hops): OK
> create attribute id domain int in foobar;
3079 Transmitting query "create attribute id domain int in foobar;" to node 4
3085 Reply received from 4.0 (2 hops): OK
> insert (23) into foobar;
4101 Transmitting query "insert (23) into foobar;" to node 4
4106 Reply received from 4.0 (2 hops): OK
> insert (12) into foobar;
4785 Transmitting query "insert (12) into foobar;" to node 4
4790 Reply received from 4.0 (2 hops): OK
> insert (79) into foobar;
5481 Transmitting query "insert (79) into foobar;" to node 4
5486 Reply received from 4.0 (2 hops): OK
> insert (38) into foobar;
6655 Transmitting query "insert (38) into foobar;" to node 4
6660 Reply received from 4.0 (2 hops): OK
> select max(id) from foobar;
7815 Transmitting query "select max(id) from foobar;" to node 4
7825 Reply received from 4.0 (2 hops): [relation = db-result, attributes = (id)]
Row 1:79
7827 Reply received from 4.0 (2 hops): [1 tuples returned; 5 tuples processed]
OK

I think I need to study netdb-client.c and netdb-server.c if I want to do something serious in a WSN application with Antelope.

References:

1 comment:

  1. Hi, I am Final yr MCA Student,I am taking my project is IoT-Home Automation, so I am going to develop this app in Cooja simulator and contiki os.
    This area has any scope in future ?

    ReplyDelete