Node Architectures 01204525 Wireless Sensor Networks and Internet of - - PowerPoint PPT Presentation

node architectures
SMART_READER_LITE
LIVE PREVIEW

Node Architectures 01204525 Wireless Sensor Networks and Internet of - - PowerPoint PPT Presentation

Node Architectures 01204525 Wireless Sensor Networks and Internet of Things Chaiporn Ja Jaikaeo (c (chaiporn.j@ku.ac.th) Department of f Computer Engineering Kasetsart University Materials taken from lecture slides by Karl and Willig Last


slide-1
SLIDE 1

Node Architectures

Chaiporn Ja Jaikaeo (c (chaiporn.j@ku.ac.th) Department of f Computer Engineering Kasetsart University

Materials taken from lecture slides by Karl and Willig Cliparts taken from openclipart.org

01204525 Wireless Sensor Networks and Internet of Things

Last updated: 2018-09-01

slide-2
SLIDE 2

2

Outline

  • Main components of a wireless sensor node
  • Processor, radio, sensors, batteries
  • Energy supply and consumption
  • Hardware platforms
  • Operating systems and execution environments
slide-3
SLIDE 3

3 3

Main Components

Communication Module CPU Sensors/ Actuators Power Supply Memory

Microcontroller

slide-4
SLIDE 4

4

Microcontroller Examples

  • Atmel ATMega
  • 8-bit controller, 8 MHz
  • Up to 128KB Flash
  • 4 KB RAM
  • 8-channel ADC
  • 6 sleep modes
  • Texas Instruments MSP430
  • 16-bit RISC core, 4 MHz
  • Up to 120 KB flash
  • 2-10 KB RAM
  • 12-channel ADC
slide-5
SLIDE 5

5

Microcontroller Examples

  • Atmel SAM-D21
  • 32-bit ARM Cortex-M0+ @48MHz
  • 256KB flash, 32KB RAM
  • 20-channel ADC
  • Full-speed USB 2.0 interface
  • ESP32
  • 32-bit Xtensa dual-core @240MHz
  • 448KB flash, 520KB RAM
  • 18-channel ADCs
  • Integrated WiFi and Bluetooth

Sources:

  • http://www.avdweb.nl/arduino/samd21/sam-d21.html
  • https://www.espressif.com
slide-6
SLIDE 6

6

Communication Device

  • Medium options
  • Electromagnetic, RF
  • Electromagnetic, optical
  • Ultrasound

Radio Transceiver radio wave bit stream

slide-7
SLIDE 7

7

Transceiver Characteristics

  • Service to upper layers: packet, byte, bit
  • Data rate
  • Power control
  • Communication range
  • etc.
slide-8
SLIDE 8

8

Transceiver States

  • Transceivers can be put into different
  • perational states, typically:
  • Transmit
  • Receive
  • Idle – ready to receive,

but not doing so

  • Sleep – significant parts
  • f the transceiver are

switched off

Rx Tx Idle Sleep

slide-9
SLIDE 9

9

Wakeup Receivers

  • When to switch on a receiver is not clear
  • Contention-based MAC protocols: Receiver is always on
  • TDMA-based MAC protocols: Synchronization overhead,

inflexible

  • Desirable: Receiver that can (only) check for incoming

messages

  • When signal detected, wake up main receiver for actual

reception

  • Ideally: Wakeup receiver can already process simple addresses
  • Not clear whether they can be actually built, however
slide-10
SLIDE 10

10

Sensors

  • Main categories
  • Passive, omnidirectional
  • Examples: light, thermometer, microphones, hygrometer, …
  • Passive, narrow-beam
  • Example: Camera
  • Active sensors
  • Example: Radar
  • Important parameter: Area of coverage
  • Which region is adequately covered by a given sensor?
slide-11
SLIDE 11

11

Outline

  • Main components of a wireless sensor node
  • Processor, radio, sensors, batteries
  • Energy supply and consumption
  • Hardware platforms
  • Operating systems and execution environments
slide-12
SLIDE 12

12

Energy Supply

  • Goal: provide as much energy as possible at smallest

cost/volume/weight/recharge time/longevity

  • In WSN, recharging may or may not be an option
  • Options
  • Primary batteries – not rechargeable
  • Secondary batteries – rechargeable, only makes sense in

combination with some form of energy harvesting

slide-13
SLIDE 13

13

Energy Supply - Requirements

  • Low self-discharge
  • Capacity under load
  • Efficient recharging at low current
  • Voltage stability (to avoid DC-DC conversion)
slide-14
SLIDE 14

14

Battery Examples

  • Energy per volume (Joule/cc):

Prima mary y batteries eries Chemistry Zinc-air Lithium Alkaline Energy (J/cm3) 3780 2880 1200 Seco conda dary y batteries ries Chemistry Lithium NiMH NiCd Energy (J/cm3) 1080 860 650

http://en.wikipedia.org/wiki/Energy_density

slide-15
SLIDE 15

15

Energy Harvesting

  • How to recharge a battery?
  • A laptop: easy, plug into wall socket in the evening
  • A sensor node? – Try to scavenge energy from environment
  • Ambient energy sources
  • Light ! solar cells – between 10 W/cm2 and 15 mW/cm2
  • Temperature gradients – 80 W/cm2 @ 1 V from 5K difference
  • Vibrations – between 0.1 and 10000 W/cm3
  • Pressure variation (piezo-electric) – 330 W/cm2 from the heel of a shoe
  • Air/liquid flow

(MEMS gas turbines)

slide-16
SLIDE 16

16

Multiple Power Consumption Modes

  • Do not run sensor node at full operation all the time
  • If nothing to do, switch to power safe mode
  • Typical modes
  • Controller: active, idle, sleep
  • Radio mode: Turn on/off transmitter/receiver, both
  • Strongly depends on hardware
  • Questions:
  • When to throttle down?
  • How to wake up again?
slide-17
SLIDE 17

17

Energy Consumption Figures

  • TI MSP 430 (@ 1 MHz, 3V):
  • Fully operation 1.2 mW
  • One fully operational mode + four sleep modes
  • Deepest sleep mode 0.3 W – only woken up by external

interrupts (not even timer is running any more)

  • Atmel ATMega
  • Operational mode: 15 mW active, 6 mW idle
  • Six modes of operations
  • Sleep mode: 75 W
slide-18
SLIDE 18

18

Switching Between Modes

  • Simplest idea: Greedily switch to lower mode whenever

possible

  • Problem: Time and power consumption required to reach

higher modes not negligible

Pactive Psleep time tevent t1 Esaved tdown tup Eoverhead

slide-19
SLIDE 19

19

Should We Switch?

  • Switching modes is beneficial if

which is equivalent to 𝐹𝑝𝑤𝑓𝑠ℎ𝑓𝑏𝑒 < 𝐹𝑡𝑏𝑤𝑓𝑒 (𝑢𝑓𝑤𝑓𝑜𝑢−𝑢1) > 1 2 𝜐𝑒𝑝𝑥𝑜 + 𝑄𝑏𝑑𝑢𝑗𝑤𝑓 + 𝑄𝑡𝑚𝑓𝑓𝑞 𝑄

𝑏𝑑𝑢𝑗𝑤𝑓 − 𝑄 𝑡𝑚𝑓𝑓𝑞

𝜐𝑣𝑞

slide-20
SLIDE 20

20

Computation vs. Communication

  • Sending one bit vs. running one instruction
  • Energy ratio up to 2900:1
  • I.e., send & receive one KB = running three million instruction
  • So, try to compute instead of communicate whenever

possible

  • Key technique – in-network processing
  • Exploit compression schemes, intelligent coding schemes,

aggregate data, …

slide-21
SLIDE 21

21

Outline

  • Main components of a wireless sensor node
  • Processor, radio, sensors, batteries
  • Energy supply and consumption
  • Hardware platforms
  • Operating systems and execution environments
slide-22
SLIDE 22

22

Mica Motes

  • By Crossbow, USA
  • Controller
  • 8-bit Atmel ATMega128L
  • Communication
  • RFM TR1000
slide-23
SLIDE 23

23

Tmote Sky

  • By Sentilla (formerly Moteiv),

USA

  • Controller
  • 16-bit TI MSP430
  • Communication
  • Chipcon CC2420

(IEEE 802.15.4)

slide-24
SLIDE 24

24

IWING-MRF Motes

  • By IWING, CPE, KU
  • Controller
  • ATMega328P
  • Communication
  • MRF24J40 (IEEE802.15.4)

Radio transceiver 8-bit AVR Microcontroller USB Connector (for reprogramming and power) Analog/Digital sensor connectors External battery connector UART Connector

slide-25
SLIDE 25

25

IWING-MRF Motes

  • Built from off-the-shelf components
  • Built-in USB boot loader
  • Reprogrammed via USB
  • Easy to modify and extend hardware
slide-26
SLIDE 26

26

Arduino Boards

  • Various communication "shields"
  • https://www.arduino.cc/en/Main/Boards
  • http://www.dragino.com/products/nb-iot/item/130-nb-iot-shield.html
  • https://store.arduino.cc/usa/arduino-wifi-shield
  • http://www.dragino.com/products/lora/item/102-lora-shield.html

WiFi Shield NBIoT Shield LoRa Shield

slide-27
SLIDE 27

27

ESP32 Modules

  • By Espressif Systems
  • Controller
  • 32-bit Xtensa dual-core
  • Communication
  • WiFi and Bluetooth

https://www.espressif.com/en/products/hardware/modules

slide-28
SLIDE 28

28

BBC's Micro:bit

https://microbit.org/guide/features/

slide-29
SLIDE 29

29

Raspberry Pi

https://www.raspberrypi.org/products/

  • By Raspberry Pi Foundation
  • Controller
  • 1.4 GHz 64/32-bit quad-core ARM

Cortex-A53

  • Communication
  • WiFi and Bluetooth

Raspberry Pi 3 Model B+ Raspberry Pi Zero W

slide-30
SLIDE 30

30

Outline

  • Main components of a wireless sensor node
  • Processor, radio, sensors, batteries
  • Energy supply and consumption
  • Implementation examples
  • Operating systems and execution environments
slide-31
SLIDE 31

31

Operating System Challenges

  • Usual operating system goals
  • Make access to device resources abstract (virtualization)
  • Protect resources from concurrent access
  • Usual means
  • Protected operation modes of the CPU
  • Process with separate address spaces
  • These are not available in microcontrollers
  • No separate protection modes, no MMU
  • Would make devices more expensive, more power-hungry
slide-32
SLIDE 32

32

Possible OS Options

  • Try to implement “as close to an operating system” on

WSN nodes

  • Support for processes!
  • Possible, but relatively high overhead
  • Stay away with operating system
  • There is only a single “application” running on a WSN node
  • No need to protect malicious software parts from each other
  • Direct hardware control by application might improve efficiency
slide-33
SLIDE 33

33

Concurrency Support

  • Simplest option: No concurrency,

sequential processing of tasks

  • Risk of missing data
  • Should support interrupts/asynchronous
  • perations

Poll sensor Process sensor data Poll transceiver Process received packet

slide-34
SLIDE 34

34

Processes/Threads

  • Based on interrupts, context

switching

  • Difficulties
  • Too many context switches
  • Most tasks are short anyway
  • Each process required its own stack
  • Not much of a problem on

modern microcontrollers

Handle sensor process Handle packet process

OS-mediated process switching

slide-35
SLIDE 35

35

Problems with Multithreads

  • Four threads, each with its own stack

Thread 1 Thread 2 Thread 3 Thread 4

slide-36
SLIDE 36

36

Problems with Multithreads

  • Code employing preemptive threading library must ensure

thread-safe operations

slide-37
SLIDE 37

37

Event-Based Concurrency

  • Perform regular processing or be idle
  • React to events when they happen immediately
  • Examples
  • Bare-metal programming with interrupt handlers
  • TinyOS

Idle/regular processing

Radio event handler Sensor event handler

slide-38
SLIDE 38

38

38

Split-Phase Operations

Request Data Blocking

Sensor Controller

Synchronous Operation Asynchronous Operation

Sensor Controller

Request Ready Ack Read Data

slide-39
SLIDE 39

39

Events Require One Stack

  • Four event handlers, one stack

Eventhandler 1 Eventhandler 2 Eventhandler 3

Stack is reused for every event handler

Eventhandler 4

slide-40
SLIDE 40

40

Event-based Protocol Stack

  • Usual networking API: sockets
  • Issue: blocking calls to receive data
  • Not match to event-based OS
  • API is therefore also event-based
  • E.g., Tell some component that some other component wants to be

informed if and when data has arrived

  • Component will be posted an event once this condition is met
  • Details: see TinyOS
slide-41
SLIDE 41

41

41

Problem with Event-based Model

Threads: sequential code flow Events: unstructured code flow

Very much like programming with GOTOs

slide-42
SLIDE 42

42

Protothreads

  • Protothreads provides thread-like operations but requires
  • nly one stack
  • E.g, four protothreads, each with its own stack

Events require one stack

Protothread 1 Protothread 2 Protothread 3 Protothread 4

Just like events

slide-43
SLIDE 43

43

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

Protothreads in Contiki

  • Contiki processes are protothreads
slide-44
SLIDE 44

44

Summary

  • The need to build cheap, low-energy, (small) devices has

various consequences

  • Much simpler radio frontends and controllers
  • Energy supply and scavenging are a premium resource
  • Power management is crucial
  • Unique programming challenges of embedded systems
  • Concurrency without support, protection
  • De facto standard:
  • Event-based programming model
  • Multithreaded programming model