by Peter Martin /
@pe7er
WordCamp NL 2016, Sunday 16th October 2016
Peter Martin (@pe7er)
Nijmegen, NL
Organizes:
* Linux Usergroup Nijmegen
* Open Coffee Nijmegen
www.db8.nl
Joomla support, application development
Joomla volunteer:
* Global Forum Moderator
* Joomla Bug Squad
* Pizza Bugs & Fun (in NL)
* Former Joomla Community
Leadership Team (6 yr)
* Mentor GSoC 2016
Questions preferably after the demo
Presentation: http://slides.db8.nl
IoT code: https://github.com/pe7er/db8iot
“The Internet of Things (IoT) is@pe7er (in exactly 140 characters)
a network of devices that are connected to each other using TCP/IP
and communicate autonomously.
#IoT #JaB16”
Microcontroller
Wifi chip
ESP8266
- low-cost: $ 1.42 at eBay.com
- full TCP/IP stack
- connects to a Wi-Fi router
Communication:
Hayes-style "AT" (modem)
Input
Sensors
- temperature
- movement
- sound
- light
- touch / push button
- pressure
Output
Signals
- light (LED)
- switch (Relay)
- sound
- screen
No need for Arduino microcontroller
programme & flash chip on ESP!
- Software Development Kit (SDK)
- esp-open-sdk (GCC toolchain)
- NodeMCU + LUA scripts
- Arduino IDE + ESP8266WiFi library !
Website with application?
arrive? -> log in
leave? -> log out
-> additional actions
therefore unreliable
besides...
taking off your jacket
switching on the lights
making a cup of coffee
connect your
laptop and/or
mobile
to Wi-Fi (LAN)
connected to LAN
bash script
collects MAC addresses
of all devices in LAN
sends them to my
external webservice
October 28th 2015
REST API
in WordPress 4.4
August 2015
me playing with RPi
and Joomla 3.4.3
No REST API for me (yet)...
SLIM Framework
external PHP script; RESTFull
connects to my
Joomla's database;
gets & stores
MAC addresses
Custom application
manages
colleagues +
MAC addresses
shows
who is there...
Mobile App (Android)
connects to
webservice
displays colleagues
and their presence
all 1-to-1 communication
all RESTFull
(need Webserver; can be heavy)
- messaging protocol
- publish/subscribe
- simple + lightweight
- layer on TCP/IP
(IBM) “MQ Telemetry Transport”
Official standard: ISO/IEC PRF 20922
WhatsApp Server = MQTT Broker
WhatsApp Group = Topic
Member of Group = Subscriber
Post in Group = Publish to Topic
Client
Broker
CONNECT
SUBSCRIBE / UNSUBSCRIBE
(Topic Name)
PUBLISH
(Topic Name + Payload + QoS)
CONNACK
(= CONNect ACKnowledge)
SUBACK / UNSUBACK
(SUBscribe ACKnowledge)
PUBACK
(PUBlish ACKnowledge) (if QoS = 1 or 2)
QoS 0
No-feedback needed
QoS 1
Acknowledge receipt
QoS 2
Just Once
Access to MQTT Broker
- Username + Password
- X509 Client Certificate
(Public/Private Keys)
- OAuth 2.0
Control MQTT resources
- Allowed topics
- Allowed operation
(publish and/or subscribe)
- Allowed QoS
Secure communication
between client & broker
- Secure connection
Transport Layer Security (TLS)
MQTT over SSL / TLS
(using
Let’s Encrypt)
- Secure message
MQTT Payload Encryption
List of
publically-accessible
MQTT brokers
(for testing and prototyping)
Install Mosquitto broker on Debian / Ubuntu
$ sudo apt-get install mosquitto
MQTT.fx (written in Java)
Platforms: Windows, Apple OSX, Linux Debian/Red Hat, Unix
Download
$ wget http://www.jensd.de/apps/mqttfx/1.1.0/mqttfx-1.1.0-64bit.deb
Installation
$ sudo dpkg -i mqttfx-1.1.0-64bit.deb
MyMQTT
MQTT Client
MQTT Dashboard
Arduino IDE editor v1.6.9
-> to flash ESP board install:
Tools > Boards > Board Manager:
esp8266 v2.2.0
-> to use MQTT + esp8266 in C++ code:
add
PubSubClient + ESP8266WiFi libraries in IDE
add in C++ code:
// include MQTT library
#include <PubSubClient.h>
// include ESP8266
#include <ESP8266WiFi.h>
Python: Mosquitto module
Arduino: PubSubClient
PHP: bluerhinos/phpMQTT
Simple PHP class to connect/publish/subscribe to an MQTT broker
PHP: McFizh/libMQTT
Simple MQTT library for PHP with support for MQTT version 3.1.1, TLS.
I do not have sheets for the demo...
You had to be there!
There might be published a
WordCamp Netherlands 2016 video soon.
Or check out the
video from the
European Joomla conference JandBeyond 2016.
Presentation:
http://slides.db8.nl
IoT code:
https://github.com/pe7er/db8iot
Peter Martin
e-mail: info at db8.nl
twitter: @pe7er
presentation: https://db8.nl