When my elderly mother moved into a nearby retirement community last year, I urged her to get a wearable alert bracelet. This would let her summon help should she, say, fall and be unable to get up or reach a phone. She signed on for one offered by her retirement community—and was given a device that’s as bulky as a can of tuna. She never wears it, and I don’t blame her.
There is actually a wealth of devices available to satisfy this emergency function, which is becoming increasingly important as the population ages. Many have a base station that attaches to a landline. Others have built-in GPS and cellular connections and can work away from home. The rub is that these devices are tied into services that tend to be pricey—typically US $30 or more a month. While my dear mother’s well-being is, of course, worth every penny of that, I didn’t see the need to spend so much on what I figured I could replicate for far less.
To do that, I turned to a product that is now past its prime but is still ideally suited to the job: the Nike+ iPod Sport Kit. No, I wasn’t thinking that my 92-year-old mother should don a pair of running shoes and earbuds. The kit consists of a diminutive RF transmitter and a matching receiver dongle that plugs into a second-generation-or-later iPod Touch. The transmitter, normally attached to the laces of running shoes, emits a signal with each footfall, allowing the iPod to report exercise statistics.
I planned to use the kit differently: My mother could wear the tiny transmitter on a chain around her neck, and the receiver would be connected to the Internet, allowing me to be notified should she trigger the necklace transmitter in an emergency.
The Nike+ iPod transmitter can be deactivated by depressing a recessed button on it for several seconds. Reactivation requires a momentary press of the same button. So my mother could wear the transmitter in its deactivated state. To send an alert, she would merely have to press the button briefly and give the transmitter a shake.
While the transmitter side of things required no hacking at all (unlike the last time I used one of these kits for a Hands On project), the receiver took some effort to pull together. My first strategy was to use an interface board from SparkFun Electronics, which allows you to plug in the receiver dongle and extract serial data. Alas, SparkFun has retired that board.
The answer was to create a simple printed-circuit board, which was inexpensive to have fabricated through OSH Park. Designing my own interface board also offered me the chance to tailor it to the Raspberry Pi.
The trickiest part to making the interface board was obtaining a 30-pin female connector to mate with the iPod dongle, as Apple has switched to the smaller Lightning connector in its products. The major component suppliers didn’t carry it, and the only source I could find online looked sketchy. So instead I bought an iPod-dongle extender for a few dollars. These extenders contain a male connector on one end and a female connector on the other, and it wasn’t difficult to extract the female connector for use on my board. This board merely routes the dongle’s 3.3-volt, TX, and RX lines to the Pi’s general-purpose input/output connector.
Having completed the very simple hardware for the project, I turned to the software. I wrote some Python code to initialize the dongle and print the bytes it sent in response. That allowed me to determine the 3-byte identifier of my Nike+ transmitter. I then wrote another program that runs automatically after the Pi boots, and which looks for that identifier.
When my system first powers up, it emits a beep (through an attached speaker) just to let you know that it’s running. Then it waits to receive a signal from the transmitter. If it detects one, it beeps three times, letting the person issuing the alert know that the call for aid has been registered. It also posts a request to Twilio to send a text message, in this case to me.
Twilio is easy to use—especially so for this project because there is a Python library for interfacing with it, as I learned from a helpful online tutorial. It’s also free for this application, because Twilio lets you send texts to the account owner’s phone for no charge. (Those messages are prefaced by the words, “Sent from your Twilio trial account,” but that’s no handicap here.)
After getting that much working, I added two minor embellishments. First, because it was my hope that this system would never be used, I figured it was important to check periodically whether the Pi was still operational. So I added some code to send a check-in text message once a day.
Also, I worried that connecting via Wi-Fi could be unreliable. So I purchased a 3G wireless hotspot for $29 from Internet on the Go. The beauty of this particular hotspot is that you can buy data that never expires. I got 3 gigabytes, which I imagine should be enough to keep the thing running for a few hundred years.
To ensure that the ample data in my plan wouldn’t be eaten up prematurely by a malicious hacker, I added a software firewall to the Pi—something called ufw, which stands for Uncomplicated Firewall. The only step I have left is to transform the Nike+ transmitter into an attractive piece of jewelry. Frankly, I’m not sure I’m up to that task. Fortunately, I have a teenage daughter with an artistic streak who would like nothing more than to introduce her grandmother to the latest fashions in wearable electronics.
This article appears in the September 2016 print issue as “DIY Emergency Button.”