The technology around personal safety pendants has not changed for years. I thought I would try a different take using Bluetooth Low Energy technology and enhance the safety pendant concept by adding in active monitoring. The idea being that if the pendant has not moved for a while, you can give the user a call to make sure he/she is ok. The main picture shows the circuit board of the pendant (aka Texas Instruments Sensor Tag).The one below shows the assembled Pendant.
Paramount to pendants is that they should last a long time (years) between replacing batteries and that they be small. Most of the ones you see are huge chunky things - why not make something like those cool sports bands?
The concept is that the pendant emits a "ibeacon"-like signal every second and changes depending upon what state it is in. The pendant's (aka Sensor Tag) states are ACTIVE, NOTACTIVE and EMERGENCY. These states are driven by the accelerometer and whether the "emergency" button has been pressed. The pendant wakes up every 10 seconds to check the accelerometer. If the values have significantly changed, the pendant state is ACTIVE. If they have not, the state is NONACTIVE. If they have pressed the emergency button, the state is EMERGENCY.
By doing it this way, I have calculated that the beacon should last around about a year on a CR2032 battery. I did this by measuring the current (voltage / resistance) using an oscilloscope...
The Raspberry PI operates as a pendant signal receiving station. You can have one or many, it does not matter since the pendant is transmitting and not receiving.
The Raspberry PI's code is dead simple (the code is included below). It runs a BluetoothLEAdvertisementWatcher to pick up the pendant's signal and writes the change to the screen, changes the Sense HAT's LEDs and sends a message to Azure.
An operations centre (or maybe just a concerned family member) would detect inactivity through a desktop app and then just give them a friendly call to see if everything is OK. The desktop app communicates to Azure to pick up the state of the pendant. Of course, being Azure, the desktop app could be running on the other side of the earth.
The code to integrate into Azure could not be simpler (well it would if everything was available to universal apps ;)). This code is also included below. It uses Azure queues which seem to be really cheap. I'm just using a basic subscription (that looks like to have no monthly fees, with a cost of $0.0637 per million operations) .
I think the main use of this project for other hackers is how easy it is to integrate into Azure and use Bluetooth LE on the Raspberry PI. I've included the PI and windows desktop app code. You can easily change it to look for an $10 ibeacon or some other home brew beacon.
Texas Instruments Sensor Tag hacking.
One of the things I spent a lot of time on was customizing the firmware on the Texas Instruments Sensor Tag. I won't go into too much detail because it would take forever. However, if you are considering it, it is a big investment (probably around $200 by the time you get the Bluetooth sniffer, the CC debugger and sensor tag). Unless you are doing very minor changes, you will also need to optimize the code because it is just about totally full (which is probably why when you query the device you gets lots of 1-character Gatt descriptions). I wanted to keep full backwards compatibility and that was achieved. The additional functionality can be seen in the Windows phone screen shots below.
Windows Phone Code
I wrote the Sensor Tag configuration software on the Windows phone. I think the user would find it easier to configure the pendant on a phone rather than hooking up the PI to a monitor and keyboard.
Anyway, here are a few screen shots of the UI. Obviously the phone app is something I'm playing around with to do other things with as well. The app is available in the app store (plug plug). However, if you have the time and seriously want to get into this, I recommend you write your own. It is a great learning experience.