Building a conference attendee tracking system - DNN

Building a conference attendee
tracking system using DNN
and MQTT
Peter Donker
DNN Connect 2017
#DNNConnect2017
Last Year
• First attempt at this using:
•
•
•
•
•
Raspberry Pi
HD44780 Display
RFID Cards and Scanner
Mono
WebAPI calls to server
#DNNConnect2017
Last Year
• Quite a few reliability issues
• IoT app ran as console app
• Network was not reliable
#DNNConnect2017
Console App
• Because the card reader was a “USB keyboard”
• Cannot read keyboard in a background process
• So look for a reader that is not a keyboard
#DNNConnect2017
#DNNConnect2017
First Snag
• Could only find “good” code in Python/C for the RC522 chip
• In general: Python is the most ubiquitous for IoT code, then C
• Subsequently it is *very* hard to do dotnetcore dev for IoT
#DNNConnect2017
Another small snag ;-)
• The old cards didn’t “work”
• Many different RFID standards (?!?)
• 2016: low frequency EM4100 cards
• 2017: MiFare cards
#DNNConnect2017
Second challenge: network reliability
• We have to assume the network is not always up
• http web api calls (can be) relatively “demanding”
• Most common protocol used in these situations: MQTT
#DNNConnect2017
MQTT
• Message Queue Telemetry Transport
• Traces back to IBM in the 90’s. First standard in 1999.
• Focus on: limited bandwidth, reliability, simplicity
• TCP – Ports 1883 or 8883 (SSL)
• Widespread support
#DNNConnect2017
MQTT
• Follows so-called Pub-Sub pattern
• Message:
• Topic (forward slash separated list)
• Message (agnostic what it is)
• QoS (0,1,2)
• Clients publish and subscribe to topics
• Everything runs through the “Broker” (i.e. the MQTT server) which
does the dispatching of messages
#DNNConnect2017
MQTT
From https://www.slideshare.net/BryanBoyd/mqtt-austin-api
#DNNConnect2017
MQTT
From https://www.slideshare.net/BryanBoyd/mqtt-austin-api
#DNNConnect2017
MQTT
• Header size up to 2-4 bytes (pub), for HTTP: 100-1000 bytes
• Keep alive ping of 2 bytes
• Client libraries are typically small and available in many languages
• Simple to implement
• Easy to find commercially available brokers
• Reliable …
#DNNConnect2017
MQTT
From https://www.slideshare.net/BryanBoyd/mqtt-austin-api
#DNNConnect2017
MQTT
• Gotchas:
• Security is on connection level, not topic level
• If you wish to have QoS > 0 then client must be able to reliably store
queued messages
#DNNConnect2017
2017 Conference Tracking System Design
Raspberry Pi Zero W
DNN Connect Server
Satellite 1
MQTT
Satellite 2
Satellite 3
#DNNConnect2017
Broker
MQTT
Conference
Site (DNN)
2017 Conference Tracking System Design
RFID
DETECTOR
DNN
Memory
DISPLAY
#DNNConnect2017
http
Python
Node Red
MQTT
Broker
Demo time
#DNNConnect2017
I have a dream
• Where one day DNN would incorporate a MQTT broker so
• We can have devices and modules on par
• We can achieve a new level of extensibility
• Obstacles
• Use of non http protocol means it falls outside of IIS scope
• MQTT is per host – you’d need to solve multiple sites/portals
#DNNConnect2017
Questions?
Please remember to evaluate the session online
#DNNConnect2017