Xmas Hackathon – A New Doorbell Based on an Amazon Dash Button, the CloudRail.Box and a Balluff Light

 In CloudRail, Internet of Things

The Xmas holidays are just around the corner, so it’s time to use the Friday afternoon to build something fun — an IIoT enabled doorbell for our office in Mannheim. So far we’ve been using a simple wireless doorbell which never really worked, so it’s time to replace it with a solid solution.

The Requirements

Our offices in Mannheim are separated by a sectional door which is closed the entire day due to security reasons. Moreover, this door is also used as fire protection, so we are not allowed to simply drill a hole for some wires. We also wanted to have a way to track when someone actually ran our doorbell. This is quite useful because parcel services, especially Amazon Logistics, tend to claim no one opened, even though we are rather sure they never actually tried it. Since we use Slack for our internal communication, we wanted to have a Slack Bot to inform us about events which happen at the door (e.g. missed visitor).

The Devices

Amazon Dash Button

We’ve been playing around the Amazon Dash Button a few months ago and actually always thought this might be the perfect doorbell. 1) It looks like a doorbell, 2) it’s wireless 3) it directly talks to the cloud 4) it’s cheap. So we replaced the Amazon label with a customized sticker and connected the Dash Button to our local Wifi. Once someone pushes it, the device sends a message to the AWS IoT Hub (AWS Cloud).

Balluff Tower Light

Of course, you also need something to actually indicate that someone pushed the button. For this purpose, we chose an industrial tower light by Balluff. This light can show different colors and has a buzzer which makes quite some noise.

The CloudRail.Box

To connect the Tower Light and the sensor to AWS, we used our CloudRail.Box. This device makes it super easy to connect industrial sensors and actuators with any cloud you want. It automatically detects IO-modules and sensors and with two clicks they are connected to for example Azure, AWS or Google.

Contrinex Inductive Senor

To measure if the door has been opened, we use an inductive sensor by Contrinex. This sensor basically indicates if it is close to a metal object, which is in our case the door.

IFM IO-Link Master

To connect the sensor and light with the CloudRail.Box, an IO-Link master is required. In this setup, we used one from IFM.

Other Devices

Moreover, we used a 24V power supply as well as a FritzBox to connect the Ethernet port of the CloudRail.Box to our local Wifi.

The Setup

Basic Lambda Functions

As a first step, we connected the AWS Dash Button to our AWS account by creating a new certificate and connecting it to our wifi (a detailed guide can be found here). When pressed, the button now sends an MQTT message to the topic iotbutton/<serial>. The idea is that when someone presses the button, we turn on the buzzer and let the light blink in yellow until the door is opened. For that purpose, we wrote the below Lambda function that is invoked whenever a message to the button topic is received.

The function also logs the doorbell event in a DynamoDB database. Those events are used to send notifications to one of our Slack channels. The mechanism for that is discussed later in this post.
In addition to tracking the doorbell, we also want to get events when someone opens or closes the door. The CloudRail.Box sends events whenever there is a change in the state of the Contrinex inductive sensor. When the sensor detects metal, the door is closed and the light should be red. When the sensor does not detect metal, the door is open and the light should then be green. To achieve this, we again wrote a small Lambda function:

Slack Integration

As you can see, the function also logs both events to the same DynamoDB table. Now, what do we want to do with those events? First of all, there should be a notification when someone rings the bell but no one opens the door within a minute or so. Secondly, it might be good to know if anyone opens the door during the night. The function below queries the last 11 minutes of events and checks for those two cases. If there are one or more of those events, a notification is sent to Slack. You can prepare your Slack account using this guide. The function is then scheduled to execute every 10 minutes using CloudWatch Events.

Final Touches

Now that AWS is set up we can mount all the devices. The AWS Dash Button went outside the door, the inductive sensor on the top corner on the inside and the rest was mounted on the wall right next to the door. When everything is plugged in we connected the inductive sensor and the Balluff light to our AWS account using the CloudRail device management tool. Here is a short video on how this process works:

Recent Posts