Showing posts with label msp430. Show all posts
Showing posts with label msp430. Show all posts

Monday, March 21, 2011

MSB430 Sensor Mote



When we are working on wireless sensor networks we find different hardware platforms developed by different vendors. Even though in each sensor mote hardware we find lot of differences, there are basic components or modules that exist in each and every wireless sensor node. Any mote requires a processing unit which is the central brain of the mote. Usually thay use microcontrollers(MCU) for this purpose rather than ordinary PC microprocessors becase MCUs operate with very little energy consumptions. Most of the MCUs we have out there in the market are targetted for environments where we have to rely on batteries.
    Usually these MCUs carry internal memory modules that can store program instructions and data within the MCU. But depending on the requirements of the sensor network developers, extra storage space may be necessary. Therefore usually a sensor mote contains a way to extend it's memory capacity by integrating with external units. These memory units can be EEPROMs or SD-/MM cards.The next important thing on a wirelless mote is the communication module. A mote should be capable of transmitting and receiving signals from other similar motes and devices in the sensor network. The transmission medium can be redio frequency, optical communication or infrared. The most common way of communicating between motes is radio frequencies since thay are very reliable. Unlike optical and infrared signals, the radio signals don't get interfered by environmental events and energy sources.
    At last sensor motes contains different sensors to gather data which is their ultimate task. The ability to plugin additional sensors is an added advantage in sensor motes rather than just using what the manufacturer of mote has shiped it with. Usually sensors are available to sense temparature, humidity, acceleration, vibrations, light, and so on.
    Now if we talk about our main topic the MSB430 sensor mote, it's a one which is specifically designed to use on research and academic purposes rather than industrial usages. MSB430 is a product of ScatterWeb which is a German vendor. It has an MCU called MSP430 developed by Texas Instruments, USA. This MCU offers 60KB of memory divided into 5KB of RAM and 55KB of flash-ROM. In addition to that it contains a SD-/MM card slot which supports upto 4GB storage.
    The radio transceiver of the sensor mote is a Chipcon CC1020 transceiver which operates on ISM band and has the ability to select the communication frequencies by software. Therefore selecting multiple channels for advanced routing schemes is supported with this tranceiver. For analog data in and out, the mote contains 2 A to D converters. To program the wireless mote we can use JTAG inerface. In addition to that we can connect the mote to a PC by the USB port with the help of a FTDI converter cable. When we connect it to the PC with USB port, we can put the mote to the USB mode by using it's switch on the main board. At this mode, it doesn't require the usual power supply with 3 AAA batteries since it can get the power though USB cable from the PC.
    When we are going to program the mote for our purposes we have differet software options. The hard way is programming it from scratch. If we're looking for some easier way, we have operating systems that can be installed on the mote. If so, we have to just write applications on top of the operating system. The manufacturer of the mote ScatterWeb itself provide an operating system called ScatterWeb operating system. And the Contiki operating system is also ported to MSB430 platform. If we're going to develope applications on Linux PCs for the Contiki operating system to run on MSB430 motes, we need some development tools installed in our Linux machine.
    GNU community provides compiler tool chains for the GCC compiler to support development for Contiki on MSB430. To install the tools and libraries we have to first add the below software source to the /etc/apt/sources.list file. 
    deb http://wyper.ca/debian i686/
Then run these commands on the shell.
    apt-get update
    apt-get install binutils-msp430 gcc-msp430 msp430-libc msp430-jtag
Now our development environment is ready. So, it's time to write some apps, install and run on our MSB430 motes.

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.