On a connecté le studio !
-
Upload
sameh-ben-fredj -
Category
Devices & Hardware
-
view
298 -
download
0
Transcript of On a connecté le studio !
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
[email protected] @SamehBenF
Qian JinAndroid Developer & Pythonista
[email protected] @bonbonking
Xebia Studio
XL Room
LannisterRoom
StarkRoom
TargaryenRoom
MeetingRoom
Toilet
TVXbox
Hallway & Leisure Space
PinballMachine
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
IoT@Work: Why ?
! Smart Office○ Energy management○ Activity tracking○ Consumption tracking○ Space management
! Smart Employee○ Data sharing○ Health monitoring○ Time management
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
Sensors
! Grove Sensors from Seeed Studio○ Temperature & Humidity sensor○ Motion sensor○ Sound sensor
! Others○ FC-51 Infra Red Distance Sensor○ Light sensor
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() {}
MQTT
! Invented in 1999 by IBM and Eurotech
! Version 3.1.1 is now an OASIS Standard (Since November 2014)
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
! Data Visualization! Data Pulling: Auto Refresh every 5min! Deployed on Github pages! Tools we love
Troubles
! Newbies in electronics! Unstable Wi-Fi condition! Lack of monitoring mechanism! Curiosity visitors! Time! Time! Time!
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
Acknowledgment
! Qian Jin (hardware + back)! Sameh Ben Fredj (hardware)! Benjamin Lacroix (front)! Thomas Guerin (back)! Julien Buret (hardware)! Xebians who actively give suggestions ;)