Post on 15-Apr-2017
Konsulko Group
Click to edit Master title style
6/25/16
Click to edit Master title style
6/25/16
Click to edit Master title style
Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelClick to edit Master text stylesSecond levelThird levelFourth level
Fifth level
6/25/16
Click to edit Master title style
Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelClick to edit Master text stylesSecond levelThird levelFourth level
Fifth level
6/25/16
Connecting Internet of Things to the Cloud with MQTT
Leon Anavi, Konsulko Groupleon.anavi@konsulko.com leon@anavi.org Arthur Chan, CatchToparthur@catchtop.com
Agenda
Internet of Things
MQTT
Open Source MQTT Brokers
Open Source MQTT Clients
Showcases
Internet of Things (IoT)
Internet-connected embedded devices
IoT Challenges
Real-time communication
Power supply and batteries
Small footprint
Low cost
Communication
MQTT
Lightweight publish/subscribe machine-to-machine protocol on top of TCP/IP
Near real-time communication
Message broker
Small source code footprint for embedded devices
MQTT Operations
Connect
Disconnect
Subscribe
Unsubscribe
Publish
Example Usage
MQTT
Broker
PC
(MQTT client)
Smart Phone
(MQTT client)
Sensor
Publish
Subscribe
Publish
Publish
Subscribe
MQTT clients connect and subscribe to a topic
The sensor is publishing a message and the MQTT broker delivers it to the subscribed clients
MQTT Publish
Topic PayloadQoSRetain
"hello/1" { "temperature": 20 }2false
Example
MQTT Topics & Wildcards
Topic
home / kitchen / temperature
Single level wildcards
home / + / temperature
Multiple levels wildcards
home / #
Last Will & Testament (LWT)
Notify interested clients about an ungracefully disconnected client
MQTT Security
Transport encryption with TLS/SSL
Authentication: username/password
Authorization: Access Control Lists (ACL)
Open Source MQTT Brokers
Mosquitto
HiveMQ
Mosca
emqttd
VerneMQ
ActiveMQ
Web Sockets
Optional feature to allow every modern web browser to connect to MQTT broker, subscribe and publish messages
Web sockets are supported in Mosquitto (since v1.4), HiveMQ (since v1.4), Mosca (since v0.13.0)
Open source implementation of MQTT client in JavaScript using WebSockets by Paho:https://www.eclipse.org/paho/clients/js/
Mosquitto
Open source MQTT broker implement in the C programming language
Supports MQTT protocol version 3.1 and 3.1.1
Available for all popular GNU/Linux distributions: Debian,Ubuntu, Fedora, RedHat Enterprise Linux, openSUSE, CentOS, ArchLinux, Slackware, etc.
Also available for Windows, FreeBSD and Mac
Project of iot.eclipse.com
Public MQTT Brokers
Server
Broker
Port
Websocket
iot.eclipse.org
Mosquitto
1883 / 8883
80 / 443
test.mosquitto.org
Mosquitto
1883 / 8883 / 8884
8080 / 8081
test.mosca.io
Mosca
1883
80
broker.hivemq.com
HiveMQ
1883
8000
broker.mqttdashboard.com
HiveMQ
1883
8000
cloudmqtt.com
Mosquitto
1xxxx
3xxxx
Open Source MQTT Clients
Paho offers MQTT client implementations for C/C++, Java, JavaScript, Python and C#http://www.eclipse.org/paho/
Node.js library for implementing MQTT clients:https://www.npmjs.com/package/mqtt
Arduino client for MQTT:http://pubsubclient.knolleary.net/
Showcase: ESP8266
Low cost MCU with WiFi
Supported programming languages: C and Lua
Compatible with Arduino IDE and libraries
Various low cost development boards (~ 26 USD per single unit)
Smart Aisle
ObjectiveDetect Human Movements
Hardware
PIR Sensors < 3 USD
NodeMCU 4 - 6 USD
Wireless
Source code:
https://github.com/arthurtalkgoal/nodemcu
Heatmap
Showcase: Raspberry Pi
Low cost credit card-sized single-board computers
Versions: 0, 1, 2, 3
Broadcom ARM SoC
Large community
Raspbian GNU/Linux distribution
Community support for other OS
Layer meta-raspberrypi for building custom GNU/Linux distributions using the Yocto Project
Showcase: A20/A10-OlinuXino
Open source hardware development board from Olimex
Allwinner A10/A20 SoC
Good community support
Supports Android, Debian and other popular GNU/Linux distributions
Layer meta-sunxi for building custom GNU/Linux distributions using the Yocto Project
Q&A
Questions?