xMatters has released an official statement and workshops to help customers navigate through COVID-19

Intelligent Communications Blog

BACK TO BLOG

The Internet of Things Includes Annoying Buzzers

Travis DePuy ON Jun 04, 2015

A while back, a couple of our engineers got to attend the Apigee I ♥ APIs conference in San Francisco. Apigee provides services for managing, analyzing and securing APIs. Their services make for a common interface to provide greater interoperability. They were just launching their new Zetta framework and offered a BeagleBone Black kit to get people playing with it. BeagleBone Black, for those not in the know, is a low-cost, community-supported development platform for developers and hobbyists.

The Internet of Things is quickly becoming a huge market, with lots of players and a ton of potential. With all these new devices, each one can become a point of contact with the xMatters event APIs.

Starting with the Internet of Things
The Zetta platform is a great way to get started creating Internet of Things enabled devices that interact with their surroundings. It is a rather powerful little board that runs a small Linux environment.

Fair warning, I’m to geek out a little bit here.

The Zetta framework is built on Node.js. In addition to the BeagleBones, it runs on Raspberry Pi, PCs and the Heroku system. It provides a simple interface to interact with all the little I/O pins available on these boards and run complex logic and web service calls based on inputs received.

OK I’m done geeking out.

After going through the lab, we took it home and developed an alarm system. When it detects motion, it triggers an event in xMatters. The event sends a notification to the targeted recipient (presumably the home owner?) and gives two response options: Buzz (starts the rather annoying buzzer) and Stop Buzz (stops the buzzer). The latter was very useful. Man! That thing was annoying.

The Internet of Things is a huge market, with lots of players and a ton of potential. Each device can be a point of contact with xMatters event APIs.

A Wider Peek
Let’s take a wider peek into how this all works.

The motion sensor is actually a passive infrared (PIR) motion sensor. Getting the system to trigger on movement was rather easy.

Since the Zetta platform incorporates Node.js, we just used the Node Package Manager to install some web service libraries and we were talking to xMatters!

The tricky part was next. How do we get xMatters to talk to the BeagleBone?

The BeagleBone was using the internet connection from my laptop, which was hooked into the wifi router of our corporate office. This is a shared building and who knows where we get internet from. So getting a port opened in the firewall wasn’t an option.

So we couldn’t use the xMatters callbacks feature to just notify the code running on the BeagleBone that a user had responded. So we decided we’d have to pull instead of push. We wrote some looping code to query for responses and there was a response, it (thankfully) silenced the alarm.

For anyone curious, here is the wiring diagram we used. The BeagleBone reads the data line, and the Node.js code takes it from there.

The makes-me-want-to-break-something buzzer is connected to + and -. The BeagleBone controls (through the Node.js code) when the buzzer gets power, which tells it to make the siren call.

The Internet of Things Includes Annoying Buzzers

In pseudo code form, this ended up as:

  1. If motion happens
    1. Check if a notification has already been sent (to avoid spamming!)
    2. Start the poll for response
    3. Fire a notification
  2. Poll wakes up every 10 seconds
    1. Check if a response was received
      1. If the response is “Buzz” then turn on the buzzer
      2. If the response is “Stop Buzz” then turn off the buzzer