cis 798 sensor network implementation. goals learning sensor network programming with crossbow motes...

20
CIS 798 Sensor Network Implementation

Upload: godwin-harold-oneal

Post on 03-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

CIS 798

Sensor Network Implementation

Page 2: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

Goals

• Learning sensor network programming with Crossbow motes

• Implement reasonable sized sensor applications

• Develop expertise to engage in more realistic sensor applications

Page 3: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

Platforms

• Crossbow Motes

• TinyOS

Page 4: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

• Student groups (2 students each)

• Lab groups

• Project groups

Page 5: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

Topics

• TinyOS programming

• Component based programming model

• System setup

Page 6: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop
Page 7: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop
Page 8: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop
Page 9: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

• Tutorials

• Help sessions

• Hardware

Page 10: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

commands

events

Components

provides uses

Interface: Bidirectional

Page 11: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

Interfaces

provides uses

Component: Provide or use multiple interfaces of the same type or different types

Page 12: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

Components

Simple components

Configuration

Page 13: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

Blink

This application simply causes the red LED on the mote to turn on and off at 1Hz

Page 14: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

BlinkBlink.nc configuration Blink {}implementation {  components Main, BlinkM, SingleTimer, LedsC;

  Main.StdControl -> BlinkM.StdControl;  Main.StdControl -> SingleTimer.StdControl;  BlinkM.Timer -> SingleTimer.Timer;  BlinkM.Leds -> LedsC;}

Page 15: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

Interface stdcontrolStdControl.nc interface StdControl {  command result_t init();  command result_t start();  command result_t stop();}

Page 16: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

Interface StdcontrolMain.StdControl -> BlinkM.StdControl;

When StdControl.init in Main is called, StdControl.init in BlinkM is automatically invoked

Page 17: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

BlinkM.ncmodule BlinkM {  provides {    interface StdControl;  }  uses {    interface Timer;    interface Leds;  }}

interface Timer {  command result_t start(char type, uint32_t interval);  command result_t stop();  event result_t fired();}

• start(): to specify the type of the timer and the interval at which the timer will expire;

• the fired() event is signaled when the specified interval has passed

Page 18: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

BlinkM.ncinterface Timer {  command result_t start(char type, uint32_t interval);  command result_t stop();  event result_t fired();}

interface Leds { async command result_t init(); async command result_t redOn(); async command result_t redOff(); async command result_t redToggle(); async command result_t greenOn(); async command result_t greenOff(); async command result_t greenToggle(); async command result_t yellowOn(); : :}

Page 19: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

BlinkM.nc

module BlinkM {  provides {    interface StdControl;  }  uses {    interface Timer;    interface Leds;  }}

implementation {

  command result_t StdControl.init() {    call Leds.init();    return SUCCESS;  }

  command result_t StdControl.start() {    return call Timer.start(TIMER_REPEAT, 1000) ;  }

  command result_t StdControl.stop() {    return call Timer.stop();  }

  event result_t Timer.fired()  {    call Leds.redToggle();    return SUCCESS;  }}

Page 20: CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop

Week 1

• Read lesson 1

• Install Tiny OS (or use machines in N22)

• Compile Blink

• Program mote to run Blink

• Modify Blink so that Led blinks for 10 secs and then stops for 5 secs (and this is repeated).