Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Smart Studio

jinqian
June 11, 2015

Smart Studio

Presented @ Breizhcamp 2015 #IoT

jinqian

June 11, 2015
Tweet

More Decks by jinqian

Other Decks in Technology

Transcript

  1. BreizhCamp 2015 #BzhCmp #IoT BreizhCamp 2015 #BzhCmp On a connecté

    le studio ! Qian JIN - @bonbonking Sameh BEN FREDJ - @SamehBenF
  2. Speakers Sameh Ben Fredj IoT Consultant & Data passionate [email protected]

    @SamehBenF Qian Jin Android Developer & Pythonista [email protected] @bonbonking
  3. Xebia Studio XL Room Lannister Room Stark Room Targaryen Room

    Meeting Room Toilet TV Xbox Hallway & Leisure Space Pinball Machine
  4. A Day in Studio • Temperature differences • Surge of

    noise level • Meeting room (a.k.a lunch room) occupied • Lights/TV left on • Coffee capsule shortage • Mobile device gone missing
  5. Example: data lecture & publish #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() { }
  6. Example: data lecture & publish 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() {}
  7. Why MQTT? • Invented in 1999 by IBM and Eurotech

    • Version 3.1.1 is now an OASIS Standard (Since November 2014) • mqtt.org
  8. Why MQTT? • Low overhead • Based on TCP/IP •

    Low energy consumption • Support of WebSocket • Different implementations: Java/Python/C++ • Commercial and Open Source version
  9. Backend • Node.js app on Heroku ◦ Connect to CloudMQTT

    via Websocket ◦ REST service using Express ◦ Index/Query Elasticsearch data • Data in ElasticSearch ◦ JSON over HTTP ◦ Data aggregation made easy
  10. Elasticsearch Aggregation "aggregations" : { "<aggregation_name>" : { "<aggregation_type>" :

    { <aggregation_body> } [,"aggregations" : { [<sub_aggregation>]+ } ]? } [,"<aggregation_name_2>" : { ... } ]* }
  11. Frontend • Data Visualization • Data Pulling: auto refresh every

    5min • Deployed on Github pages • Tools we love
  12. MQTT Broker (Cloud- MQTT) Architecture Overview CC3200 Sensors (Meeting room)

    ElasticSearch (Bonsai Cluster) REST Service (Heroku Instance) FrontEnd Web Dashboard (Github Pages) Publish Subscribe Deliver Data Indexing Search & Aggregation CC3200 Sensors (Mezzanine) Publish
  13. Physical Indications • Meeting room occupation sign • Button obsession

    ◦ Check-in button ◦ Croissant button • Hack the LED screen
  14. Connected X • Connected Chairs • Connected Fridge • Connected

    storage for mobile device ◦ RFID + Monitor Screen ◦ Inventory Made Easy
  15. Acknowledgment • Qian Jin (hardware + back) • Sameh Ben

    Fredj (hardware) • Benjamin Lacroix (front) • Thomas Guerin (back) • Julien Buret (hardware) • Xebians who actively give suggestions ;)