Your SlideShare is downloading. ×
Building the Internet of Things with Thingsquare and Contiki - day 2 part 2
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Building the Internet of Things with Thingsquare and Contiki - day 2 part 2

6,209

Published on

The second slide set from the second day of the Thingsquare Building the IoT with Contiki course. http://thingsquare.com/training/

The second slide set from the second day of the Thingsquare Building the IoT with Contiki course. http://thingsquare.com/training/

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,209
On Slideshare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
9
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Diving into the IoT/IP stack
  • 2. The IoT/IP stack HTTP, WebSockets, CoAP Application TCP, UDP Transport IPv6, IPv4, RPL Network, routing 6lowpan Adaptation CSMA/CA MAC ContikiMAC, CSL Duty cycling 802.15.4 Radio
  • 3. The application layer • Do something useful with the data • Today, applications typically run above the application layer – E.g. the Web runs on top of HTTP Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 4. The transport layer • Allow program A to send data to program B – Even though the network may drop packets – Get packets in order, despite them being reordered on the way Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 5. The network layer • Figure out how to send a packet from A to C, through node B Application Transport Network, routing C A Adaptation MAC Duty cycling B Radio
  • 6. The adaptation layer • Send network layer packets over the radio • Compress headers, fragment packets Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 7. The MAC layer • Make sure to not send when others are sending • Back off exponentially when there is too much traffic Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 8. The radio duty cycling layer • Turn off the radio when not needed, to save power – The radio consumes more power than other components • Make sure nodes are awake to hear messages from others Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 9. The radio link layer • Frequency bands – 2.4 GHz and sub-GHz • Modulations and encodings • Bit rates and bit errors • Standards and nonstandards Application Transport Network, routing Adaptation MAC Duty cycling Radio
  • 10. The packet path Application Application Application Transport Transport Transport Network, routing Network, routing Network, routing Adaptation Adaptation Adaptation MAC MAC MAC Duty cycling Duty cycling Duty cycling Radio Radio Radio
  • 11. Application Transport The IoT/IP Protocols Network, routing Adaptation The application layer MAC Duty cycling Radio
  • 12. The application layer • The layer where applications supposedly run • But many applications actually run on top of an application layer protocol • Application layer protocols for the IoT – HTTP (TCP) – WebSockets (TCP) – CoAP (UDP)
  • 13. HTTP • HyperText Transfer Protocol • The same HTTP which is used on the web • HTTP is often used for automated mechanisms • Useful for mesh-to-Internet communication
  • 14. REST • Representational State Transfer • A conceptualization of the way HTTP works – Resource: an URL – Resources are manipulated with methods • GET http://device-25.local/sensor/light • POST http://device-28.local/configuration sensor=123&batt=3300 • DELETE, UPDATE, HEAD, ... • There is a lot of confusion around what REST is and is not
  • 15. WebSockets • A recently defined standard – RFC6455 • Provides a TCP-like service on top of HTTP with very little overhead • Goes through firewalls, proxies (TCP port 80) • Compatible with HTTP – A WebSocket connection starts with a handshake over HTTP • Useful for mesh-to-Internet communication
  • 16. Websocket exchange GET /path HTTP/1.1 Host: api.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw== Sec-WebSocket-Protocol: example Sec-WebSocket-Version: 12 Origin: http://example.com HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk= Sec-WebSocket-Protocol: example
  • 17. Websocket message header
  • 18. CoAP • Message protocol over UDP • Started as a bit-optimized REST mechanism • Has grown into a fully fledged transport/application solution – – – – – – Retransmissions Confirmable/non-confirmable transmission modes Support for caching Support for sleeping nodes Subscription support Resource discovery • Useful for in-mesh communication – May have problems with firewalls
  • 19. Application Transport The IoT/IP Protocols Network, routing Adaptation The transport layer MAC Duty cycling Radio
  • 20. The problem • Getting data from application A to application B • UDP – Best-effort delivery, no ordering • TCP – Reliable stream delivery: in order, reliably • We’ll know whether it was received or not
  • 21. UDP • • • • • User Datagram Protocol Provides 16-bit port numbers Payload checksum Length field No protocol logic
  • 22. The UDP Header
  • 23. TCP • Transport Control Protocol • Significantly more complex than UDP • Reliable, in-order stream delivery – Byte sequence – End-to-end acknowledgements – Flow control • Avoid overloading the receiver – Congestion control • Avoid overloading the network
  • 24. The TCP header
  • 25. The TCP byte stream
  • 26. TCP 3-way handshake, opening • SYN – Includes maximum segment size option • SYN + ACK – Also includes maximum segment size option • ACK
  • 27. TCP retransmissions
  • 28. TCP 3-way handshake, closing • FIN • FIN+ ACK • ACK
  • 29. TCP problems for wireless • TCP reacts strongly to packet loss – Reduces sending rate significantly • TCP does not like reordering – May reduce sending rate • But TCP can be made efficient for lowpower wireless – E.g. Duquennoy, Österlind, Dunkels, SenSys 2011
  • 30. TCP for IoT applications • May be overkill for some applications – Not all applications need a reliable data stream • Does not support multicast/broadcast operation – TCP is strictly point-to-point • But TCP works well with the Internet
  • 31. In Contiki • Full support for UDP and TCP • TCP implementation is simple – Uses stop-and-wait, resulting in low throughput – TCP-segment splitting can improve throughput • UDP and TCP callback-based sockets (Contiki 3.x) – Register a socket with a callback function that gets called when something happens
  • 32. Takeaway transport layer • UDP and TCP – UDP: simple, datagram delivery – TCP: reliable byte stream
  • 33. More http://thingsquare.com

×