Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ably Masterclass Episode 2 - Building an IoT based realtime attendance system for Slack

Ably Masterclass Episode 2 - Building an IoT based realtime attendance system for Slack

In this masterclass, Ably’s Developer Advocate, Srushtika Neelakantam, spoke about the basics of IoT and the realtime communication protocol these devices like to use i.e. MQTT.

She then demonstrated a realtime attendance system for Slack that could
• Detect the use of an entry keycard
• Publish this info in realtime to an Ably channel
• Ably, in turn, pinged Zapier
• Zapier, in turn, published this info on a Slack channel.

The links from the 7th slide are listed below:

Hardware components:
1. Adafruit Feather HUZZAH ESP866 - https://learn.adafruit.com/adafruit-feather-huzzah-esp8266/overview
2. MFRC522 RFID sensor - https://playground.arduino.cc/Learning/MFRC522/
3. Breadboard (Optional) - https://en.wikipedia.org/wiki/Breadboard
4. Jump wires - https://en.wikipedia.org/wiki/Breadboard#Jump_wires

Software components:
1. The Arduino IDE - https://www.arduino.cc/en/main/software
2. An account with Ably (free or paid) - https://www.ably.io/signup
3. An account with Zapier (free or paid) - https://zapier.com/
4. An account with Slack (free or paid) - https://slack.com/intl/en-gb/

Feel free to reach out to Srushtika via Twitter for any questions or concerns.

Srushtika Neelakantam

February 25, 2020
Tweet

More Decks by Srushtika Neelakantam

Other Decks in Technology

Transcript

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

    View full-size slide

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

    View full-size slide

  3. 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

    View full-size slide

  4. 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

    View full-size slide

  5. 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

    View full-size slide

  6. 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

    View full-size slide

  7. 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)

    View full-size slide

  8. 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

    View full-size slide

  9. Let’s understand the code

    View full-size slide

  10. 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

    View full-size slide

  11. 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

    View full-size slide

  12. 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)

    View full-size slide

  13. 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

    View full-size slide

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

    View full-size slide

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

    View full-size slide