SlideShare a Scribd company logo
HOW TO BUILD OWN IOT PLATFORM?
AGENDA
โžค What is Internet of Things
โžค What we may do with it?
โžค Does it involve in our lives?
SOME EXAMPLES
SOME EXAMPLES
REST API
โžค KISS - Keep It Simple Stupid
โžค Make documentation
โžค Use e. g. Swagger
โžค Integration with other APIs
COLLECT DATA AND ANALYSE
โžค e. g. Elasticsearch and Kibana
MONITORING
MQTT
โžค MQTT is lightweight, secure, battery friendly and machine-to-
machine (M2M) / โ€œInternet of Thingsโ€ connectivity protocol
โžค Publish-subscribed based
โžค Designed for connections with remote locations where โ€œsmall
code footprintโ€ is required and/or network bandwidth is
limited
โžค The publish-subscribe messaging pattern requires a message
broker
โžค The broker is responsible for distributing messages to
interested clients based on the topic of a message
MQTT
โžค supports o๏ฌ„ine messaging
โžค retains messages like key/value store
ARCHITECTURE
ARCHITECTURE
MQTT SUBSCRIBER
var mqtt = require('mqtt');
// load balancer
var client = mqtt.connect('mqtt://YOUR.BROKER.URL');
client.subscribe('business/link');
client.on('message', function(topic, message) {
console.log(message.toString());
});
console.log('Client started...');
MQTT PUBLISHER
var mqtt = require('mqtt');
// load balancer
var client = mqtt.connect('mqtt://YOUR.BROKER.URL');
client.subscribe('business/link');
console.log('Client publishing...');
client.publish('business/link', โ€˜Welcome at IoT meetingโ€ฆ Test Ping! ' + Date());
client.end();
MQTT.FQ
โžค
MQTT BROKERS
โžค Mosquito
โžค Mosca
โžค CloudMQTT
โžค HiveMQ
MQTT.JS
โžค 20k packets/second parser
โžค stream based
โžค High-Level Client API
โžค Low-Level Server
MOSCA
โžค Standalone usage
โžค Embeddable in your app
โžค Authentication API
โžค Supports AMQP, Mongo, Redis, and MQTT as pub/sub
backends
โžค Needs a DB as LevelDB, Mongo or Redis
โžค Support Websockets
โžค Fast, 10k+ messages routed per second
โžค Scalable, 10k+ concurrent connections
MOSCA, MQTT.JS, BROWSER
โžค Works on top of WebSockets
โžค Node.js excels that ;)
โžค MQTT over Websocket is โ€˜standardโ€™
โžค Uses test broker at test.mosca.io
MOSCA SPEED
MOSCA VS MOSQUITTO
ECLIPSE PONTE
โžค Supports multiple protocols HTTP, MQTT, CoAP
โžค Based on Mosca, Express and Node.js
โžค Will support data transformation too!
THANKS
โžค Metteo Collina for an awesome stu๏ฌ€ ;)
ANGULAR SERVICE
define([
'angular',
], function (angular) {
'use strict';
angular.module('BenfiIoTApp.Services.MQTTService', [
'BenfiIoTApp.Config'
])
.factory('MQTTService', ServiceFn);
ServiceFn.$inject = [];
function ServiceFn() {
var service = this;
var client = {};
service.connect = connect;
service.publish = publish;
service.onMessage = onMessage;
function connect(host, port, user, password) {
var options = {
username: user,
password: password
};
console.log("Try to connect to MQTT Broker " + host + " with user " + user);
client = mqtt.connect(host, {});
client.subscribe("presence");
client.subscribe("sensors/brightness");
client.subscribe("sensors/temperature");
client.subscribe("sensors/humidity");
client.on('error', function(err) {
console.log('error!', err);
client.stream.end();
});
client.on('message', function (topic, message) {
service.callback(topic, message);
});
}
function publish(topic, payload) {
client.publish(topic, payload, {retain: true});
console.log('publish-Event sent '+ payload + ' with topic: ' + topic + ' ' + client);
}
function onMessage(callback) {
service.callback = callback;
}
return service;
}
});
BROWSER SUBSCRIBER
define([
'angular'
], function (angular) {
'use strict';
angular.module('BenfiIoTApp.Controllers.RealtimeCtrl', [
'BenfiIoTApp.Config',
'BenfiIoTApp.Services.MQTTService'
])
.controller('RealtimeCtrl', ControllerFn);
ControllerFn.$inject = ['$scope', 'MQTTService'];
function ControllerFn($scope, MQTTService) {
var vm = this;
vm.brightness = 0;
vm.temperature = 0;
vm.humidity = 0;
MQTTService.connect(
โ€˜ws://YOUR.BROKER.URL'
);
MQTTService.onMessage(function(topic, payload) {
switch (topic) {
case 'sensors/brightness':
vm.brightness = payload.toString();
break;
case 'sensors/temperature':
vm.temperature = payload.toString();
break;
case 'sensors/humidity':
vm.humidity = payload.toString();
break;
default:
break;
}
$scope.$apply();
});
}
});
BROWSER PUBLISHER
define([
'angular'
], function (angular) {
'use strict';
angular.module('BenfiIoTApp.Controllers.ColorCtrl', [
'BenfiIoTApp.Services.MQTTService'
])
.controller('ColorCtrl', ControllerFn);
ControllerFn.$inject = ['MQTTService'];
function ControllerFn(MQTTService) {
var vm = this;
vm.selectedColor = '#000000';
vm.send = send;
MQTTService.connect(
'ws://YOUR.BROKER:URL'
);
function send() {
MQTTService.publish('color', vm.selectedColor);
}
}
});
DEVICE SOFTWARE
โžค On your Arduino Yun install packages:
โžค opkg update
โžค opkg install mosquitto mosquitto-client libmosquitto
DEVICE PUB/SUB
#include <MQTTclient.h>
#define MQTT_HOST โ€œYOUR.BROKER.URLโ€
void setup() {
Serial.begin(115200);
// remember the bridge!
Bridge.begin();
// begin the client library (initialize host)
mqtt.begin(MQTT_HOST, 1883);
mqtt.subscribe("color", colorEvent);
}
void loop() {
// check for incoming events
mqtt.monitor();
mqtt.publish("sensors/brightness", brightness);
mqtt.publish("sensors/temperature", temperature);
mqtt.publish("sensors/humidity", humidity);
delay(1000);
}
void colorEvent(const String& topic, const String& subtopic, const String& message) {
// hex to rgb
String hexstring = message;
// Get rid of '#' and convert it to integer
long number = strtol( &hexstring[1], NULL, 16);
// Split them up into r, g, b values
long r = number >> 16;
long g = number >> 8 & 0xFF;
long b = number & 0xFF;
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(r,g,b)); // Moderately bright green color.
pixels.show(); // This sends the updated pixel color to the hardware.
delay(delayval); // Delay for a period of time (in milliseconds).
}
}
WHY CLOUD? WHY AWS? WHAT MAY BE USEFUL?
โžค Load balancers
โžค Security groups
โžค Autoscaling
โžค Elastic Beanstalk
โžค EC2
โžค S3
โžค Elasticsearch Service
โžค ElasticCache
โžค Lambda
โžค Kinesis
IOT PLATFORMS
LINKS
โžค MQTT.js
โžค Mosca
โžค Eclipse Ponte
โžค Easy Arduino Yun MQTT Client
QUESTIONS?
Patryk Omiotek
patryk@benfimedia.pl
https://865632885505.signin.aws.amazon.com/console/

More Related Content

PPTX
Fiware IoT_IDAS_intro_ul20_v2
ย 
PPTX
Building the IOT Platform as a Service
PDF
PaaS: An Enabler for IoT in NFV Worlds
ย 
PPTX
FIWARE IoT Introduction 1
PPTX
Introduction to FIWARE Open Ecosystem
PPTX
FIWARE Primer - Learn FIWARE in 60 Minutes
PDF
Connecting to the internet of things (IoT)
PDF
[WSO2Con EU 2017] Building Smart, Connected Products with WSO2 IoT Platform
ย 
Fiware IoT_IDAS_intro_ul20_v2
ย 
Building the IOT Platform as a Service
PaaS: An Enabler for IoT in NFV Worlds
ย 
FIWARE IoT Introduction 1
Introduction to FIWARE Open Ecosystem
FIWARE Primer - Learn FIWARE in 60 Minutes
Connecting to the internet of things (IoT)
[WSO2Con EU 2017] Building Smart, Connected Products with WSO2 IoT Platform
ย 

What's hot (17)

PPTX
IoT on the Edge
ย 
PPTX
Cosmos, Big Data GE implementation in FIWARE
PPTX
Developing your first application using FI-WARE
PDF
FIWARE Overview of Generic Enablers
PPTX
Orion Context Broker webminar 2014-04-01
PDF
Octoblu, the IoT platform
PPT
FIWARE Developers Week_FIWARE IoT: Beginner's tutorial_conference
ย 
PPTX
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
PDF
AWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web Day
PDF
Building Open Source IoT Cloud
ย 
PPTX
IoT interoperability
PDF
Solace Singapore User Group: Sumeet Puri
ย 
PDF
Open source IoT gateway
PPTX
High-Velocity, Real-Time Connected Industry โ€“ From Edge to Cloud
ย 
PDF
FIWARE Context Broker
PDF
A Pragmatic Reference Architecture for The Internet of Things
PDF
Iot gateway dream team - Eclipse Kura and Apache Camel
IoT on the Edge
ย 
Cosmos, Big Data GE implementation in FIWARE
Developing your first application using FI-WARE
FIWARE Overview of Generic Enablers
Orion Context Broker webminar 2014-04-01
Octoblu, the IoT platform
FIWARE Developers Week_FIWARE IoT: Beginner's tutorial_conference
ย 
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
AWS IoT Button and Lambda to power a blockchain project - AWS Serverless Web Day
Building Open Source IoT Cloud
ย 
IoT interoperability
Solace Singapore User Group: Sumeet Puri
ย 
Open source IoT gateway
High-Velocity, Real-Time Connected Industry โ€“ From Edge to Cloud
ย 
FIWARE Context Broker
A Pragmatic Reference Architecture for The Internet of Things
Iot gateway dream team - Eclipse Kura and Apache Camel
Ad

Similar to How to build own IoT Platform (20)

ODP
Connecting Internet of Things to the Cloud with MQTT
PDF
MQTT โ€“ protocol for yours IoT
PDF
MQTT - Austin IoT Meetup
PDF
Building an IOT app using MQTT
PDF
Gettiing Started with IoT using Raspberry Pi and Python
PDF
MQTT-REST Bridge using the Smart Object API
PDF
MQTT REST Bridge using the Smart Object API
PDF
MQTT - REST Bridge using the Smart Object API
PDF
Why and how we proxy our IoT broker connections
PDF
JAX 2014 - M2M for Java Developers with MQTT
PDF
MQTT: A lightweight messaging platform for IoT
PDF
MQTT - A practical protocol for the Internet of Things
PDF
Iot hub agent
PDF
NEXT-GENERATION REMOTE MONITORING SOLUTION FOR THE INDUSTRIAL SECTOR
ย 
PDF
Lightweight and scalable IoT Messaging with MQTT
PDF
Supercharge your IOT toolbox with MQTT and Node-RED
PDF
Messaging for the Internet of Awesome Things
PDF
MQTT with Java - a protocol for IoT and M2M communication
PDF
MQTT_v2 protocol for IOT based applications
PDF
MQTT - Communication in the Internet of Things
Connecting Internet of Things to the Cloud with MQTT
MQTT โ€“ protocol for yours IoT
MQTT - Austin IoT Meetup
Building an IOT app using MQTT
Gettiing Started with IoT using Raspberry Pi and Python
MQTT-REST Bridge using the Smart Object API
MQTT REST Bridge using the Smart Object API
MQTT - REST Bridge using the Smart Object API
Why and how we proxy our IoT broker connections
JAX 2014 - M2M for Java Developers with MQTT
MQTT: A lightweight messaging platform for IoT
MQTT - A practical protocol for the Internet of Things
Iot hub agent
NEXT-GENERATION REMOTE MONITORING SOLUTION FOR THE INDUSTRIAL SECTOR
ย 
Lightweight and scalable IoT Messaging with MQTT
Supercharge your IOT toolbox with MQTT and Node-RED
Messaging for the Internet of Awesome Things
MQTT with Java - a protocol for IoT and M2M communication
MQTT_v2 protocol for IOT based applications
MQTT - Communication in the Internet of Things
Ad

More from Patryk Omiotek (6)

PDF
Unlocking Realtime Web Applications - 4Developers Katowice 2023
PDF
TensorFlow for beginners
PDF
Docker how to
PDF
Web crawlers part-2-20161104
PDF
How the Internet of Things will change our lives?
ODP
WordpUp Lublin #1
Unlocking Realtime Web Applications - 4Developers Katowice 2023
TensorFlow for beginners
Docker how to
Web crawlers part-2-20161104
How the Internet of Things will change our lives?
WordpUp Lublin #1

Recently uploaded (20)

PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
๐Ÿ’ฐ ๐”๐Š๐“๐ˆ ๐Š๐„๐Œ๐„๐๐€๐๐†๐€๐ ๐Š๐ˆ๐๐„๐‘๐Ÿ’๐ƒ ๐‡๐€๐‘๐ˆ ๐ˆ๐๐ˆ ๐Ÿ๐ŸŽ๐Ÿ๐Ÿ“ ๐Ÿ’ฐ
ย 
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
innovation process that make everything different.pptx
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
Funds Management Learning Material for Beg
PPT
tcp ip networks nd ip layering assotred slides
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PPTX
artificial intelligence overview of it and more
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
ย 
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PDF
Vigrab.top โ€“ Online Tool for Downloading and Converting Social Media Videos a...
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
Digital Literacy And Online Safety on internet
PDF
Testing WebRTC applications at scale.pdf
Job_Card_System_Styled_lorem_ipsum_.pptx
๐Ÿ’ฐ ๐”๐Š๐“๐ˆ ๐Š๐„๐Œ๐„๐๐€๐๐†๐€๐ ๐Š๐ˆ๐๐„๐‘๐Ÿ’๐ƒ ๐‡๐€๐‘๐ˆ ๐ˆ๐๐ˆ ๐Ÿ๐ŸŽ๐Ÿ๐Ÿ“ ๐Ÿ’ฐ
ย 
522797556-Unit-2-Temperature-measurement-1-1.pptx
WebRTC in SignalWire - troubleshooting media negotiation
innovation process that make everything different.pptx
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
SASE Traffic Flow - ZTNA Connector-1.pdf
Funds Management Learning Material for Beg
tcp ip networks nd ip layering assotred slides
Module 1 - Cyber Law and Ethics 101.pptx
artificial intelligence overview of it and more
RPKI Status Update, presented by Makito Lay at IDNOG 10
ย 
An introduction to the IFRS (ISSB) Stndards.pdf
Introuction about WHO-FIC in ICD-10.pptx
Vigrab.top โ€“ Online Tool for Downloading and Converting Social Media Videos a...
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Tenda Login Guide: Access Your Router in 5 Easy Steps
international classification of diseases ICD-10 review PPT.pptx
Digital Literacy And Online Safety on internet
Testing WebRTC applications at scale.pdf

How to build own IoT Platform

  • 1. HOW TO BUILD OWN IOT PLATFORM?
  • 2. AGENDA โžค What is Internet of Things โžค What we may do with it? โžค Does it involve in our lives?
  • 5. REST API โžค KISS - Keep It Simple Stupid โžค Make documentation โžค Use e. g. Swagger โžค Integration with other APIs
  • 6. COLLECT DATA AND ANALYSE โžค e. g. Elasticsearch and Kibana
  • 8. MQTT โžค MQTT is lightweight, secure, battery friendly and machine-to- machine (M2M) / โ€œInternet of Thingsโ€ connectivity protocol โžค Publish-subscribed based โžค Designed for connections with remote locations where โ€œsmall code footprintโ€ is required and/or network bandwidth is limited โžค The publish-subscribe messaging pattern requires a message broker โžค The broker is responsible for distributing messages to interested clients based on the topic of a message
  • 9. MQTT โžค supports o๏ฌ„ine messaging โžค retains messages like key/value store
  • 12. MQTT SUBSCRIBER var mqtt = require('mqtt'); // load balancer var client = mqtt.connect('mqtt://YOUR.BROKER.URL'); client.subscribe('business/link'); client.on('message', function(topic, message) { console.log(message.toString()); }); console.log('Client started...');
  • 13. MQTT PUBLISHER var mqtt = require('mqtt'); // load balancer var client = mqtt.connect('mqtt://YOUR.BROKER.URL'); client.subscribe('business/link'); console.log('Client publishing...'); client.publish('business/link', โ€˜Welcome at IoT meetingโ€ฆ Test Ping! ' + Date()); client.end();
  • 15. MQTT BROKERS โžค Mosquito โžค Mosca โžค CloudMQTT โžค HiveMQ
  • 16. MQTT.JS โžค 20k packets/second parser โžค stream based โžค High-Level Client API โžค Low-Level Server
  • 17. MOSCA โžค Standalone usage โžค Embeddable in your app โžค Authentication API โžค Supports AMQP, Mongo, Redis, and MQTT as pub/sub backends โžค Needs a DB as LevelDB, Mongo or Redis โžค Support Websockets โžค Fast, 10k+ messages routed per second โžค Scalable, 10k+ concurrent connections
  • 18. MOSCA, MQTT.JS, BROWSER โžค Works on top of WebSockets โžค Node.js excels that ;) โžค MQTT over Websocket is โ€˜standardโ€™ โžค Uses test broker at test.mosca.io
  • 21. ECLIPSE PONTE โžค Supports multiple protocols HTTP, MQTT, CoAP โžค Based on Mosca, Express and Node.js โžค Will support data transformation too!
  • 22. THANKS โžค Metteo Collina for an awesome stu๏ฌ€ ;)
  • 23. ANGULAR SERVICE define([ 'angular', ], function (angular) { 'use strict'; angular.module('BenfiIoTApp.Services.MQTTService', [ 'BenfiIoTApp.Config' ]) .factory('MQTTService', ServiceFn); ServiceFn.$inject = []; function ServiceFn() { var service = this; var client = {}; service.connect = connect; service.publish = publish; service.onMessage = onMessage; function connect(host, port, user, password) { var options = { username: user, password: password }; console.log("Try to connect to MQTT Broker " + host + " with user " + user); client = mqtt.connect(host, {}); client.subscribe("presence"); client.subscribe("sensors/brightness"); client.subscribe("sensors/temperature"); client.subscribe("sensors/humidity"); client.on('error', function(err) { console.log('error!', err); client.stream.end(); }); client.on('message', function (topic, message) { service.callback(topic, message); }); } function publish(topic, payload) { client.publish(topic, payload, {retain: true}); console.log('publish-Event sent '+ payload + ' with topic: ' + topic + ' ' + client); } function onMessage(callback) { service.callback = callback; } return service; } });
  • 24. BROWSER SUBSCRIBER define([ 'angular' ], function (angular) { 'use strict'; angular.module('BenfiIoTApp.Controllers.RealtimeCtrl', [ 'BenfiIoTApp.Config', 'BenfiIoTApp.Services.MQTTService' ]) .controller('RealtimeCtrl', ControllerFn); ControllerFn.$inject = ['$scope', 'MQTTService']; function ControllerFn($scope, MQTTService) { var vm = this; vm.brightness = 0; vm.temperature = 0; vm.humidity = 0; MQTTService.connect( โ€˜ws://YOUR.BROKER.URL' ); MQTTService.onMessage(function(topic, payload) { switch (topic) { case 'sensors/brightness': vm.brightness = payload.toString(); break; case 'sensors/temperature': vm.temperature = payload.toString(); break; case 'sensors/humidity': vm.humidity = payload.toString(); break; default: break; } $scope.$apply(); }); } });
  • 25. BROWSER PUBLISHER define([ 'angular' ], function (angular) { 'use strict'; angular.module('BenfiIoTApp.Controllers.ColorCtrl', [ 'BenfiIoTApp.Services.MQTTService' ]) .controller('ColorCtrl', ControllerFn); ControllerFn.$inject = ['MQTTService']; function ControllerFn(MQTTService) { var vm = this; vm.selectedColor = '#000000'; vm.send = send; MQTTService.connect( 'ws://YOUR.BROKER:URL' ); function send() { MQTTService.publish('color', vm.selectedColor); } } });
  • 26. DEVICE SOFTWARE โžค On your Arduino Yun install packages: โžค opkg update โžค opkg install mosquitto mosquitto-client libmosquitto
  • 27. DEVICE PUB/SUB #include <MQTTclient.h> #define MQTT_HOST โ€œYOUR.BROKER.URLโ€ void setup() { Serial.begin(115200); // remember the bridge! Bridge.begin(); // begin the client library (initialize host) mqtt.begin(MQTT_HOST, 1883); mqtt.subscribe("color", colorEvent); } void loop() { // check for incoming events mqtt.monitor(); mqtt.publish("sensors/brightness", brightness); mqtt.publish("sensors/temperature", temperature); mqtt.publish("sensors/humidity", humidity); delay(1000); } void colorEvent(const String& topic, const String& subtopic, const String& message) { // hex to rgb String hexstring = message; // Get rid of '#' and convert it to integer long number = strtol( &hexstring[1], NULL, 16); // Split them up into r, g, b values long r = number >> 16; long g = number >> 8 & 0xFF; long b = number & 0xFF; for (int i = 0; i < NUMPIXELS; i++) { pixels.setPixelColor(i, pixels.Color(r,g,b)); // Moderately bright green color. pixels.show(); // This sends the updated pixel color to the hardware. delay(delayval); // Delay for a period of time (in milliseconds). } }
  • 28. WHY CLOUD? WHY AWS? WHAT MAY BE USEFUL? โžค Load balancers โžค Security groups โžค Autoscaling โžค Elastic Beanstalk โžค EC2 โžค S3 โžค Elasticsearch Service โžค ElasticCache โžค Lambda โžค Kinesis
  • 30. LINKS โžค MQTT.js โžค Mosca โžค Eclipse Ponte โžค Easy Arduino Yun MQTT Client