Slide 1

Slide 1 text

BreizhCamp 2015 #BzhCmp #IoT BreizhCamp 2015 #BzhCmp On a connecté le studio ! Qian JIN - @bonbonking Sameh BEN FREDJ - @SamehBenF

Slide 2

Slide 2 text

Speakers Sameh Ben Fredj IoT Consultant & Data passionate [email protected] @SamehBenF Qian Jin Android Developer & Pythonista [email protected] @bonbonking

Slide 3

Slide 3 text

Xebia Studio

Slide 4

Slide 4 text

Xebia Studio

Slide 5

Slide 5 text

Ground Floor Xebia Studio 1st Floor Mezzanine

Slide 6

Slide 6 text

Xebia Studio XL Room Lannister Room Stark Room Targaryen Room Meeting Room Toilet TV Xbox Hallway & Leisure Space Pinball Machine

Slide 7

Slide 7 text

Yes! A pinball machine!

Slide 8

Slide 8 text

A Day in Studio

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

What about connecting the Studio?

Slide 11

Slide 11 text

IoT: What is it?

Slide 12

Slide 12 text

IoT: How big?

Slide 13

Slide 13 text

IoT: How much? Source : EMC, IDC, 2013

Slide 14

Slide 14 text

IoT: Why should I care?

Slide 15

Slide 15 text

IoT@Work

Slide 16

Slide 16 text

IoT@Work: How ?

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Get Hands Dirty

Slide 19

Slide 19 text

MQTT \ Backend Architecture Overview Hardware Data Service Frontend Publish Subscribe Deliver Hardware Publish

Slide 20

Slide 20 text

Electronics

Slide 21

Slide 21 text

Hardware Nano Computer Micro Controller

Slide 22

Slide 22 text

Hardware ● TI LaunchPad CC3200 + Platform Energia

Slide 23

Slide 23 text

Sensors Grove Temperature & Humidity Sensor Grove Motion Sensor Grove Sound Sensor

Slide 24

Slide 24 text

Sensors

Slide 25

Slide 25 text

Example: data lecture & publish #include #include #include // 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() { }

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

Hack the Coffee Machine

Slide 28

Slide 28 text

Hack the coffee machine

Slide 29

Slide 29 text

Hack the coffee machine FC-51 Infra Red Distance Sensor

Slide 30

Slide 30 text

Hack the coffee machine

Slide 31

Slide 31 text

Communication Protocol

Slide 32

Slide 32 text

Why MQTT? ● Invented in 1999 by IBM and Eurotech ● Version 3.1.1 is now an OASIS Standard (Since November 2014) ● mqtt.org

Slide 33

Slide 33 text

MQTT: light Pub/Sub model

Slide 34

Slide 34 text

Why MQTT? ● Low overhead ● Based on TCP/IP ● Low energy consumption ● Support of WebSocket ● Different implementations: Java/Python/C++ ● Commercial and Open Source version

Slide 35

Slide 35 text

Backend

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

Elasticsearch Aggregation "aggregations" : { "" : { "" : { } [,"aggregations" : { []+ } ]? } [,"" : { ... } ]* }

Slide 38

Slide 38 text

Frontend

Slide 39

Slide 39 text

Frontend ● Data Visualization ● Data Pulling: auto refresh every 5min ● Deployed on Github pages ● Tools we love

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

Difficulties

Slide 42

Slide 42 text

Difficulties ● Newbies in electronics ● Unstable Wi-Fi condition ● Curiosity visitors ● Time! Time! Time!

Slide 43

Slide 43 text

Dashboard

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

Coworkers’ Reaction

Slide 46

Slide 46 text

Before

Slide 47

Slide 47 text

After

Slide 48

Slide 48 text

1st tweet

Slide 49

Slide 49 text

Next Steps

Slide 50

Slide 50 text

Physical Indications ● Meeting room occupation sign ● Button obsession ○ Check-in button ○ Croissant button ● Hack the LED screen

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

iBeacons ● Presence tracking ● Information pushing

Slide 53

Slide 53 text

Data mining ● Data analysis and correlation ● Prediction

Slide 54

Slide 54 text

Acknowledgment

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

Working Session

Slide 57

Slide 57 text

Thank you! Q&A