On a connecté le studio !

Preview:

Citation preview

BreizhCamp 2015 #BzhCmp

#IoT

BreizhCamp 2015 #BzhCmp

On a connecté le studio !

Qian JIN - @bonbonkingSameh BEN FREDJ - @SamehBenF

Speakers

Sameh Ben Fredj IoT Consultant & Data passionate

sbenfredj@xebia.fr @SamehBenF

Qian JinAndroid Developer & Pythonista

qjin@xebia.fr @bonbonking

Xebia Studio

Xebia Studio

Ground Floor

Xebia Studio

1st Floor

Mezzanine

Xebia Studio

XL Room

LannisterRoom

StarkRoom

TargaryenRoom

MeetingRoom

Toilet

TVXbox

Hallway & Leisure Space

PinballMachine

Yes! A pinball machine!

A Day in Studio

A Day in Studio

! Temperature varies! Surge of noise level! Meeting room (a.k.a lunch room) occupied! Lights/TV left on! Coffee capsule shortage! Mobile device gone missing

What about connecting the Studio?

IoT: What is it?

IoT: How big?

IoT: How much?

Source : EMC, IDC, 2013

IoT: Why Should I care?

IoT@Work

IoT@Work: Why ?

! Smart Office○ Energy management○ Activity tracking○ Consumption tracking○ Space management

! Smart Employee○ Data sharing○ Health monitoring○ Time management

IoT@Work: How ?

Get Hands Dirty

Tech Stack

! Electronics: TI LaunchPad CC3200 + Energia + Grove sensors

! Communication: MQTT clients + CloudMQTT

! Frontend: Bower + Gulp + Github Pages + DataViz libraries

! Backend○ Node.js + Heroku○ Elasticsearch + Bonsai.io

MQTT Broker

(Cloud-MQTT)

Architecture Overview

CC3200Sensors

(Meeting room)

DataElasticSearch

(Bonsai Cluster)

BackendREST Service

(Heroku Instance)

FrontEndWeb Dashboard(Github Pages)

Publish

Subscribe

Deliver

Store Data

Search & Aggregation

HTTP Request

s

CC3200Sensors

(Mezzanine)

Publish

Electronics

Hardware

Nano Computer Micro Controller

Hardware

! TI LaunchPad CC3200 + Platform Energia

Sensors

! Grove Sensors from Seeed Studio○ Temperature & Humidity sensor○ Motion sensor○ Sound sensor

! Others○ FC-51 Infra Red Distance Sensor○ Light sensor

Sensors

Grove Temperature & Humidity Sensor

Grove Motion Sensor

Grove Sound Sensor

Sensors

Example: data lecture#include <WiFi.h> #include <PubSubClient.h> #include <DHT.h>

// PIN POSITIONS #define TEMP_HUMI_PIN 24 #define SOUND_SENSOR 6 #define LIGHT_SENSOR 2

#define ROOM_ID 1

DHT dht(TEMP_HUMI_PIN, DHT22); WiFiClient wifiClient; PubSubClient client(server, 16301, callback, wifiClient);

char temp_buffer[256]; char humidity_buffer[256];

void setup() { // Setting up ...

dht.begin(); } void loop() { }

Example: data lecture

void loop() { // read values from sensors & pubish to mqtt

_temperature = dht.readTemperature(); _humidity = dht.readHumidity();

sprintf(temp_buffer, "{\"value\": %d,\"room_id\": %d}", _temperature, ROOM_ID); sprintf(humidity_buffer, "{\"value\": %d,\"room_id\": %d}", _humidity, ROOM_ID);

if (client.publish("temp", temp_buffer) && client.publish("humidity", humidity_buffer){

log("Data published succeeded!"); } else {

log("Data publish failed"); }

delay(5000); }

void log() {}

Hack the Coffee Machine

Hack the coffee machine

Hack the coffee machine

FC-51 Infra Red Distance Sensor

Hack the coffee machine

CommunicationProtocol

Why MQTT?

MQTT vs XMPP vs AMQP

MQTT

! Invented in 1999 by IBM and Eurotech

! Version 3.1.1 is now an OASIS Standard (Since November 2014)

Backend

Backend

! Node.js app on Heroku○ Connect to CloudMQTT via Websocket○ REST service to frontend○ Index/Query Elasticsearch data

! Data in ElasticSearch○ JSON over HTTP○ Data aggregation made easy

Elasticsearch Aggregation

"aggregations" : { "<aggregation_name>" : { "<aggregation_type>" : { <aggregation_body> } [,"aggregations" : { [<sub_aggregation>]+ } ]? } [,"<aggregation_name_2>" : { ... } ]* }

Frontend

Frontend

! Data Visualization! Data Pulling: Auto Refresh every 5min! Deployed on Github pages! Tools we love

Dashboard

Dashboard live: http://bit.ly/1e1sCER

Troubles

Troubles

! Newbies in electronics! Unstable Wi-Fi condition! Lack of monitoring mechanism! Curiosity visitors! Time! Time! Time!

Coworkers’Reaction

Before

After

1st tweet

Next Steps

Physical Indications

! Meeting room occupation sign

! Button obsession○ Check-in button○ Croissant button

! Hack the LED screen

Connected X

! Connected Chairs! Connected Fridge! Connected storage for mobile device○ RFID + Monitor Screen○ Inventory Made Easy

iBeacons

! Presence tracking! Information pushing

Data mining

! Data analysis and correlation! Prediction

Acknowledgment

Acknowledgment

! Qian Jin (hardware + back)! Sameh Ben Fredj (hardware)! Benjamin Lacroix (front)! Thomas Guerin (back)! Julien Buret (hardware)! Xebians who actively give suggestions ;)

Working session

Thank you!Q&A