Internet of Things: Lecture 5-Software Platforms and Services
Internet of Things: Lecture 5-Software Platforms and Services
1
Wireless Sensor (and Actuator)
Networks
Services?
End-user
Operating
Systems? Core network
Gateway e.g. Internet
Protocols?
Protocols?
Sink
Gateway Computer services
node
3
Features of the OS in embedded
systems
− Memory management
− Power management
− File management
− Networking
− Providing programming environment and tools
(commands, interpreters, compiler, etc.)
− Providing entry points to access sensitive resources
such as writing to input components.
− Providing and supporting functional aspects such as
scheduling, multi-threading, handling interrupts, memory
allocations.
4
Operating systems and run-time in constrained
environments
5
Threads and events
6
Thread-based vs Event-based
Programming
7
Thread-based vs Event-based
Programming- II
8
Dynamic Programming
10
Embedded Operating Systems
11
Source: The Web of Things, Marko Grobelnik, Carolina Fortuna, Jožef Stefan Institute.
TinyOS
12
TinOS - programming
13
TinyOS
14
Contiki
15
Source: http://www.contiki-os.org
Contiki- Functional aspects
16
The Contiki OS
Loadable programs
Loaded program Can be easily updated
Communication service
Kernel
17
Protothreads
− For example consider a MAC protocol that turns off the radio
subsystem on a periodic basis; but you want to make sure that the
radio subsystem completes the communication before it goes to
sleep state.
1. At t=t0 set the radio ON
2. The radio remains on for a period of tawake seconds
3. Once tawake is over, the radio has to be switched off, but any on-going
communication needs to be completed.
4. If there is an on-going communication, the MAC protocol will wait for a period,
twait_max before switching off the radio.
5. If the communication is completed or the maximum wait time is over, then the
radio will go off and will remain in the off state for a period of tsleep.
6. The process is repeated.
Source: Adam Dunkels, Oliver Schmidt, Thiemo Voigt, and Muneeb Ali. 2006. Protothreads: simplifying event-driven programming of memory-
constrained embedded systems. In Proceedings of the 4th international conference on Embedded networked sensor systems (SenSys '06). ACM. 19
Radio sleep cycle code with events
Source: Adam Dunkels, Oliver Schmidt, Thiemo Voigt, and Muneeb Ali. 2006. Protothreads: simplifying event-driven programming of memory- 20
constrained embedded systems. In Proceedings of the 4th international conference on Embedded networked sensor systems (SenSys '06). ACM.
Radio sleep cycle with Protothreads
Source: Adam Dunkels, Oliver Schmidt, Thiemo Voigt, and Muneeb Ali. 2006. Protothreads: simplifying event-driven programming of memory-
constrained embedded systems. In Proceedings of the 4th international conference on Embedded networked sensor systems (SenSys '06). ACM. 21
Sensor Network Programming
22
The Contiki code
Header files
#include "contiki.h"
AUTOSTART_PROCESSES(&sample_process);
Defines the
PROCESS_THREAD(sample_process, ev, data) {
process will be
PROCESS_BEGIN(); started every time
while(1) { module is loaded
PROCESS_WAIT_EVENT();
}
PROCESS_END(); contains the
process code
}
#include "contiki.h"
PROCESS(sample_process, "My sample process");
AUTOSTART_PROCESSES(&sample_process, &LED_process);
− If you plan to compile your code on the chosen platfrom more than once;
− make TARGE=XM1000 savetarget
− Upload your code
− make simple_process.upload
25
Nodes and Applications in
Wireless Sensor Networks
− Sensor nodes
− Low power
− Consist of sensing device, memory, processor and radio
− Resource-constrained
− Sink nodes
− Another sensor node or a different wireless node
− Normally more powerful/better resources
− Gateway
− A more powerful node
− Connection to core network
− Could consist service representation, cache/storage, discovery
and other functions
Types of applications
− Event detection
− Reporting occurrences of events
− Reporting abnormalities and changes
− Could require collaboration of other nearby or remote nodes
− Event definition and classification is an issue
− Periodic measurements
− Sensors periodically measure and report the observation and
measurement data
− Reporting period is application dependent
− Approximation and pattern detection
− Sending messages along the boundaries of patterns in both space/time
− Tracking
− When the source of an event is mobile
− Sending event updates with location information
Requirements and challenges
− Fault tolerance
− The nodes can get damaged, run out of power, the wireless
communication between two nodes can be interrupted, etc.
− To tolerate node failures, redundant deployments can be
necessary.
− Lifetime
− The nodes could have a limited energy supply;
− Sometimes replacing the energy sources is not practical (e.g.
underwater deployment, large/remote field deployments).
− Energy efficient operation can be a necessity.
Requirements and challenges – Cont’d
− Scalability
− A WSN can consists of a large number of nodes
− The employed architectures and protocols should scale to these
numbers.
− Wide range of densities
− Density of the network can vary
− Different applications can have different node densities
− Density does not need to be homogeneous in the entire network
and network should adapt to such variations.
Requirements and challenges – Cont’d
− Programmability
− Nodes should be flexible and their tasks could change
− The programmes should be also changeable during operation.
− Maintainability
− WSN and environment of a WSN can change;
− The system should be adaptable to the changes.
− The operational parameters can change to choose different
trade-offs (e.g. to provide lower quality when energy efficiency is
more important)
Required mechanisms
− Wired
− USB, Ethernet
− Wireless
− Wifi, Bluetooth, ZigBee, IEEE 802.15.x
− Single-hop or multi-hop
− Sink nodes, cluster heads…
− Point-to-Point or Point-to-Multi Point
− (Energy) efficient routing
ZigBee
[source: Gary Legg, ZigBee: Wireless Technology for Low-Power Sensor Networks,
http://www.eetimes.com/document.asp?doc_id=1275760]
ZigBee
[source: Gary Legg, ZigBee: Wireless Technology for Low-Power Sensor Networks,
http://www.eetimes.com/document.asp?doc_id=1275760]
Network protocols
Source: Jonathan W. Hui and David E. Culler, IPv6 in Low-Power Wireless Networks, Proceedings of the IEEE (Volume:98 , Issue: 11 ).
Using gateway and middleware
Gateway
Frieder Ganz, Payam Barnaghi, Francois Carrez and Klaus Moessner, "Context-aware
Management for Sensor Networks", in the Fifth International Conference on COMmunication
System softWAre and middlewaRE (COMSWARE11), July 2011.
Service interfaces to WSN
C. Bormann, A. P. Castellani, Z. Shelby, "CoAP: An Application Protocol for Billions of Tiny Internet Nodes," IEEE Internet Computing,
vol. 16, no. 2, pp. 62-67, Feb. 2012, doi:10.1109/MIC.2012.29
Constrained Application Protocol (CoAP)
Server
200 OK
GET/temperature, Txt/plain
Room A 17, Celsius
Client
CoAP protocol stack and interactions
C. Bormann, A. P. Castellani, Z. Shelby, "CoAP: An Application Protocol for Billions of Tiny Internet Nodes," IEEE Internet Computing,
vol. 16, no. 2, pp. 62-67, Feb. 2012, doi:10.1109/MIC.2012.29
Further reading and examples
− Examples: https://github.com/contiki-
os/contiki/tree/master/examples
48
Acknowledgment
49
Questions?
50