You are on page 1of 14

Indian Institute of Technology Bombay

Computer Science and Engineering Department

Wireless Lab Manual

Author:
Prasanna Karthik V

Supervisor:
Prof. Kameswari Chebrolu

October 9, 2010

Contents
1 Introduction

2 Equipment Overview

3 802.11 Platform
3.1 802.11 Experimental Requirements
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Device Driver Installation on Mikrotik Boards
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.1 Compiling Linux Kernel . . . . . . . . . . . . .
3.2.2 Netbooting the board using the Ramdisk image
3.2.3 Permanent installation on the Routerboard . .
3.3 Persistent Network Settings . . . . . . . . . . . . . . .
3.4 Wireless Commands . . . . . . . . . . . . . . . . . . .
3.5 Other Related Softwares . . . . . . . . . . . . . . . . .
3.5.1 Readlog . . . . . . . . . . . . . . . . . . . . . .
3.5.2 iPerf . . . . . . . . . . . . . . . . . . . . . . . .

1
. . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

2
2
3
5
5
7
8
8
9

4 802.15.4 Platform
4.1 802.15.4 Platform Requirements . . . . . . . .
4.2 Device Driver/OS installation on Motes . . .
4.2.1 Installing TinyOS onto the MasterPC
4.2.2 Installing the image onto the Motes .
4.3 Logging using a backend Java program . . . .
4.3.1 Increasing the size of the packet . . .
4.3.2 Changing the Channels of operation .

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

9
9
9
9
10
10
11
11

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

List of Tables
Abstract

802.11 PLATFORM

Introduction
This manual gets you introduced to the various platforms that you will be dealing with, in the

wireless lab. It is assumed that you have no practical background in this field, although it assumes some
theoretical knowledge in wireless networks. The illustrations are verbose to cater to the larger sect of
the audience, though it may prove to be annoying for the others. We cover 3 wireless platforms in this
manual, namely:
802.11
802.15.4
TIs

It is important for us to get familiarized with the equipments that we will be using. When we say we
are going to work on 802.11, what kind of equipments will we be using, given the fact that 802.11 is just
a protocol? Such questions need to be addressed, before we proceed.

Equipment Overview
A node in our wireless testbed is composed of two major components. First, a host

system that interfaces between the radios( working on 802.11 or 802.15.4) and the user. This could
be a microcontroller, laptop or a Router Board. Second, the Wireless interface card ( popularly called
the Radio) that works on the data layer and provides physical(wireless) connectivity to the other nodes
in the network. It is very important to understand that the host system(laptop or microcontroller)
specifically has certain wireless interfaces to understand the corresponding Radios(say, 802.11) and cannot
understand other Radios(like 802.15.4). Generally, to deal with this dependency we use a host systemRadio pair that are compatible with one another. Let us kick off by introducing the hostsystem-radio
pairs that we will be using(though other options are always available):
Mikrotik Board - 802.11a (5 GHz)
Mikrotik Board - 802.11b (2.4 GHz)
Mikrotik Board - 802.11g (2.4 GHz)
Tmote Motes - 802.15.4(2.4 GHz)
MSP430 - CC430 Radio(800 MHz)

3
3.1

802.11 Platform
802.11 Experimental Requirements

Components: Mikrotik Boards, a network cable with RJ45 interface(one per mikrotik board), Wireless
Cards(802.11a/b/g), Pig Tails(one per card), Serial Cable(for driver/os installation).

3.2

Device Driver Installation on Mikrotik Boards


3

3.2

802.11 PLATFORM

Device Driver Installation on Mikrotik Boards


Mikrotik RouterBOARDs are hardwares manufactured by MikroTik. It comes with a proprietary

OS called RouterOS, leaving very little or no scope for customization. For this, we install a linux based
OS with the wireless device drivers provided by Madwifi. This wireless device driver allows us to make
modification to the driver code.
For proceeding with the installation, we need a Master system(a PC) on which we have to compile
the integrated linux & Driver codes. It is to be noted that compilation is not that straight forward as
MikroTik boards are based on Atheros AR7100 chipset. So it is required of us to cross compile linux
for the Atheros AR7100 platform. OpenWRT does this for us. Once the compilation is done, we can
proceed to installing the same compiled kernel image onto each of the boards. The process of going
about doing it is described below in detail:
3.2.1

Compiling Linux Kernel

Goal: To generate net boot image (to be used for network booting the board), permanent kernel image
(a complete kernel image to be used later on), Root file system (to be mounted on the board). The
process of compilation is described below:
1. Download the OpenWRT linux source[Kamikaze] for embedded systems from the following link.
Though, a new version of OpenWRT, backfire, is available, i havent tried it out personally.
2. UnTar the Source and browse through the contents to familiarize yourselves with the code. You can
find the Default Madwifi Source in /kamikaze 8.09/dl/madwifi-trunk-r3314.tar.gz . This
is where you have to modify the driver code, in case you are planning to. Those who are less
interested in modifying, can use the default madwifi driver and proceed to compilation.
3. Compilation of Kamikaze linux kernel: Browse to the top level directory (kamikaze 8.09/) and run

make menuconfig . This opens the menu for selecting what components you wish to include in
the linux kernel image.
4. make menuconfig may require some additional packages like gawk,ncurses etc. It would report
the same, if they are missing. Install the same using apt-get or synaptic. Try rerunning the above
command again.
5. If you were successful in the above step, you should be sitting in front of a menu window with
numerous options. For now, let us not bother about the various options available and concentrate
on the required ones.
6. As we are compiling the kernel image for Atheros AR7100, select Target System

Atheros

71xx [2.6]
7. Also select Target Images

Ramdisk as we are first going to generate a ramdisk image for

network booting the Routerboard.


8. Now exit the menu and dont forget to save the configuration when it asks for it.

3.2

Device Driver Installation on Mikrotik Boards


3

802.11 PLATFORM

9. To generate the netboot image, run make V=99 . This compiles the kernel using the config file
previously generated. Note: This step may require proxy authentication from command line, for
downloading some packages.
10. Rerun make menuconfig and repeat step 6. Followed by select Target Images

tgz

and ext2 this time for generating the persistent kernel image and rootfs. Save and exit the
configuration. run make V=99 .
11. You can find the generated images in /kamikaze 8.09/bin/ .
12. It is in the best of your interest to move the 3 files to a new location and back it up. The three files
are : openwrt-ar71xx-vmlinux-initramfs.elf, openwrt-ar71xx-vmlinux.elf, openwrt-ar71xx-rootfs.tgz
3.2.2

Netbooting the board using the Ramdisk image

Goal: To network boot the Board using the Ramdisk image.


1. For performing network boot, we need 3 packages installed on our Master PC, namely: xinetd,
dhcp server and tftpserver. You can do it by:

sudo apt-get install xinetd


sudo apt-get install atftpd
sudo apt-get install dhcp3-server
2. Now modify the config file /etc/dhcp3/dhcpd.conf of the dhcp server accordingly, to assign ip
address to your router board. This is a must to netboot the board.
3. This is a copy of the dhcpd.conf file that i have been using:
# G l o b a l Parameters
authoritative ;
maxl e a s e time 6 0 4 8 0 0 ;
d e f a u l t l e a s e time 3 1 0 0 ;
ddnsupdates t y l e none ;
ddnst t l 7 2 0 0 ;
allow booting ;
a l l o w bootp ;
onel e a s e perc l i e n t t r u e ;
#10.129 i s t h e IP p r e f i x t o be used f o r b o a r d s .
s u b n e t 1 0 . 1 2 9 . 0 . 0 netmask 2 5 5 . 2 5 5 . 0 . 0 {
option routers 10 .1 2 9. 41 . 21 3;

# Your Master PC i p a d d r e s s

o p t i o n subnetmask 2 5 5 . 2 5 5 . 0 . 0 ;
o p t i o n b r o a d c a s t a d d r e s s 1 0 . 1 2 9 . 2 5 5 . 2 5 5 ;
i g n o r e c l i e n t u p d a t e s ;
}

3.2

Device Driver Installation on Mikrotik Boards


3

802.11 PLATFORM

group {
host routerboard {
# Below i s a l i s t o f MAC a d d r e s s e s o f t h e b o a r d s a v a i l a b l e ;
# I f you dont f i n d your board i n t h i s l i s t , then you g o t t o make an e n t r y .
# hardware e t h e r n e t 0 0 : 0C: 4 2 : 3 B : E3 : 7 3 ;
# hardware e t h e r n e t 0 0 : 0C: 4 2 : 3C: 5 E : 9B ;
# hardware e t h e r n e t 0 0 : 0C: 4 2 : 3 B : E3 : 7C ;
# hardware e t h e r n e t 0 0 : 0C: 4 2 : 3C: 5 E : 9 8 ;
# hardware e t h e r n e t 0 0 : 0C: 4 2 : 3D: 6 3 : 7 7 ;
# hardware e t h e r n e t 0 0 : 0C : 4 2 : 3 2 : 3A: 0B ;
# hardware e t h e r n e t 0 0 : 0C : 4 2 : 5 8 : C4 : B0 ;
# hardware e t h e r n e t 0 0 : 0C: 4 2 : 3C: 5 E : 9 E ;
# hardware e t h e r n e t 0 0 : 0 c : 4 2 : 4 4 :AC: 4 4 ;
hardware e t h e r n e t 0 0 : 0C: 4 2 : 3 B: 6 F : 5 5 ; # This c o r r e s p o n d s t o my board ! !
# hardware e t h e r n e t 0 0 : 0C: 4 2 : 3 B : E3 : 7 0 ;
nexts e r v e r 1 0 . 1 2 9 . 4 1 . 2 1 3 ;

# IP a d d r e s s o f t h e Master PC

f i x e d a d d r e s s 1 0 . 1 2 9 . 5 0 . 1 5 3 ; # IP a d d r e s s t o be a s s i g n e d t o your board .
f i l e n a m e vmlinux ; # Name o f t h e image ( n e t b o o t image ) .
}
}
4. If you are a keen observer, you would have noticed that the dhcp server is asked to point to a file
vmlinux that isnt available yet. For this:

cd
mkdir -p /tftpboot
cp bin/openwrt-ar71xx-vmlinux-initramfs.elf /tftpboot/vmlinux
5. Now we need to start/restart the xinetd,atftpd and dhcp3-server.

/etc/init.d/xinetd start
/etc/init.d/atftpd start
/etc/init.d/dhcp3-server start
If the servers are already running, then use the restart option.
6. Now power on the RouterBoard and connect it to the hub using a network cable. Make sure that
the MasterPC and Board are connected to the same hub.
7. Also connect the board to your MasterPC using the serial cable. You can access the RouterBoard
now, using the command minicom.
8. After entering into the minicom console(minicom console displays openwrt, make sure you dont
reboot your MasterPC), type reboot.

9. During boot, it asks you to press any key within 2 seconds. Do as requested. Now, in the menu,
press o, then e and then x. This basically asks the board to boot from the network.
10. If the dhcp server is configured properly and there is no network problem, the RouterBoard boots
up without any problem. Otherwise, something went wrong. You can try changing the network
4

3.3

Persistent Network Settings

802.11 PLATFORM

cable and see if that works.


11. Once you are done, now it is time to configure the network settings on the RouterBoard.

ifconfig br-lan down


brctl delbr br-lan
ifconfig eth0 down
ifconfig eth0 10.129.50.153 netmask 255.255.0.0 up
passwd
3.2.3

Permanent installation on the Routerboard

Goal: To install the image and the rootfs and ensure the standalone working of RouterBoard(connected
through ssh and not minicom)
1. Now we need to copy the persistent images from kamikaze 8.09/bin/ to the Board. On the MasterPC:

scp openwrt-ar71xx-vmlinux.elf openwrt-ar71xx-rootfs.tgz 10.129.50.153:/tmp/


2. Now switch back to the RouterBoard, and execute the following commands.

mount /dev/mtdblock1 /mnt/


mv /tmp/openwrt-ar71xx-vmlinux.elf /mnt/kernel
umount /mnt
mount /dev/mtdblock2 /mnt/
cd /mnt/
rm * -rf
tar -xzvf /tmp/openwrt-ar71xx-rootfs.tgz
cd ..
umount /mnt/
sync
3. This completes the persistent installation on the router board. Now reboot the Board(you know
how to do it !!), use o, then o again and x options to boot from the nand(persistent storage).

3.3

Persistent Network Settings


The below steps ensures that the Board is reachable from the MasterPC through the network.

1. Execute the following commands:

ifconfig br-lan down


brctl delbr br-lan
ifconfig eth0 down
ifconfig eth0 10.129.50.153 netmask 255.255.0.0 up
passwd
2. The above steps are a one time process after you have written into the nand.
3. You might want to execute some scripts everytime you boot up the board. Such commands can be
executed by making an entry in the /etc/rc.d/S99sysctl file.
5

3.3

Persistent Network Settings

802.11 PLATFORM

4. There are 2 ways of entering Network config information: Manually making entries in /etc/config/wireless and /etc/config/network, or Making an entry in S99sysctl mentioned above. I would
suggest you to do both however.
Making Manual entries:

/etc/config/network File contents


c o n f i g i n t e r f a c e loopback
o p t i o n ifname l o
option proto s t a t i c
option ipaddr 1 2 7 . 0 . 0 . 1
o p t i o n netmask 2 5 5 . 0 . 0 . 0
# A s s i g n i n g IP a d d r e s s t o t h e E t h e r n e t I n t e r f a c e
c o n f i g i n t e r f a c e eth0
o p t i o n ifname e t h 0
option proto s t a t i c
option ipaddr 10.129.50.153
o p t i o n netmask 2 5 5 . 2 5 5 . 1 2 8 . 0
# A s s i g n i n g IP a d d r e s s t o t h e Radio .
# Virutal I n t e r f a c e corresponding to w i f i 0 . [ Refer to / c o n f i g / w i r e l e s s ]
c o n f i g i n t e r f a c e ath0
o p t i o n ifname ath0
option proto s t a t i c
option ipaddr 1 9 2 . 1 6 8 . 6 4 . 1
o p t i o n netmask 2 5 5 . 2 5 5 . 1 9 2 . 0 # S e t t i n g n e t mask i s not t r i v i a l
/etc/config/network File contents
c o n f i g w i f i d e v i c e w i f i 0
o p t i o n type a t h e r o s
# A s s i g n i n g v i r u t a l i n t e r f a c e ath0 t o p h y s i c a l i n t e r f a c e w i f i 0 .
c o n f i g w i f i i f a c e ath0
option device w i fi 0
o p t i o n mode adhoc
o p t i o n s s i d mynetwork1
o p t i o n e n c r y p t i o n none
Making an entry in S99sysctl.

Contents of S99sysctl. Instructing it to execute /home/newmon.sh.


#!/ b i n / sh / e t c / r c . common
# Copyright (C) 2006 OpenWrt . o r g
START=99
start () {
[ f / e t c / s y s c t l . c o n f ] && s y s c t l p >&
/home/newmon . sh
6

! ! ; )

3.4

Wireless Commands

802.11 PLATFORM

}
Contents of /home/newmon.sh
w l a n c o n f i g ath0 d e s t r o y
w l a n c o n f i g ath0 c r e a t e wlandev w i f i 0 wlanmode adhoc
sleep 5
ath = i f c o n f i g a | g r e p ath | c u t f 1 d
i w c o n f i g ath c h a n n e l 36
i w c o n f i g ath e s s i d mynetwork1
i w c o n f i g ath txpower 15dbm
i w c o n f i g ath r a t e 18M f i x e d
i f c o n f i g ath down
i f c o n f i g ath 1 9 2 . 1 6 8 . 6 4 . 1 netmask 2 5 5 . 2 5 5 . 1 9 2 . 0 up
echo 0 > / p r o c / s y s / dev / w i f i 0 / d i v e r s i t y
echo 2 > / p r o c / s y s / dev / w i f i 0 / rxantenna
echo 2 > / p r o c / s y s / dev / w i f i 0 / txantenna

#rm /home/ o u t f i l e
#r e a d l o g /home/ o u t f i l e ath0 &
#o p t i o n a l d i s a b l i n g o f c a r r i e r s e n s i n g , CCA :
#s y s c t l w dev . w i f i 0 . d i s a b l e c c a =7
5. Now disconnect the serial cable and try accessing the RouterBoard using ssh. If you can, then you
are done with the installation.

3.4

Wireless Commands
The file mentioned above, newmon.sh, introduces you to a new set of commands that you could

execute to set the properties of your Radio. The following are some of the commands and their use.
1. ifconfig

ifconfig ath0 Displays the status of the specified interface. In case of missing interface name, it
displays status of all interfaces.

ifconfig ath0 down Causes the driver of the interface to shut down.
ifconfig ath0 192.168.64.1 netmask 255.255.192.0 up Causes the specified interface to start
up. Also assigns the specified ip and netmask for the interface.
2. iwconfig

iwconfig ath0 Displays the status of the specified wireless interface. (Channel information,
mode etc.)

iwconfig ath0 channel 36 Sets the working channel to channel no. 36. Needs interface restart
to take effect(described in ifconfig command).
7

3.5

Other Related Softwares

802.11 PLATFORM

iwconfig ath0 essid mynetwork1 Sets my essid to the given string. It should be noted that
nodes belonging to different essids cannot communicate.

iwconfig ath0 txpower 15dBm Sets the transmit power of wireless transciever to 15dBm.
iwconfig ath0 rate 18M fixed Sets the MAC sending rate to 18M, also disables the auto rate
selection algorithm.

iwconfig ath0 mode Ad-hoc Sets the working mode to adhoc. Other available options are
Master,Managed,Monitor etc. This can also be set using wlanconfig command.
3. wlanconfig

wlanconfig ath0 destroy Command specific to madwifi. Used to destroy an existing virtual
interface(ath0).

wlanconfig ath0 create wlandev wifi0 wlanmode adhoc Creates a virutal interface(ath0)
corresponding to physical interface(wifi0), in adhoc mode.
4. iwlist

iwlist ath0 channel Displays the set of available channels, along with the current channel.
iwlist ath0 scan Displays the set of other wireless ap/other nodes in the vicinity.
5. iwpriv
Displays the private commands specific to the driver that the interface uses, as against the
general commands provided by iwconfig. Feel free to explore more about it.

3.5

Other Related Softwares

You might require some other softwares to generate and receive packets, to generate related logs etc.
This section describes some of the tools that may be helpful for the same.
3.5.1

Readlog

This software is a packet capturing program that works at the MAC layer. It uses the Prism
header to generate per packet properties like signal strength, noise level etc. that may be helpful in
understanding communication patterns. However, it should be noted that some inconsistencies in the
behavior of readlog have been observed. Sometimes it generates multiple entries for the same packet.
Installing Readlog:

An executable of readlog is available. You can just paste it onto the board, to

the location /bin.


Using Readlog:
Readlog is intended to work at the receiving end. Also dont forget to daemonize it.
readlog [log filename] [interface] [Daemonize]

Example: readlog log ath0 &


Now for seeing the log, dont use cat log as the file is constantly written into. Instead you can use tail
-f log

3.5.2

802.15.4 PLATFORM

iPerf

This tool is a mean by which we can measure the quality and bandwidth of the link. It also provides
some useful statistics and data transmissions options. In its simplest form, it could also be used to
generate tcp/udp packets.
Installing iPerf:

An executable for iPerf is available. You can just copy paste it onto the board and

start using it. It might require additional library libstdc++.so.6, which should be copied to /lib.
Using iPerf: This example shows how to measure bandwidth using Udp traffic.
At the Receiver end : iperf -s -u -i2 , instructs iperf to work in server mode, accept udp traffic and
to generate log every 2 sec.
At the Sender end: iperf -c 192.168.64.2 -u -b20M -t20 , instructs the iperf client to contact
server at 192.168.64.2 and transfer udp packets at 20Mbps for 20 sec.

802.15.4 Platform

4.1

802.15.4 Platform Requirements

Components: Tmote Sky motes, USB extension Cables, Batteries.

4.2

Device Driver/OS installation on Motes

Motes require a OS to be installed onto them. We typically use TinyOS for this purpose because it
gives total control to us, leaving a lot of scope for modification. We need to install the Tiny Os packages
onto our system(Master PC). This process is described below, in detail. Then, we compile the modules to
generate the bootable image that can be installed on the motes. After this, the mote can be operating as
a standalone entity. Data logging can also be done by running a java backend program in the MasterPC
and by using printf statements.
4.2.1

Installing TinyOS onto the MasterPC

The latest version of TinyOs(as of this writing) is TinyOS 2.1.1. Though there are various ways to
install TinyOS onto your system, i am explaining the easiest way to do so. The other ways can be seen
here. In this manual, we describe how to install TinyOS 2.1.1 on a linux based Ubuntu OS. Goal: To
install TinyOS 2.1.1 onto the MasterPC and ensure its working and setting environment variables.

1. Add the following line to /etc/apt/sources.list that contains the list of ubuntu repositories. deb
http://tinyos.stanford.edu/tinyos/dists/ubuntu distro main.
For example, you might be using Ubuntu 10.04 Lucid. In that case you should include deb
http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main.
2. You should update the list of available softwares/packages, as you have added a new repository.
You can do this simply by pressing Reload in Synaptic Package manager or by using sudo apt-get
update.
3. You can install tinyos-2.1.1 by searching for the same, in the synaptic package manager. However,
you can also do the same manually by sudo apt-get install tinyos-2.1.1.

4.3

Logging using a backend Java program

802.15.4 PLATFORM

4. Allow the installation to complete. Once it is done, then add this line source /opt/tinyos-2.1.1/tinyos.sh
to your /.bashrc. This sets up the required environmental variables.
5. Restarting the terminal, if everything went on successfully, should result in a welcome message at
the starting.
4.2.2

Installing the image onto the Motes

Goal: To check if the installation went on well, we need to burn a sample program onto the Mote and
see if it is working.

1. Browse on to /opt/tinyos-2.1.1/apps/RadioCountToLeds. There you can find the files of the RadioCountToLeds application.
2. For installing this application onto the Mote, we need to compile the same. For this, using the
terminal, browse onto the above specified directory and execute the following command. make
telosb. This creates the required images in the directory ./build.
3. Now connect your mote onto the MasterPC using a USB cable. You can identify the terminal at
which the Mote resides, using motelist. This gives an output of the form /dev/ttyUSBx.
4. Now you can install the images onto the mote by specifying which terminal it resides on. Example:

make telosb reinstall bsl,/dev/ttyUSB0.


5. You can install the required program onto the other motes. The application, whose image is to be
burned, must be specified in the Makefile present in that directory.
6. You can test the application by just plugging in a pair of motes to the USB port.

4.3

Logging using a backend Java program

Goal: To run a backend java program to log some details.


1. You can specify the data to be logged by using printf statements. The syntax of printf is the same
as it is in C.
2. However, for using printf, you need to include #include

printf.h

in the .h file. Also you need to

include CFLAGS += -I(TOSDIR)/lib/printf to the Makefile.


3. After entering the above lines, you can recompile the code and reinstall it onto the Motes. Now
your mote keeps sending in the logs. You need to run a java program to capture these.
4. The inbuilt Java program to capture these logs can be run using java net.tinyos.tools.PrintfClient
-comm serial@/dev/ttyUSBXXX:telosb. Where USBxxx is the port at which your Mote resides.
Reducing the overhead due to Logging

It should be noted that the above logging process

involves a lot of context switching. This could end up degrading the throughput of your communication.
To reduce this overhead, you can print the logs on a periodic basis. If you are familiar with the printf
usage, you must also be knowing the use of printfflush(). That is, the logs are flushed onto the board
only when printfflush() is executed. So, this allows us to do extensive logging and still not degrade the
throughput, by flushing it once every 15 seconds or so.
10

4.3

Logging using a backend Java program

Allocating more buffer for storing the logs(on the mote)

802.15.4 PLATFORM

We know that the logs get stored

temporarily on the mote, until printfflush is used. This requires a buffer, the size of which is limited. In
order to increase the size of this buffer, you can modify the TinyOs code as shown below:
vim /opt/tinyos-2.1.1/tos/lib/printf/printf.h
Modify the definition

#ifndef PRINTF BUFFER SIZE


#define PRINTF BUFFER SIZE 8000
4.3.1

Increasing the size of the packet

Goal: To increase the size of the packet sent on air.


1. The payload size of the packet can be modified(by adding some other data variables) to as much
as 29 bytes. This limit is specified by the TinyOS message.h.
2. If you want to increase the size beyond 29 bytes, you can specify MSG SIZE = x bytes in the
Makefile. Make sure that this statement is among the starting lines of the Makefile. However, even
this x should be lesser than 116 bytes. This is limited by the current Mote hardware.
4.3.2

Changing the Channels of operation

Motes have around 16 channels of operation. The following the process to change the channel of
operation. It should be noted that the Motes share their channels of operation(2.4GHz band) with the
802.11b/g.
1. In the configuration file, add the component CC2420ControlC and wire it to the application file.
This is shown below:
components CC2420ControlC;
App.CC2420Config CC2420ControlC;
2. In the application file, add the component interface CC2420Config; under the uses part of the
module.
3. In the application file, during the startup phase(or wherever you require it), you can assign channel
of operation using
call CC2420Config.setChannel(22);
call CC2420Config.sync();.
4. The above code, changes the channel of operation to channel 22.

11

You might also like