SlideShare a Scribd company logo
Python for IoT
A return of experience
Alexandre Abadie, Inria
Outline
What IoT are we talking about ?
The usual protocols for IoT
Pyaiot, connecting objects to the web
How we built Pyaiot
Lessons learned
Conclusion
What IoT are we talking about ?
The Internet of Things today
High-end devices
Low-end devices
⇒ adapted protocols are required
Outline
What IoT are we talking about ?
⇒ The usual protocols for IoT
Pyaiot, connecting objects to the web
How we built Pyaiot
Lessons learned
Conclusion
Usual protocols for IoT: CoAP
Core WG at IETF specifications (2010)
RFC 7252
Similar to HTTP REST:
GET/PUT/POST/DELETE + OBSERVE
Works on UDP with small payload
overhead
More information at http://coap.technology/
source: https://fr.wikipedia.org/wiki/CoAP
CoAP: available implementations in Python
3 available implementations:
TxThings: Twisted based, Python 2 & 3
https://github.com/mwasilak/txThings
Aiocoap: asyncio based, Python 3 only
https://github.com/chrysn/aiocoap
CoaPthon: Threading based, Python 2 & 3
https://github.com/Tanganelli/CoAPthon
Implementations exist for other languages: http://coap.technology/impls.html
Usual protocols for IoT: MQTT
Based on publication/subscriptions to topics pattern
Topics have a path form: this/is/a/topic
MQTT v3.1.1 is an OASIS standard
MQTT Sensor Network (MQTT-SN): adapted for constrained devices
source: https://dev.to/kenwalger/overview-of-the-mqtt-protocol
MQTT: available implementations in Python
2 available implementations:
Paho-mqtt: threading based, considered as the reference implementation
https://pypi.python.org/pypi/paho-mqtt
HBMQTT: asyncio based
https://github.com/beerfactory/hbmqtt
Outline
What IoT are we talking about ?
The usual protocols for IoT
⇒ Pyaiot, connecting objects to the web
How we built Pyaiot
Lessons learned
Conclusion
Why Pyaiot?
Need for a web application able to communicate with contrained devices
⇒ but constrained devices cannot use usual web protocols
Why Pyaiot?
Need for a web application able to communicate with contrained devices
⇒ but constrained devices cannot use usual web protocols
Need for multi-site support
⇒ but constrained devices cannot be exposed directly to the web
Why Pyaiot?
Need for a web application able to communicate with contrained devices
⇒ but constrained devices cannot use usual web protocols
Need for multi-site support
⇒ but constrained devices cannot be exposed directly to the web
Heterogeneous protocol support
⇒ various IoT protocols exist
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
Modular ⇒ extensible
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
Modular ⇒ extensible
Bi-directionnal and real time access to nodes ⇒ reactive
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
Modular ⇒ extensible
Bi-directionnal and real time access to nodes ⇒ reactive
No constraint regarding the backend language ⇒ let's choose Python!
General guidelines
Open-Source and simple design⇒ can be deployed by anyone
https://github.com/pyaiot/pyaiot
Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
Modular ⇒ extensible
Bi-directionnal and real time access to nodes ⇒ reactive
No constraint regarding the backend language ⇒ let's choose Python!
Pyaiot targets contrained nodes running RIOT: https://riot-os.org
Pyaiot overview
Permanent web showcase for RIOT available at
http://riot-demo.inria.fr
Pyaiot: The web dashboard
Outline
What IoT are we talking about ?
The usual protocols for IoT
Pyaiot, connecting objects to the web
⇒ How we built Pyaiot
Lessons learned
Conclusion
Pyaiot overview
Pyaiot services
Gateways are clients running in private networks
Nodes are kept isolated from Internet
Messages exchanged in JSON format
Works with low-end devices (RIOT) and high-end devices (Python)
Technical choices
Web dashboard developed with Vue.js   http://vuejs.org
Service applications based on Tornado framework with:
HTTP server
Websocket server and client
Aiocoap for CoAP protocol support
HBMQTT for MQTT protocol support
Technical choices
Web dashboard developed with Vue.js   http://vuejs.org
Service applications based on Tornado framework with:
HTTP server
Websocket server and client
Aiocoap for CoAP protocol support
HBMQTT for MQTT protocol support
⇒ All python packages are asyncio based/compatible ⇒ simplify integration
The MQTT gateway in detail
MQTT-SN is required for low-end device
⇒ a MQTT to MQTT-SN gateway/broker is required
No implementation in Python
⇒ let's go for mosquitto.rsmb
The MQTT gateway in detail
MQTT-SN is required for low-end device
⇒ a MQTT to MQTT-SN gateway/broker is required
No implementation in Python
⇒ let's go for mosquitto.rsmb
Node/Gateway
subscribe/publish to topic publish/subscribe to topics
gateway//discover node/check
node//resources
node//
Outline
What IoT are we talking about ?
The usual protocols for IoT
Pyaiot, connecting objects to the web
How we built Pyaiot
⇒ Lessons learned
Conclusion
Using asyncio
Easy to read asynchronous programming language
Using asyncio
Easy to read asynchronous programming language
Asyncio new syntax available with Python >= 3.5
Using asyncio
Easy to read asynchronous programming language
Asyncio new syntax available with Python >= 3.5
... but Python 3.4.2 available on Raspbian
@asyncio.coroutine
def my_coroutine():
my_long_call()
yield from my_coroutine() # wait until done
asyncio.get_event_loop().create_task(my_coroutine) # scheduled in ioloop
asyncio.ensure_future(my_coroutine) # scheduled in ioloop, requires python 3.4.4
Using asyncio
Easy to read asynchronous programming language
Asyncio new syntax available with Python >= 3.5
... but Python 3.4.2 available on Raspbian
@asyncio.coroutine
def my_coroutine():
my_long_call()
yield from my_coroutine() # wait until done
asyncio.get_event_loop().create_task(my_coroutine) # scheduled in ioloop
asyncio.ensure_future(my_coroutine) # scheduled in ioloop, requires python 3.4.4
with python 3.5 new syntax:
async def my_coroutine():
my_long_call()
await my_coroutine() # wait until done
asyncio.ensure_future(my_coroutine) # scheduled in ioloop
The benefits of Python
Develop fast, even with complex things
The benefits of Python
Develop fast, even with complex things
Can run on any high-end device : from a Raspberry PI to a Cloud server
The benefits of Python
Develop fast, even with complex things
Can run on any high-end device : from a Raspberry PI to a Cloud server
Off-the-shelf packages for IoT available: Aiocoap, HBMQTT
The benefits of Python
Develop fast, even with complex things
Can run on any high-end device : from a Raspberry PI to a Cloud server
Off-the-shelf packages for IoT available: Aiocoap, HBMQTT
⇒ Python is adapted to IoT
Conclusion
Widely used protocol in IoT is MQTT
Adapted protocols are required for constrained devices (microcontrollers)
⇒ CoAP, MQTT-SN
Conclusion
Widely used protocol in IoT is MQTT
Adapted protocols are required for constrained devices (microcontrollers)
⇒ CoAP, MQTT-SN
We easily built an application following the initial requirements
⇒ Pyaiot: https://github.com/pyaiot/pyaiot
Conclusion
Widely used protocol in IoT is MQTT
Adapted protocols are required for constrained devices (microcontrollers)
⇒ CoAP, MQTT-SN
We easily built an application following the initial requirements
⇒ Pyaiot: https://github.com/pyaiot/pyaiot
Asyncio made things simpler... after some headaches
Conclusion
Widely used protocol in IoT is MQTT
Adapted protocols are required for constrained devices (microcontrollers)
⇒ CoAP, MQTT-SN
We easily built an application following the initial requirements
⇒ Pyaiot: https://github.com/pyaiot/pyaiot
Asyncio made things simpler... after some headaches
Pyaiot is still work in progress... even if it works pretty well
Demo!
http://riot-demo.inria.fr
Thanks!

More Related Content

What's hot

Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek WebRTC 2015 - What's next for WebRTC?Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek
 
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
Linaro
 
Inria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoT
Inria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoTInria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoT
Inria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoT
Stéphanie Roger
 
Linux on RISC-V (ELC 2020)
Linux on RISC-V (ELC 2020)Linux on RISC-V (ELC 2020)
Linux on RISC-V (ELC 2020)
Drew Fustini
 
Upperside WebRTC conference - WebRTC intro
Upperside WebRTC conference - WebRTC introUpperside WebRTC conference - WebRTC intro
Upperside WebRTC conference - WebRTC intro
Victor Pascual Ávila
 
Linux on RISC-V with Open Hardware (ELC-E 2020)
Linux on RISC-V with Open Hardware (ELC-E 2020)Linux on RISC-V with Open Hardware (ELC-E 2020)
Linux on RISC-V with Open Hardware (ELC-E 2020)
Drew Fustini
 
Kranky Geek WebRTC 2015 - The future of ORTC with WebRTC
Kranky Geek WebRTC 2015 - The future of ORTC with WebRTCKranky Geek WebRTC 2015 - The future of ORTC with WebRTC
Kranky Geek WebRTC 2015 - The future of ORTC with WebRTC
Kranky Geek
 
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
Samsung Open Source Group
 
Janus conf'19: janus client side
Janus conf'19:  janus client sideJanus conf'19:  janus client side
Janus conf'19: janus client side
Alexandre Gouaillard
 
Quality Assurance for WebRTC Services
Quality Assurance for WebRTC ServicesQuality Assurance for WebRTC Services
Quality Assurance for WebRTC Services
Tsahi Levent-levi
 
SOSCON 2016 JerryScript
SOSCON 2016 JerryScriptSOSCON 2016 JerryScript
SOSCON 2016 JerryScript
Samsung Open Source Group
 
Webrtc puzzle
Webrtc puzzleWebrtc puzzle
Webrtc puzzle
Mihály Mészáros
 
What is a Service Mesh and what can it do for your Microservices
What is a Service Mesh and what can it do for your MicroservicesWhat is a Service Mesh and what can it do for your Microservices
What is a Service Mesh and what can it do for your Microservices
Matt Turner
 
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Igalia
 
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/LinuxIoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
Samsung Open Source Group
 
Open Source Internet of Things 101 – EclipseCon 2016
Open Source Internet of Things 101 – EclipseCon 2016Open Source Internet of Things 101 – EclipseCon 2016
Open Source Internet of Things 101 – EclipseCon 2016
Benjamin Cabé
 
BKK16-105 HALs for LITE
BKK16-105 HALs for LITEBKK16-105 HALs for LITE
BKK16-105 HALs for LITE
Linaro
 
Iotivity atmel-20150328rzr
Iotivity atmel-20150328rzrIotivity atmel-20150328rzr
Iotivity atmel-20150328rzr
Phil www.rzr.online.fr
 
Reaching the multimedia web from embedded platforms with WPEWebkit
Reaching the multimedia web from embedded platforms with WPEWebkitReaching the multimedia web from embedded platforms with WPEWebkit
Reaching the multimedia web from embedded platforms with WPEWebkit
Igalia
 

What's hot (20)

Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek WebRTC 2015 - What's next for WebRTC?Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek WebRTC 2015 - What's next for WebRTC?
 
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
Linux-wpan: IEEE 802.15.4 and 6LoWPAN in the Linux Kernel - BUD17-120
 
Inria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoT
Inria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoTInria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoT
Inria Tech Talk : RIOT, l'OS libre pour vos objets connectés #IoT
 
Linux on RISC-V (ELC 2020)
Linux on RISC-V (ELC 2020)Linux on RISC-V (ELC 2020)
Linux on RISC-V (ELC 2020)
 
Upperside WebRTC conference - WebRTC intro
Upperside WebRTC conference - WebRTC introUpperside WebRTC conference - WebRTC intro
Upperside WebRTC conference - WebRTC intro
 
Linux on RISC-V with Open Hardware (ELC-E 2020)
Linux on RISC-V with Open Hardware (ELC-E 2020)Linux on RISC-V with Open Hardware (ELC-E 2020)
Linux on RISC-V with Open Hardware (ELC-E 2020)
 
Kranky Geek WebRTC 2015 - The future of ORTC with WebRTC
Kranky Geek WebRTC 2015 - The future of ORTC with WebRTCKranky Geek WebRTC 2015 - The future of ORTC with WebRTC
Kranky Geek WebRTC 2015 - The future of ORTC with WebRTC
 
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
Connected Tizen: Bringing Tizen to Your Connected Devices Using the Yocto Pro...
 
Janus conf'19: janus client side
Janus conf'19:  janus client sideJanus conf'19:  janus client side
Janus conf'19: janus client side
 
Quality Assurance for WebRTC Services
Quality Assurance for WebRTC ServicesQuality Assurance for WebRTC Services
Quality Assurance for WebRTC Services
 
SOSCON 2016 JerryScript
SOSCON 2016 JerryScriptSOSCON 2016 JerryScript
SOSCON 2016 JerryScript
 
Webrtc puzzle
Webrtc puzzleWebrtc puzzle
Webrtc puzzle
 
What is a Service Mesh and what can it do for your Microservices
What is a Service Mesh and what can it do for your MicroservicesWhat is a Service Mesh and what can it do for your Microservices
What is a Service Mesh and what can it do for your Microservices
 
WebRTC eduCONF
WebRTC eduCONFWebRTC eduCONF
WebRTC eduCONF
 
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
 
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/LinuxIoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
 
Open Source Internet of Things 101 – EclipseCon 2016
Open Source Internet of Things 101 – EclipseCon 2016Open Source Internet of Things 101 – EclipseCon 2016
Open Source Internet of Things 101 – EclipseCon 2016
 
BKK16-105 HALs for LITE
BKK16-105 HALs for LITEBKK16-105 HALs for LITE
BKK16-105 HALs for LITE
 
Iotivity atmel-20150328rzr
Iotivity atmel-20150328rzrIotivity atmel-20150328rzr
Iotivity atmel-20150328rzr
 
Reaching the multimedia web from embedded platforms with WPEWebkit
Reaching the multimedia web from embedded platforms with WPEWebkitReaching the multimedia web from embedded platforms with WPEWebkit
Reaching the multimedia web from embedded platforms with WPEWebkit
 

Similar to Python for IoT, A return of experience

Tranquilizer
TranquilizerTranquilizer
Tranquilizer
Albert DeFusco
 
La web de las Cosas
La web de las CosasLa web de las Cosas
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux DeviceAdding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Samsung Open Source Group
 
The Crucial Component of IoT Products by Aravinth Panchadcharam [ Senior Embe...
The Crucial Component of IoT Products by Aravinth Panchadcharam [ Senior Embe...The Crucial Component of IoT Products by Aravinth Panchadcharam [ Senior Embe...
The Crucial Component of IoT Products by Aravinth Panchadcharam [ Senior Embe...
Next Big Thing AG
 
Monkey Server
Monkey ServerMonkey Server
Monkey Server
Eduardo Silva Pereira
 
APIs at the Edge
APIs at the EdgeAPIs at the Edge
APIs at the Edge
Red Hat
 
Возможности интерпретатора Python в NX-OS
Возможности интерпретатора Python в NX-OSВозможности интерпретатора Python в NX-OS
Возможности интерпретатора Python в NX-OS
Cisco Russia
 
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Marcin Bielak
 
PyQt Application Development On Maemo
PyQt Application Development On MaemoPyQt Application Development On Maemo
PyQt Application Development On Maemo
achipa
 
IoT with Apache ActiveMQ, Camel & Spark
IoT with Apache ActiveMQ, Camel & SparkIoT with Apache ActiveMQ, Camel & Spark
IoT with Apache ActiveMQ, Camel & Spark
Red Hat Developers
 
P4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptxP4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptx
tampham61268
 
ORTC Library - Introduction
ORTC Library - IntroductionORTC Library - Introduction
ORTC Library - Introduction
Erik Lagerway
 
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP ProtocolSerial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Sanjay Kumar
 
An hour with WebRTC FIC UDC
An hour with WebRTC FIC UDCAn hour with WebRTC FIC UDC
An hour with WebRTC FIC UDCQuobis
 
From the internet of things to the web of things course
From the internet of things to the web of things courseFrom the internet of things to the web of things course
From the internet of things to the web of things course
Dominique Guinard
 
Master-Master Replication and Scaling of an Application Between Each of the I...
Master-Master Replication and Scaling of an Application Between Each of the I...Master-Master Replication and Scaling of an Application Between Each of the I...
Master-Master Replication and Scaling of an Application Between Each of the I...
vsoshnikov
 
swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices ...
swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices ...swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices ...
swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices ...
Ivan Kravets
 
End-to-end IoT solutions with Java and Eclipse IoT
End-to-end IoT solutions with Java and Eclipse IoTEnd-to-end IoT solutions with Java and Eclipse IoT
End-to-end IoT solutions with Java and Eclipse IoT
Benjamin Cabé
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
Henry Schreiner
 
Interconnection Automation For All - GPF 2023
Interconnection Automation For All - GPF 2023Interconnection Automation For All - GPF 2023
Interconnection Automation For All - GPF 2023
Chris Grundemann
 

Similar to Python for IoT, A return of experience (20)

Tranquilizer
TranquilizerTranquilizer
Tranquilizer
 
La web de las Cosas
La web de las CosasLa web de las Cosas
La web de las Cosas
 
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux DeviceAdding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
 
The Crucial Component of IoT Products by Aravinth Panchadcharam [ Senior Embe...
The Crucial Component of IoT Products by Aravinth Panchadcharam [ Senior Embe...The Crucial Component of IoT Products by Aravinth Panchadcharam [ Senior Embe...
The Crucial Component of IoT Products by Aravinth Panchadcharam [ Senior Embe...
 
Monkey Server
Monkey ServerMonkey Server
Monkey Server
 
APIs at the Edge
APIs at the EdgeAPIs at the Edge
APIs at the Edge
 
Возможности интерпретатора Python в NX-OS
Возможности интерпретатора Python в NX-OSВозможности интерпретатора Python в NX-OS
Возможности интерпретатора Python в NX-OS
 
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
 
PyQt Application Development On Maemo
PyQt Application Development On MaemoPyQt Application Development On Maemo
PyQt Application Development On Maemo
 
IoT with Apache ActiveMQ, Camel & Spark
IoT with Apache ActiveMQ, Camel & SparkIoT with Apache ActiveMQ, Camel & Spark
IoT with Apache ActiveMQ, Camel & Spark
 
P4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptxP4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptx
 
ORTC Library - Introduction
ORTC Library - IntroductionORTC Library - Introduction
ORTC Library - Introduction
 
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP ProtocolSerial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
Serial Data from Arduino to Raspberry Pi to MySQL using CoAP Protocol
 
An hour with WebRTC FIC UDC
An hour with WebRTC FIC UDCAn hour with WebRTC FIC UDC
An hour with WebRTC FIC UDC
 
From the internet of things to the web of things course
From the internet of things to the web of things courseFrom the internet of things to the web of things course
From the internet of things to the web of things course
 
Master-Master Replication and Scaling of an Application Between Each of the I...
Master-Master Replication and Scaling of an Application Between Each of the I...Master-Master Replication and Scaling of an Application Between Each of the I...
Master-Master Replication and Scaling of an Application Between Each of the I...
 
swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices ...
swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices ...swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices ...
swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices ...
 
End-to-end IoT solutions with Java and Eclipse IoT
End-to-end IoT solutions with Java and Eclipse IoTEnd-to-end IoT solutions with Java and Eclipse IoT
End-to-end IoT solutions with Java and Eclipse IoT
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
Interconnection Automation For All - GPF 2023
Interconnection Automation For All - GPF 2023Interconnection Automation For All - GPF 2023
Interconnection Automation For All - GPF 2023
 

Recently uploaded

PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 

Recently uploaded (20)

PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 

Python for IoT, A return of experience

  • 1. Python for IoT A return of experience Alexandre Abadie, Inria
  • 2. Outline What IoT are we talking about ? The usual protocols for IoT Pyaiot, connecting objects to the web How we built Pyaiot Lessons learned Conclusion
  • 3. What IoT are we talking about ? The Internet of Things today
  • 5. Low-end devices ⇒ adapted protocols are required
  • 6. Outline What IoT are we talking about ? ⇒ The usual protocols for IoT Pyaiot, connecting objects to the web How we built Pyaiot Lessons learned Conclusion
  • 7. Usual protocols for IoT: CoAP Core WG at IETF specifications (2010) RFC 7252 Similar to HTTP REST: GET/PUT/POST/DELETE + OBSERVE Works on UDP with small payload overhead More information at http://coap.technology/ source: https://fr.wikipedia.org/wiki/CoAP
  • 8. CoAP: available implementations in Python 3 available implementations: TxThings: Twisted based, Python 2 & 3 https://github.com/mwasilak/txThings Aiocoap: asyncio based, Python 3 only https://github.com/chrysn/aiocoap CoaPthon: Threading based, Python 2 & 3 https://github.com/Tanganelli/CoAPthon Implementations exist for other languages: http://coap.technology/impls.html
  • 9. Usual protocols for IoT: MQTT Based on publication/subscriptions to topics pattern Topics have a path form: this/is/a/topic MQTT v3.1.1 is an OASIS standard MQTT Sensor Network (MQTT-SN): adapted for constrained devices source: https://dev.to/kenwalger/overview-of-the-mqtt-protocol
  • 10. MQTT: available implementations in Python 2 available implementations: Paho-mqtt: threading based, considered as the reference implementation https://pypi.python.org/pypi/paho-mqtt HBMQTT: asyncio based https://github.com/beerfactory/hbmqtt
  • 11. Outline What IoT are we talking about ? The usual protocols for IoT ⇒ Pyaiot, connecting objects to the web How we built Pyaiot Lessons learned Conclusion
  • 12. Why Pyaiot? Need for a web application able to communicate with contrained devices ⇒ but constrained devices cannot use usual web protocols
  • 13. Why Pyaiot? Need for a web application able to communicate with contrained devices ⇒ but constrained devices cannot use usual web protocols Need for multi-site support ⇒ but constrained devices cannot be exposed directly to the web
  • 14. Why Pyaiot? Need for a web application able to communicate with contrained devices ⇒ but constrained devices cannot use usual web protocols Need for multi-site support ⇒ but constrained devices cannot be exposed directly to the web Heterogeneous protocol support ⇒ various IoT protocols exist
  • 15. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot
  • 16. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability
  • 17. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability Modular ⇒ extensible
  • 18. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability Modular ⇒ extensible Bi-directionnal and real time access to nodes ⇒ reactive
  • 19. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability Modular ⇒ extensible Bi-directionnal and real time access to nodes ⇒ reactive No constraint regarding the backend language ⇒ let's choose Python!
  • 20. General guidelines Open-Source and simple design⇒ can be deployed by anyone https://github.com/pyaiot/pyaiot Multiprotocol: CoAP, MQTT, etc ⇒ interoperability Modular ⇒ extensible Bi-directionnal and real time access to nodes ⇒ reactive No constraint regarding the backend language ⇒ let's choose Python! Pyaiot targets contrained nodes running RIOT: https://riot-os.org
  • 21. Pyaiot overview Permanent web showcase for RIOT available at http://riot-demo.inria.fr
  • 22. Pyaiot: The web dashboard
  • 23. Outline What IoT are we talking about ? The usual protocols for IoT Pyaiot, connecting objects to the web ⇒ How we built Pyaiot Lessons learned Conclusion
  • 25. Pyaiot services Gateways are clients running in private networks Nodes are kept isolated from Internet Messages exchanged in JSON format Works with low-end devices (RIOT) and high-end devices (Python)
  • 26. Technical choices Web dashboard developed with Vue.js   http://vuejs.org Service applications based on Tornado framework with: HTTP server Websocket server and client Aiocoap for CoAP protocol support HBMQTT for MQTT protocol support
  • 27. Technical choices Web dashboard developed with Vue.js   http://vuejs.org Service applications based on Tornado framework with: HTTP server Websocket server and client Aiocoap for CoAP protocol support HBMQTT for MQTT protocol support ⇒ All python packages are asyncio based/compatible ⇒ simplify integration
  • 28. The MQTT gateway in detail MQTT-SN is required for low-end device ⇒ a MQTT to MQTT-SN gateway/broker is required No implementation in Python ⇒ let's go for mosquitto.rsmb
  • 29. The MQTT gateway in detail MQTT-SN is required for low-end device ⇒ a MQTT to MQTT-SN gateway/broker is required No implementation in Python ⇒ let's go for mosquitto.rsmb Node/Gateway subscribe/publish to topic publish/subscribe to topics gateway//discover node/check node//resources node//
  • 30. Outline What IoT are we talking about ? The usual protocols for IoT Pyaiot, connecting objects to the web How we built Pyaiot ⇒ Lessons learned Conclusion
  • 31. Using asyncio Easy to read asynchronous programming language
  • 32. Using asyncio Easy to read asynchronous programming language Asyncio new syntax available with Python >= 3.5
  • 33. Using asyncio Easy to read asynchronous programming language Asyncio new syntax available with Python >= 3.5 ... but Python 3.4.2 available on Raspbian @asyncio.coroutine def my_coroutine(): my_long_call() yield from my_coroutine() # wait until done asyncio.get_event_loop().create_task(my_coroutine) # scheduled in ioloop asyncio.ensure_future(my_coroutine) # scheduled in ioloop, requires python 3.4.4
  • 34. Using asyncio Easy to read asynchronous programming language Asyncio new syntax available with Python >= 3.5 ... but Python 3.4.2 available on Raspbian @asyncio.coroutine def my_coroutine(): my_long_call() yield from my_coroutine() # wait until done asyncio.get_event_loop().create_task(my_coroutine) # scheduled in ioloop asyncio.ensure_future(my_coroutine) # scheduled in ioloop, requires python 3.4.4 with python 3.5 new syntax: async def my_coroutine(): my_long_call() await my_coroutine() # wait until done asyncio.ensure_future(my_coroutine) # scheduled in ioloop
  • 35. The benefits of Python Develop fast, even with complex things
  • 36. The benefits of Python Develop fast, even with complex things Can run on any high-end device : from a Raspberry PI to a Cloud server
  • 37. The benefits of Python Develop fast, even with complex things Can run on any high-end device : from a Raspberry PI to a Cloud server Off-the-shelf packages for IoT available: Aiocoap, HBMQTT
  • 38. The benefits of Python Develop fast, even with complex things Can run on any high-end device : from a Raspberry PI to a Cloud server Off-the-shelf packages for IoT available: Aiocoap, HBMQTT ⇒ Python is adapted to IoT
  • 39. Conclusion Widely used protocol in IoT is MQTT Adapted protocols are required for constrained devices (microcontrollers) ⇒ CoAP, MQTT-SN
  • 40. Conclusion Widely used protocol in IoT is MQTT Adapted protocols are required for constrained devices (microcontrollers) ⇒ CoAP, MQTT-SN We easily built an application following the initial requirements ⇒ Pyaiot: https://github.com/pyaiot/pyaiot
  • 41. Conclusion Widely used protocol in IoT is MQTT Adapted protocols are required for constrained devices (microcontrollers) ⇒ CoAP, MQTT-SN We easily built an application following the initial requirements ⇒ Pyaiot: https://github.com/pyaiot/pyaiot Asyncio made things simpler... after some headaches
  • 42. Conclusion Widely used protocol in IoT is MQTT Adapted protocols are required for constrained devices (microcontrollers) ⇒ CoAP, MQTT-SN We easily built an application following the initial requirements ⇒ Pyaiot: https://github.com/pyaiot/pyaiot Asyncio made things simpler... after some headaches Pyaiot is still work in progress... even if it works pretty well