Today’s post outlines a project that I threw together in as short of time as possible because there was an urgent need for it.
As readers of This Blog may know, my wife is quite ill and has been for some time. Unfortunately her condition has worsened greatly, and she is now bed bound. This has necessitated that she be able to easily contact our adult daughter who is her primary caregiver, or myself. Even when we are in the house, this can be a challenge if we don’t hear her asking for help. When we are out of the house, it is obviously an issue.
To solve this, we looked at options such as an key fob alarm, but this would require Very Loud Noises and also some time for shipping from Amazon which is currently delayed. A wireless doorbell would also work, but would require an online order or even a trip to a big store with a giant line of people waiting to get in- not to mention the half hour drive to the nearest one.
Being an electronics hobbyist with an increasingly well stocked parts bin, I decided that I had enough to cobble something together that would notify both my daughter and I on our phones whenever my wife pressed a button.
I’m happy to report that it works! Here’s how I did it.
The first problem I needed to solve: How to get notifications that my wife pressed the button. For this I decided to use a product that launched on Hacker News last year called Notify17.net. It’s designed to be used by server admins to allow them to send alerts and notifications from any Internet connected device. This is the perfect solution for this project! I grabbed the example code from their website, put in my API key, then installed the app on my phone. In just a couple of minutes I was sending myself alerts to my phone from the command line on my home server.
The IOT Button
For this I chose the easiest thing I had on hand: A Raspberry Pi Zero W from Seeed Studio. It was sitting in a drawer just waiting for a project that needed it. I connected a button to Pin 10 and to 3.3V, and found a python script to detect the button presses. I modified the script to run my bash script from earlier, and in just another few minutes, I was getting notifications on every button press.
The button itself is a phone hangup switch salvaged from an old printer/fax/copier that I tore apart a couple of years ago. A larger tab was glued to it so that there would be something easy to press. The switch was wired up with an old USB cable that I cut up. USB cables, usually sourced from old mice and keyboards, have four conductors and are a great source of small gauge 4 conductor wire.
Lastly, I setup a Notify17.net account for my daughter, duplicated the setup on her phone, and in just a few minutes, both of us were getting notifications when my wife pressed the button.
For information about the source code, read these two links:
The only difference was that I debounced the switch and used FALLING for button detection, which detects when you let the button go rather than when it’s pressed, which solved problems with multiple notifications for a single button press:
I learned those tricks from http://shallowsky.com/blog/hardware/buttons-on-raspberry-pi.html.
The problem was solved in about an hour using parts on hand, and it seemed to work really well at first. But then we started getting false notifications, and before I had a chance to troubleshoot further, my wife ordered a doorbell on Amazon. Oh well. You win some, you don’t win some.
In the end though, I learned a lot and got more familiar with Notify17, which is actually intended to help System Administrators and DevOps teams get notifications from programs when something goes wonky- which is exactly what I’m going to use it for from now on.
And even though this didn’t work out as I’d hope, I do hope that this post helps YOU to be inspired to use what you have to fill a need. When you get a chance to try out Notify17. It’s a great project!