Project Open Source
Project Open Source
HTTP JSON
MQTT
MQTT
TCP
TCP
Why IoT?
Why Open Source?
Why your Project?
Why IoT?
Faster Innovation
Better Quality / Security
Lower Business Risk
Lower Costs
Why your own IoT Project?
Open
Vendor Neutral, tons of Implementations
~ 20 Brokers: Mosquitto, Apache ActiveMQ,
~ 60 Clients: Arduino, C/C++, Java, Objective C,
Standardized
MQTT v3.1.1 is an OASIS Standard
MQTT is Simple
5 Protocol Verbs
connect
publish
subscribe
unsubscribe
disconnect
3 Callbacks
deliveryComplete
messageArrived
connectionLost
MQTT is Efficient
Broker
Can handle many 10k clients
Client
Small footprint (e.g. Java 147KB without JRE)
Sending Messages
10x more messages
10x less energy
MQTT is Robust
Networks
Typically TCP
But also VSAT, GPRS, 2G.
Connect to Broker
Client B
Client A
Client C
Broker
Client D
Subscribe to Topic X
Subscriber
Client
Topic X Subscriber
Broker
Client
Publish A to Topic X
Subscriber
Message A
Publisher
Topic X Subscriber
Broker
Client
Broker forwards A to Subscribers of X
Subscriber
Message A
Message A
Publisher
Topic X Subscriber
Broker
Client
MQTT Topics
Topic Organization
String of one or more UTF-8 chars
Topic separator / used to seprate topic into levels
Examples
bsiag.com/munich/4thfloor/temperature/last
/Bundesliga/Game/BER/BAY
262a1843-589e-4067-a773-03fbe663bc5e
The MQTT Broker
The MQTT Broker
https://www.eclipse.org/mosquitto/
http://mosquitto.org/
Mosquitto on Raspberry Pi
Step-by-Step
1. Prepare SD Card
2. Download and Copy Noobs to SD Card
3. Connect Raspberry to Keyboard, Screen, Mouse, Power
4. Configure Raspberry
5. Add USB WiFi dongle and connection
6. Add Mosquitto Broker
7. Reboot frequently
Links that helped
SD Card
http://www.raspberrypi.org/help/noobs-setup/
Noobs
http://www.raspberrypi.org/downloads/
Add WiFi
http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-
wifi-network/
WiFi USB Dongle
Go for the Edimax EW-7811Un
Mosquitto
http://jpmens.net/2013/09/01/installing-mosquitto-on-a-raspberry-pi/
The MQTT Scout Client
The MQTT Scout Client
https://www.eclipse.org/scout
Scout Architecture
Service
Desktop
Scout Scout
Mobile
Webserver
Learn more about Scout
Step-by-Step
1. Download and Install Eclipse Scout
https://www.eclipse.org/downloads/
2. Clone the MQTT Scout Github Repo
https://github.com/BSI-Business-Systems-Integration-AG/mqtt.git
3. Open Scout IDE with empty workspace
4. Import plugins in scout subfolder of cloned project
The MQTT Paho Client
The MQTT Paho Client
https://www.eclipse.org/paho
Paho
The MQTT Arduino Client
The MQTT Arduino Client
https://github.com/knolleary/pubsubclient
http://knolleary.net/arduino-client-for-mqtt/
Simple Arduino Sketch
Arduino MQTT Client
Step-by-Step
1. Download and Install Arduino IDE
http://arduino.cc/en/Main/Software
2. Clone the MQTT Scout Github Repo
https://github.com/BSI-Business-Systems-Integration-AG/mqtt.git
3. Open mqttClient.ino Sketch in Arudino IDE
And fix WiFi Settings/MQTT Broker for you Setup
4. Put WiFi Shield on Arduino Uno and add Electronics
5. Connect Arduino to Computer
6. Upload Script
The MQTT Arduino Client
What it does
1. Setup Input/Output Pins
2. Finds correct WiFi
3. Connects to WiFi
4. Connects to MQTT Broker
and subscribes to eclipse/scout/arduino
5. Listens for Commands
RELAY ON Switches Lamp On
RELAY OFF Switches Lamp Off
LDR GET Publishes LDR to eclipse/scout/arduino/ldr
Wrap Up
What have we done?
Get the
Get Gadgets Software
Start to play
Thanks !