Saturday, December 20, 2014

Using RPL in Contiki

When working on a sensor network application or an evaluation of a research work, sometimes we need to have a network setup which runs RPL routing protocol on sensor nodes. If we are working on Contiki OS platform, we are lucky to have not only the implementation of RPL protocol but also some sample applications which use RPL. To understand it, the best example would be simple-udp-rpl which resides in the path contiki-2.7/examples/ipv6/simple-udp-rpl of contiki source code. There are two source files inside this directory which draw our attention. First one is unicast-receiver.c file which is the receiver of unicast messages in the RPL routing tree and therefore behaves as the root node. The second file is unicast-sender.c which implements a unicast sending functionality to the root node of the RPL routing tree.

The best way to easily try out RPL on Contiki is to use Cooja simulator. First, we need to start Cooja simulator by moving into the contiki-2.7/tools/cooja directory from a linux terminal and issuing the command ant run. It will start Cooja simulation window and then we need to start a new simulation as usual. When adding motes, first we should add a Sky mote and browse and select unicast-receiver.c file as the program code to run on this mote. This will be our root node of the RPL tree. Then again add few other Sky motes but this time, use the file unicast-sender.c as the application code allowing them to be sender nodes in the RPL tree. To witness how packets from sender nodes traverse through the RPL tree over multiple hops to the root node, it would be better to keep some nodes out of the radio range of root node so that they are only accessible through some other forwarder nodes in the tree. The first figure depicts my node setup in the simulation.

After setting up the simulation with nodes with relevant applications, we can start simulation  by clicking on the Start button of Cooja simulator. After a while all the nodes started up with Contiki OS, we will start to see that every sender node periodically transmits a packet which travel through the RPL tree to the root node. Both sender and receiver nodes prints a string about these events which can be evident from the mote output window of Cooja simulator. Second figure in this article depicts some excerpt from the mote output window with sender and receiver message logs. Even though the RPL implementation of Contiki OS is a bit complicated to understand easily, these two simple sender and receiver applications would be helpful if we need to setup a scenario where we need our nodes to simply communicate using RPL without too much troubles.

~******~

Wednesday, December 17, 2014

Prof. Margot and Ravihansa from QUT, Australia.

Ravihansa and Prof. Margot
Last week was a so much busy time. In ICTer 2014 conference, I had been assigned various duties and therefore I had to run here and there to organize different things for about a week. Mainly I was assigned to facilitate a workshop conducted by the Zone24x7 company on 13th December and also a session in 12th December. However, I involved in many other works and lot of those things were really interesting. Besides all the things, I decided to write today about two interesting workshops I attended and a keynote speech in ICTer conference.

Ravihansa Rajapakse was once a student at University of Colombo School of Computing (UCSC) and was a one year senior to me. After he finished his bachelors degree, he worked in our junior academic staff. Now he is in Queensland University of Technology (QUT), Australia studying for his PhD. He came to Sri Lanka for the ICter conference not alone but with his supervisor who is a very nice lady. She is Prof. Margot Brereton from QUT. Ravihansa conducted a very interesting workshop in 10th December and then Prof. Margot delivered her keynote speech at ICTer conference in 11th. She did another nice workshop in 13th December. I was lucky to attend all these events while managing my time for various official duties.

Our prototype :D
First of all, I have to write about Mr. Ravihansa's workshop which was so interesting than I ever thought. I knew him for several years as he was a senior to me in my undergraduate degree. However, this is the first time I got a chance to be in the audience of a lecture or a workshop conducted by him. His workshop title was "Build First Plan Later: The Voice of DIY Approach in Today's Design". The whole point he tried to convince us from this workshop as I understood was, sometimes it's better to build things with the user instead of designing and building something separately and then applying it to the user context. He brought various things such as fruits, stationaries, clay, etc and in addition to that, he had brought few kits called Makey Makey. Mr. Dulan Wathugala who was once a great teacher and a mentor to us also attended to this workshop which made me so happy. We had a chat during the tea break of the workshop about various new technological trends.

Among different activities we did, the main task was to organize as a group and then select one person as a client who has a special requirement. This requirement is having some loved one in a long distance so that this group member has a need to be connected with the loved one. The task of the group is to talk with her and identify a method which provides a connectedness between her and the loved one. We formed a group where we had me, Chathura Suduwella and three members from software development unit (SDU) of UCSC. Actually I didn't know those three before this workshop and while performing the group work I made a friendship with them too. One girl in our group is selected as the client whose parents are living out of Colombo while she lives in Colombo. Our goal is to make a connection between she and her parents in some way other than standard communication mechanisms such as telephone calls, text messages, etc. After having interviews with our group member who is the client and also after a long brainstorming among the group members, finally Chathura came up with a great idea which everybody liked.

Makey Makey
Our idea was to create a small pot with a plant which has some automated functionalities. It has a small water container with an electric valve. A control signal can water the plant. Additionally, there will be some UV lights around the plant which can be turned on and off when necessary. We will put this automated plant in the living room of our clients parents house. We will put sensors in the house of our client girl so that we can track whether she has left home in the morning in a predefined time and also return home in the evening within a predefined time. Perhaps we can get this information from the sensor fixed onto a door of her living place in Colombo. Additionally, we can connect some sensor to track weather she used her plate for meals providing us the valuable information about her eating times. All these information is transferred from her living place in Colombo to her parents house where the automated plant resides. Our idea is to make the system to water the plant and provide light conditions when she leave home in the morning, return back in the evening and eat within a predefined time. Our hope is that the condition of the plant will reflect the good living condition in our clients life to her parents.

After this first workshop next day I attended to the keynote speech of Prof. Margot Brereton where she talked about different ways people have introduced ICT solutions for problems in the communities around the world and how they have succeeded and failed. Her keynote speech reflects a similar idea to Ravihansa's workshop where the importance of designing solutions with the user instead of for the user is highlighted. After her keynote speech, I took a picture of Prof. Margot and Ravihansa for the purpose of including in this article. Finally in last Saturday, there was another little workshop conducted by Prof. Margot where she helped us to visualize a problem by drawing with a paper and some color pens. Each participant was given a chance to select some problem with which they are dealing these days and then draw the connections of people and every other thing that relates to the problem. This method helps to identify the important parts of the problem and what are the things that should be considered when thinking about the solution.

As always, I enjoy meeting new people and getting to know various new things that broaden my understanding and improve my thinking about the world around me. Among various things I saw and people I met during the ICTer 2014 conference days, Professor Margot and Ravihansa are very important people and the knowledge and experiences they brought to me from Australia is awesome.

~********~

Saturday, December 6, 2014

Capturing WiFi Packets in Monitor Mode With Wireshark

I've used Wireshark for looking at different network packets and their contents. However recently I wanted to observe WiFi networks around me using Wireshark without actually connecting to any of those networks. For this purpose we have to run our wireless card in monitor mode which allows us to eavesdrop WiFi packets in wireless networks around us passively. I searched in the web to learn how to do it in my Asus laptop which runs Ubuntu 12.04 LTS. So, I'm writing down how I did it in my platform. There's an important thing to keep in mind that not all the wireless cards support monitor mode. If your wireless card doesn't support it, you are in trouble.

Steps to follow in a terminal:

// setting wlan0 to monitor mode
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor
iwconfig wlan0
sudo ifconfig wlan0 up

// install wireshark if you haven't yet
sudo apt-get install wireshark

// run wireshark with root priviledges
sudo wireshark

Now Wireshark GUI window will open up and then you can select your wlan0 interface to start capturing packets. Following screenshot shows my Wireshark window with various WiFi packets.

Wireshark window with captured WiFi packets


References:





Friday, November 28, 2014

A new home for the SCoRe group

My new station
After staying in the same place for around 8 years, sustainable computing research (SCoRe) group, which is previously known as Wireless Ad-hoc Sensor Network (WASN) research group is moving. For all these years, we've been staying in a small room located in a hidden corner of the UCSC building. That place was home for many successful researchers and many successful research projects conducted by the group. With the refurbishments of UCSC building, various new parts were added including an extra floor which is the 4th floor. New lab room for the SCoRe group is allocated from this all new 4th floor.

A nice view from our window
I got to know about WASN research group around early 2010, after having a short chat with Dr. Chamath and Dr. Kasun at their office. Initially, I started contributing to their projects by doing small supportive work, little by little, learning their subject domains. In my 3rd year, I did my internship at the WASN lab with the research group and learned how to live in a research environment. Even during my 4th year of the undergraduate education, I spent most of my time at the WASN lab working in research project works. Finally after my 4th year, I got the chance to work as a research assistant (RA) for few years before I go abroad. When I return to the lab after more than a year of new life experiences, WASN lab was facing various significant changes such as people and the role of the lab.

Currently the situation in our WASN lab location is a bit complicated. Instead of being a place dedicated for research and development works, some other roles are emerging in that place. Some undergraduate course works which are operated by a lecturer is based on the lab and therefore always, many undergraduates are vising the place. Sometimes, undergraduate students stay in the lab with their laptops to do their own works without any specific relation to the lab research or course work. I've faced many situations, where the lab was too noisy and hard to focus on my work due to the behavior of undergraduate students. Additionally, there are some requirements such as the lecturer who is handling the undergraduate courses is in need of transforming it into an undergraduate lab.

Under all these conditions, I think, receiving a new place for the SCoRe research group is a positive movement. Our new place is very peaceful and has less distractions compared to the old place. I personally like this new room since it has a nice view from the window. I can see the UCSC ground and far away places inside the university premises from this place. Our neighborhood is some other research labs with other researchers. I hope that having a green view will help me to recover from hard times in lab work.


Thursday, November 20, 2014

Setting Up an SVN Repository Server

More than 4 years ago, I wrote a blog post about setting up an SVN (subversion) client in an Ubuntu system because I had to use the version control  system maintained by the lab for research project works. After such a long time period, finally a week ago I had to install an SVN server in a newly settled server for the lab. Keeping  the tradition, I'm writing down the steps of this installation for the benefit of me in the future and also for the rest of the world.

First of all, we should login to the sever where we need to configure SVN server using SSH. Then we can follow the command sequence given below.

# installing svn application
apt-get install subversion

# template for a project repository directory structure
mkdir /var/svn/
mkdir /var/svn/tmpproject
mkdir /var/svn/tmpproject/branches
mkdir /var/svn/tmpproject/tags
mkdir /var/svn/tmpproject/trunk

# creating a real project repository and copy the template content into it
svnadmin create /var/svn/myproject --fs-type fsfs
svn import /var/svn/tmpproject file:///var/svn/myproject -m "initial import"

# add new users to the system to be a client of the repository
adduser asanka
adduser chamath


# starting svnserve deamen. Not necessary if users access with SSH I think.
svnserve -d

Now we are done at the server side. We should logout from the server and now check whether we can access the repository from the client side. There are various  ways of providing user access to an SVN repository but in my configuration, I'm only allowing the users who have a  user account in the server to access the repository. Follow the  given command sequence to access the SVN repository in the server.
 
svn co svn+ssh://chamath@192.248.xxx.xxx/var/svn/temproject/
svn add some_file.txt
svn commit trunk/ --message "My initial messsage"

In this way, we can start using our newly initialized SVN repository server. I'm not sure whether  I missed any important step because I compiled these steps after trying various other ways. In case I have missed something, please be kind to point out :-)

Tuesday, November 11, 2014

Removing shortcuts from GNOME Classic launcher

This may sound stupid but for a long time, I was not able to remove shortcuts from the launcher in GLOME Classic. Therefore I was afraid of adding things to the launcher. I just has put Firefox, Terminal, Gedit and a green screen shot  capturing app. Today, I accidentally added some other shortcuts into the launcher and faced a situation of removing them somehow. Then only I bothered to search google about it and found the solution.

The key combination  Super(= Windows key) + Alt + Right-Click on the launcher icon provided me the option "Remove From Panel". Thats what exactly we wanted. Just right-clicking on a launcher icon does not provide this option. I found this solution from this forum discussion.


Monday, November 3, 2014

Drawing Gantt Charts using Latex

While preparing some document in last week, I wanted to draw a Gantt chart to visualize a time line of a project. I tried different GUI based tools but I didn't like  them. At the end, I decided to find out whether there's any Latex package available to get my task done. Luckily, I found it. For this purpose, first of all, we need to have a style file called gantt.sty which you can download from here. Then we need to compose our gantt  chart definition in a .tex file. Following is such an example gantt chart definition which I saved with the file name my_gantt_chart.tex in the same directory as the style file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
\documentclass{article}

\usepackage[pdftex,active,tightpage]{preview} \setlength\PreviewBorder{2mm}
\usepackage{gantt}

\begin{document}
\begin{preview}

\begin{gantt}{7}{12}
    \begin{ganttitle}
      \titleelement{\textbf{Year 2015}}{12}
    \end{ganttitle}
    \begin{ganttitle}
      \titleelement{\textbf{Jan}}{1}
      \titleelement{\textbf{Feb}}{1}
      \titleelement{\textbf{Mar}}{1}
      \titleelement{\textbf{Apr}}{1}
      \titleelement{\textbf{May}}{1}
      \titleelement{\textbf{Jun}}{1}
      \titleelement{\textbf{Jul}}{1}
      \titleelement{\textbf{Aug}}{1}
      \titleelement{\textbf{Sep}}{1}
      \titleelement{\textbf{Oct}}{1}
      \titleelement{\textbf{Nov}}{1}
      \titleelement{\textbf{Dec}}{1}
    \end{ganttitle}
    \ganttbar[color=green]{\textbf{Phase-1: Design and prototype implementation}}{0}{3}
    \ganttbarcon[color=blue]{\textbf{Phase-2: Pilot deployment and field trials}}{3}{6}
    \ganttbarcon[color=red]{\textbf{Phase-3: Full scale deployment and evaluations}}{9}{3}
  \end{gantt}
\end{preview}
\end{document}

Now we can generate the PDF file by issuing  the  following command in the terminal.

pdflatex my_gantt_chart.tex

Following is a screenshot of the output PDF I received.

Even though the output doesn't look fancy as the output of many other tools, I'm happy with this because it allows  me to prepare it using Latex, my favorite document processing tool.

References: