Close
0%
0%

Personal Guardian

A wearable device to allow vulnerable people to maintain their independence, by providing a safety link with a remote carer.

Similar projects worth following
Many vulnerable people have their independence restricted because they are at risk of falling over, or getting lost, when out and about. This can mean that they are forced to stay indoors unless accompanied by a carer. I wanted to build something that would help people to remain active on their own, by providing a "safety net" of connectivity to the absent carer.

The Personal Guardian is an easy to use, wearable device to address this issue. If the user has a problem while out and about, the carer will be informed by SMS, and the carer can query the device remotely to check that the user is OK. The device monitors the user's heartrate and location, and detects if the user falls over. The user can also send predefined text messages to the carer, or activate a panic function.

I started this project in response to an Intel Hacks challenge. Now I'm providing full details of the build on hackaday so that you can make one yourself!

Basic characteristics

The following fundamental characteristics are needed:

  • Wearable and unobtrustive
  • Battery powered, with battery life of a least a day
  • Easy to operate, with minimal controls and a simple user interface - for the target user, a smartphone is too complex to operate
  • Able to provide sufficient functionality to allow the user to be independent

Functionality

The device will provide communications between the user and the carer via text messaging, and will continuously monitor the user in case of any problem.

Monitoring functions

The Personal Guardian will send a text message to the carer if any of the following trigger events take place:

  • User falls over
  • User presses the panic button
  • User moves more than a set distance (currently 500m) from the home location
  • User's heart rate falls outside set lower and upper limits
  • In response to a query text from the carer

Additional functions

The following additional functions are provided:

  • Text messages from the carer are displayed on the screen
  • User can send one of several predefined text messages to the carer
  • User can display their GPS coordinates
  • User can initiate a heart rate measurement manually and see the result

Build overview

I chose the following components to carry out all the required functions:

  1. Arduino 101 microcontroller board with a built-in Inertial Measurement Unit (to detect acceleration) and Bluetooth Low Energy interface (to allow connection to a BLE heart rate monitor strap)
  2. GSM shield, to allow sending and receiving of text messages
  3. GPS module, to get the user's location (also used to determine the current time)
  4. USB power bank (containing battery and charger)
  5. A 16x2 character LCD and two buttons, for the user interface 
  6. BLE heart rate monitor strap

This is my first Arduino project, and I will document the various build steps and challenges in the project logs.

Project overview

The challenge - how to allow people to maintain their independence even if they are at risk when out on their own. How to solve it - by providing a link with a remote carer, who can easily check that the user is OK, and will be contacted automatically or by the user themselves in the event of a problem.

I hope that this project can result in a genuinely useful device that can make a difference to someone's lifestyle. As a first prototype, there might be various tweaks or improvements needed, but it should show the basic principle is workable. Although many of the functions could be carried out by a smartphone app, this would be simply too complex to operate for the target user. Having a simple to use, dedicated device may not change the world, but should certainly improve things a little bit!

sketch.ino

Arduino 101 sketch - free for non-commercial use

x-arduino - 24.56 kB - 09/03/2017 at 18:50

Download

  • 1 × Intel Arduino/Genuino 101 Microcontroller board with built-in IMU and BLE
  • 1 × GSM900 shield Shield for Arduino to provide mobille network text messaging
  • 1 × U-Blox VK-172 GPS USB stick Modified to provide GPS data via serial interface
  • 1 × USB power bank 18650 Li-ion cell and charger/SMPS
  • 1 × 16x2 LCD with IIC interface From Grove starter kit for Arduino

View all 8 components

  • Example screens

    Ray Lynch09/03/2017 at 17:25 0 comments

    Here are some pictures of the device in operation, showing the use of the RGB backlight for status feedback. Here is the menu option for sending a text:


    And the user can select one of several predefined messages:


    The panic function is activated by holding the button down for 2 seconds:


    A red screen confirms the activation and the device sends a message to the carer:


    The screen then strobes alternately red and blue, and an alarm sounds, to draw attention to the user. It can be cancelled by pressing on the touch sensor:


    Here is a phone screenshot showing a text conversation with the device. The location is faked for the purposes of this screenshot, but the calculated distance from this fake location is genuine. As a result, the device sent an alert due to the large distance from home (the first status report visible is in response to the query '?', the second came automatically the next time the device was powered on):

    During the fall detection, the screen turns orange in freefall, and then red after the impact. If the user cancels the warning, the screen returns to green.

  • Step 5 - wearable housing

    Ray Lynch09/03/2017 at 16:49 0 comments

    I found a suitable housing for the device, which is an optimum size to hold all the components and has rounded edges suitable for a wearable device. It also has a pleasant scent of mint and tea tree and it looks like this:


    As a bonus it came with some free shower gel inside! I used that up first before continuing. Then I cut the housing in half and added cutouts for the LCD and touch sensor. The panic button will fit into the opening where the cap was:


    The stack of boards was really too large to fit, so I decided to eliminate the Grove interface shield, which was just connecting bits together. I used a small piece of matrix board as a replacement, with flying leads to plug into the Arduino headers. This board includes the LED, the capacitance for the GSM board power (two electrolytic capacitors in parallel) and the wiring to the panic button, as well as the connectors for the LCD, touch sensor and sounder. Here it is, with the panic button attached and glued into the housing:


    Here are the internals of the power bank fitted into the housing. I added two switches - one to disconnect the cell, and one to switch the device on and off. The power bank circuit has a push button to activate it, and this protrudes from the bottom of the housing. The USB connectors are accessible at the side, to allow the device to be charged up.


    Here is the newly slimmed-down stack of boards connected up and ready to fit into the housing, with some pieces of foam rubber to allow a snug fit:


    Now everything is in place - to get the GSM antenna to fit I removed the plastic cover:


    And finally with the lid on, held in place with velcro straps that double as attachment straps for wearing the device:


    And a view underneath:


    Everything fits surprisingly well! To wear the device, it can be attached to the upper arm, like this:


    Alternatively, the housing is slim enough for the device to go into a trouser pocket, and this is a bit less intrusive. The fall detection works with the device in either location.

    Now everything is in place, and all that remains is to fine-tune the software and try to figure out the BLE heartrate measurement, or get a different heart rate monitor! Here is the M2 strap making a measurement triggered by the device via BLE - if only I could read the result:

  • Step 4 - GPS

    Ray Lynch09/02/2017 at 21:52 0 comments

    To allow the device to track the user's location, I could have used a GPS shield, but I was concerned that the unit was getting too big to be wearable. An alternative is a GPS USB stick, which is physically much smaller than a shield. USB is generally not the most convenient method of connecting something to an Arduino, but luckily most GPS chipsets support serial comms - the challenge is to access these pins, and not use USB at all.

    I bought a U-Blox VK-172 GPS USB stick like this one. Inside, it looks like this:

    The chip at the top left of the picture is the UBX-G7020. The capabilities are amazing considering that the complete stick cost $7 - GPS and GLONASS support, 56 channels, 10Hz update rate and 1 second hot start acquisition. There is even a coin cell battery to retain the ephemeris data.

    I found the hardware integration manual for the UBX-G7020 here. It is all very interesting but the main point is that the serial Rx and Tx lines are provided on pins 18 and 19, at 3.3V level, and the default baud rate is 9600.

    To use the board I simply desoldered the USB connector and discarded the plastic housing. Then I soldered two wires on to pins 18 and 19 of the UBX chip, added 100 ohm series resistors, and connected them to pins 8 and 7 of the Arduino (in this way the voltage levels are compatible). To communicate I used the software serial library with pin 7 as Rx and 8 as Tx.

    Here's the first wire soldered on - this is 34swg (0.236mm) enamelled wire (the chip is a QFN-40 package, which is 5mm along one side):

    +5V and ground wires can be soldered to the board at the pads where the USB connector originally was. To add some mechanical protection I covered the soldered wires with hot melt glue. Then I added flying leads with pins attached, to allow the board to be plugged in to the Arduino headers:

    The black stuff is some foam rubber I glued on to allow the board to fit nicely into the case (see later).

    As it happens, in the software I never send any commands to the GPS board, I only listen to the data, and the default configuration provides everything needed. The location information is provided in the standard NMEA format (various other settings are possible as well).

    To parse the NMEA data I'm using the really excellent TinyGPS++ library written by Mikal Hart. This library "just works" with almost no coding required at all, and makes it really easy to get position and speed information as well as find the distance from a fixed point, like this:

    gnssDistance=(unsigned int)(gnss.distanceBetween(gnss.location.lat(),gnss.location.lng(),HOME_LAT,HOME_LNG));

    So there's a simple and cheap way to add GPS functionality to an Arduino device, and I will definitely use the same hardware/software combination in the future!

    With all the functionality in place, the next step will be to fit the device into a suitable housing.

  • Step 3 - IMU and BLE functions

    Ray Lynch09/02/2017 at 00:10 0 comments

    IMU functions

    The Arduino 101 Inertial Measurement Unit is fully documented and works well. For the fall detection, the software detects a short period of freefall followed by a shock. Both events are handled via callbacks:

    void imuInit(void) {
      // Initialise the IMU
      lcd.setCursor(0,1);
      lcd.print("Starting IMU... ");
      CurieIMU.begin();
      CurieIMU.setAccelerometerRange(4);
      CurieIMU.attachInterrupt(imuCallback);
      // Enable Freefall Detection
      CurieIMU.setDetectionThreshold(CURIE_IMU_FREEFALL,500);
      CurieIMU.setDetectionDuration(CURIE_IMU_FREEFALL,50); //ms
      CurieIMU.interrupts(CURIE_IMU_FREEFALL);
      // Enable Shock Detection
      CurieIMU.setDetectionThreshold(CURIE_IMU_SHOCK,500); //mg
      CurieIMU.setDetectionDuration(CURIE_IMU_SHOCK,20); //ms
      CurieIMU.interrupts(CURIE_IMU_SHOCK);
    }
    // IMU Callback
    static void imuCallback(void) {
      if(CurieIMU.getInterruptStatus(CURIE_IMU_SHOCK)) {
        if(falling) {
          lcd.setRGB(255,0,0);
          fallEvent=true;    
        }
      }
      if(CurieIMU.getInterruptStatus(CURIE_IMU_FREEFALL)) {
        if(!fallEvent) lcd.setRGB(255,128,0);
        falling=true;
        lcdTimeout=fallTimeout=millis();
      }  
    }

    When the freefall begins, the LCD colour is set to orange. If a shock subsequently happens within a certain timeout period, the LCD colour changes to red and an alarm is triggered. An emergency text message will be sent unless the user presses a button to cancel it. These functions are handled by the main code polling loop.

    BLE functions

    Implementing the Bluetooth functions involved a bit more effort! The first step was to acquire a BLE heart rate monitor. There is a huge variety available, so it was pot luck whether the one I chose would be easy to use or not. It turned out to be... not.

    Bingo M2

    The device I got from China via ebay is the Bingo M2. As far as I can tell, this seems to be an Indian copy of the Xiaomi Mi Band 2. The latter seems to be a fairly decent low cost device, whereas the former, even cheaper device has some rather dubious features.

    Firstly, when I received the M2 it was completely dead. It comes with a USB adaptor for charging, but plugging it in did nothing. I decided to cut it open and see what was inside.


    As well as the circuit board, vibration motor and pulse sensor, it contained a small Li-poly cell that measured about 2V. It seems that at such a low voltage, the charge circuitry doesn't work, which is a bit of a design flaw.

    I connected up some AA cells as a rudimentary battery charger (note: use a resistor), and with the cell charged up to 3V it started to work (and the charger subsequently worked as well).


    Now came the task of interfacing to it. Most of the BLE examples for the Arduino 101 configure it as a peripheral (providing a service), but in this case I wanted to act as a central (client) device. Luckily there are some examples of how to do this here. With the PeripheralExplorer example, the M2 showed up and announced its services. Success!

    Er, not quite. Unfortunately the M2 does not support the standard BLE heart rate service with UUID 0x180D. In fact it has a proprietary, undocumented interface. Although I could figure out how to read the step count from the device, trigger a notification or vibration and even start a heart rate measurement (turning the sensor LEDs on), I couldn't work out how to read the heart rate result.

    Looking at the code of the official Droihealth app, it seems that the heart rate result will be provided in a UUID that is not visible in the initial BLE service scan, but only provided after triggering a measurement. I could not find out how to read this new UUID with the Arduino 101 BLE implementation. Eventually I gave up, because in any case the heart rate measurements of this device (when triggered manually) don't seem to correlate in any way with the user's actual heart rate. Whether the heart rate is fast or slow, or the device is sitting on the table, the heart rate always seems to be 89. It might be just my device, or it might be a good idea to...

    Read more »

  • Step 2: Software and SMS functionality

    Ray Lynch09/01/2017 at 23:05 0 comments

    IDE installation

    Initially I had a problem with the IDE (on 64-bit Ubuntu 16.04) in that I couldn't connect to the board at all. It turns out that you have to manually run a script to set USB permissions, and the location of this script is not as documented. I had to do this:

    sudo ~/.arduino15/packages/Intel/hardware/arc32/2.0.2/scripts/create_dfu_udev_rule

     After this, everything ran smoothly! I wrote the code to implement a basic menu controlled by the two buttons (the pushbutton and touch sensor), and I used the serial console to display debugging information.

    Here is the stack with power connected and the LCD backlight set to green:


    At the top level menu screen, the push button acts as a panic switch and the touch sensor cycles through the menu options. When cycling through the options, the push button selects a menu item. The lower line of the LCD makes it clear what each button will do.

    Power problems and solutions

    The GSM shield can draw quite some current when transmitting (about 2A for short periods). The shield has a regulator to provide the 4.1V supply for the SIM900, and a power jack for an external adaptor that feeds this regulator. This external adaptor is fine for testing, but won't be much use for a wearable device.

    There is a switch on the shield that can be used to feed the regulator from the Arduino 5V pins instead of the external jack, but the current available is not enough to support the transient peaks. I found that the SIM900 would frequently reset due to lack of power. Luckily, I found an easy solution. By adding a large electrolytic capacitor on the 4.1V line, the transients can be supported and the shield will operate fine from the Arduino 5V supply. I found that 4700uF was ample. The MIC29302 regulator doesn't seem to mind the extra capacitance on the output.

    The power architecture of the Arduino 101 supports various possibilities for powering the board, including power from the external jack, the USB interface and also a direct feed on the 5V pins. Looking at the schematic, it seems to me that low dropout protection devices prevent any backfeed damage. I plan to provide 5V via this direct method, and this will also feed the GSM shield regulator.

    USB power bank

    The source of 5V will be a USB power bank. This provides a neat solution as it integrates a 3.7V Li-ion cell with a power supply circuit and charger, and will allow the device to be charged up with a USB cable.

    Here is the project so far, with the Arduino powered by the USB power bank. At this stage the GSM shield still has external power, as the capacitor is not yet connected. The LCD is showing the top level menu screen, with custom defined arrow icons:

    GSM functions

    I bought a pre-paid SIM card that offered free texts to the same network as my mobile phone. This is helpful as you can end up sending a lot of texts during development.

    I found the following SIM900 references very useful:

    SIM900 AT command reference

    SIM900 GPRS shield

    GPRS/GSM shield

    It turns out that sending and receiving text messages in a basic way is really quite easy. The SIM card contains a few memory slots for received text messages. You can either poll the SIM900 to see if a new message has arrived in one of the slots, or you can ask to be notified when a new message arrives. I chose to poll for new messages, and the software does this every 60 seconds. If a new message has arrived, it is read and then deleted from the SIM card.

    Sending a text message is simply a case of sending one AT command followed by the destination phone number and the actual message. Here is the complete function for sending a text, with the GSM shield connected to Serial1, and noting that gsmWait() simply waits until the Serial1 receive buffer is empty:

    bool gsmSendSMS(int n) {
      bool result=false;
      Serial.print("Sending SMS ");
      Serial.println(n);
      Serial1.print("AT+CMGS=\"");
      Serial1.print(MOBILE_NUMBER);
      Serial1.println("\"");
      if(gsmWait()) {
        if(n==REPORT) Serial1.print("Status...
    Read more »

  • Step 1: Assembly of the main components

    Ray Lynch09/01/2017 at 22:08 0 comments

    Trial assembly

    I started by obtaining all the basic components and plugging them together. The Arduino design concept makes it really easy to build up a fairly complex design without any soldering, and it should just work. So I was hoping that this would prove to be the case!

    The Grove starter kit consists of several useful parts and an interface shield to connect them all together. I wanted to use several of these components, including the 16x2 LCD, which has a nice RGB backlight that I could use to indicate the device status. There is also a touch sensor that I wanted to try out as a button for the user interface.

    Here is the Arduino 101 with the Grove interface shield and the sounder, LED and pushbutton components, with connecting cables:


    And I got this SIM900 shield from ebay - it seems to be a common design:


    Preparation of the GSM shield

    Before using the GSM shield I had to do some preparation of the board, because the pin headers were not fitted. I decided to populate just the pins that were needed. After reading up about the Arduino serial interface, I discovered that the Arduino 101 has two hardware serial interfaces, and the one used for programming is different from the one available on D0/D1, so there is no conflict. I decided therefore to use D0/D1 for the GSM shield, and avoid software serial, which apparently can sometimes be problematic.

    In addition to D0/D1 for the serial pins. D9 is used to power the shield on. I found that my board had an open jumper on the board that I needed to solder to connect this D9 line. In the image above it's visible just above the last two pins on the right of the row of red pin headers.

    To allow things to fit together better, I relocated the block of serial selection jumpers from the top to the bottom of the board.

    Stacking the boards

    The GSM shield had to go on top of the stack of boards, as it doesn't carry the IIC pins that are needed for the interface shield. I decided to attach the 16x2 LCD and touch sensor on top of the GSM shield, to make a compact block. The LCD fitted neatly once the serial jumpers on the GSM shield had been relocated. To attach the parts I used hot melt glue and some small balsa wood standoffs. In between the LCD and GSM shield  is a piece of rubber sheet to prevent any short circuits between the boards.

    Here is the GSM shield with the LCD and touch sensor firmly attached:


    Finally, here is the complete stack, consisting of Arduino, Grove interface, GSM shield, LCD, touch sensor, pushbutton, LED and sounder. For a portable device it is looking rather tall:


    The next step was to connect the power, install the Arduino IDE and start writing some software!

View all 6 project logs

  • 1
    Block diagram - initial prototype

    I've described much of the build process in the update logs, so I'll use this section for block diagrams showing the wiring connections.

    Here is a block diagram of the initial development version, using the Grove interface shield:

  • 2
    Block diagram - final design

    With the matrix interface board replacing the Grove shield, and with the power bank internal parts removed and placed in the housing, the updated block diagram represents the final design:

  • 3
    Software

    The software is a single sketch for the Arduino IDE. I have uploaded it here as an attached file. You are free to use the software for any non-commercial use.

    Important - when I made the interface board, I changed the polarity of the pushbutton, which is active low as defined in the final software. If you build the shield version, you will need to either change the software to look for an active high button, or use a button that is active low (unlike the Grove starter kit button, which is active high).

View all 3 instructions

Enjoy this project?

Share

Discussions

design8a wrote 10/18/2017 at 02:48 point

Hi, nice project. What's your next step? 

  Are you sure? yes | no

Morning.Star wrote 09/03/2017 at 07:13 point

Great idea, you've packed a lot of situational feedback into this, the accelerometer is a really useful addition to a panic button as well as just keeping an eye on the user.

One comment I feel I should make because of my experience with Bea, who has almost no communication - vulnerable people like her often cant read or write even if they can speak, which Bea doesnt. In the UK at least communication is taught on a fallback; less complicated methods are offered for those who struggle, so a large proportion of special needs schools exempt students from the standard curriculum and teach Makaton, PECs, BSL and other languages instead. Those with moderate issues are offered a VOCA, this is a device that they carry that either has buttons for limited responses, or a touchscreen with icons for those with more ability. Modern devices even speak the response in a natural sounding voice, thanks to advances in speech synthesis.

If I were to use this for Bea myself, I'd include a larger screen that can display languages more commonly taught than written English, and I'd back it up with speech from the device. Not a phone, a relay using the text as a carrier.

Even if you didnt use a formal symbolic language like PECs, a picture of the carer on the device provides a level of emotional security way above anything else - it doesnt have to be video or even sent from the carer in realtime, it could be stored on the device.

People with learning disabilities tend to love routine, and find comfort in familiarity. Being able to see their carer makes a huge difference when they are unsure about something. :-)

  Are you sure? yes | no

Ray Lynch wrote 09/03/2017 at 16:11 point

Hi, thanks a lot for the comments based on your experience with Bea! I hadn't really considered a simple alternative language for the display. If I changed the character display for a dot matrix display, it would be possible to display signs and icons and this would be quite easy to implement. Maybe a small colour QVGA screen would be better as then I could display pictures as well, such as one of the carer.

I could also add speech using an MP3 player - there are some small boards available with 32MB flash that can be loaded with about 10 short tracks. Thanks for the ideas! :-)

  Are you sure? yes | no

Morning.Star wrote 09/04/2017 at 14:03 point

No problem Ray, I like where you are going with it. Bea would too, if she were able to use one, but it's rare to find someone like her living in the community this way. It would be perfect for those with more independence though.

Best wishes :-)

Oh BTW, great case hack... ;-)

  Are you sure? yes | no

Arsenijs wrote 09/03/2017 at 00:25 point

Hi! Great project! Have you seen that there are displays like the one you have, but with RGB backlight? Having controllable backlight color might be a way to convey status like "Panic mode" very quickly. Adafruit carries this kind of displays, AFAIK.

Also, do I understand it right that you got the vibromotor on Mi 2 band working through BLE? If so, I might just go ahead and hack the band that I currently have =)

Those powerbanks, like pictured, can be of really bad quality - one of our cellphone providers used to gift those to customers, and AFAIK there has been more than one occasion of wires inside the powerbank randomly shorting to each other and heating up the powerbank (it's a miracle there was no fire). So, if I were you, I'd throw this one away =)

  Are you sure? yes | no

Ray Lynch wrote 09/03/2017 at 16:20 point

Thanks, in fact the screen I'm using does have an RGB backlight and it's really nice. I'll post some more photos of the different colours as I'm using it for status feedback. I'm also ramping the brightness down to give a fading out effect after a few seconds of inactivity.

Yes, I can get the M2 vibration motor working via BLE, and I can also display a (fixed) notification icon on the screen. I found that service 1817, characteristic 2a5f is the one to use. Write 02 to vibrate, 04 to show the notification symbol and 0x31 to start a heart rate measurement. Let me know if you figure out how to read the result of the heart rate measurement! ;-)

I agree about the powerbank - it's not well designed inside and there's plenty of scope for short circuits. I've taken the parts out and rewired the cell with better insulation at the connections. I've also added a switch to disconnect the cell, and leave it switched off when not in use.

  Are you sure? yes | no

Arsenijs wrote 09/06/2017 at 19:38 point

Happy to hear about all this! Will note the Mi Band info, once Iget mine, will put it to good use =) Cheers!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates