Title: TinyOS and Low Power Wireless Networking
1TinyOS and Low Power Wireless Networking A
Study in Realistic Abstraction
- David E. Culler
- Mobicom / Mobihoc Lunch
- Sept 12, 2007
with thanks to a generation of students, NSF,
DARPA, Micro, Intel, Microsoft, HP, Sun
2Abstraction
- the process of generalization by reducing the
information content of a concept or an observable
phenomenon, typically in order to retain only
information which is relevant for a particular
purpose.
3In Math and Science
- to focus on essential aspects of a problem
4In Computer Science
- forming boundaries that decouple complex systems
and limit dependence on implementation artifacts.
5Today
- Were going to talk about the interplay of
abstractions and innovation in system design - But first, to set context
6The Internet Today
7The Internet Tomorrow
8Why Real Information is so Important
Enable New Knowledge
Increase Comfort
Enhance Safety Security
Preventing Failures
High-Confidence Transport
9Enabling Technology
Network
IEEE 802.15.4
10The Systems Challenge
- Monitoring Managing Spaces and Things
applications
Store
Comm.
actuate
sensing
Proc
Power
technology
Miniature, low-power connections to the physical
world
11Circa 97 Inspirations
- Post-PC age arrived
- The Palm Pilot in hand and massive computing
clusters in the infrastructure! - Smart Dust vision thing
- complete (albeit very limit) mm3 computing system
expected in 10 15 years gt Only 10 years to get
the systems networking right! - Estrin PC104-WiFi Testbed
- None of the beautiful networking ideas mattered
because ALL the energy went into idle listening
of 802.11 MAC. - Growing community Solving Imaginary Problems
- Need a platform to rub our noses in the real
problems - Necessity IS the mother of invention
12Traditional Systems
- Well established layers of abstractions
- Strict boundaries
- Ample resources
- Independent Applications at endpoints communicate
pt-pt through routers - Well attended
Application
Application
User
System
Network Stack
Transport
Threads
Network
Address Space
Data Link
Files
Physical Layer
Drivers
Routers
13by comparison, WSNs ...
- Highly Constrained resources
- processing, storage, bandwidth, power
- Applications spread over many small nodes
- self-organizing Collectives
- highly integrated with changing environment and
network - communication is fundamental
- Concurrency intensive in bursts
- streams of sensor data and network traffic
- Robust
- inaccessible, critical operation
- Unclear where the boundaries belong
- even HW/SW will move
- gt Provide a framework for
- Resource-constrained concurrency
- Defining boundaries
- Appln-specific processing and power management
- allow abstractions to emerge
14Starting Points
- Classical RTOS
- Focused on scheduling predictable loads, load
shedding, and deadlines - Communication inherently asynchronous
- Threads in their many forms
- Many stacks, unstructured interactions through
shared variables, coordination through complex
schedulers - Event-driven models
- Easy to schedule handfuls of small, roughly
uniform things - State transitions, but what storage and comm
model? - Usually results in brittle monolithic dispatch
spaghetti - Threaded Abstract machine
- compilation target of inherently parallel
languages - Simple two-level scheduling hierarchy
- Active Messages
- Both parties in communication know format of the
message - Fine-grain dispatch and consume without parsing
- Concurrent Data-structures
- Non-blocking, lock-free (Herlihy)
15Embedded System Reality gt Hardware
- Abstract a hardware unit for convenient software
access. - Datasheet describes set of interfaces (pins,
wires, busses) and operations - Commands that can be asserted or issued to it
- Events that it will signal or raise
- Interfaces to other hardware units that it is
attached to - Internally the unit has state and computational
processes that operate in parallel with other
units.
state
16Embedded System Realitygt Data Acquisition
- Configure and command ADC to sample external I/O
attached to sensor. - Either directly or over a bus protocol
- Obtain readings upon notification by polling or
handling interrupts - One short or periodic
- Perform processing on the readings (smoothing,
thresholding, transformation) and possibly signal
higher level notification - Similar for DAC to actuator
Digital Signal Processing Software
storage
threads
Bus
Digital sensor
ADC
Analog sensor
17Embedded System Realitygt Protocol Implementation
- For
- Bus Protocols within a node,
- Link Protocols between two nodes in direct
communication, - Network Protocols between possibly widely
separate node. - Each has
- Set of operations that it issues
- Set responses that it receives
- synchronous or asynchronous,
- state it maintains,
- state-transition diagram that it implements
- And various commands and events that define its
interface above and below - Exceptions, etc.
18Tiny OS Abstraction Builder
- System Scheduler graph of Components
- Hierarchical
- Component
- Set of bidirectional Command/Event Interfaces
- Commands Handlers
- Event Handlers
- Frame (storage)
- Tasks (concurrency)
- Constrained two-level scheduling model
- tasks events
- Constrained Storage Model
- frame per component,
- Single shared stack,
- no heap
- Structured event-driven processing
- Very lean multithreading
- Efficient Layering
- Events can signal events
Commands
Events
Component
Internal State
Task
19System Graph of Components
Route map
router
sensor appln
application
Modular construction of Protocols. - layers and
layers.
Active Messages
Radio Packet
Serial Packet
packet
Temp
photo
SW
HW
UART
Radio byte
ADC
byte
Graph of cooperating state machines on shared
stack Execution driven by interrupts
clocks
RFM
bit
Early TinyOS 0.x component graph going all the
way down to modulating the RF channel in software.
20Reality Gap narrowed, but
- Monitoring Managing Spaces and Things
Applications
Technology
Miniature, low-power connections to the physical
world
21Architecture of a Mote
Processing
Storage
I/O
microcontroller
Flash
timers
proc
data logs
Wireless Net Interface
antenna
RF transceiver
pgm images
WD
Wired Net Interface
serial link USB,EN,
Low-power Standby Wakeup
- Efficient wireless protocol primitives
- Flexible sensor interface
- Ultra-low power standby
- Very Fast wakeup
- Watchdog and Monitoring
- Data SRAM is critical limiting resource
System Architecture Directions for Networked
Sensors, Hill,. Szewcyk, Woo, Culler, Hollar,
Pister, ASPLOS 2000
22Abstraction of a whole industry
23Microcontroller Reality Check
- Memory starved
- Far from Amdahl-Case 3M rule
- 4x improvement in 2005
- Fairly uniform active inst per nJ
- Faster MCUs generally a bit better
- Min operating voltage
- 1.8 volts gt most of alkaline battery
- 2.7 volts gt half of alkaline battery
- Standby power
- Recently a 10x improvement
- Probably due to design focus
- Fundamentally SRAM leakage
- Wake-up time is key
- Trade sleep power for wake-up time
- Memory restore
- DMA Support
- permits ADC sampling while processor is sleeping
2004 Microcontroller market responded
substantially to WSN requirements 2005/6 Radio
integration 2006/7 Proliferation and
solidification ? - Complete SoC
24Memory s its different down there
- Regression
- RAM 0.397 per kB
- FLASH 0.074 per kB
- standard SRAM/DRAM
- 1M SRAM 0.002 per kB
- 256M DRAM 10-5 per kB
25The Mote Explosion
WINS(UCLA/ROckwell)
Intel rene
SmartDust WeC
Rene
00
01
03
02
04
06
05
07
97
99
98
LWIM
Expedition
NEST
Cyber-Physical
SENSIT
NETS/ NOSS
CENS STC
DARPA
NSF
26A worldwide community
27Grounded Foundation with some constraints
Applications
architecture
Technology
28A Set of Stacks Emerge
Applications
architecture
Technology
29A Hardware Abstraction Architecture
30Execution Model
TinyOS 2.0
WSN mote platform
Communication Centric Resource-Constrained Event-d
riven Execution
31Low Power Networking in the Real World
Applications
architecture
Technology
32Why Multihop Routing
- Power!
- to transmit D grows as D3 or worse
- to route distance D grows linearly
- Bandwidth (spatial multiplexing)
- With n nodes in a single cell, each gets at most
1/n bandwidth - Many small cells gt many simultaneous
transmissions. - Reliability (spatial diversity)
- Individual links experience interference,
obstacles, and multipath effects - Even short-range wireless wires require human
nurturing - IRDA, Bluetooth, WiFi, Cell
- Provides spatial diversity and receiver diversity
- rather than antenna diversity
- Protocol level reliability
33What we mean by Low Power
- 2 AA gt 1.5 amp hours (4 watt hours)
- Cell gt 1 amp hour (3.5 watt hours)
- Cell 500 -1000 mW gt few hours active
- WiFi 300 - 500 mW gt several hours
- GPS 50 100 mW gt couple days
- WSN 50 mW active, 20 uW passive
- 450 uW gt one year
- 45 uW gt 10 years
- Ave Power fact Pact fsleep Psleep
fwaking Pwaking
34Routing Mechanism
- Upon each transmission, one of the recipients
retransmits. - Which one?
- What determines a link?
35Classical Routing Abstraction
- Connectivity between nodes defines the network
graph. - A Routing algorithm determines the sub-graph that
is used for communication between nodes. - Route formation, path selection
- Packets are forwarded from source to destination
over the routing subgraph - At each node in the path, determine the recipient
of the next hop - The selection at each hop is made based on the
information at hand - Sender address, current address, destination
address, information in the packet, information
on the node. - Table-driven, source based, algorithmic,
- Who knows the route? Do you determine it as you
go?
36Whats different in WSN?
- There is no a priori network graph
- It is discovered by sending packets and seeing
who receives them. - The embedding of the network in space is
important. - Need to get information to travel between
particular physical places. - addressing naming
- Flat EUID? Hierarchical? Topologically
meaningful? Spatially meaningful?
37Grasping for a Connectivity Abstraction
- Unit Disk model
- Link(A,B) iff dist(A,B) R
- Assumed by much work on wireless network
protocols - Routing, clustering, scheduling, coverage,
- With no accounting of traffic, etc.
- Collisions,
R
38?Self-Organized Mesh Routing is easy
0
39Complexity of Connectivity
- Direct Reception Neighborhood
- Non-isotropic
- Large variation in affinity
- Asymmetric links
- Long, stable high quality links
- Short bad ones
- Varies with traffic load
- Collisions
- Distant nodes raise noise floor
- Many poor neighbors
- Good ones mostly near, some far
- Capture-effect
40Abstracting Uncertainty
Distance
41Which node do you route through?
42What does this mean?
- Always routing through nodes at the hairy edge
- Wherever you set the threshold, the most useful
node will be close to it - Topology determination is a continuous process of
discovery and validation - and it must be done politely
- Connectivity is determined by communication
- If B receives packet reasonably reliably from A,
then A ? B - If A receives packet reasonably reliably from B,
then A ? B - And if both are true, A ?? B
43Trickle, dont Flood
0
44Mesh Protocols that Work
- Polite, continuous observation
- Passive probing wherever possible
- Adjust communication rate to node density
- Link level retransmission and rerouting
- Maintain at least two (preferably three)
candidate next hops (e.g., parents) - Use acks to determine quality of the link
- Throw in a new candidate from time to time.
- Cope with transients locally
- Never record a list of children, list of
neighbors, - Insufficient memory to build the table.
- With the nodes (almost) never listening
45Communication Power Passive Vigilance
Transmit 20 mA x 1-5 ms 20 - 100 uAs
Sleep 10 uA
I
Time
I
Time
Listen 20 mA
Receive 20 mA x 2-6 ms
463 Basic Solution Techniques
- Goal listen only when there is likely to be
something useful to hear. - Listen during scheduled time slots
- Arrange a schedule of possible communication
opportunities - Maintain appropriately coordinated clocks and
schedule - Only listen during specific slots
- Many variants Token-Ring, TDMA, Beacons,
Bluetooth piconets, TSMP, - Sampled Listening
- Listen for very short intervals to detect eminent
transmissions - On detection, listen actively to receive
- Listen after send (with powered infrastructure)
- Generally, device is not listening and will not
receive. - After it transmits to a receptive device, it
listens for a time window - Many variants 802.11 AMAT, Key fobs, remote
modems,
47A Systems Challenge
- Monitoring Managing Spaces and Things
applications
Store
Comm.
uRobots actuate
MEMS sensing
Proc
Power
technology
Miniature, low-power connections to the physical
world
48Thinking about the Physical World as Signals
- What is the bandwidth of the weather?
- What is the nyquist of the soil?
- What is the placement noise?
- What is the sampling jitter error?
49Realistic Abstraction
- The Right Abstractions can be Tremendously
Empowering - Reveal essential elements without all the
contextual artifacts - Allow innovation within a portion of a complex
and important system - The Wrong ones can seriously disenfranchise
- Become a distorted reality of their own
- Surrounding constraints prevent useful innovation
50Let Chaos Reign, Rein in Chaos
- TinyOS was invented to provided a framework for
defining important abstractions for wireless
intelligent devices embedded in the physical
world. - Allow the right abstractions to emerge from
experience - Structured events great for protocols, natural to
put simple threads on top for application logic - TinyOS as an operating system design platform
is essentially done - Good set of hardened abstractions in TinyOS 2.0
- Many platforms Broad international community
- Opportunities are also enabled by the presence of
structure - We have the BSD of wsn, it is time for TCP/IP and
the rest.
51THE Question
If Wireless Sensor Networks represent a future of
billions of information devices embedded in the
physical world, why dont they run THE standard
internetworking protocol?
?
Sonet
Serial
Self-Contained
Plugs and People
52Sensor Network Networking
EnviroTrack
Hood
TinyDB
Regions
FTSP
Diffusion
SPIN
TTDD
Trickle
Deluge
Drip
MMRP
Arrive
TORA
Ascent
MintRoute
CGSR
AODV
GPSR
ARA
DSR
GSR
GRAD
DBF
DSDV
TBRPF
Resynch
SPAN
FPS
GAF
ReORg
PC
Yao
SP100.11a
SMAC
WooMac
PAMAS
BMAC
TMAC
WiseMAC
Pico
802.15.4
Bluetooth
eyes
RadioMetrix
CC1000
nordic
RFM
wHART
Zigbee
Zwave
53The Answer
- They should
- Substantially advances the state-of-the-art in
both domains. - Implementing IP requires tackling the general
case, not just a specific operational slice - Interoperability with all other potential IP
network links - Potential to name and route to any IP-enabled
device within security domain - Robust operation despite external factors
- Coexistence, interference, errant devices, ...
- While meeting the critical embedded wireless
requirements - High reliability and adaptability
- Long lifetime on limited energy
- Manageability of many devices
- Within highly constrained resources
54Making sensor nets make sense
- LoWPAN 802.15.4
- 1 of 802.11 power, easier to embed, as easy to
use. - 8-16 bit MCUs with KBs, not MBs.
- Off 99 of the time
Web Services
XML / RPC / REST / SOAP / OSGI
HTTP / FTP / SNMP
TCP / UDP
IP
802.15.4,
802.11
Ethernet
Sonet
IETF 6lowpan
556LoWPAN IPv6 over IEEE 802.15.4
IEEE 802.15.4 Frame Format
S pan
D pan
Dst EUID 64
Src EUID 64
preamble
Dst16
Src16
DSN
Network Header
Application Data
dsp
IETF 6LoWPAN Format
01
1
Uncompressed IPv6 address RFC2460
0
40 bytes
0
0
0
0
01
0
1
0
0
0
0
HC1
Fully compressed 1 byte
Source address derived from link
address Destination address derived from link
address Traffic Class Flow Label zero Next
header UDP, TCP, or ICMP
- Deep compression by breaking the layering
abstraction and putting it all back together
again.
56Non-Traditional Directions Ahead
- Testing
- for application specific, platform specific
embedded distributed systems that are very long
lived and low power - in the face of adversarial
factors. - Synthesis
- Whole System and Platform from application
declaration - Performance Reliability analysis
- Interactions and trade-offs
57Reliability
Beware hype
58Traditional Analysis
Delivered Performance
Offered Load
59Analysis that really matters
Reliability
60Directions Ahead
- Testing
- Synthesis
- Performance Reliability analysis
- THE NETWORK REALLY
- TCP UCP / IP / 6LoWPAN is a given soon
RFC4944 - all the other aspects of internet services for
broad-based physical information - Time to define the equivalent of Sockets API
- How to collect, categorize, search?
- Which MAC(s) below? Channel Hopping? Power
Mgmt? - Mesh Under or Router Over?
- Routing into, out of, within? RL2N BoF in BC
61A new tier
62The Internet of Things has Arrived
63An(other) inconvenient truth
Many critical issues facing science,
government, and the public call
for high fidelity and real time observations of
the physical world Networks of smart, wireless
sensors, forming the Front-Tier of the Internet
can help reveal the previously unobservable
But an inconvenient truth is that the field does
not lend itself to familiar abstractions and
research practices