Polling is for Wimps?

Embed Size (px)

DESCRIPTION

Talk about choices of protocals given at Wuthering Bytes 2013. I started with the premise that pub/sub should be the default choice. After further consideration I admitted that there are exceptions to the rule. Praise for MQTT and node.js

Citation preview

  • 1. 14th September '13 Wuthering Bytes 2013 1 Wuthering Bytes :: September 2013 Polling is for Wimps? @paul_tanner

2. 14th September '13 Wuthering Bytes 2013 2 Polling is for Wimps Internet of Things System approach Protocols and choices Security and availability Current project Workshop tomorrow 3. 14th September '13 Wuthering Bytes 2013 3 Internet of Things Real-time control systems: Input Sensors; (Stateful) processing; Control actuators Internet connectivity 4. 14th September '13 Wuthering Bytes 2013 4 System approach out = in > T || out && in > -T 5. 14th September '13 Wuthering Bytes 2013 5 Distributed System 6. 14th September '13 Wuthering Bytes 2013 6 Why Rules Engine? IoT installations will often evolve System owners may be domain experts Best not to build the business rules in code Rules-based approach best Must be extendable (nodes, processing) Needs usable interface (e.g drag 'n drop) Engines typically needed at > 1 level 7. 14th September '13 Wuthering Bytes 2013 7 Distributed System 8. 14th September '13 Wuthering Bytes 2013 8 The Hardware RFM12Pi Arduino with Ethernet 9. 14th September '13 Wuthering Bytes 2013 9 Protocols XMPP messaging/ pub/ sub Bayeux pub/ sub over http MQTT a lightweight pub/ sub numerous implementations REST for gets and puts HTTP for remote control In all cases: application-specific semantics :-( 10. 14th September '13 Wuthering Bytes 2013 10 Which to Use? Criteria: Bandwidth efficiency? Power consumption? Security? Standardisation? Interoperability (local and global)? 11. 14th September '13 Wuthering Bytes 2013 11 Comparison Polling Pub/ Sub Bandwidth Efficiency 4.4M 46K* Power consumption +10%** +10%** Security SSL/ Cert Auth DIY * Using MQTT (Bayeux figure was 490K) ** 3W-2.7W estimates (no real-time energy monitor available) Test condition: download of 8 channel Xively data format every 10 minutes (download latency 1 minute) 12. 14th September '13 Wuthering Bytes 2013 12 Security (CI) models Installation firewalls: no open incoming ports SSL across the net (performance overhead) OAuth to authenticate installation access to central services (as Twitter API) OAuth to authenticate admin access to installations 13. 14th September '13 Wuthering Bytes 2013 13 Availability Models Central Services: External monitor (on standby m/c) Checkpointing to data store Automatic restart Installations: Hardware watchdog Cache to handle Internet outage Checkpointing to central service Automatic restart 14. 14th September '13 Wuthering Bytes 2013 14 When Wimps Rule OK With pub/sub you may need DIY security The above availability model is quite complex Pub/sub justified if bandwidth is at a premium On cheap connections you can afford to be more profligate: use polling for data transfers save on need for auto restart on central services 15. 14th September '13 Wuthering Bytes 2013 15 Node.js goodness runs great on Rpi (after 6 hour build) support for sockets and REST node MQTT.js works fine with mosquitto server node-serialport enables device attachment ease of implementing engine, rules etc removes heavy lifting from low-power devices like Arduinos 16. 14th September '13 Wuthering Bytes 2013 16 The Elephant... 17. 14th September '13 Wuthering Bytes 2013 17 But this need to be Local conventions may not need it Globally: Distributed approach to discovery Needs to go to end-point level DNS-like network of discovery nodes Needs investment and collaboration 18. 14th September '13 Wuthering Bytes 2013 18 Current Project ecoHome demonstrator mostly autonomous numerous sensors controls heating, ventilation, shutters, lights etc. RPi + Arduinos, talking MQTT Logging to Xively (for analysis) Local rules engine Admin app on local web server 19. 14th September '13 Wuthering Bytes 2013 19 Workshop plug Get hands dirty with MQTT Need laptop and Arduino, RPi or equivalent Some kind of sensor and/ or actuator I have MQTT microbroker and rules engine Ethernet 20. 14th September '13 Wuthering Bytes 2013 20 Contact Paul Tanner @paul_tanner www.slideshare.net/paul_tanner [email protected] 01494 581979 ?