The document introduces TinyOS, nesC, and TOSSIM. TinyOS is an open-source operating system for wireless sensor networks. It is designed for low-power embedded devices and uses nesC as its programming language. TOSSIM simulates TinyOS applications by replacing hardware components with simulation implementations. The document discusses TinyOS and nesC programming, TOSSIM simulation, and troubleshooting TinyOS and TOSSIM.
Introduction to TinyOS, nesC and TOSSIM: An Application Perspective
1. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Introduction to TinyOS, nesC and TOSSIM:
An Application Perspective
Prakhar Bansal
Registration No. - 2011CS29
Computer Science and Engineering Department
Motilal Nehru National Institute of Technology Allahabad,
Allahabad, India
January 29, 2013
Prakhar Bansal, MNNIT Allahabad 1 / 29
TinyOS, nesC and TOSSIM
2. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
1 Introduction to TinyOS, nesC and TOSSIM
2 Introduction to Hardware
3 TinyOS Installation
4 TinyOS Programming using nesC
Mote-mote Radio Communication
Mote-PC Serial Communication
5 Simulation with TOSSIM
6 Troubleshooting
TinyOS-2.x versus TinyOS-1.x
Troubleshooting TinyOS-2.1.1
Troubleshooting TOSSIM
7 References
Prakhar Bansal, MNNIT Allahabad 2 / 29
TinyOS, nesC and TOSSIM
3. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
What is TinyOS?
free, open-source, BSD-licensed OS designed for low-power
embedded distributed wireless devices used in sensor networks
[1].
designed to support the concurrency intensive operations
required by networked sensors with minimal hardware
requirements.
developed by University of California, Berkeley, Intel Research
and Crossbow Technology.
written in nesC programming language [2].
Prakhar Bansal, MNNIT Allahabad 3 / 29
TinyOS, nesC and TOSSIM
4. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
What is nesC?
network embedded systems C, C optimized to support
components and concurrency [3].
component based, event driven programming language used
to build application for TinyOS platform.
components are wired together to run applications on TinyOS.
Programs = software components (connected statically via
interfaces).
Prakhar Bansal, MNNIT Allahabad 4 / 29
TinyOS, nesC and TOSSIM
5. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
What is TOSSIM?
simulates entire TinyOS applications [4].
replaces components with simulation implementations.
core code = tos/lib/tossim
2 interfaces: c++ and python.
Prakhar Bansal, MNNIT Allahabad 5 / 29
TinyOS, nesC and TOSSIM
6. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Introduction to Hardware
MICAz mote: MPR2400CA
Figure: MICAz mote
Prakhar Bansal, MNNIT Allahabad 6 / 29
TinyOS, nesC and TOSSIM
7. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
MICAz mote
2.4 GHz mote for enabling low-power wireless sensor networks.
IEEE 802.15.4 compliant Radio frequency transceiver.
radio, resistant to RF interference and provides inherent data
security.
Atmel128L, low power microcontroller.
51-pin expansion connector.
high speed (250 Kbps), hardware security (AES-128).
MICAz mote specification
Prakhar Bansal, MNNIT Allahabad 7 / 29
TinyOS, nesC and TOSSIM
8. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Sensor Board: MTS400CA
What can it sense?
acceleration: dual-axis acceleration sensor.
atmospheric pressure: barometric pressure sensor.
light: ambient light sensor.
humidity and temperature: relative humidity and temperature
sensor.
MTS400CA specification
Prakhar Bansal, MNNIT Allahabad 8 / 29
TinyOS, nesC and TOSSIM
9. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Sensor Board: MDA100CB
What can it sense?
light: light sensor and photocell.
92 unconnected soldering points.
51-pin connector.
MDA100CB specification
Prakhar Bansal, MNNIT Allahabad 9 / 29
TinyOS, nesC and TOSSIM
10. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Other Hardware
gateway, mib520
usb cable
AA Alkaline batteries
Prakhar Bansal, MNNIT Allahabad 10 / 29
TinyOS, nesC and TOSSIM
11. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
TinyOS Installation
TinyOS-2.1.1: Installation Steps for ubuntu linux
1 Add
“deb http://tinyos.standard.edu/tinyos/dists/ubuntu
[CODENAME] main” in /etc/opt/sources.list
OR add using synaptic [5].
2 To check linux codename use; lsb release − a command.
3 sudo apt-get update OR through synaptic.
4 synaptic; tinyos-2.1.1 install
path: /opt/tinyos-2.1.1
5 Add “source /opt/tinyos-2.1.1/tinyos.sh”line in ∼/.bashrc or
∼/.profile (superuser).
6 compile tinyos.jar and change permissions.
Prakhar Bansal, MNNIT Allahabad 11 / 29
TinyOS, nesC and TOSSIM
12. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
TinyOS Programming using nesC
Blink Application
make micaz install mib520,serial port
make micaz install mib520,/dev/ttyUSB0
change permissions.
Prakhar Bansal, MNNIT Allahabad 12 / 29
TinyOS, nesC and TOSSIM
13. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Understanding Blink Application
TinyOS Boot Sequence
understanding BlinkAppC.nc and BlinkC.nc
Interfaces: Init.nc, Scheduler.nc and Boot.nc
Configuration file: RealMainC.nc and module MainC.nc
LedsC.nc
Prakhar Bansal, MNNIT Allahabad 13 / 29
TinyOS, nesC and TOSSIM
14. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Documentation of TinyOS Programs
make micaz docs
tinyos-2.1.1/doc/nesdoc
Prakhar Bansal, MNNIT Allahabad 14 / 29
TinyOS, nesC and TOSSIM
15. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Mote-mote Radio Communication
Mote-mote Radio Communication
BlinktoRadio and BaseStation communications.
Prakhar Bansal, MNNIT Allahabad 15 / 29
TinyOS, nesC and TOSSIM
16. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Mote-PC Serial Communication
Mote-PC Serial Communication
TestSerial
mote will send data to PC on a serial-port.
java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:micaz
java net.tinyos.sf.SerialForwarder -comm
serial@/dev/ttyUSB0:micaz
java TestSerial
Packet format:
Figure: MICAz mote
Prakhar Bansal, MNNIT Allahabad 16 / 29
TinyOS, nesC and TOSSIM
17. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Mote-PC Serial Communication
MIG-tool: Message Interface Generator
/tests/TestSerial
compile java files
java net.tinyos.tools.MsgReader -comm
serial@/dev/ttyUSB1:micaz TestSerialMsg
Prakhar Bansal, MNNIT Allahabad 17 / 29
TinyOS, nesC and TOSSIM
18. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Mote-PC Serial Communication
BlinktoRadio/BaseStation
BlinktoRadio motes sends data to BaseStation.
Prakhar Bansal, MNNIT Allahabad 18 / 29
TinyOS, nesC and TOSSIM
19. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Mote-PC Serial Communication
Oscilloscope
SENSORBOARD=basicb/micasb make micaz install,1
mib510,/dev/ttyUSB0
Reading the sensor readings using GUI application.
Prakhar Bansal, MNNIT Allahabad 19 / 29
TinyOS, nesC and TOSSIM
20. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Simulation with TOSSIM
simulates entire TinyOS application [4]
TinyOS library
works by replacing components with simulation
implementations
core code = tos/lib/tossim
currently for micaz motes only
RadioCountToLeds
make micaz sim
writes xml schema
Prakhar Bansal, MNNIT Allahabad 20 / 29
TinyOS, nesC and TOSSIM
21. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Running TOSSIM with Python
from TOSSIM import *
t=Tossim([])
t.runNextEvent()
m=t.getNode(32);
m.bootAtTime(45654);
t.runNextEvent()
m.isOn()
m.turnOff()
dir(t)
Prakhar Bansal, MNNIT Allahabad 21 / 29
TinyOS, nesC and TOSSIM
22. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Printing using debugging statements
RadioCountToLeds; modify Boot.booted()
dbg(“Boot”, “Application booted”);
import sys
t.addChannel(“Boot”, sys.stdout);
t.addChannel(“RadioCountToLedsC”, sys.stdout);
t.runNextEvent()
Prakhar Bansal, MNNIT Allahabad 22 / 29
TinyOS, nesC and TOSSIM
23. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Configuring a Network
from TOSSIM import *
t = Tossim([])
r = t.radio()
dir(r)
r.add(src, dest, gain)
r.connected(src, dest)
r.gain(src, dest)
r.threshold()
r.setThreshold(val)
creating a topology from file
Prakhar Bansal, MNNIT Allahabad 23 / 29
TinyOS, nesC and TOSSIM
24. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Adding a Noise
tos/lib/tossim/noise
uses createNoiseModel()
meyer-heavy.txt
for node number i; t.getNode(i).addNoiseTraceReading(val)
for node number i; t.getNode(i).createNoiseModel()
t.getNode(1).bootAtTime(100001);
t.runNextEvent()
running directly from file
Prakhar Bansal, MNNIT Allahabad 24 / 29
TinyOS, nesC and TOSSIM
25. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
TinyOS-2.x versus TinyOS-1.x
TinyOS-2.x versus TinyOS-1.x
Replacement of Tinyviz (used in TinyOS-1.x)
no make pc, its make micaz sim
currently only for micaz motes
Prakhar Bansal, MNNIT Allahabad 25 / 29
TinyOS, nesC and TOSSIM
26. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Troubleshooting TinyOS-2.1.1
Troubleshooting TinyOS-2.1.1
lots of problem in setting paths and environment variables.
need to compile tinyos.jar
changing permissions of serial ports
do verify serial port
changing permissions of tinyos.jar
may be their is no class file in the folder, when running some
.class file, need to run make
Prakhar Bansal, MNNIT Allahabad 26 / 29
TinyOS, nesC and TOSSIM
27. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Troubleshooting TOSSIM
Troubleshooting TOSSIM
change in python version in
/opt/tinyos − 2.1.1/tos/lib/tossim/tossim wrap.cxx
Prakhar Bansal, MNNIT Allahabad 27 / 29
TinyOS, nesC and TOSSIM
28. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
References
TinyOS
http://www.tinyos.net.
TinyOS
http:
//docs.tinyos.net/tinywiki/index.php/Main_Page.
nesC
http://en.wikipedia.org/wiki/NesC.
TOSSIM Simulation
http://www.tinyos.net/dist-2.0.0/doc/html/
tutorial/lesson11.html.
TinyOS Installation
http://docs.tinyos.net/tinywiki/index.php/Getting_
started.
Prakhar Bansal, MNNIT Allahabad 28 / 29
TinyOS, nesC and TOSSIM
29. Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simu
Thankyou
Questions Please?
Prakhar Bansal, MNNIT Allahabad 29 / 29
TinyOS, nesC and TOSSIM