Slide 1

Slide 1 text

Building an IoT based realtime attendance system for Slack Episode 2 By Srushtika Neelakantam, Dev Advocate, Ably

Slide 2

Slide 2 text

Ably - Serious realtime infrastructure Page 2 Srushtika Neelakantam | Ably Masterclass - Episode 2 Hi there, I’m Srushtika Developer Advocate @Srushtika [email protected]

Slide 3

Slide 3 text

Ably - Serious realtime infrastructure Page 3 Srushtika Neelakantam | Ably Masterclass - Episode 2 What will we build? + RFID- MFRC522 + Adafruit feather HUZZAH ESP8266 1 Ably MQTT broker publish msg (MQTT) 2 Zapier apps connector publish msg (WebHooks/ REST) 3 Slack messaging app publish msg (WebHooks/ REST) 4

Slide 4

Slide 4 text

Page 4 Ably - Serious realtime infrastructure Srushtika Neelakantam | Ably Masterclass - Episode 2 AGENDA ● About Ably ● Working of MQTT ● Things you need ● Wiring the IoT components ● Understanding the code ● Working of WebHooks ● Setting up a Zap ● Ably Hub ● Live Q/A

Slide 5

Slide 5 text

Page 5 Ably - Serious realtime infrastructure Srushtika Neelakantam | Ably Masterclass - Episode 2 About Ably Realtime messaging APIs for event-driven applications. ● Minimal latency ● Reliability ● Message ordering ● Scalability ● Protocol interoperability

Slide 6

Slide 6 text

Ably - Serious realtime infrastructure Page 6 Srushtika Neelakantam | Ably Masterclass - Episode 2 MQTT IoT board MQTT broker (Ably) Devices Server Database publish msg subscribe publish msg subscribe publish msg subscribe publish msg

Slide 7

Slide 7 text

Page 7 Ably - Serious realtime infrastructure Srushtika Neelakantam | Ably Masterclass - Episode 2 Things you’ll need Hardware components: 1. Adafruit Feather HUZZAH ESP866 - WiFi enabled board that works with the Arduino software 2. MFRC522 RFID sensor 3. Breadboard (Optional) 4. Jump wires Software components: 1. The Arduino IDE 2. An account with Ably (free or paid) 3. An account with Zapier (free or paid) 4. An account with Slack (free or paid)

Slide 8

Slide 8 text

Page 8 Ably - Serious realtime infrastructure Srushtika Neelakantam | Ably Masterclass - Episode 2 Wiring the IoT components Huzzah pins RFID 4 RST 5 SDA 13 MOSI 12 MISO 14 SCK 3V 3.3V GND GND

Slide 9

Slide 9 text

Let’s understand the code

Slide 10

Slide 10 text

Page 10 Ably - Serious realtime infrastructure Srushtika Neelakantam | Ably Masterclass - Episode 2 What’s happening in the code 1. In setup method a. Set data rate b. Connect to WiFi c. Specify MQTT broker’s connection details d. Call the connect method 2. In connect method a. Check if WiFi is connected b. If yes, connect to the MQTT broker 3. In loop method (called repeatedly) a. Check if the RFID sensor has detected an access card b. If yes, get the ID of that card, match it with an employee name and publish that as a message to the Ably MQTT broker

Slide 11

Slide 11 text

Ably - Serious realtime infrastructure Page 11 Srushtika Neelakantam | Ably Masterclass - Episode 2 What will we build? + RFID- RC522 + Adafruit feather HUZZAH ESP8266 1 Ably MQTT broker publish msg (MQTT) 2 Zapier apps connector publish msg (WebHooks/ REST) 3 Slack messaging app publish msg (WebHooks/ REST) 4

Slide 12

Slide 12 text

Ably - Serious realtime infrastructure Page 12 Srushtika Neelakantam | Ably Masterclass - Episode 2 WebHooks Ably Platform Server Hi, http://test/endpoint is my address. Call me if something happens publish msg (via REST)

Slide 13

Slide 13 text

Page 13 Ably - Serious realtime infrastructure Srushtika Neelakantam | Ably Masterclass - Episode 2 What else can you build with these components? - Send an SMS or a push notification when a high security file room is accessed by someone. - Monitor environmental data and constantly stream data to the Ably MQTT broker and make that data available via the Hub. - Home automation based on location tracking

Slide 14

Slide 14 text

Page 14 Ably - Serious realtime infrastructure Srushtika Neelakantam | Ably Masterclass - Episode 2

Slide 15

Slide 15 text

Q&A

Slide 16

Slide 16 text

That’s all folks! Thankyou. @Srushtika [email protected] Icons used in this presentation are from https://flaticon.com/