INTRODUCTION TO
WIRELESS SENSOR
INTRODUCTION
NETWORKSTO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
NETWORKS INTRODUCTION TO
WIRELESS SENSOR NETWORKS
ANNA FÖRSTER
ANNA FÖRSTER
CHAPTER 2: ANATOMY OF A
SENSOR NODE
Anna Förster
INTRODUCTION TO
OVERVIEW
WIRELESS SENSOR
INTRODUCTION
NETWORKSTO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
1. Hardware components
NETWORKS
2. Power Consumption
ANNA FÖRSTER
3. Operating Systems and Concepts
ANNA FÖRSTER
1. Memory Management
2. Interrupts
3. Tasks, Threads and Events
4. Simulators
5. Communication Stack
INTRODUCTION TO
HARDWARE COMPONENTS
WIRELESS SENSOR
INTRODUCTION
NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
Microcontroller
NETWORKS
Radio transceiver
ANNA FÖRSTER
Sensor
ANNA FÖRSTER
External memory
Battery
Serial adapter
Embedded antenna Z1 sensor node.
Oscillator
measured typically in Ampere-hour (Ah). For example, a typical AA battery has a capacity
nominal capacity of 2800 mAh. Thus, in theory, if you draw 0.01 mA from this battery
INTRODUCTION TO
POWER CONSUMPTION
continuously, you should be able to survive for 2800 mAh/0.01 mA = 280,000 h,
which is approximately 32 years. However, that is only considering the radio’s sleep
WIRELESS SENSOR
mode and a constantly sleeping radio is not very useful. If you assume that both the
INTRODUCTION
NETWORKS TO
radio and the microcontroller are on and working, they have a total of 1.8 mA + 19.7
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
Sensor
mA = 21.5nodes operate
mA and the battery willon batteries
survive
is approximately five and a half days.
for 2800 mAh/21.5 mA = 130.23 h, which
NETWORKS
Each component on the sensor node consumes power
TABLE 2.1 Nominal power consumption of Z1 node components. Data from
Measured
[Link], in Ampere (A, current) or milli Ampere (mA).
ANNA FÖ[Link], and [Link].
Component Mode Current Draw
ANNA FÖRSTERMicrocontroller (TI MSP430) Active 1.8 mA
Sleep 5.1 µA
RF Transceiver (CC2420) Receive 19.7 mA
Transmit (at 0 dBm) 17.4 mA
Sleep 0.01 mA
Accelerometer (ADXL345) Standby 0.0001 mA
Active 0.04 – 0.145 mA
External flash (Micron M25P16) Write 15 mA
Read 4 mA
Sleep 0.001 mA
Temperature sensor (TMP102) Sense 0.015 mA
Sleep 0.001 mA
Power consump1on of Z1 sensor nodes
INTRODUCTION TO
EXERCISE:
WIRELESS SENSOR BATTERIES
INTRODUCTION
NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
Explore the batteries in front of you.
NETWORKS
What is their nominal capacity?
Consider a scenario, where the sensor node is working in cycles.
ANNA FÖRSTER
Every cycle, the components are working with the following time
percentages:
ANNA FÖRSTER
Radio: 10% send, 10% receive, 80% sleep
Microcontroller: 10% active, 90% sleep
Temperature sensor: 5% sense, 95% sleep
The other components are always sleeping /inactive.
Compute the energy consumption of one cycle with length 1 second.
Now assume the active time of all components is halved. What is
now the energy consumption of 1 cycle of length 1 second?
For both scenarios above, compute the theoretical lifetime of the
sensor nodes, considering the battery capacity in front of you.
Discuss your results.
INTRODUCTION
CONCEPTS OF TO
OPERATING SYSTEMS
WIRELESS SENSOR
INTRODUCTION
NETWORKSTO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR The tasks of the operating
User
NETWORKS system:
ANNA FÖRSTER
Manage software and hardware
Application
ANNA FÖRSTER Allow the user to access easily the
hardware
Allow several programs to run
simultaneously
Operating System
Manage the memory of the system
Manage shared resources
(memory, CPU, external devices)
Hardware
INTRODUCTION TO
Memory
WIRELESSManagement
SENSOR
INTRODUCTION
NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSORmanagement: Reserve all
Static memory
NETWORKS
memory at compilation time.
Simple,
ANNA FÖRSTER
does not need have any overhead for
ANNA FÖRSTER
management
Inflexible, cannot extend on demand
Dynamic memory management: A special
memory management software reserves
memory on demand.
Flexible, uses only memory which is really needed
Complex to maintain, can easily overflow on memory-
restricted devices (like sensor nodes)
INTRODUCTION TO
EXERCISE: MANAGE MEMORY
WIRELESS SENSOR
INTRODUCTION
NETWORKSTO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS
Read SENSOR
Section “Memory Management
NETWORKS
Example” on page 19.
ANNA FÖRSTER
Discuss the usage of the Big-O Notation.
ANNA FÖRSTER
Explain the different implementations and
compare against each other.
Do you have other ideas of how to
implement the same functionality?
INTRODUCTION TO
INTERRUPTS
WIRELESS SENSOR
INTRODUCTION NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS Goal: react SENSOR as fast as possible to an external
NETWORKS signal (sensor, user, etc.)
Example:
ANNA FÖRSTER ask sensor for data.
Problem: sensor does not answer immediately.
ANNA FÖRSTER
WITHOUT INTERRUPTS WITH INTERRUPTS
Init Init
sensor yes
process do one step interrupt process
data? something sensor
no else data
do one step
something
else
INTRODUCTION TO
TASKS WIRELESS SENSOR
INTRODUCTION
NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
Interrupts are used to control the flow of programs
NETWORKS
How to enable several programs to run simultaneously?
Task: an independent process in the system with its own resources
ANNA FÖRSTER
and memory, which works independently from all other processes
Memory management unit: makes sure memory is allocated to each
ANNA FÖRSTER
process and that processes cannot access/corrupt memory of other
processes.
Multitasking: the scheduler decides which task is allowed to proceed
and which is interrupted.
Shared resources: the process needs access to some shared
resource/device, e.g. printer or network interface. This access should
not be interrupted.
Atomic operations: runs until completion and nobody can interrupt it.
DISADVANTAGE: tasks are resource-intensive
INTRODUCTION TO
EVENTWIRELESS BASED SENSOR PROGRAMMING
INTRODUCTION
NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
An alternative to multi-tasking
NETWORKS
Based on events as opposed to interrupts: events are not
necessarily
ANNA FÖRSTER
handled immediately (like interrupts) and can be
generated also by software components. For example, a
lengthy processing job can create intermediate results and
ANNA FÖRSTER
signal those by creating events.
Each event correspond to one or more event handlers, which
process the event.
Event-based programming is based on finite state
machines.
QUESTION: what is a finite state machine?
DISADVANTGE: Finite state machines are not trivial to
implement and do not scale well.
INTRODUCTION TO
EXERCISE: PROTOTHREADS
WIRELESS SENSOR
INTRODUCTION
NETWORKSTO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS
InformSENSOR
yourself on the Contiki website
NETWORKS
about protothreads.
ANNA FÖRSTER
Implement a small application, which uses
protothreads
ANNA FÖRSTER
Discuss the usage of protothreads in
terms of technical efficiency and ease of
implementation
INTRODUCTION TO
SIMULATORS
WIRELESS SENSOR
INTRODUCTION
NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
A software system, running on a normal
NETWORKS
computer, which mimics the behavior of
ANNA FÖRSTER
some other system and its interactions
ANNA FÖRSTER
Various tools exist:
Cooja for the Contiki operating system
OMNeT++ for more sophisticated and
general-purpose network simulators
Many others
INTRODUCTION TO
SIMULATION
WIRELESS SENSOR MODELS
INTRODUCTION NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS
SimulationSENSOR relies on simulation models, which mimic
NETWORKS
the behavior of individual real components and
properties
ANNA FÖRSTER
Wireless propagation models: how does the
ANNA FÖRSTER
wireless signal propagates through different
environments?
Mobility models: how do the mobile nodes move
around?
Energy expenditure models: how much energy is
needed for individual components and/or tasks?
Traffic model: how much data is sent and when?
INTRODUCTION TO
COMMUNICATION
WIRELESS SENSOR STACK
INTRODUCTION
NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
Reduced sensor network communication
NETWORKS
stack (as opposed to OSI)
ANNA FÖRSTER
Gather and pre-process sensory data, report
Application
ANNA FÖRSTER
data, aggregate and compress data, etc.
Routing Plan a route from the current node to the final
destination, find the next hop, etc.
Link management Error control of packets, node addressing,
link quality evaluation
Medium Access Plan the access to the wireless medium -
listen, send, sleep
Physical Encode the data to transmit into an
electromagnetic wave
INTRODUCTION TO
PROTOCOLS VS.
WIRELESS SENSOR ALGORITHMS
INTRODUCTION
NETWORKSTO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS SENSOR
NETWORKS
Algorithm: a general-purpose, parameter-
based computation flow.
ANNA FÖRSTER
Protocol: exact implementation of one or
ANNA FÖRSTER
more stack layers, parameters are often
fixed or a very limited number of options is
provided
INTRODUCTION TO
SUMMARY WIRELESS SENSOR
INTRODUCTION NETWORKS TO
Anna Förster, Introduc1on to Wireless Sensor Networks, 2016
WIRELESS
Sensor node SENSORconsists of microcontroller, radio
NETWORKS
transceiver, sensors, serial connection, LEDs, flash
memory. ANNA FÖRSTER
Each component needs energy, with radio and flash
ANNA FÖRSTER
being the most “hungry” ones.
Putting individual components to sleep saves energy.
Towards the end of battery lifetime, performance of
individual components degrades and might deliver
false results.
WSN operating systems are simple and usually have
only limited dynamic memory and multi-tasking
functionalities.