Introduction to TinyOS

Similar documents
Politecnico di Milano Advanced Network Technologies Laboratory. Internet of Things. TinyOS Programming and TOSSIM (and Cooja)

Politecnico di Milano Advanced Network Technologies Laboratory. Internet of Things. TinyOS Programming and TOSSIM

WSN Programming. Introduction. Olaf Landsiedel

WSN Programming. Introduction. Olaf Landsiedel. Programming WSNs. ! What do we need to write software for WSNs?! Programming language

Politecnico di Milano Advanced Network Technologies Laboratory. Internet of Things. TinyOS Programming and TOSSIM (and Cooja)

Politecnico di Milano Advanced Network Technologies Laboratory. TinyOS

A Virtual Machine-Based Programming Environment for Rapid Sensor Application Development

Wireless Sensor Networks

Enabling Networked Sensors

Wireless Sensor Networks (WSN)

Wireless Systems Laboratory 4 November 2013

Sistemas Distribuídos com Redes de Sensores. Noemi Rodriguez

Complete Network Embedded System

Programming Sensor Networks

Advanced Distributed Systems

Introduction to Programming Motes

Interfacing Java-DSP with Sensor Motes

TinyOS Tutorial. Greg Hackmann CSE 521S Fall 2010

TinyOS 2.x. Hongwei Zhang

Implementation of Gradient Routing in WSNs

NesJ: a translator for Java to NesC

ITEM, TinyOS module for sensor networks

Übersicht. Laufzeitumgebungen Fallstudie TinyOS

TinyOS. Wireless Sensor Networks

Microcontroller VU

ProxyMotes: Linux-based TinyOS Platform for Non-TinyOS Sensors and Actuators

Sensor Network Application Development ZIGBEE CONCEPTS 0

TOSSIM. Răzvan Musăloiu-E.

Metrics for Sensor Network Platforms

00 Modeling and Analysis of TinyOS Sensor Node Firmware: A CSP Approach

Internship at Sentilla. Chris Merlin March 08 - June 08

CSC 774 Advanced Network Security

Mobile and Ubiquitous Computing Routing Protocols. Niki Trigoni

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software!

Exposure to Sensor Motes

Wireless Embedded Systems and Networking. How to get TinyOS open source dist.

Porting TinyOS to an Amulet2e Sensor Mote

The industrial technology is rapidly moving towards ARM based solutions. Keeping this in mind, we are providing a Embedded ARM Training Suite.

Inter-Context Control-Flow Graph for NesC, with Improved Split-Phase Handling

Terra System Low abstraction level built-in functionalities (TerraNet v0.2) Introduction & user guide Adriano Branco

}w!"#$%&'()+,-./012345<ya

A Domain-Specific Modeling for Dynamically Reconfigurable Environmental Sensing Applications

nesc Ø Programming language for TinyOS and applications Ø Support TinyOS components Ø Whole-program analysis at compile time Ø Static language

Networking Level Laboratory WSN Software Platform TinyOS: Installation and Configuration

VORAGO VA108x0 GCC IDE application note

TinyOS Tutorial. Greg Hackmann CSE 467S Spring 2011

Indriya_DP_03A14. Features. Block Diagram. XBEE based Wireless Sensor Network development platform

Embedded System Design : Project Specification Crowd Information Monitor

Localization Software Setup Manual

TinyOS. Jan S. Rellermeyer

TOSSIM simulation of wireless sensor network serving as hardware platform for Hopfield neural net configured for max independent set

Worldsens : Development and Prototyping Tools for Application Specific Wireless Sensors Networks

Towards a Resilient Operating System for Wireless Sensor Networks

TinyOS. Lecture Overview. UC Berkeley Family of Motes. Mica2 and Mica2Dot. MTS300CA Sensor Board. Programming Board (MIB510) 1.

The Emergence of Networking Abstractions and Techniques in TinyOS

EMBEDDED HARDWARE. Core Board. ARM7 Development board. ARM7 Evaluation Board. Page 1 of 5

Networking Level Laboratory Mote-Computer Serial Communication

Development Environment of Embedded System

Advanced Embedded Systems

KMote - Design and Implementation of a low cost, low power platform for wireless sensor networks. Naveen Madabhushi

System Energy Efficiency Lab seelab.ucsd.edu

CM5000 DATASHEET v0.1

Intel Research mote. Ralph Kling Intel Corporation Research Santa Clara, CA

MYD-Y6ULX Development Board

A Distributed Particle Filter Implementation for Tracking in a Wireless Sensor Network

Microcontroller: CPU and Memory

ArduCAM CC3200 UNO board

An Environmental Sensing Experiment Using IEEE Radio Hop of the WSN TelosB Motes

Hands-On with STM32 MCU Francesco Conti

System Architecture Directions for Networked Sensors[1]

Self-Organization in Autonomous Sensor/Actuator Networks [SelfOrg]

Sensor Networks. Dr. Sumi Helal & Jeff King CEN 5531

CoLinkEx_LPC11C14 EVB Kit User Guide

Lab Course Microcontroller Programming

EMBEDDED SYSTEMS WITH ROBOTICS AND SENSORS USING ERLANG

The Once and Future Internet of EveryThing

Reminder. Course project team forming deadline. Course project ideas. Friday 9/8 11:59pm You will be randomly assigned to a team after the deadline

Advanced Distributed Systems

Network Embedded Systems Sensor Networks Fall Hardware. Marcus Chang,

Hands on Experience with AVR32

Integrating Concurrency Control and Energy Management in Device Drivers

Armstrap Documentation

TKN. Technical University Berlin. T2: A Second Generation OS For Embedded Sensor Networks

T2: A Second Generation OS For Embedded Sensor Networks

PXA270 EPIC Computer with Power Over Ethernet & Six Serial Protocols SBC4670

The Emergence of Networking Abstractions and Techniques in TinyOS

Embedded OSes. Carolyn Keenan, Ian Perera, Yu Zhong

Politecnico di Milano Advanced Network Technologies Laboratory. Internet of Things. Contiki and Cooja

How to set up the TinyOS environment on Debian

Architectures and Applications for Wireless Sensor Networks ( ) Node Programming

A VIRTUALLAB APPROACH FOR WIRELESS SENSOR MOTES AND WIRELESS SENSOR NETWORKS

Energy-aware Reconfiguration of Sensor Nodes

Group Members: Chetan Fegade Nikhil Mascarenhas. Mentor: Dr. Yann Hang Lee

ECE 480 Team 5 Introduction to MAVRK module

General Data Acquisition Platform for Wireless Sensor Network Based on CC2538

MYD-IMX28X Development Board

Nano RK And Zigduino. wnfa ta course hikaru4

Lab 1: I/O, timers, interrupts on the ez430-rf2500

MV 4412 Android 4.0 Compilation

386EX PC/104 Computer with CompactFlash and PCMCIA SBC1390

Transcription:

Fakultät Informatik Institut für Systemarchitektur Professur Rechnernetze Introduction to TinyOS Jianjun Wen 21.04.2016

Outline Hardware Platforms Introduction to TinyOS Environment Setup Project of This Semester 2

Hardware Platform mote type Telosb intelmote2 processor memory - msp430 16 bits - 8 MHz - 48 KB ROM - 10 KB RAM - pxa271 xscale 32bits - 13 MHz ~ 104 MHz - 32 MB FLASH - 256 KB SRAM - 32 MB SDRAM storage 1 MB external Flash - 32 MB FLASH (shared) radio CC2420 (IEEE 802.15.4) CC2420 (IEEE 802.15.4) programming USB JTAG sensors Light, Temperature, Humidity on sensor board: - 3D accelerometer - temperature, humidity - light 3

TelosB light sensor temp./ humidity sensor CC2420 radio 4

IntelMote2 CC2420 radio PXA271 processor reset button power input 5

IntelMote2 - sensor board temperature sensor (I2C) humidity sensor (I2C) 3D accelerometer (SPI) 6

TinyOS What is TinyOS - operating system, but not full-fledged - designed for low-power wireless embedded systems - task scheduler + collection of device drivers - component based and event driven - static resource management (no malloc and free ) - running as single application - written in NesC (C dialect) 7

A TinyOS Application an example of application application uses uses configuration comc implementation componenta.interfacea->componentb.interfacea wiring interfacea interface uses uses component A component uses uses interface provides component interface uses interface module comp uses interface InterfaceA; implementation sometask provides component B provides hardware platform component provides interface A command cmd_1(.. ); event void event_x(.. ); 8

Basic Concept of TinyOS component - reusable pieces of code - similar to Class, groups related functionality into a single unit. e.g LedsC, TimerC - two types: module and configuration interface - access points to a component - define the operation specification: commands & events 9

Blink Example module BlinkC @safe() uses interface Timer<TMilli> as Timer0; uses interface Timer<TMilli> as Timer1; uses interface Timer<TMilli> as Timer2; uses interface Leds; uses interface Boot; implementation event void Boot.booted() call Timer0.startPeriodic( 250 ); call Timer1.startPeriodic( 500 ); call Timer2.startPeriodic( 1000 ); event void Timer0.fired() call Leds.led0Toggle(); BlinkC.nc configuration BlinkAppC implementation components MainC, BlinkC, LedsC; components new TimerMilliC() as Timer0; components new TimerMilliC() as Timer1; components new TimerMilliC() as Timer2; BlinkC -> MainC.Boot; BlinkC.Timer0 -> Timer0; BlinkC.Timer1 -> Timer1; BlinkC.Timer2 -> Timer2; BlinkC.Leds -> LedsC; interface Leds /** * Toggle LED 0; if it was off, turn it on, if was on, turn it off. */ async command void led0toggle(); /** * Turn on LED 1. The color of this LED */ async command void led1on(); Leds.nc BlinkAppC.nc 10

Component: Module module BlinkC component name uses interface Timer<TMilli> as Timer0; uses interface Timer<TMilli> as Timer1; uses interface Timer<TMilli> as Timer2; uses interface Leds; interface specification uses interface Boot; implementation event void Boot.booted() call Timer0.startPeriodic( 1. variable definition 250 ); call Timer1.startPeriodic( 2. logic implementation 500 ); call Timer2.startPeriodic( command, event 1000 etc. ); module: two parts - interface specification ->provide and use - code implementation -> define variables, functions -> implement interface commands and events BlinkC.nc 11

Component: Module module BlinkC uses interface Timer<TMilli> as Timer0; uses interface Timer<TMilli> as Timer1; uses interface Timer<TMilli> as Timer2; uses interface Leds; uses interface Boot; implementation event void Boot.booted() call Timer0.startPeriodic( 250 ); call Timer1.startPeriodic( 500 ); call Timer2.startPeriodic( 1000 ); unique name module: two parts - interface specification ->provide and use - code implementation -> define variables, functions -> implement interface commands and events event void Timer0.fired() call Leds.led0Toggle(); BlinkC.nc 12

Component: Module module BlinkC uses interface Timer<TMilli> as Timer0; uses interface Timer<TMilli> as Timer1; uses interface Timer<TMilli> as Timer2; uses interface Leds; uses interface Boot; implementation event void Boot.booted() invoke command call Timer0.startPeriodic( 250 ); call Timer1.startPeriodic( 500 ); call Timer2.startPeriodic( 1000 ); module: two parts - interface specification ->provide and use - code implementation -> define variables, functions -> implement interface commands and events event void Timer0.fired() call Leds.led0Toggle(); BlinkC.nc 13

Component: Configuration configuration BlinkAppC implementation components MainC, BlinkC, LedsC; components new TimerMilliC() as Timer0; components new TimerMilliC() as Timer1; components new TimerMilliC() as Timer2; configuration - similar to module - difference: connect components into larger abstractions BlinkC -> MainC.Boot; BlinkC.Timer0 -> Timer0; BlinkC.Timer1 -> Timer1; BlinkC.Timer2 -> Timer2; BlinkC.Leds -> LedsC; wiring: connect two components together 14

Component: Configuration configuration BlinkAppC implementation components MainC, BlinkC, LedsC; components new TimerMilliC() as Timer0; components new TimerMilliC() as Timer1; components new TimerMilliC() as Timer2; components declaration BlinkC -> MainC.Boot; BlinkC.Timer0 -> Timer0; BlinkC.Timer1 -> Timer1; BlinkC.Timer2 -> Timer2; BlinkC.Leds -> LedsC; configuration - similar to module - difference: connect components into larger abstractions wiring: connect two components together 15

Component: Configuration configuration BlinkAppC implementation components MainC, BlinkC, LedsC; components new TimerMilliC() as Timer0; components new TimerMilliC() as Timer1; components new TimerMilliC() as Timer2; BlinkC -> MainC.Boot; user -> provider BlinkC.Timer0 -> Timer0; BlinkC.Timer1 -> Timer1; BlinkC.Timer2 -> Timer2; BlinkC.Leds -> LedsC; wiring together configuration - similar to module - difference: connect components into larger abstractions wiring: connect two components together wiring operator: ->, <-, = 16

Component: Configuration configuration BlinkAppC implementation components MainC, BlinkC, LedsC; components new TimerMilliC() as Timer0; components new TimerMilliC() as Timer1; components new TimerMilliC() as Timer2; configuration - similar to module - difference: connect components into larger abstractions BlinkC -> MainC.Boot; BlinkC.Timer0 -> Timer0; BlinkC.Timer1 -> Timer1; BlinkC.Timer2 -> Timer2; BlinkC.Leds -> LedsC; module BlinkC uses interface Timer<TMilli> as Timer0; uses interface Timer<TMilli> as Timer1; uses interface Timer<TMilli> as Timer2; uses interface Leds; uses interface Boot; implementation event void Boot.booted() 17

Generic Component singleton component: only one instance exists - components are singletons in TinyOS by default generic component: can have multiple instances configuration BlinkAppC implementation components MainC, BlinkC, LedsC; components new TimerMilliC() as Timer0; components new TimerMilliC() as Timer1; components new TimerMilliC() as Timer2; generic singleton generic configuration TimerMilliC() provides interface Timer<TMilli>; implementation 18

Interface interface - a group of logically related functions uses user - commands & events - bidirectional interaction interface command event provides provider interface Timer<precision_tag> /** * Set a periodic timer to repeat every dt time units. */ command void void startperiodic(uint32_t dt); /** * Signalled when the timer expires * (one-shot) or repeats (periodic). */ event void fired(); must be implemented in provider called by user must be implemented in user signalled by provider 19

How they combined uses BlinkAppC uses uses Boot Leds Timer provides provides provides MainC LedsC Timer0 (TimerMilliC) Timer2 (TimerMilliC) uses uses RealMainP LedsP Timer uses uses provides Init provides TinySchedulerC provides GeneralIO HilTimerMilliC PlatformC PlatformLedsC AlarmMilli32C 20

Make It Executable! cross compiling process 1. race detection 2. generate a single c file TinyOS Application NesC Compiler xx.nc app.c install binary Cross Compiler 21

What is Cross Compiler A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running [wikipedia] BlinkAppC Leds uses Blink Application provides led0 -> port54 led1 -> port55 led2 -> port56 LedsC LedsP led0 -> GPIO103 led1 -> GPIO104 led2 -> GPIO105 msp430-gcc xscale-elf-gcc avr-gcc GeneralIO exe binary exe binary exe binary PlatformLedsC PlatformLedsC telosb Imote2 MicaZ HplMsp430GeneralIOC HplPXA27xGPIOC telesb imote2 22

Installation-TinyOS Download and install TinyOS source code wget http://github.com/tinyos/tinyos-release/archive/tinyos-2_1_2.tar.gz tar -zxvf tinyos-2_1_2.tar.gz Setup environment: put following lines into tinyos.env change to your own location * to make these environment variables permanently accessible, add following line to ~/.profile : source <file-location>/tinyos.env 23

Installation - tool chains Install cross compiler for imote2 - xscale-elf-* is the specific tool chains for xscale processor - common arm-cross-tool-chain can also be used here e.g arm-none-eabi-* wget http://sing.stanford.edu/intelmote2/tools/linux/xscale-elfbinutils-2.15-2.i386.deb wget http://sing.stanford.edu/intelmote2/tools/linux/xscale-elfgcc-3.4.3-2.i386.deb wget http://sing.stanford.edu/intelmote2/tools/linux/xscale-elfnewlib-1.13.0-1.i386.deb sudo dpkg -i <tool-name>.deb 24

Installation - tool chains(cond.) OpenOCD: open on-chip debugger - debugging - in system programming installation, please refer to: http://tinyos.stanford.edu/tinyos-wiki/index.php/openocd_for_imote2 25

Installation - tool chains(cond.) Install nesc tool chains - xscale-elf-* is the specific tool chains for xscale processor - common arm-cross-tool-chain can also be used here e.g arm-none-eabi-* wget http://tinyos.stanford.edu/tinyos/dists/ubuntu/pool/main/n/ nesc/nesc_1.3.4-20120709_i386.deb wget http://www.tinyos.net/dist-2.1.0/tinyos/linux/tinyosdeputy-1.1-1.fc9.i386.rpm wget http://tinyos.stanford.edu/tinyos-rpms/tinyostools-1.4.0-3.ubuntu.i386.rpm sudo alien -i <tool-name>.rpm 26

Let s do it! 27

Our Project project description (summer semester 2016) task 1: sensing - temperature, humidity, 3D accelerometer - transmission strategy: 1. send what you got immediately; 2. combine them in one packet. task 2: MAC protocol - duty cycling -> energy efficiency - contention based, contention free X-MAC, RI-MAC, or TDMA 28

Our Project (cond.) project description (summer semester 2016) task 3: routing protocol - multi-hop - CTP? task 4: data collection (sensor network to PC ) - basestation -> PC, serial communication - printf like? - data storage: database or file-like 29

Our Project (cond.) project description (summer semester 2016) task 5: presentation - GUI application on PC - display sensing data in real time - other statistical analysis: max, min, average task 6: integration - integrate all above togethers and test. 30

Project Overview link task 2 + task 3 task 4 serial comm basestation / gateway task 5 sensor nodes task 1 relay nodes task 6 31

some hint some useful interfaces and components task 1: sensing - components LIS3L02DQC -> 3D accelerometer - components TMP175C -> temperature - components Tsl2561C -> light - components SensirionSht11C -> humidity/temperature - interface Timer<TMilli> - interface Read<uint16_t> * please refer to: $TOSROOT/tos/sensorboards/im2sb/examples/ 32

some hint some useful interfaces and components task 2 + 3: communication in WSN - components ActiveMessageC - components AMsenderC - components AMReceiverC - interface LowPowerListening - interface AMSend - interface Receive * please refer to: $TOSROOT/apps/tests/TestLpl $TOSROOT/apps/tests/TestNetwork or TestNetworkLpl 33

some hint some useful interfaces and components task 4: serial communication (mote side) - components ActiveMessageC - components SerialActiveMessageC - interface AMSend - interface Receive task 4: pc sides - database: sqlite, mysql.. or save as cvs file * please refer to: $TOSROOT/apps/BaseStation 34

some hint some useful interfaces and components task 5: presentation - python, java, c/c++, whatever you prefer - some framework you can use: - wxpython, AWT?, Qt4.. 35

about problem virtual machine virtual machine: https://www.dropbox.com/s/ntclm5zgrurjgqe/vm-wsnproject.zip?dl=0 mailing list mailing list: https://mailman.zih.tu-dresden.de/groups/listinfo/sya-rn-wsn using subject: [WSN]: problem 36

reference [1] TinyOS official website: www.tinyos.net [2] TinyOS wiki: http://tinyos.stanford.edu/tinyos-wiki/index.php/main_page [3] Programming TinyOS, David Culler, Phil Levis, Rob Szewczyk, Joe Polastre University of California, BerkeleyIntel Research Berkeley 37

Thanks! 38