The document discusses the Internet of Things (IoT) by defining what IoT is, how it works, and where it is used. It provides examples of IoT hardware kits, code snippets for connecting sensors and devices to an IoT platform, and diagrams illustrating IoT architecture. The document also offers resources and tips for developing IoT solutions using tools from the SmartLiving IoT platform.
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Getting Started with the Internet of Things - Allianz Hackrisk Hackathon 29/5/15 #IoT
1. Westminster Impact Hub
London, UK. 29/5/2015
Hack Risk Allianz
Hackathon
Getting started with the
Internet of Things
Tom Collins
@snillocmot
2. What is IoT?
An extension of the traditional web
providing intelligent features
through embedded computing,
which allows dumb objects
to autonomously react, inform and learn
from the context of Humans and Things
3. How is IoT?
The convergence of
cheaper and accessible
cloud, network and processing power,
with smaller and smarter computers
and a variety of hardware I/O sources
7. By 2020...
$7.1 trillion market value
50 billion connected devices
30 million every day
1 in 3 ‘knowledge workers’ will be
replaced by a digital workforce and smart machines
8. Why IoT?
To improve quality of life and drive new business
through connecting physical, cyber and social domains
11. Problems
Millions of apps
Still stuck in remote control mode
Siloed solutions (An API doesn’t make it IoT)
Big innovation captures the consumers eye,
but not enough immediate ROI for business
to adopt
12. SmartLiving
IoT Starter Kit
A Computer (Arduino Ethernet, Intel
Edison or Raspberry PI) & Grove shield
A bunch of sensors and actuators
● Button
● Blue LED (5mm)
● Rotary Angle Sensor (P)
● Light Sensor (P)
● Vibration Motor
● Temperature Sensor
● Infrared receiver
● Infrared emitter
● LED Bar
● PIR Motion sensor
Check out the kits at
http://www.smartliving.io/kits
13. Examples
TCP/IP, MQTT, IPv6,
CoAP, REST, XBEE,
ZigBee, ZWave, Serial,
custom radios, IPoAC, etc
CONNECTIVITY
Landscape
END POINTS
aka Things
MIDDLEWARE
router
gateways
fog services
cloud bridges
brokers
Examples
OpenHAB,
TheThingSystem, ZIPR,
Dowse, Ponte,
WebSphere, RabbitMQ,
Dweet
IOT SERVICES
SmartLiving
IFTTT
Xively
TempoIQ
InitialState
Waylay.io
Millions of other
single use services...
Examples
Persistence, (E.g TempoIQ),
automation (E.g IFTTT),
intelligence, third party
integrators (ERP
connectors)
APPS
Companion apps
Widgiots
Freeboard
Node red
Wyliodrin
Examples
WidgIoTs, SmartLiving
Web & Mobile Apps,
Freeboard
Custom RF
14. END POINTS
aka Things
CONNECTIVITY MIDDLEWARE IOT SERVICES APPS
LED
POT
Arduino DBBroker Manage
Widget
Rules
Blinking IoT Led
Trusty
Ethernet cable
Potentiometer Sensor Code
Device.Send(String(potRead), pot); //Reads and
sends pot
LED Actuator code
if (command == "false") {
digitalWrite(led, LOW); //Turns LED off
} else if (command == "true") {
digitalWrite(led, HIGH); //Turns LED on
}
SmartLiving API’s
httpServer = "api.smartliving.io";
mqttServer = "broker.smartliving.io";
Automation Rule
When
Arduino.pot > 500
Then
Arduino.led = true
Else
Arduino.led = false
15. SmartLiving Toolbox
END POINTS CONNECTIVITY MIDDLEWARE IOT SERVICES APPS
Arduino
Raspberr
y Pi
Android
Makers
App
Virtual
actuator
Virtual
sensors
iOS App
Web app Widgets
ZWave
Devices
SolutionsDevTools
C Lib
Android
Gateway
Arduino
Gateway
PUBSUB
Clients
REST
Clients
Raspberry
Pi Makers
Gateway
Management
Telemetry DB
Rule Engine
Automation
Scripting
Rule
Wizard
SERIALTCP/IP
ZWAVE
XBEE
Python
Lib
JS
Lib
Widget
Lib
Node.js
Lib
Go
Lib
433 Mhz
IR!!?
Polymer
Widgets
Web
Services
ZigBee
Custom
microco
ntrollers
Java
Lib
Plenty of
existing
resources
here
SmartLiving
pub:sub
Broker
ZWave
IPv6
Gateway
16. Library & API’S
Endpoints (Hardware and libs)
Arduino/C
Python
Node.js
C#
Javascript (HTML5-browser-as-a-sensor)
Middleware
Python Gateway
C++ Gateway
XBee Gateway
IOT Services
REST API - Gateway, Device, Asset, Rules,
Users
Telemetry API - Sensor data, actuator
commands
Automation rules, scripting & API
Apps
Javascript Widgets
17. Arduino - setup
void setup()
{
pinMode(ledPin, OUTPUT); // initialize the digital pin as an output.
Serial.begin(9600); // init serial link for debugging
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xE1, 0x3E}; // Adapt to your Arduino MAC Address
if (Ethernet.begin(mac) == 0) // Initialize the Ethernet connection:
{
Serial.println(F("DHCP failed,end"));
while(true); //we failed to connect, halt execution here.
}
delay(1000); //give the Ethernet shield a second to initialize:
if(Device.Connect(ðClient, httpServer)) //connect the device with the IOT platform.
{
Device.AddAsset(knobPin, "Potentiometer", "A rotary sensor pot",false, "int"); //pin, name, desc, assetType, dataPro
Device.AddAsset(ledPin, "LED", "A blinky light emitting diode", true, "bool"); //pin, name, desc, assetType, dataPro
Device.Subscribe(pubSub);
}
}
18. Arduino - sensor read loop
void loop()
{
unsigned long curTime = millis();
if (curTime > (time + 1000)) // publish light reading every 5 seconds to sensor 1
{
unsigned int lightRead = analogRead(knobPin); // read from light sensor (photocell)
if(prevVal != lightRead){
Device.Send(String(lightRead), knobPin);
prevVal = lightRead;
}
time = curTime;
}
Device.Process();
}
19. Arduino - actuator callback
void callback(char* topic, byte* payload, unsigned int length)
{
String msgString;
{
char message_buff[length + 1];
strncpy(message_buff, (char*)payload, length);
message_buff[length] = '0';
msgString = String(message_buff);
}
int* idOut = NULL;
{
int pinNr = Device.GetPinNr(topic, strlen(topic)); //Find what topic hooks to the pin
if (pinNr == ledPin)
{
if (msgString == "false") {
digitalWrite(ledPin, LOW); //led off
idOut = &ledPin;
}
else if (msgString == "true") {
digitalWrite(ledPin, HIGH); //led on
idOut = &ledPin;
}
}
}
Device.Send(msgString, *idOut); //Acknowledges the LED was activated and confirm in the user interface
}
21. Node.js - Summary
var a0 = new mraa.Aio(0); //setup access analog input Analog pin #0 (A0)
var d8 = new mraa.Gpio(8); //LED hooked up to digital pin 13 (or built in pin on Galileo Gen1 & Gen2)
d8.dir(mraa.DIR_OUT); //set the gpio direction to output
smartliving.addAsset("2", "Missile launcher", "Fires 10xD missiles at incoming spacecraft, and also a neat LED for some visual feedback...", true, "bool", confirmEnroll());
smartliving.addAsset("3", "Thermoreactor turbine temperature ", "Monitors the temperature of main alpha turbine", false, "int", confirmEnroll());
smartliving.subscribe(smartliving.baseMQTTUrl, 1883);
vloop();
function vloop()
{
var analogValue = a0.read(); //read the value of the analog pin
smartliving.send(analogValue, "3")
setTimeout(vloop,1000);
}
smartliving.registerActuatorCallback("2", function() {
d8.write(ledState?1:0); //if ledState is true then write a '1' (high) otherwise write a '0' (low)
ledState = !ledState; //invert the ledState
});
22. Rules
FYI
● Rule wizard doesn’t support complex operators like &&, ||
● Create a script and run it in the cloud if you need crazy logic
23. Hackathon Ethos
Fake it, until you make it
(literally)
Hackathons always have
network issues
Hardware is normally limited or
even shared
Mock data is easy
Things always go wrong
Fancy UI elements always look
good
KISS, Hardware is Hard, Retrofit
● Nest is just a potentiometer,
temp, PIR sensor
● GNL is just a LED & Push
Button
● Hue is just a RGB
● Wemo is just a Relay
MVP Mentality
Build small think big (What’s the
story behind your use case)
High impact features first
24. Brainstorming IoT
The problem - Short sharp
sentence describing the story of
your problem and how the solution
solves it
Topology diagram - Visualise what
you’re going to build, show the
inputs and outputs and use it to
explain your idea
THINGS - What are the dumb objects?
END POINTS - What computers and sensors are need
to make things smarter?
DATA MODEL - What type of data will the Things
produce? What are the inputs/outputs?
MIDDLEWARE - How will devices communicate? one-
one, one-many?
AUTOMATION - When this event happens then do
this event?
UI - Mockups and wireframes
HUMANS - Who are the most important people using
the solution?
25. Resources
Get your SmartLiving IoT Starter Kit
www.smartliving.io/kits
The platform
beta.smartliving.io
Documentation
http://docs.smartliving.io/Get_Started
GitHub
https://github.com/allthingstalk
API Reference
http://allthingstalk.github.io/api-docs