Smart Studio

7b5a07956eb0b62be7214d043821a987?s=47 jinqian
June 11, 2015

Smart Studio

Presented @ Breizhcamp 2015 #IoT

7b5a07956eb0b62be7214d043821a987?s=128

jinqian

June 11, 2015
Tweet

Transcript

  1. 1.

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

    le studio ! Qian JIN - @bonbonking Sameh BEN FREDJ - @SamehBenF
  2. 2.

    Speakers Sameh Ben Fredj IoT Consultant & Data passionate sbenfredj@xebia.fr

    @SamehBenF Qian Jin Android Developer & Pythonista qjin@xebia.fr @bonbonking
  3. 6.

    Xebia Studio XL Room Lannister Room Stark Room Targaryen Room

    Meeting Room Toilet TV Xbox Hallway & Leisure Space Pinball Machine
  4. 9.

    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. 15.
  6. 17.
  7. 24.
  8. 25.

    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() { }
  9. 26.

    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() {}
  10. 32.

    Why MQTT? • Invented in 1999 by IBM and Eurotech

    • Version 3.1.1 is now an OASIS Standard (Since November 2014) • mqtt.org
  11. 34.

    Why MQTT? • Low overhead • Based on TCP/IP •

    Low energy consumption • Support of WebSocket • Different implementations: Java/Python/C++ • Commercial and Open Source version
  12. 35.
  13. 36.

    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
  14. 37.

    Elasticsearch Aggregation "aggregations" : { "<aggregation_name>" : { "<aggregation_type>" :

    { <aggregation_body> } [,"aggregations" : { [<sub_aggregation>]+ } ]? } [,"<aggregation_name_2>" : { ... } ]* }
  15. 38.
  16. 39.

    Frontend • Data Visualization • Data Pulling: auto refresh every

    5min • Deployed on Github pages • Tools we love
  17. 40.

    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
  18. 43.
  19. 46.
  20. 47.
  21. 48.
  22. 50.

    Physical Indications • Meeting room occupation sign • Button obsession

    ◦ Check-in button ◦ Croissant button • Hack the LED screen
  23. 51.

    Connected X • Connected Chairs • Connected Fridge • Connected

    storage for mobile device ◦ RFID + Monitor Screen ◦ Inventory Made Easy
  24. 55.

    Acknowledgment • Qian Jin (hardware + back) • Sameh Ben

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