SlideShare una empresa de Scribd logo
1 de 48
Descargar para leer sin conexión
IP-based
Sensor Networking with
        Contiki
Adam Dunkels, PhD, Fredrik Österlind, Nicolas Tsiftes,
          Niclas Finne, Joakim Eriksson, Zhitao He (SICS)
                      Oliver Schmidt (SAP AG)
             Julien Abeillé, Mathilde Durvy, PhD (Cisco)
         Takahide Matsutsuka, Simon Barner, Simon Berg
                       Colin O'Flynn (NewAE)
        Eric Gnoske, Blake Leverett, Michael Vidales (Atmel)
                              David Kopf
Today
•   IP for embedded systems
•   The history of IP-based sensor networks
•   Contiki
•   Hands-on
    – Instant Contiki
    – Contiki for Tmote Sky
    – Tmote Sky as IPv6/6lowpan bridge
IP for Embedded Systems
History of IP for Embedded
               Systems
• Embedded systems
  – Resource-constrained
  – Autonomous operation
  – Remote configuration, data collection, …
• 1999: EMIT Alliance – remote communication
  – EMbed the InterneT Alliance
  – EmWare, Atmel, Texas Instruments, Zilog, Microchip,
    …
  – ”IP too heavyweight”
     • Non-IP based wired protocol
     • Gateways
2000: lwIP
• Open source lightweight IP stack
  – Top-down design
    • Similar to BSD, Linux, …
  – 40 kb code, 20 kb RAM
  – IP, ICMP, UDP, TCP
  – Widely used
    • ”Too large”…
2001: uIP
• World’s smallest TCP/IP stack
  – Open source
  – Bottom-up design
  – 4 kb code, 1 kb RAM
  – Fully RFC compliant
  – IP, ICMP, UDP, TCP
2002: IP for Embedded is a Fact
• Non-IP solutions went away
  – Highly optimized custom protocols
  – IP took over
• EMIT Alliance is no more
  – EmWare moved to uIP
The Most Important
          Lesson Learned
• Ability to communicate more important
  than performance
Example: uIP-based Pico Satellite
• CubeSat: pico satellite construction kit
 – MSP430-based
• 128 bytes of RAM for uIP
2004: IP-based Sensor Networks
•   Lightweight IP stack (uIP)
•   Header compression
•   Low-power MAC layer
•   Sensor data
    – UDP
• Configuration
    – TCP
• 2006: IETF 6lowpan
2004: First IP-based Sensor
          Network
Why IP for Sensor Networks?
•   Scalable
•   Versatile
•   Manageable
•   Open and flexible standard
•   Widely deployed
•   Lightweight
    – As shown by uIP, uIPv6
• Low-power
    – IETF 6lowpan wg
    – Power-saving MAC protocols
September 2008:
IP for Smart Objects Alliance
October 2008:
uIPv6, first certified IPv6 stack,
          SICSlowpan
November 2008:
30th best invention of 2008
The Contiki Operating System
Contiki as an Open Source
               Project
• Open source – BSD license
   – C programming language
• Version 1.0 released in March 2003
   – Version 2.2.3 in March 2009
• Highly portable
   – Tmote Sky, JCreate, TelosB, Atmel Raven, MSB,
     ESB, MicaZ, …
   – Simulators: Cooja, MSPsim, AvroraZ, netsim
   – Native platform
• Actively developed
   – 17 developers from SICS, SAP, Cisco, NewAE, TU
     Munich, Atmel
• Active mailing list
Contiki as a Research Theme
• Exploring successful computer science abstractions,
  mechanisms for sensor networks
   –   Dynamic module loading and linking [ACM SenSys 2006]
   –   File system [IEEE/ACM IPSN 2009]
   –   Multi-threaded programming [EmNets 2004]
   –   Java, scripting, … [ACM SenSys 2006, …]
   –   Interactive network shell
   –   IP networking for low-power embedded systems [ACM/Usenix
       MobiSys 2003, ACM SenSys2007, ACM SenSys 2008]
• Pursuing new abstractions
   –   Protothreads [ACM SenSys 2006]
   –   Low-power radio networking [ACM SenSys 2007]
   –   Power profiling [EmNets 2007]
   –   Novel communication primitives
Contiki Influence
• Dynamic loading [EmNets 2004]
   – SOS: loadable modules [MobiSys 2005]
   – TinyOS 2.1.0: loadable modules (2008)
• Preemptive threads on top of events [EmNets 2004]
   – TOSThreads: preemptive threads on top of events (TinyOS
     2.1.0, 2008)
• Software-based power profiling [EmNets 2007]
   – TinyOS Quanto [OSDI 2008]
• IP-based sensor networks [MobiSys 2003, EWSN 2004,
  SenSys 2007]
   –   IETF 6lowpan: IPv6 over 802.15.4 (2006)
   –   Two papers at ACM SenSys 2008
   –   Tutorials at IPSN 2009
   –   Several demos, posters at SenSys, IPSN, …
Coffee [IPSN 2009]

                         Contiki Timeline                                                 Contiki 2.2.3
                                                                                   Contiki 2.2.2
                                                                                 Best poster @ SenSys 2008
                                                                              uIPv6
                                                                            Contiki 2.2.1
                                                                           Contiki 2.2
                                                                       Instant Contiki
                                                                    Contiki 2.1
                                                                Best demo @ SenSys 2007 (Mottola, Picco)
                                                                Power profiling [SenSys 2007]
                                                                Rime [SenSys 2007]
                                                           Power profiling [EmNets 2007]
                                                          Contiki 2.0
                                                   Dynamic linking [SenSys 2006]
                                                   Protothreads paper [SenSys 2006]
                                               Cooja
                                    Protothreads
                                 Contiki paper [EmNets 2004]
                               Contiki 1.2
                         IP for Sensor networks [EWSN 2004]
                uIP paper [MobiSys 2003]
               Contiki 1.0
         uIP
  lwIP

                                                   2007        2008           2009
2001 2002 2003    2004       2005       2006
The Coffee file system
              [IPSN 2009]
•   Flash-based file system
•   open(), read(), seek(), write(), close()
•   Constant memory complexity
•   Very lightweight
    – 5 kb ROM, < 0.5 kb RAM
• Very fast
    – More than 92% of raw flash throughput
Interactive shell
• Network debugging, performance tuning
• Leverage UNIX-style pipelines
• Network commands
• Direct serial connection, or over
  Telnet/TCP
• A generic interface for higher level
  applications
    – Automated interaction, scripting
Power Profiling
             [EmNets 2007]
• Software-based
  – Zero-cost hardware
  – Zero-effort deployment
• Good accuracy, low overhead
• Enables network-scale energy profiling
• Enables energy-aware mechanisms
Linear current draw

                         Transmit


                                    LED


      Sensors

                Listen




CPU
Accuracy is good [EmNets 2007]
Trend: experimental is increasing
                        30
 Experimental papers,


                        25
    ACM SenSys



                        20

                        15

                        10

                        5

                        0
                             2003   2004   2005   2006   2007   2008
                                              Year
Example: B-MAC
      [Polastre et al, SenSys 2004]
 “To [experimentally] determine the power consumption of
   each protocol, we implemented counters in the MAC
   protocol that keep track of how many times various
   operations were performed.
 For B-MAC, this includes receiving a byte, transmitting a
   byte, and checking the channel for activity.
 For S-MAC, we count the amount of time that the node is
   active, number of bytes transmitted and received, and
   the additional time the node spent awake due to
   adaptive listening.”
Polastre, Hill, Culler. Versatile low power media access for wireless sensor networks. SenSys 2004
Per-peripheral Power Profiling
  7

  6

  5

  4

  3

  2

  1

  0
      CPU   LPM    Tx    Rx
Per-packet Power Profiling
7
       Broadcast
6

5

4
Data reception
3

2

    Idle listening
1

0
     CPU    LPM      Tx   Rx
Rime: Communication Primitives
      [ACM SenSys 2007]
• Makes implementation of sensor network
  mechanisms easier
• A set of protocols
  – Data collection
  – Data dissemination
  – Unicast multi-hop routing
  – Single-hop bulk transfer
  –…
The Contniki IP Architecture
                   Applications


                       uIP                    Rime


                   SICSlowpan


                   SICSlowmac



  X-MAC               LPP                  NULLMAC



          CC2420                  CC1100
Instant Contiki
•   Contiki development environment
•   Single-file download
•   Linux system with all Contki tools installed
•   Runs in VMWare, VirtualBox
•   Removes toolset installation hurdle
Seamless Integration with IP
            Networks
• Atmel Raven/Jackdaw USB
  Stick
• Attaches as network card in
  Windows, Linux [EWSN 2009]
• IPv6 packets sent out over
  802.15.4 with 6lowpan header
  compression
Today: Build IPv6 Bridge with a
               Mote
• Make Tmote Sky mote a Linux
  SICSlowpan network card
• No custom hardware needed
                  Linux

                           Application
    Application

                           Transport
    Transport

                              IP
       IP

                           MAC / Link
    MAC / Link


                                         mote
                    mote
Contiki Programming Crash Course
• Hello world
• uIP APIs
  – Raw API
  – Protosockets
• Timers
• Building
Hello, world!
/* Declare the process */
PROCESS(hello_world_process, “Hello world”);
/* Make the process start when the module is loaded */
AUTOSTART_PROCESSES(&hello_world_process);

/* Define the process code */
PROCESS_THREAD(hello_world_process, ev, data) {
  PROCESS_BEGIN();            /* Must always come first */
  printf(“Hello, world!n”); /* Initialization code goes
   here */
  while(1) {                  /* Loop for ever */
    PROCESS_WAIT_EVENT();     /* Wait for something to
   happen */
  }
  PROCESS_END();              /* Must always come last */
}
uIP APIs
• Two APIs
  – The “raw” uIP event-driven API
  – Protosockets – sockets-like programming based on
    protothreads
• Event-driven API works well for small programs
  – Explicit state machines
• Protosockets work better for larger programs
  – Sequential code
Protosockets: example
int smtp_protothread(struct psock *s)
{
  PSOCK_BEGIN(s);

  PSOCK_READTO(s, 'n');

  if(strncmp(inputbuffer, “220”, 3) != 0) {
    PSOCK_CLOSE(s);
    PSOCK_EXIT(s);
  }

  PSOCK_SEND(s, “HELO ”, 5);
  PSOCK_SEND(s, hostname, strlen(hostname));
  PSOCK_SEND(s, “rn”, 2);

  PSOCK_READTO(s, 'n');

  if(inputbuffer[0] != '2') {
    PSOCK_CLOSE(s);
    PSOCK_EXIT(s);
  }
Four types of timers
• struct timer
   – Passive timer, only keeps track of its expiration time
• struct etimer
   – Active timer, sends an event when it expires
• struct ctimer
   – Active timer, calls a function when it expires
• struct rtimer
   – Real-time timer, calls a function at an exact time
   – Limited function support
Using etimers in processes
PROCESS_THREAD(hello_world_process, ev, data) {
  static struct etimer et;        /* Must be static      */
  PROCESS_BEGIN();                /* since processes are */
                                  /* protothreads        */
  while(1) {
       etimer_set(&et, CLOCK_SECOND);
       PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
  }
  PROCESS_END();
}
Example: building hello world
•   cd examples/hello-world
•   make TARGET=native               Build monolithic system for native
•   ./hello-world.native             Run entire Contiki system + app
•   make TARGET=netsim               Build netsim simulation
•   ./hello-world.netsim             Run netsim simulation
•   make TARGET=sky                  Build monolithic system image
•   make TARGET=sky hello-world.u    Build & upload system image
•   make TARGET=sky hello-world.ce   Build loadable module
•   make TARGET=esb                  Monolithic system image for ESB
•   make TARGET=esb hello-world.u             Build & upload image
•   make TARGET=esb hello-world.ce   Build loadable module
make TARGET=
• TARGET=name of a directory under
  platform/
• make TARGET=xxx savetarget
  – Remembers the TARGET
  – Example: make TARGET=netsim savetarget
Hands-on
Hands on
• Install Instant Contiki
   – USB stick with VMWare Player, Instant Contiki, FTDI
     Driver
• Compilation
   –   Hello World for native
   –   Blink for Tmote Sky
   –   Hello World for Tmote Sky
   –   Contiki Shell for Tmote Sky
• IPv6 mote bridge
   – Tmote Sky / JCreate as an IPv6/6lowpan bridge
Conclusions
• IP for embedded systems, sensor networks
• Contiki: many influential, widely used features
  – IP for sensor networks, dynamic loading, protothreads
  – Vision and mission
     • Exploring successful CS abstractions in a novel context,
       pursing new abstractions
• Instant Contiki simplifies development
• IPv6 bridge mote: no custom hardware needed
Thank You
http://www.sics.se/contiki/

Más contenido relacionado

La actualidad más candente

Mininet: Moving Forward
Mininet: Moving ForwardMininet: Moving Forward
Mininet: Moving Forward
ON.Lab
 
Recent advance in netmap/VALE(mSwitch)
Recent advance in netmap/VALE(mSwitch)Recent advance in netmap/VALE(mSwitch)
Recent advance in netmap/VALE(mSwitch)
micchie
 

La actualidad más candente (20)

Symmetric Crypto for DPDK - Declan Doherty
Symmetric Crypto for DPDK - Declan DohertySymmetric Crypto for DPDK - Declan Doherty
Symmetric Crypto for DPDK - Declan Doherty
 
DPDK summit 2015: It's kind of fun to do the impossible with DPDK
DPDK summit 2015: It's kind of fun  to do the impossible with DPDKDPDK summit 2015: It's kind of fun  to do the impossible with DPDK
DPDK summit 2015: It's kind of fun to do the impossible with DPDK
 
Operating System fo IoT
Operating System fo IoTOperating System fo IoT
Operating System fo IoT
 
DPDK Summit - 08 Sept 2014 - Futurewei - Jun Xu - Revisit the IP Stack in Lin...
DPDK Summit - 08 Sept 2014 - Futurewei - Jun Xu - Revisit the IP Stack in Lin...DPDK Summit - 08 Sept 2014 - Futurewei - Jun Xu - Revisit the IP Stack in Lin...
DPDK Summit - 08 Sept 2014 - Futurewei - Jun Xu - Revisit the IP Stack in Lin...
 
Coscup SDN workshop - mininet
Coscup SDN workshop - mininetCoscup SDN workshop - mininet
Coscup SDN workshop - mininet
 
Performance challenges in software networking
Performance challenges in software networkingPerformance challenges in software networking
Performance challenges in software networking
 
Accelerating Neutron with Intel DPDK
Accelerating Neutron with Intel DPDKAccelerating Neutron with Intel DPDK
Accelerating Neutron with Intel DPDK
 
Lagopus presentation on 14th Annual ON*VECTOR International Photonics Workshop
Lagopus presentation on 14th Annual ON*VECTOR International Photonics WorkshopLagopus presentation on 14th Annual ON*VECTOR International Photonics Workshop
Lagopus presentation on 14th Annual ON*VECTOR International Photonics Workshop
 
Disruptive IP Networking with Intel DPDK on Linux
Disruptive IP Networking with Intel DPDK on LinuxDisruptive IP Networking with Intel DPDK on Linux
Disruptive IP Networking with Intel DPDK on Linux
 
Python Basics for Operators Troubleshooting OpenStack
Python Basics for Operators Troubleshooting OpenStackPython Basics for Operators Troubleshooting OpenStack
Python Basics for Operators Troubleshooting OpenStack
 
ON.LAB Mininet
ON.LAB MininetON.LAB Mininet
ON.LAB Mininet
 
Intel DPDK Step by Step instructions
Intel DPDK Step by Step instructionsIntel DPDK Step by Step instructions
Intel DPDK Step by Step instructions
 
Tommaso Cucinotta - Low-latency and power-efficient audio applications on Linux
Tommaso Cucinotta - Low-latency and power-efficient audio applications on LinuxTommaso Cucinotta - Low-latency and power-efficient audio applications on Linux
Tommaso Cucinotta - Low-latency and power-efficient audio applications on Linux
 
Openstack Quantum Security Groups Session
Openstack Quantum Security Groups SessionOpenstack Quantum Security Groups Session
Openstack Quantum Security Groups Session
 
DPDK Summit 2015 - NTT - Yoshihiro Nakajima
DPDK Summit 2015 - NTT - Yoshihiro NakajimaDPDK Summit 2015 - NTT - Yoshihiro Nakajima
DPDK Summit 2015 - NTT - Yoshihiro Nakajima
 
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitchDPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
 
Mininet: Moving Forward
Mininet: Moving ForwardMininet: Moving Forward
Mininet: Moving Forward
 
Recent advance in netmap/VALE(mSwitch)
Recent advance in netmap/VALE(mSwitch)Recent advance in netmap/VALE(mSwitch)
Recent advance in netmap/VALE(mSwitch)
 
Vigor 3910 docker firmware quick start
Vigor 3910 docker firmware quick startVigor 3910 docker firmware quick start
Vigor 3910 docker firmware quick start
 
Openstack Trunk Port
Openstack Trunk PortOpenstack Trunk Port
Openstack Trunk Port
 

Destacado

RIOT and the evolution of operating systems for IoT devices (Emmanuel Baccell...
RIOT and the evolution of operating systems for IoT devices (Emmanuel Baccell...RIOT and the evolution of operating systems for IoT devices (Emmanuel Baccell...
RIOT and the evolution of operating systems for IoT devices (Emmanuel Baccell...
AGILE IoT
 

Destacado (20)

Contiki introduction I.
Contiki introduction I.Contiki introduction I.
Contiki introduction I.
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
 
Internship end
Internship endInternship end
Internship end
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
 
Switch to Python 3…now…immediately
Switch to Python 3…now…immediatelySwitch to Python 3…now…immediately
Switch to Python 3…now…immediately
 
XMPP Technical Overview + Jingle Protocol Study
XMPP Technical Overview + Jingle Protocol StudyXMPP Technical Overview + Jingle Protocol Study
XMPP Technical Overview + Jingle Protocol Study
 
Internet Of Things: Hands on: YOW! night
Internet Of Things: Hands on: YOW! nightInternet Of Things: Hands on: YOW! night
Internet Of Things: Hands on: YOW! night
 
Contiki introduction II-from what to how
Contiki introduction II-from what to howContiki introduction II-from what to how
Contiki introduction II-from what to how
 
Arduino compatible layer (with 6LoWPAN) on Contiki
Arduino compatible layer (with 6LoWPAN) on ContikiArduino compatible layer (with 6LoWPAN) on Contiki
Arduino compatible layer (with 6LoWPAN) on Contiki
 
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under LinuxPractical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
 
The Real Time Web with XMPP
The Real Time Web with XMPPThe Real Time Web with XMPP
The Real Time Web with XMPP
 
What is XMPP Protocol
What is XMPP ProtocolWhat is XMPP Protocol
What is XMPP Protocol
 
RIOT and the evolution of operating systems for IoT devices (Emmanuel Baccell...
RIOT and the evolution of operating systems for IoT devices (Emmanuel Baccell...RIOT and the evolution of operating systems for IoT devices (Emmanuel Baccell...
RIOT and the evolution of operating systems for IoT devices (Emmanuel Baccell...
 
Run Your Own 6LoWPAN Based IoT Network
Run Your Own 6LoWPAN Based IoT NetworkRun Your Own 6LoWPAN Based IoT Network
Run Your Own 6LoWPAN Based IoT Network
 
XMPP In Real Time
XMPP In Real TimeXMPP In Real Time
XMPP In Real Time
 
XMPP 101
XMPP 101XMPP 101
XMPP 101
 
ICT role in Yemen
ICT role in Yemen ICT role in Yemen
ICT role in Yemen
 
Contiki os timer tutorial
Contiki os timer tutorialContiki os timer tutorial
Contiki os timer tutorial
 
Network configuration
Network configurationNetwork configuration
Network configuration
 
CoAP Course for m2m and Internet of Things scenarios
CoAP Course for m2m and Internet of Things scenariosCoAP Course for m2m and Internet of Things scenarios
CoAP Course for m2m and Internet of Things scenarios
 

Similar a IPSN 2009 Contiki / uIP tutorial

SNAIL Project for IoT Connectivity
SNAIL Project for IoT ConnectivitySNAIL Project for IoT Connectivity
SNAIL Project for IoT Connectivity
Daeyoung Kim
 

Similar a IPSN 2009 Contiki / uIP tutorial (20)

CIF16: Building the Superfluid Cloud with Unikernels (Simon Kuenzer, NEC Europe)
CIF16: Building the Superfluid Cloud with Unikernels (Simon Kuenzer, NEC Europe)CIF16: Building the Superfluid Cloud with Unikernels (Simon Kuenzer, NEC Europe)
CIF16: Building the Superfluid Cloud with Unikernels (Simon Kuenzer, NEC Europe)
 
CINECA for HCP and e-infrastructures infrastructures
CINECA for HCP and e-infrastructures infrastructuresCINECA for HCP and e-infrastructures infrastructures
CINECA for HCP and e-infrastructures infrastructures
 
Architectures and buildings
Architectures and buildingsArchitectures and buildings
Architectures and buildings
 
Intelligent IoT gateway on openwrt
Intelligent IoT gateway on openwrtIntelligent IoT gateway on openwrt
Intelligent IoT gateway on openwrt
 
SNAIL Project for IoT Connectivity
SNAIL Project for IoT ConnectivitySNAIL Project for IoT Connectivity
SNAIL Project for IoT Connectivity
 
Internet das Coisas: Tecnologias Atuais e Futuras, e o Papel do Software
Internet das Coisas: Tecnologias Atuais e Futuras, e o Papel do SoftwareInternet das Coisas: Tecnologias Atuais e Futuras, e o Papel do Software
Internet das Coisas: Tecnologias Atuais e Futuras, e o Papel do Software
 
Unikraft: Fast, Specialized Unikernels the Easy Way
Unikraft: Fast, Specialized Unikernels the Easy WayUnikraft: Fast, Specialized Unikernels the Easy Way
Unikraft: Fast, Specialized Unikernels the Easy Way
 
ccna lec 1.pdf
ccna lec 1.pdfccna lec 1.pdf
ccna lec 1.pdf
 
Contiki IoT simulation
Contiki IoT simulationContiki IoT simulation
Contiki IoT simulation
 
QSpiders - Day1 Network Basics
QSpiders - Day1 Network BasicsQSpiders - Day1 Network Basics
QSpiders - Day1 Network Basics
 
Real-time DeepLearning on IoT Sensor Data
Real-time DeepLearning on IoT Sensor DataReal-time DeepLearning on IoT Sensor Data
Real-time DeepLearning on IoT Sensor Data
 
Internet of Things – Contiki.pdf
Internet of Things – Contiki.pdfInternet of Things – Contiki.pdf
Internet of Things – Contiki.pdf
 
µIP (micro IP)
µIP (micro IP)µIP (micro IP)
µIP (micro IP)
 
XPDDS18: Unleashing the Power of Unikernels with Unikraft - Florian Schmidt, ...
XPDDS18: Unleashing the Power of Unikernels with Unikraft - Florian Schmidt, ...XPDDS18: Unleashing the Power of Unikernels with Unikraft - Florian Schmidt, ...
XPDDS18: Unleashing the Power of Unikernels with Unikraft - Florian Schmidt, ...
 
Webcast: Reduce latency, improve analytics and maximize asset utilization in ...
Webcast: Reduce latency, improve analytics and maximize asset utilization in ...Webcast: Reduce latency, improve analytics and maximize asset utilization in ...
Webcast: Reduce latency, improve analytics and maximize asset utilization in ...
 
International SIP conference 2009
International SIP conference 2009International SIP conference 2009
International SIP conference 2009
 
Intelligent IoT Gateway on OpenWrt
Intelligent IoT Gateway on OpenWrtIntelligent IoT Gateway on OpenWrt
Intelligent IoT Gateway on OpenWrt
 
Mina2
Mina2Mina2
Mina2
 
Open Ethernet: an open-source approach to modern network design
Open Ethernet: an open-source approach to modern network designOpen Ethernet: an open-source approach to modern network design
Open Ethernet: an open-source approach to modern network design
 
Addressing the hard problems of automotive Linux: networking and IPC
Addressing the hard problems of automotive Linux: networking and IPCAddressing the hard problems of automotive Linux: networking and IPC
Addressing the hard problems of automotive Linux: networking and IPC
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

IPSN 2009 Contiki / uIP tutorial

  • 1. IP-based Sensor Networking with Contiki Adam Dunkels, PhD, Fredrik Österlind, Nicolas Tsiftes, Niclas Finne, Joakim Eriksson, Zhitao He (SICS) Oliver Schmidt (SAP AG) Julien Abeillé, Mathilde Durvy, PhD (Cisco) Takahide Matsutsuka, Simon Barner, Simon Berg Colin O'Flynn (NewAE) Eric Gnoske, Blake Leverett, Michael Vidales (Atmel) David Kopf
  • 2. Today • IP for embedded systems • The history of IP-based sensor networks • Contiki • Hands-on – Instant Contiki – Contiki for Tmote Sky – Tmote Sky as IPv6/6lowpan bridge
  • 3. IP for Embedded Systems
  • 4. History of IP for Embedded Systems • Embedded systems – Resource-constrained – Autonomous operation – Remote configuration, data collection, … • 1999: EMIT Alliance – remote communication – EMbed the InterneT Alliance – EmWare, Atmel, Texas Instruments, Zilog, Microchip, … – ”IP too heavyweight” • Non-IP based wired protocol • Gateways
  • 5. 2000: lwIP • Open source lightweight IP stack – Top-down design • Similar to BSD, Linux, … – 40 kb code, 20 kb RAM – IP, ICMP, UDP, TCP – Widely used • ”Too large”…
  • 6. 2001: uIP • World’s smallest TCP/IP stack – Open source – Bottom-up design – 4 kb code, 1 kb RAM – Fully RFC compliant – IP, ICMP, UDP, TCP
  • 7.
  • 8. 2002: IP for Embedded is a Fact • Non-IP solutions went away – Highly optimized custom protocols – IP took over • EMIT Alliance is no more – EmWare moved to uIP
  • 9. The Most Important Lesson Learned • Ability to communicate more important than performance
  • 10. Example: uIP-based Pico Satellite • CubeSat: pico satellite construction kit – MSP430-based • 128 bytes of RAM for uIP
  • 11. 2004: IP-based Sensor Networks • Lightweight IP stack (uIP) • Header compression • Low-power MAC layer • Sensor data – UDP • Configuration – TCP • 2006: IETF 6lowpan
  • 12. 2004: First IP-based Sensor Network
  • 13. Why IP for Sensor Networks? • Scalable • Versatile • Manageable • Open and flexible standard • Widely deployed • Lightweight – As shown by uIP, uIPv6 • Low-power – IETF 6lowpan wg – Power-saving MAC protocols
  • 14. September 2008: IP for Smart Objects Alliance
  • 15. October 2008: uIPv6, first certified IPv6 stack, SICSlowpan
  • 16.
  • 17. November 2008: 30th best invention of 2008
  • 19. Contiki as an Open Source Project • Open source – BSD license – C programming language • Version 1.0 released in March 2003 – Version 2.2.3 in March 2009 • Highly portable – Tmote Sky, JCreate, TelosB, Atmel Raven, MSB, ESB, MicaZ, … – Simulators: Cooja, MSPsim, AvroraZ, netsim – Native platform • Actively developed – 17 developers from SICS, SAP, Cisco, NewAE, TU Munich, Atmel • Active mailing list
  • 20. Contiki as a Research Theme • Exploring successful computer science abstractions, mechanisms for sensor networks – Dynamic module loading and linking [ACM SenSys 2006] – File system [IEEE/ACM IPSN 2009] – Multi-threaded programming [EmNets 2004] – Java, scripting, … [ACM SenSys 2006, …] – Interactive network shell – IP networking for low-power embedded systems [ACM/Usenix MobiSys 2003, ACM SenSys2007, ACM SenSys 2008] • Pursuing new abstractions – Protothreads [ACM SenSys 2006] – Low-power radio networking [ACM SenSys 2007] – Power profiling [EmNets 2007] – Novel communication primitives
  • 21. Contiki Influence • Dynamic loading [EmNets 2004] – SOS: loadable modules [MobiSys 2005] – TinyOS 2.1.0: loadable modules (2008) • Preemptive threads on top of events [EmNets 2004] – TOSThreads: preemptive threads on top of events (TinyOS 2.1.0, 2008) • Software-based power profiling [EmNets 2007] – TinyOS Quanto [OSDI 2008] • IP-based sensor networks [MobiSys 2003, EWSN 2004, SenSys 2007] – IETF 6lowpan: IPv6 over 802.15.4 (2006) – Two papers at ACM SenSys 2008 – Tutorials at IPSN 2009 – Several demos, posters at SenSys, IPSN, …
  • 22. Coffee [IPSN 2009] Contiki Timeline Contiki 2.2.3 Contiki 2.2.2 Best poster @ SenSys 2008 uIPv6 Contiki 2.2.1 Contiki 2.2 Instant Contiki Contiki 2.1 Best demo @ SenSys 2007 (Mottola, Picco) Power profiling [SenSys 2007] Rime [SenSys 2007] Power profiling [EmNets 2007] Contiki 2.0 Dynamic linking [SenSys 2006] Protothreads paper [SenSys 2006] Cooja Protothreads Contiki paper [EmNets 2004] Contiki 1.2 IP for Sensor networks [EWSN 2004] uIP paper [MobiSys 2003] Contiki 1.0 uIP lwIP 2007 2008 2009 2001 2002 2003 2004 2005 2006
  • 23. The Coffee file system [IPSN 2009] • Flash-based file system • open(), read(), seek(), write(), close() • Constant memory complexity • Very lightweight – 5 kb ROM, < 0.5 kb RAM • Very fast – More than 92% of raw flash throughput
  • 24. Interactive shell • Network debugging, performance tuning • Leverage UNIX-style pipelines • Network commands • Direct serial connection, or over Telnet/TCP • A generic interface for higher level applications – Automated interaction, scripting
  • 25. Power Profiling [EmNets 2007] • Software-based – Zero-cost hardware – Zero-effort deployment • Good accuracy, low overhead • Enables network-scale energy profiling • Enables energy-aware mechanisms
  • 26. Linear current draw Transmit LED Sensors Listen CPU
  • 27. Accuracy is good [EmNets 2007]
  • 28. Trend: experimental is increasing 30 Experimental papers, 25 ACM SenSys 20 15 10 5 0 2003 2004 2005 2006 2007 2008 Year
  • 29. Example: B-MAC [Polastre et al, SenSys 2004] “To [experimentally] determine the power consumption of each protocol, we implemented counters in the MAC protocol that keep track of how many times various operations were performed. For B-MAC, this includes receiving a byte, transmitting a byte, and checking the channel for activity. For S-MAC, we count the amount of time that the node is active, number of bytes transmitted and received, and the additional time the node spent awake due to adaptive listening.” Polastre, Hill, Culler. Versatile low power media access for wireless sensor networks. SenSys 2004
  • 30. Per-peripheral Power Profiling 7 6 5 4 3 2 1 0 CPU LPM Tx Rx
  • 31. Per-packet Power Profiling 7 Broadcast 6 5 4 Data reception 3 2 Idle listening 1 0 CPU LPM Tx Rx
  • 32. Rime: Communication Primitives [ACM SenSys 2007] • Makes implementation of sensor network mechanisms easier • A set of protocols – Data collection – Data dissemination – Unicast multi-hop routing – Single-hop bulk transfer –…
  • 33. The Contniki IP Architecture Applications uIP Rime SICSlowpan SICSlowmac X-MAC LPP NULLMAC CC2420 CC1100
  • 34. Instant Contiki • Contiki development environment • Single-file download • Linux system with all Contki tools installed • Runs in VMWare, VirtualBox • Removes toolset installation hurdle
  • 35. Seamless Integration with IP Networks • Atmel Raven/Jackdaw USB Stick • Attaches as network card in Windows, Linux [EWSN 2009] • IPv6 packets sent out over 802.15.4 with 6lowpan header compression
  • 36. Today: Build IPv6 Bridge with a Mote • Make Tmote Sky mote a Linux SICSlowpan network card • No custom hardware needed Linux Application Application Transport Transport IP IP MAC / Link MAC / Link mote mote
  • 37. Contiki Programming Crash Course • Hello world • uIP APIs – Raw API – Protosockets • Timers • Building
  • 38. Hello, world! /* Declare the process */ PROCESS(hello_world_process, “Hello world”); /* Make the process start when the module is loaded */ AUTOSTART_PROCESSES(&hello_world_process); /* Define the process code */ PROCESS_THREAD(hello_world_process, ev, data) { PROCESS_BEGIN(); /* Must always come first */ printf(“Hello, world!n”); /* Initialization code goes here */ while(1) { /* Loop for ever */ PROCESS_WAIT_EVENT(); /* Wait for something to happen */ } PROCESS_END(); /* Must always come last */ }
  • 39. uIP APIs • Two APIs – The “raw” uIP event-driven API – Protosockets – sockets-like programming based on protothreads • Event-driven API works well for small programs – Explicit state machines • Protosockets work better for larger programs – Sequential code
  • 40. Protosockets: example int smtp_protothread(struct psock *s) { PSOCK_BEGIN(s); PSOCK_READTO(s, 'n'); if(strncmp(inputbuffer, “220”, 3) != 0) { PSOCK_CLOSE(s); PSOCK_EXIT(s); } PSOCK_SEND(s, “HELO ”, 5); PSOCK_SEND(s, hostname, strlen(hostname)); PSOCK_SEND(s, “rn”, 2); PSOCK_READTO(s, 'n'); if(inputbuffer[0] != '2') { PSOCK_CLOSE(s); PSOCK_EXIT(s); }
  • 41. Four types of timers • struct timer – Passive timer, only keeps track of its expiration time • struct etimer – Active timer, sends an event when it expires • struct ctimer – Active timer, calls a function when it expires • struct rtimer – Real-time timer, calls a function at an exact time – Limited function support
  • 42. Using etimers in processes PROCESS_THREAD(hello_world_process, ev, data) { static struct etimer et; /* Must be static */ PROCESS_BEGIN(); /* since processes are */ /* protothreads */ while(1) { etimer_set(&et, CLOCK_SECOND); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); } PROCESS_END(); }
  • 43. Example: building hello world • cd examples/hello-world • make TARGET=native Build monolithic system for native • ./hello-world.native Run entire Contiki system + app • make TARGET=netsim Build netsim simulation • ./hello-world.netsim Run netsim simulation • make TARGET=sky Build monolithic system image • make TARGET=sky hello-world.u Build & upload system image • make TARGET=sky hello-world.ce Build loadable module • make TARGET=esb Monolithic system image for ESB • make TARGET=esb hello-world.u Build & upload image • make TARGET=esb hello-world.ce Build loadable module
  • 44. make TARGET= • TARGET=name of a directory under platform/ • make TARGET=xxx savetarget – Remembers the TARGET – Example: make TARGET=netsim savetarget
  • 46. Hands on • Install Instant Contiki – USB stick with VMWare Player, Instant Contiki, FTDI Driver • Compilation – Hello World for native – Blink for Tmote Sky – Hello World for Tmote Sky – Contiki Shell for Tmote Sky • IPv6 mote bridge – Tmote Sky / JCreate as an IPv6/6lowpan bridge
  • 47. Conclusions • IP for embedded systems, sensor networks • Contiki: many influential, widely used features – IP for sensor networks, dynamic loading, protothreads – Vision and mission • Exploring successful CS abstractions in a novel context, pursing new abstractions • Instant Contiki simplifies development • IPv6 bridge mote: no custom hardware needed