Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

66
Architectures and Architectures and Applications for Wireless Applications for Wireless Sensor Networks (204525) Sensor Networks (204525) Single-Node Architecture Single-Node Architecture Chaiporn Jaikaeo [email protected] Department of Computer Engineering Kasetsart University Materials taken from lecture slides by Karl and Willig Contiki materials taken from slides by Adam Dunkels

description

Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture. Chaiporn Jaikaeo [email protected] Department of Computer Engineering Kasetsart University. Materials taken from lecture slides by Karl and Willig. - PowerPoint PPT Presentation

Transcript of Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Page 1: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Architectures and Applications Architectures and Applications for Wireless Sensor Networks for Wireless Sensor Networks

(204525)(204525)

Single-Node ArchitectureSingle-Node Architecture

Chaiporn [email protected]

Department of Computer EngineeringKasetsart UniversityMaterials taken from lecture slides by Karl and Willig

Contiki materials taken from slides by Adam Dunkels

Page 2: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

OutlineOutline Main components of a wireless Main components of a wireless

sensor nodesensor node Processor, radio, sensors, batteriesProcessor, radio, sensors, batteries

Energy supply and consumptionEnergy supply and consumption Operating systems and execution Operating systems and execution

environmentsenvironments IWING's MoteLibIWING's MoteLib TinyOSTinyOS ContikiContiki

Example implementationsExample implementations

Page 3: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Main ComponentsMain Components

Communication Communication DeviceDevice ControllerController Sensors/Sensors/

ActuatorsActuators

Power SupplyPower Supply

MemoryMemory

Page 4: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

ControllerController Main options: Main options:

MicrocontrollerMicrocontroller – general purpose – general purpose processor, optimized for embedded processor, optimized for embedded applications, low power consumptionapplications, low power consumption

DSPDSP – optimized for signal processing – optimized for signal processing tasks, not suitable heretasks, not suitable here

FPGAFPGA – may be good for testing – may be good for testing ASICASIC – only when peak performance is – only when peak performance is

needed, no flexibilityneeded, no flexibility

Page 5: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Example MicrocontrollersExample Microcontrollers Texas Instruments Texas Instruments

MSP430MSP430 16-bit RISC core, 4 MHz16-bit RISC core, 4 MHz Up to 120 KB flashUp to 120 KB flash 2-10 KB RAM2-10 KB RAM 12 ADCs, RT clock12 ADCs, RT clock

Atmel ATMegaAtmel ATMega 8-bit controller, 8 MHz8-bit controller, 8 MHz Up to 128KB FlashUp to 128KB Flash 4 KB RAM4 KB RAM

Page 6: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Communication DeviceCommunication Device Medium optionsMedium options

Electromagnetic, RFElectromagnetic, RF Electromagnetic, opticalElectromagnetic, optical UltrasoundUltrasound

RadioRadioTransceiverTransceiver

radio waveradio wave

bit streambit stream

Page 7: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Transceiver Transceiver CharacteristicsCharacteristics Service to upper layer: packet, byte, Service to upper layer: packet, byte,

bitbit Power consumptionPower consumption Supported frequency, multiple Supported frequency, multiple

channelschannels Data rateData rate ModulationModulation Power controlPower control Communication rangeCommunication range etc.etc.

Page 8: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Transceiver StatesTransceiver States Transceivers can be put into Transceivers can be put into

different operational different operational statesstates, , typically: typically: TransmitTransmit ReceiveReceive IdleIdle – ready to receive, – ready to receive,

but not doing sobut not doing so SleepSleep – significant parts – significant parts

of the transceiver are of the transceiver are switched offswitched off

RxRxTxTx IdleIdle

SleepSleep

Page 9: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Wakeup ReceiversWakeup Receivers When to switch on a receiver is not clearWhen to switch on a receiver is not clear

Contention-based MAC protocols: Receiver is Contention-based MAC protocols: Receiver is always on always on

TDMA-based MAC protocols: Synchronization TDMA-based MAC protocols: Synchronization overhead, inflexibleoverhead, inflexible

Desirable: Receiver that can (only) check Desirable: Receiver that can (only) check for incoming messages for incoming messages When signal detected, wake up main receiver When signal detected, wake up main receiver

for actual receptionfor actual reception Ideally: Ideally: Wakeup receiverWakeup receiver can already process can already process

simple addressessimple addresses Not clear whether they can be actually built, Not clear whether they can be actually built,

howeverhowever

Page 10: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Optical CommunicationOptical Communication Optical communication can consume less Optical communication can consume less

energyenergy Example: passive readout via corner cube Example: passive readout via corner cube

reflectorreflector Laser is reflected back directly to source if Laser is reflected back directly to source if

mirrors are at right anglesmirrors are at right angles Mirrors can be “tilted” Mirrors can be “tilted”

to stop reflecting to stop reflecting Allows data to be Allows data to be

sent back to sent back to laser source laser source

200 µm

Page 11: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Ultra Wideband Ultra Wideband CommunicationCommunication Use a large bandwidth, do Use a large bandwidth, do

not modulate, simply emit a not modulate, simply emit a “burst” of power “burst” of power

AdvantagesAdvantages Pretty resilient to multi-path Pretty resilient to multi-path

propagationpropagation Very good ranging capabilitiesVery good ranging capabilities Good wall penetrationGood wall penetration

http://www.soumu.go.jp/joho_tsusin/eng/Releases/NewsLetter/Vol15/Vol15_01/2-UWB-1.jpg http://www.ixbt.com/comm/images/uwb/uwb1.png

Page 12: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

SensorsSensors Main categoriesMain categories

Passive, omnidirectional Passive, omnidirectional Examples: light, thermometer, microphones, Examples: light, thermometer, microphones,

hygrometer, …hygrometer, … Passive, narrow-beamPassive, narrow-beam

Example: CameraExample: Camera Active sensorsActive sensors

Example: RadarExample: Radar

Important parameter: Area of coverageImportant parameter: Area of coverage Which region is adequately covered by a Which region is adequately covered by a

given sensor? given sensor?

Page 13: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

OutlineOutline Main components of a wireless Main components of a wireless

sensor nodesensor node Processor, radio, sensors, batteriesProcessor, radio, sensors, batteries

Energy supply and consumptionEnergy supply and consumption Operating systems and execution Operating systems and execution

environmentsenvironments IWING's MoteLibIWING's MoteLib TinyOSTinyOS ContikiContiki

Example implementationsExample implementations

Page 14: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Energy SupplyEnergy Supply Goal: provide as much energy as Goal: provide as much energy as

possible at smallest possible at smallest cost/volume/weight/recharge cost/volume/weight/recharge time/longevity time/longevity In WSN, recharging may or may not be In WSN, recharging may or may not be

an optionan option OptionsOptions

Primary batteriesPrimary batteries – not rechargeable – not rechargeable Secondary batteriesSecondary batteries – rechargeable, – rechargeable,

only makes sense in combination with only makes sense in combination with some form of energy harvestingsome form of energy harvesting

Page 15: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Energy Supply - Energy Supply - RequirementsRequirements Low self-dischargeLow self-discharge Long shelf lifeLong shelf life Capacity under load Capacity under load Efficient recharging at low currentEfficient recharging at low current Good relaxation properties (seeming Good relaxation properties (seeming

self-recharging)self-recharging) Voltage stability (to avoid DC-DC Voltage stability (to avoid DC-DC

conversion)conversion)

Page 16: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Battery examplesBattery examples Energy per volume (Joule/cc): Energy per volume (Joule/cc):

Primary batteriesPrimary batteriesChemistryChemistry Zinc-airZinc-air LithiumLithium AlkalineAlkalineEnergy Energy (J/cm(J/cm33))

37803780 28802880 12001200

Secondary batteriesSecondary batteriesChemistryChemistry LithiumLithium NiMHNiMH NiCdNiCdEnergy Energy (J/cm(J/cm33))

10801080 860860 650650

Page 18: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Multiple Power Consumption Multiple Power Consumption ModesModes Do not run sensor node at full operation Do not run sensor node at full operation

all the timeall the time If nothing to do, switch to power safe modeIf nothing to do, switch to power safe mode

Typical modesTypical modes Controller: Active, idle, sleepController: Active, idle, sleep Radio mode: Turn on/off transmitter/receiver, Radio mode: Turn on/off transmitter/receiver,

bothboth Strongly depends on hardwareStrongly depends on hardware

Questions: Questions: When to throttle down? When to throttle down? How to wake up again? How to wake up again?

Page 19: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Energy Consumption Energy Consumption FiguresFigures TI MSP 430 (@ 1 MHz, 3V): TI MSP 430 (@ 1 MHz, 3V):

Fully operation 1.2 mW Fully operation 1.2 mW One fully operational mode + four sleep One fully operational mode + four sleep

modesmodes Deepest sleep mode 0.3 Deepest sleep mode 0.3 W – only woken W – only woken

up by external interrupts (not even timer is up by external interrupts (not even timer is running any more)running any more)

Atmel ATMegaAtmel ATMega Operational mode: 15 mW active, 6 mW Operational mode: 15 mW active, 6 mW

idleidle Six modes of operationsSix modes of operations Sleep mode: 75 Sleep mode: 75 W W

Page 20: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Switching Between ModesSwitching Between Modes Simplest idea: Greedily switch to Simplest idea: Greedily switch to

lower mode whenever possiblelower mode whenever possible Problem: Time and power Problem: Time and power

consumption required to reach consumption required to reach higher modes not negligible higher modes not negligible

Pactive

Psleep

timeteventt1

Esaved

down up

Eoverhead

Page 21: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Should We Switch?Should We Switch? Switching modes is beneficial ifSwitching modes is beneficial if

which is equivalent towhich is equivalent to

upsleepactive

sleepactivedownevent PP

PPtt

2

1)( 1

EEoverheadoverhead < < EEsavedsaved

Page 22: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Computation vs. Computation vs. Communication Energy CostCommunication Energy Cost Sending one bitSending one bit vs. vs. running one running one

instructioninstruction Energy ratio up to Energy ratio up to 29002900::11 I.e., send & receive one KB = running three I.e., send & receive one KB = running three

million instructionmillion instruction So, So, try to compute instead of try to compute instead of

communicate whenever possiblecommunicate whenever possible Key technique – Key technique – in-network in-network

processingprocessing Exploit compression schemes, intelligent Exploit compression schemes, intelligent

coding schemes, aggregate data, … coding schemes, aggregate data, …

Page 23: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

OutlineOutline Main components of a wireless Main components of a wireless

sensor nodesensor node Processor, radio, sensors, batteriesProcessor, radio, sensors, batteries

Energy supply and consumptionEnergy supply and consumption Operating systems and execution Operating systems and execution

environmentsenvironments IWING's MoteLibIWING's MoteLib TinyOSTinyOS ContikiContiki

Example implementationsExample implementations

Page 24: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Operating System Operating System ChallengesChallenges Usual operating system goalsUsual operating system goals

Make access to device resources abstract Make access to device resources abstract (virtualization)(virtualization)

Protect resources from concurrent accessProtect resources from concurrent access Usual means Usual means

Protected operation modes of the CPUProtected operation modes of the CPU Process with separate address spacesProcess with separate address spaces

These are not available in microcontrollersThese are not available in microcontrollers No separate protection modes, no MMUNo separate protection modes, no MMU Would make devices more expensive, more Would make devices more expensive, more

power-hungrypower-hungry

Page 25: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Possible OS OptionsPossible OS Options Try to implement “as close to an Try to implement “as close to an

operating system” on WSN nodesoperating system” on WSN nodes Support for processes! Support for processes! Possible, but relatively high overheadPossible, but relatively high overhead

Stay away with operating systemStay away with operating system There is only a single “application” running on There is only a single “application” running on

a WSN nodea WSN node No need to protect malicious software parts No need to protect malicious software parts

from each otherfrom each other Direct hardware control by application might Direct hardware control by application might

improve efficiencyimprove efficiency

Page 26: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Possible OS OptionsPossible OS Options Currently popular approachCurrently popular approach

No OS, just a simple run-time No OS, just a simple run-time environmentenvironment

Enough to abstract away hardware Enough to abstract away hardware access detailsaccess details

Biggest impact: Unusual programming Biggest impact: Unusual programming modelmodel

Page 27: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Concurrency SupportConcurrency Support Simplest option: No Simplest option: No

concurrency, concurrency, sequential processing sequential processing of tasksof tasks Risk of missing dataRisk of missing data Should support Should support

interrupts/asynchronous interrupts/asynchronous operationsoperations

Poll sensor

Process sensor

data

Poll transceiver

Process received packet

Page 28: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Processes/ThreadsProcesses/Threads

Based on Based on interrupts, context interrupts, context switchingswitching

DifficultiesDifficulties Too many context Too many context

switchesswitches Most tasks are Most tasks are

short anywayshort anyway Each process Each process

required its own required its own stackstack

Handle sensor Handle sensor processprocess

Handle packet Handle packet processprocess

OS-mediatedprocess switching

Page 29: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Event-Based ConcurrencyEvent-Based Concurrency Event-based programming modelEvent-based programming model

Perform regular processing or be idlePerform regular processing or be idle React to events when they happen immediatelyReact to events when they happen immediately Basically: interrupt handlerBasically: interrupt handler

Must not remain in interrupt handler too Must not remain in interrupt handler too longlong Danger of loosing eventsDanger of loosing events

Idle/regular processing

Radio event handler

Sensor event handler

Page 30: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Components Instead of Components Instead of ProcessesProcesses An abstraction to group functionality An abstraction to group functionality Typically fulfill only a single, well-Typically fulfill only a single, well-

defined function defined function E.g., individual functions of a E.g., individual functions of a

networking protocolnetworking protocol Main difference to processes: Main difference to processes:

Component does not have an execution Component does not have an execution Components access same address space, Components access same address space,

no protection against each other no protection against each other

Page 31: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Event-based Protocol StackEvent-based Protocol Stack

Usual networking API: Usual networking API: socketssockets Issue: Issue: blocking callsblocking calls to receive data to receive data Not match to event-based OSNot match to event-based OS

API is therefore also event-based API is therefore also event-based E.g., Tell some component that some E.g., Tell some component that some

other component wants to be informed other component wants to be informed if and when data has arrivedif and when data has arrived

Component will be posted an event Component will be posted an event once this condition is met once this condition is met

Details: see Details: see IWING's MoteLibIWING's MoteLib and and TinyOSTinyOS

Page 32: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

OutlineOutline Main components of a wireless Main components of a wireless

sensor nodesensor node Processor, radio, sensors, batteriesProcessor, radio, sensors, batteries

Energy supply and consumptionEnergy supply and consumption Operating systems and execution Operating systems and execution

environmentsenvironments IWING's MoteLibIWING's MoteLib TinyOSTinyOS ContikiContiki

Example implementationsExample implementations

Page 33: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Case Study: Case Study: IWING's IWING's MoteLibMoteLib Developed by IWING (CPE, KU) along Developed by IWING (CPE, KU) along

with IWING moteswith IWING motes Provides hardware abstraction and Provides hardware abstraction and

virtualization in standard C virtualization in standard C interfacesinterfaces

Follows event-based programming Follows event-based programming modelmodel

Page 34: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

MoteLib Architecture and MoteLib Architecture and APIAPI

Software

Hardware

Page 35: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Example: Example: Count and SendCount and Send Node#0 runs a counter and Node#0 runs a counter and

broadcasts its valuebroadcasts its value Other nodes display received values Other nodes display received values

on LEDson LEDs

Page 36: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

#include <motelib/system.h>#include <motelib/timer.h>#include <motelib/radio.h>#include <motelib/led.h>

Timer timer;uint8_t counter;

void timerFired(Timer *t){ counter++; radioRequestTx(BROADCAST_ADDR, 0, (char*)&counter, sizeof(counter), NULL);}

void receive(Address source, MessageType type, void *message, uint8_t len){ ledSetValue(((char*)message)[0]);}

void boot(){ counter = 0; if (getAddress() == 0) { timerCreate(&timer); timerStart(&timer, TIMER_PERIODIC, 500, timerFired); } else radioSetRxHandler(receive);}

Example: Example: Count and SendCount and Send

called when node called when node receives a radio packetreceives a radio packet

called when timer called when timer expiresexpires

called when node called when node bootedbooted

Page 37: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

OutlineOutline Main components of a wireless Main components of a wireless

sensor nodesensor node Processor, radio, sensors, batteriesProcessor, radio, sensors, batteries

Energy supply and consumptionEnergy supply and consumption Operating systems and execution Operating systems and execution

environmentsenvironments IWING's MoteLibIWING's MoteLib TinyOSTinyOS ContikiContiki

Example implementationsExample implementations

Page 38: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Case Study: Case Study: TinyOSTinyOS Developed by UC Berkeley as runtime Developed by UC Berkeley as runtime

environment for their motesenvironment for their motes nesC (network embedded system C) as nesC (network embedded system C) as

adjunct programming languageadjunct programming language Design aspects:Design aspects:

Component-based system Component-based system Components interact by exchanging Components interact by exchanging

asynchronous eventsasynchronous events Components form a program by Components form a program by wiringwiring them them

together (akin to VHDL – hardware description together (akin to VHDL – hardware description language)language)

Website Website http://www.tinyos.nethttp://www.tinyos.net

Page 39: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

TinyOS ComponentsTinyOS Components ComponentsComponents

FrameFrame – state – state informationinformation

TasksTasks – normal – normal execution programexecution program

Command handlersCommand handlers Event handlersEvent handlers

Hierarchically Hierarchically arrangedarranged Events are passed Events are passed

upward from hardwareupward from hardware Commands are passed Commands are passed

downwarddownward

TimerComponent

setRate fire

init start stop fired

Eventhandlers

Commandhandlers

Frame

Tasks

Page 40: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

InterfacesInterfaces Many commands/events can be groupedMany commands/events can be grouped nesC structures corresponding nesC structures corresponding

commands/events into commands/events into interface types interface types Example: Structure timer into three Example: Structure timer into three

interfacesinterfaces StdCtrlStdCtrl TimerTimer ClockClock

The TimerComponentThe TimerComponent Provides:Provides: StdCtrl, Timer StdCtrl, Timer Uses:Uses: Clock Clock

ClockClock

setRate fire

init start stop fired

TimerTimerStdCtrlStdCtrl

TimerComponent

Page 41: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Forming New ComponentsForming New Components

ClockClock

HWClock

ClockClock

TimerTimerStdCtrlStdCtrl

TimerComponent

"Clock" interface provider"Clock" interface provider

"Clock" interface user"Clock" interface user

init

StdCtrlStdCtrl

start stop fired

TimerTimer

CompleteTimerCompleteTimer

Page 42: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Sample nesC CodeSample nesC Codeconfiguration CompleteTimer{ provides { interface StdCtrl; interface Timer; }

implementation { components TimerComponent, HWClock; StdCtrl = TimerComponent.StdCtrl; Timer = TimerComponent.Timer; TimerComponent.Clock -> HWClock.Clock; }}

Page 43: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Active Messages

Route map router sensor app

Sample App ConfigurationSample App Configuration

RFM

Radio byte

Radio Packet

UART

Serial Packet

ADC

Temp photo

clocks

bit

byt

ep

acke

tap

plic

atio

n

HW

SW

Page 44: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Command/event handlers must run to Command/event handlers must run to completioncompletion Must not wait an indeterminate amount of timeMust not wait an indeterminate amount of time Only a Only a requestrequest to perform some action to perform some action

Tasks can perform arbitrary, long Tasks can perform arbitrary, long computationcomputation Can be interrupted by handlersCan be interrupted by handlers Also have to be run to completionAlso have to be run to completion

Preemptive multitasking not implementedPreemptive multitasking not implemented

Handlers versus TasksHandlers versus Tasks

Idle / Running task

task queue

Sensor event handler Radio event handler

Page 45: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Split-Phase OperationsSplit-Phase Operations

RequestRequest

DataData

BlockingBlocking

SensorSensorControllerController

Synchronous OperationSynchronous Operation Asynchronous OperationAsynchronous Operation

SensorSensorControllerController

RequestRequest

ReadyReady

AckAck

ReadRead

DataData

Page 46: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

OutlineOutline Main components of a wireless Main components of a wireless

sensor nodesensor node Processor, radio, sensors, batteriesProcessor, radio, sensors, batteries

Energy supply and consumptionEnergy supply and consumption Operating systems and execution Operating systems and execution

environmentsenvironments IWING's MoteLibIWING's MoteLib TinyOSTinyOS ContikiContiki

Example implementationsExample implementations

Page 47: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Case Study: Case Study: ContikiContiki Multitasking OS developed by Multitasking OS developed by Swedish Swedish

Institute of Computer Science (SICS)Institute of Computer Science (SICS) The kernel is event drivenThe kernel is event driven Processes are Processes are protothreadsprotothreads

Very light weight threadsVery light weight threads Provide a linear, thread-like programming Provide a linear, thread-like programming

modelmodel Comes with various communication Comes with various communication

stacks: uIP, uIPv6, Rimestacks: uIP, uIPv6, Rime Website Website http://www.contiki-os.org/http://www.contiki-os.org/

Page 48: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Problem with Problem with MultithreadingMultithreading Four threads, each with its own stackFour threads, each with its own stack

Thread 1 Thread 2 Thread 3 Thread 4

Page 49: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Events Require One StackEvents Require One Stack Four event handlers, one stackFour event handlers, one stack

Eventhandler 1Eventhandler 2Eventhandler 3

Stack is reused for every event handler

Eventhandler 4

Page 50: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Problem with Event-based Problem with Event-based ModelModel

Threads: sequential code flowEvents: unstructured code flow

Very much like programming with GOTOs

Page 51: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

ProtothreadsProtothreads Protothreads require only one stackProtothreads require only one stack E.g, four protothreads, each with its own E.g, four protothreads, each with its own

stackstack

Events require one Events require one stackstack

Protothread 1Protothread 2Protothread 3Protothread 4

Just like events

Page 52: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

PROCESS_THREAD(hello_world_process, ev, data) PROCESS_THREAD(hello_world_process, ev, data) {{ PROCESS_BEGIN(); PROCESS_BEGIN(); printf(“Hello, world!\n”); printf(“Hello, world!\n”); while(1) { while(1) { PROCESS_WAIT_EVENT(); PROCESS_WAIT_EVENT(); }} PROCESS_END(); PROCESS_END(); }}

Contiki ProcessesContiki Processes Contiki processes are protothreadsContiki processes are protothreads

Page 53: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Contiki's Cooja SimulatorContiki's Cooja Simulator

Page 54: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

OutlineOutline Main components of a wireless Main components of a wireless

sensor nodesensor node Processor, radio, sensors, batteriesProcessor, radio, sensors, batteries

Energy supply and consumptionEnergy supply and consumption Operating systems and execution Operating systems and execution

environmentsenvironments IWING's MoteLibIWING's MoteLib TinyOSTinyOS ContikiContiki

Example implementationsExample implementations

Page 55: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Mica MotesMica Motes By Crossbow, USABy Crossbow, USA MCU: MCU:

Atmel ATMega128LAtmel ATMega128L Comm: RFM TR1000Comm: RFM TR1000

Page 56: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

EYES NodesEYES Nodes By Infineon, EUBy Infineon, EU MCU: TI MSP430MCU: TI MSP430 Comm: Infineon radio modem TDA5250Comm: Infineon radio modem TDA5250

Page 57: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

BtnoteBtnote By ETH ZurichBy ETH Zurich MCU: MCU:

Atmel ATMega128LAtmel ATMega128L Comm: Comm:

BluetoothBluetooth Chipcon CC1000Chipcon CC1000

Page 58: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

ScatterWebScatterWeb By Computer Systems & Telematics By Computer Systems & Telematics

group, Freie Universitat Berlingroup, Freie Universitat Berlin MCU:MCU:

TI MSP 430TI MSP 430 Comm:Comm:

Bluetooth, IBluetooth, I22C, CANC, CAN

Page 59: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Tmote SkyTmote Sky By Sentilla (formerly Moteiv), By Sentilla (formerly Moteiv),

USAUSA MCU:MCU:

TI MSP430TI MSP430

Comm:Comm: Chipcon CC2420Chipcon CC2420

(IEEE 802.15.4)(IEEE 802.15.4)

Page 60: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

IRIS MotesIRIS Motes By Crossbow, USABy Crossbow, USA MCU: ATMega128LMCU: ATMega128L Comm: Atmel's RF230 (IEEE 802.15.4)Comm: Atmel's RF230 (IEEE 802.15.4) 3x radio range compared to Tmote3x radio range compared to Tmote

"Postage-stamp" form factor costs as low as $29 "Postage-stamp" form factor costs as low as $29 per unit (when purchased in large volumes)per unit (when purchased in large volumes)

Page 61: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

IMote2IMote2 By Intel ResearchBy Intel Research MCU: PXA271 XScaleMCU: PXA271 XScale Comm: Chipcon CC2420 (IEEE802.15.4)Comm: Chipcon CC2420 (IEEE802.15.4)

Page 62: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Other WSN-Capable Other WSN-Capable ModulesModules Many low-cost, wireless SoC modules Many low-cost, wireless SoC modules

already availablealready available

HopeRF 433 MHz modulebased on Silicon Labs's SoC

(~6 USD/module)

Synapse Wireless 2.4 GHz modulebased on Atmel's SoC

SNAP OS / embedded Python(~25 USD/module)

Page 63: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

IWING-MRF MotesIWING-MRF Motes

Radio transceiver

8-bit AVR Microcontroller

USB Connector(for reprogramming

and power)

Analog/Digital sensor connectors

External battery connector

Digital sensor connectors

Morakot Saravanee, Chaiporn Jaikaeo, 2010. Intelligent Wireless Network Group Morakot Saravanee, Chaiporn Jaikaeo, 2010. Intelligent Wireless Network Group (IWING), KU(IWING), KU

Page 64: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

IWING-MRF MotesIWING-MRF Motes Built from off-the-shelf componentsBuilt from off-the-shelf components Built-in USB boot loaderBuilt-in USB boot loader

Reprogrammed via USBReprogrammed via USB Easy to modify and extend hardwareEasy to modify and extend hardware

Page 65: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

IWING-MRF MoteIWING-MRF Mote ProcessorProcessor

8-bit AVR microcontroller ATMega88/168/328, 8-bit AVR microcontroller ATMega88/168/328, 12 MHz12 MHz

16KB flash, 2KB RAM16KB flash, 2KB RAM RF transceiverRF transceiver

Microchip's MRF24J40A/B/C, 2.4GHz IEEE Microchip's MRF24J40A/B/C, 2.4GHz IEEE 802.15.4802.15.4

SPI interfaceSPI interface External connectorsExternal connectors

6 ADC connectors (can also be used as TWI)6 ADC connectors (can also be used as TWI) 1 UART1 UART

Power optionsPower options 3 – 3.6 VDC3 – 3.6 VDC USB or 2 AA batteriesUSB or 2 AA batteries

Page 66: Architectures and Applications for Wireless Sensor Networks (204525) Single-Node Architecture

Summary Summary The need to build cheap, low-energy, The need to build cheap, low-energy,

(small) devices has various consequences(small) devices has various consequences Much simpler radio frontends and controllersMuch simpler radio frontends and controllers Energy supply and scavenging are a premium Energy supply and scavenging are a premium

resourceresource Power management is crucial Power management is crucial

Unique programming challenges of Unique programming challenges of embedded systemsembedded systems Concurrency without support, protection Concurrency without support, protection De facto standard: De facto standard:

Event-based programming model: TinyOSEvent-based programming model: TinyOS Multithreaded programming model: ContikiMultithreaded programming model: Contiki