intoduction to tinyos, nesc and tossim
DESCRIPTION
This presentation is prepared for workshop session and is not in detail. You can ask your doubts here or you can email me at [email protected]. I'll try to answer to my best.TRANSCRIPT
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Introduction to TinyOS, nesC and TOSSIM:An Application Perspective
Prakhar BansalRegistration No. - 2011CS29
Computer Science and Engineering DepartmentMotilal Nehru National Institute of Technology Allahabad,
Allahabad, India
January 29, 2013Prakhar Bansal, MNNIT Allahabad 1 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
1 Introduction to TinyOS, nesC and TOSSIM
2 Introduction to Hardware
3 TinyOS Installation
4 TinyOS Programming using nesCMote-mote Radio CommunicationMote-PC Serial Communication
5 Simulation with TOSSIM
6 TroubleshootingTinyOS-2.x versus TinyOS-1.xTroubleshooting TinyOS-2.1.1Troubleshooting TOSSIM
7 References
Prakhar Bansal, MNNIT Allahabad 2 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
What is TinyOS?
free, open-source, BSD-licensed OS designed for low-powerembedded distributed wireless devices used in sensor networks[1].
designed to support the concurrency intensive operationsrequired by networked sensors with minimal hardwarerequirements.
developed by University of California, Berkeley, Intel Researchand Crossbow Technology.
written in nesC programming language [2].
Prakhar Bansal, MNNIT Allahabad 3 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
What is nesC?
network embedded systems C, C optimized to supportcomponents and concurrency [3].
component based, event driven programming language usedto build application for TinyOS platform.
components are wired together to run applications on TinyOS.
Programs = software components (connected statically viainterfaces).
Prakhar Bansal, MNNIT Allahabad 4 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Introduction to HardwareMICAz mote: MPR2400CA
Figure: MICAz mote
Prakhar Bansal, MNNIT Allahabad 6 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
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 datasecurity.
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Sensor Board: MTS400CAWhat can it sense?
acceleration: dual-axis acceleration sensor.
atmospheric pressure: barometric pressure sensor.
light: ambient light sensor.
humidity and temperature: relative humidity and temperaturesensor.
MTS400CA specification
Prakhar Bansal, MNNIT Allahabad 8 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Sensor Board: MDA100CBWhat 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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Other Hardware
gateway, mib520
usb cable
AA Alkaline batteries
Prakhar Bansal, MNNIT Allahabad 10 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
TinyOS InstallationTinyOS-2.1.1: Installation Steps for ubuntu linux
1 Add“deb http://tinyos.standard.edu/tinyos/dists/ubuntu[CODENAME] main” in /etc/opt/sources.listOR 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 installpath: /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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
TinyOS Programming using nesCBlink Application
make micaz install mib520,serial portmake micaz install mib520,/dev/ttyUSB0
change permissions.
Prakhar Bansal, MNNIT Allahabad 12 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Understanding Blink ApplicationTinyOS 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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Documentation of TinyOS Programs
make micaz docs
tinyos-2.1.1/doc/nesdoc
Prakhar Bansal, MNNIT Allahabad 14 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Mote-mote Radio Communication
Mote-mote Radio Communication
BlinktoRadio and BaseStation communications.
Prakhar Bansal, MNNIT Allahabad 15 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Mote-PC Serial Communication
Mote-PC Serial CommunicationTestSerial
mote will send data to PC on a serial-port.java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:micazjava net.tinyos.sf.SerialForwarder -commserial@/dev/ttyUSB0:micazjava TestSerialPacket format:
Figure: MICAz mote
Prakhar Bansal, MNNIT Allahabad 16 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Mote-PC Serial Communication
MIG-tool: Message Interface Generator
/tests/TestSerial
compile java files
java net.tinyos.tools.MsgReader -commserial@/dev/ttyUSB1:micaz TestSerialMsg
Prakhar Bansal, MNNIT Allahabad 17 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Mote-PC Serial Communication
BlinktoRadio/BaseStation
BlinktoRadio motes sends data to BaseStation.
Prakhar Bansal, MNNIT Allahabad 18 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Mote-PC Serial Communication
Oscilloscope
SENSORBOARD=basicb/micasb make micaz install,1mib510,/dev/ttyUSB0
Reading the sensor readings using GUI application.
Prakhar Bansal, MNNIT Allahabad 19 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Simulation with TOSSIM
simulates entire TinyOS application [4]
TinyOS library
works by replacing components with simulationimplementations
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
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
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
References
TinyOShttp://www.tinyos.net.
TinyOShttp:
//docs.tinyos.net/tinywiki/index.php/Main_Page.
nesChttp://en.wikipedia.org/wiki/NesC.
TOSSIM Simulationhttp://www.tinyos.net/dist-2.0.0/doc/html/
tutorial/lesson11.html.
TinyOS Installationhttp://docs.tinyos.net/tinywiki/index.php/Getting_
started.Prakhar Bansal, MNNIT Allahabad 28 / 29
TinyOS, nesC and TOSSIM
Introduction to TinyOS, nesC and TOSSIM Introduction to Hardware TinyOS Installation TinyOS Programming using nesC Simulation with TOSSIM Troubleshooting References
Thankyou
Questions Please?
Prakhar Bansal, MNNIT Allahabad 29 / 29
TinyOS, nesC and TOSSIM