PiCare Health Monitoring Glasses

on February 10 | by

PiCare Glasses

Note: Stuart Crouch is the 2nd place winner of the PiOT: Maker Famous that Initial State hosted in partnership with MagPi. You can see the contest website here.

Introduction

PiCare is a concept that allows vulnerable, disabled, or elderly people to live independently, safe in the knowledge that a community of remote-access responders is on hand to help if necessary. PiCare is an IOT system activated by Pi sensors. In the prototype, a PIR (passive infrared  – motion detector) sensor is activated by rapid blinking. A call for help is made & responders are sent to the client’s GPS location.

I built the PIR glasses a couple of weeks ago as an experiment. PiCare as a crowd care concept came to me when I realized that Initial State enables multiple users to share input to a Dashboard. The Raspberry Pi is an ideal board for this type of project as version 3 has on-board wifi. Users could, however, hack a PiZero to make a miniature version of the PiCare glasses.

How it works

The client wears glasses with a PIR sensor. The PIR responds only to ‘energetic’ blinking. When the client needs help, she blinks and a message is sent to the Initial State dashboard showing her name and PiCare ID. I chose the PIR sensor on the assumption that this particular client has mobility issues and might not be able to activate a switch or pull-cord. Other sensors (voice activated, touch, etc.) could also be used.

At the same time, the GPS module (whose location data is normally hidden to protect the client’s privacy) is activated and the GPS coordinates are shown on the Initial State dashboard, as is a request for help.

A team of volunteer responders also has access to the Initial State screen. When they see a call for help, they call for help. As this is a crowd-community care system, many individuals can view the client’s dashboard simultaneously. Anyone who sees an emergency request for help can press a button switch and then call 911 for help, giving the client’s GPS location, name, and PiCare ID.

In order to reassure the client, the responder’s button press sends a message to the Initial State dashboard saying that help is on the way.

The Raspberry Pi Setup

In order to emulate the client and the responder, you will need two Raspberry Pis working.

Hardware 1 for the client:
Raspberry Pi 3 (or other model with a wifi dongle)
PIR module connected to a Raspberry Pi (connect the GND and VCC from the PIR to -ve and +ve on the Raspberry Pi. Connect Out on the PIR to GPIO pin 7 on the Raspberry Pi)
GPS module connected USB on the Raspberry Pi
USB 5V power supply – but an obvious enhancement would be to have a battery powered Pi).
I have my Pi connected to a Nexdock, a laptop shell that is powered by the Raspberry Pi (see http://www.nexdock.com)

Hardware 2 for the responders:
A second Raspberry Pi 3 with a push button switch connected to GPIO Pin 7.
I have my Pi connect to a PiTop laptop (see https://www.pi-top.com)

The Initial State Dashboard

Initial State allows us to visually track the state of a client. If you’re a pro tier member, then you can also set this up to send you SMS text messages or emails when there is a change you want to see.

Register for an Initial State account and make note of your access keys.

You can see a video here on how to register:

I have used a mixture of text and images to convey messages. I used GPS data rather than a map, so that a responder who did not know the client’s locale could easily give precise location data.

The Code
Code for the client


from ISStreamer.Streamer import Streamer
import RPi.GPIO as GPIO
import time
import os
import gps
import serial
import pynmea2

session = gps.gps("localhost", "2947")
session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)

streamer = Streamer(bucket_name="PiCare-StuartCrouch", bucket_key="PiCare-StuartCrouch", access_key="4ufLn0EQcsfRhlWYuEu632CAZW5XBs9J")
while True:
try:
report = session.next()
if report['class'] == 'TPV':
if hasattr(report, 'time'):
print report.lat
print report.lon
streamer.log("My GPS Location","{lat},{lon}".format(lat=report.lat,lon=report.lon))

streamer.log("My Messages", "PiCare - Remote Crowd Care in the Community")
streamer.log("My Name and I.D.", "John Doe-DE-0001")
#        streamer.log("PiCare Message", "Status-Normal")

GPIO.setmode(GPIO.BCM)
PIR_PIN = 7
GPIO.setup(PIR_PIN,GPIO.IN)

print "PIR Module test (Ctrl+C to exit)"
time.sleep(2)
print "Ready"
while True:
if GPIO.input(PIR_PIN):
print "Motion Detected"
streamer.log("My Health Status", ":sos:")
streamer.log("My Request", "Call 911 and give my name and I.D.")
streamer.log("My GPS Location","{lat},{lon}".format(lat=report.lat,lon=report.lon))
time.sleep(5)
else:
streamer.log("My Health Status", ":smile:")
streamer.log("My Request", "Please monitor this channel")
streamer.log("My GPS Location", ":no_entry_sign:")
streamer.flush()
time.sleep(1)

except KeyboardInterrupt:
print "Quit"

GPIO.cleanup()
streamer.close()
quit()

Code for the responder

from ISStreamer.Streamer import Streamer
import RPi.GPIO as GPIO
import time
import os

streamer = Streamer(bucket_name="PiCare-StuartCrouch", bucket_key="PiCare-StuartCrouch", access_key="4ufLn0EQcsfRhlWYuEu632CAZW5XBs9J")

GPIO.setmode(GPIO.BCM)
SW_PIN = 7
GPIO.setup(SW_PIN,GPIO.IN)
print "working"

try:
while True:
if GPIO.input(SW_PIN):
print "cord pulled"
streamer.log("PiCare Message", "Help is coming")
streamer.log("PiCare Status", ":ambulance:")
streamer.flush()
else:
print "cord not pulled"
streamer.log("PiCare Message", "Status-Normal")
streamer.log("PiCare Status", ":white_check_mark:")
streamer.flush()
time.sleep(2)

except KeyboardInterrupt:
print "quit"
GPIO.cleanup()
streamer.close()
quit()

Future Improvements

Hardware: apart from the need to be mobile (tethered to a mobile phone 3G signal, for example), and battery operated, the PiCare glasses need to be lightweight. In addition, the large PIR sensor and GPS module need to be reduced in size.

What happens if nobody responds?: I think it would be good to have an automatic call for help if no responder replies within a certain length of time.

Organization: in a commercial setting, a database of clients and responders would have to be kept. Details of different emergency numbers (999 in UK; 911 in USA; 910 in Germany) would also be a requirement.

About Stuart Crouch
Stuart Crouch is a teacher, writer, and techie. He is an International Baccalaureate faculty member and a Follett Education Moderator. Stuart was also the 2nd place winner in the PiOT: Maker Famous competition that Initial State hosted in partnership with The MagPi Magazine.
Web: www.stuartcrouch.net
Twitter: @MrStuartCrouch
Facebook: MrStuartCrouch

Leave a Reply

Your email address will not be published. Required fields are marked *

«

Initial State Technologies, Inc.
Scroll to top
Initial State