initializing

The contents of the box will be updated when the IoT Button is clicked at a remote location.

Overview

At Remote Location…

  1. IoT Button
    • Button has been registered in Amazon Web Services (AWS)
    • Security keys have been imported from AWS into the button
    • Button is connected to local WiFi
  2. The button uses WiFi to transmit button click data to the AWS cloud via HTTPS
    • The button comes pre-configured to use an endpoint at Amazon AWS
  3. AWS routes the following button click data to a Lambda Function:
    • Button Serial Number
    • Click Type (Single | Double | Long)
    • Battery Voltage
  4. The AWS Lambda Function uses Python language to POST the data from AWS to a PHP script located at this website
    • The PHP script stores the click data to a MySQL database as a new record

Meanwhile, at this website…

  • PHP framework
  • MySQL database
  • HTML web design
  • JQuery polls the database every 3 seconds to look for a new database record. If it finds new data then the box is updated with the new status, date/time, and an icon is selected based on the click value:
    • NO CLICK TODAY = airplane icon
    • SINGLE = one-finger icon
    • DOUBLE = two-finger icon
    • LONG = hand icon

Download the Code

AWS IoT Button To PHP — Integrate an Amazon AWS IoT Button with AWS Lambda to send button clicks to a PHP web page, which uses jQuery to automatically update the page.


AWS IoT Button Use Cases

The system you see here could do more than just change text and an icon… it could be used to change entire pages, including pictures. At the simplest it could be used as an online “OPEN” or “CLOSED” sign for a retail store.

Amazon’s most popular use case is the Dash Button, and they also sell AWS IoT buttons to nerds like me 🙂

Here’s a great tutorial that shows how to integrate your IoT button with Slack: Slack Messaging with the AWS IoT Button. In that implementation, the use case is as follows:

  1. the business occupies multiple floors of a building
  2. each floor has a coffee machine
  3. if someone notices that the coffee is running out, they can press an IoT button next to the machine
  4. using AWS Lambda, each button triggers a unique message
  5. the message is POSTed to a channel in Slack
  6. the person responsible for making coffee only needs to monitor the Slack channel to know when coffee needs to be replenished