Security for seniors at home

A friend of mine has elderly parents in their 80’s. They have on occasions had folk knock their door and ask for money after some sob story. Then in the early hours of one morning a group of druggies decided their porch was a good place to hang out and jack up!

This was a very disconcerting and worrying experience especially as my friends 87 year old father insists on opening the door any time of the day to anyone who knocks!

As techies we discussed various options and he installed an IP camera and setup the inbuilt motion detection. The first night he got over 300 emails. So a plan B was required. I suggested a modified “Granny monitor” but using a standard external lighting PIR as the sensor.

When the PIR triggers it activates a message from an internet connected monitor using an electricimp.com device, which causes a cloud App to read a snapshot image from the IP camera and post to a database.

We use the same timeline App from the Granny Monitor but add a link to the camera snapshot. The monitor will send mobile alerts via pushover.net if there is activity during the night & early hours.

We get the odd false positives from what looks like the same cat. But we’ve caught this Arsehole one morning some time after 4am. What was he up to!

The timeline gives a quick time index to review camera video stored on a NAS device (network video recorder). And alerts tell my friend immediately if there is something going on, enabling him to act accordingly.

This is a very cheap and easy way of overcoming the obvious limitations of inbuilt IP camera motion sensors.

here kitty

cat

The Arsehole

ARESHOLE

Building a mobile web app on Node-RED

Having adopted Node-RED (NR) as our control and integration platform. I’m now porting all our pure node solutions to NR. One thing we need is a mobile web app to configure, monitor and control Things.  You can do a lot out of the box with Node-RED but it isn’t obvious how to build a web app.  Fortunately for me Dave CJ one the Node-RED developers sent me a flow template to get me going.Below is the Node-RED IDE and mobile web app running in an emulator on mobiletest.me.

The web app is served via a HTTP: [Request]–[Template]–[Response] flow at the top of the work-space. The Template node contains single page web app built using  jquerymobile and highcharts. Once the web app is loaded into the browser all communications is done via web sockets.

In the example flow all actions on the web app are passed back to an UI dispatch Javascript function which handlers events like turn on a light using EnOcean wireless or operate a PI Face relay. [Webscoket in]–[UI dispatcher]–[your devices].

Having to move to NR has provided the opportunity to simplify the way web app communicates with the server. The solutions uses a simple JSON format using the HTML ID of the widget being updated or being clicked on along with a value. All communication is over SSL/TLS NR supports Basic Authentication but most mobile browsers won’t save passwords or support passing credentials via the URL. So we are thinking best how we implement user authentication.

Node-RED IDE and mobile web app via mobiletest.me

Example flow

I’ve built an example flow which Node-REDers can use to build their own solutions. However there is some very basic documentation on the Git page! But the flow should be easy to follow for someone with a bit NR experience. https://github.com/industrialinternet/Node-red-flows-mobile-web-app

A quick demo video

Sorry not the best of quality movie maker was groaning a wee bit..

Using Node-RED to Integrate KNX & EnOcean

I spotted Node-RED late last year and “thought that looks good”. Now I’ve had time to work with it, it’s good, very good. Node-RED (NR) is an open source platform for developing control and integration solutions. It’s developed by IBM’s Emerging Technology team in the UK.

For those used to working with a visual “Function Block” style of programming you will feel immediately at home. NR caters for all, from the Citizen Developer to the harden node.js programmer. As someone who sit’s between these two end points working with NR is a joy. You develop a solution by linking nodes together to form a flow. Node-RED supports the creation of functions which allows you to develop custom control strategies or business logic.

There is a growing community of contributes who are adding features and interfaces to a wide range of Things, protocols and web services. There are two ways to extend NR, develop Node-RED nodes which requires programmer level skills and functions which is for anyone who can do a little JavaScript. Having learnt a bit of node.js by developing both an EnOcean and KNX interface it was quite straight forward to port these to NR.

Hardware – Server

I’m running Node-RED server on a Raspberry PI talking to the Weinzierle KNX BAOS web services gateway & EnOcean USB 300 gateway. So what I now have is a very powerful control and integration platform that costs only £50 quid.

IDE – Editor

Below are a few screen shots of the IDE (Editor) which runs in a web browser. It’s very easy to use but still powerful. You get a debug window and a nice highlighter to show what node wrote to the log along with connection status of communicating nodes. Once editing is complete hitting the deploy button sends the flows to the NR server where they are compiled and the server re-started, this only take a few seconds! You can have multiple works spaces (canvases) so the project can be broken up into logical blocks.

KNX to EnOcean Flow

It only takes four nodes to receive and process a KNX telegram and then transmit an EnOcean wireless one. Processing is project specific and is achieved with some simple JavaScript running in a function node. Click on the image below and you can see the JavaScript code in the function node. node-red-knx-enocean-ui.

KNX to anything Flow

With NR you can talk to any IP device traditional AV devices support TCP or UDP and modern internet enabled devices use Http web services. There are nodes for Sending SMS, Email getting weather data from the cloud and logging to a local or remote database. And when needed you can use good old serial. What’s more add an I/O board to the Raspberry PI and you can monitor the temperature in the KNX panel and cycle the bus power supply from a txt message! node-red-knx-anything

KNX to pushover.net Flow

Pushover is great service and App it allows you to send push notifications to iOS and Android phones no monthly fee just one off App purchase of about £3. Adding pushover to my flow took less then two minuets. It’s a great way to get alerts if there issues with an installation or an annoying event keeps happening and you want to know before the customer is on the phone giving out to you! node-red-knx-pushover

Making a robot with my 6yr old

I’ve been working on and off with my 6yr old daughter making a wheely robot. Jerry the robot is now a play thing he’s asked for when her mates come round. He chases them around the place which they find a real hoot! What’s more they love the fact that Jerry crashes in to them.  We use simple limit switches that’s how he got his name he has whisker like sensing arms. What she’s enjoyed most is drawing the block diagram and the physical making of it. She got her first solder burn (a tiny splash sorted with arnica).Jerry DiagramShe’s shown no interest in programming Jerry (which uses Squirrel)  My experience with her and friends of this age is that they just don’t get the conceptual notion of programming. So doing stuff on a PC screen is too dull. That said they love the physical world stuff like Jerry and some of the other things I’ve done.  So this summer we are going to have fun with Pipes, Valves,  Motors and WATER!!

Best fit Programming types

I was wondering what would be the best programming langue/style based of their learning styles. NPL, Neuro-Linguistic Programming says we have three different learning types. Visual, Auditory and Kinesthetic (touch). The issue for the second is that you can’t hear code. For the touch-ers there is computer science unplugged but that’s for older kids.

But the idea of learning coding concepts away from the machine is something we need to expand  at one code club they build hammer beads to design and explore the concept of gaming sprites.  Scratch seems to be the go to choice for 5 and 6yr old’s in UK schools I describe it as “jigsaw like” programming. My daughter is a visual/drawing type thinker but Scratch doesn’t work for her but visual flow diagramming does

flow style programming

Jerry

Jerry is build with a standard  kit of wheels, base and motors. We added a  motor controller chip and use the electricimp.com April board as the processor. Jerry uses a very simple crash strategy if he hits something he reverses and then heads left or right. We’ve had to add bit’s like the yellow ty wrap to sense when we he goes under the side board and two big head-on collision detectors for spindly chair legs.

IoT activity monitor for the elderly/seniors.

Thoughts and observations one year on.

Inspiration

The idea of making a simple internet enabled Granny Monitor for friends and family was sown when working with the charity Designability.  I helped them build smart homes solutions for people suffering from dementia. These cost  thousands of pounds. I wanted something that cost £100 quid and you could install yourself.

Once I discovered electricimp I knew I had the platform I’d been waiting for. I created a simple device consisting of a PIR, temperature and humidity sensor. Electricimp removes the whole burden of dealing with cloud connectivity, misbehaving WIFI routers and provides a rich event driven software platform & APIs.

The vital signs of daily life

I’ve long held the belief that placing a monitor in the kitchen was the best way to a get a sense that someone was looking after themselves. It’s the place where you make a cuppa first thing, cook a meal and make a hot drink before bed time.

Learning by building – using the data

Installing Mk1 monitor in my study we quickly started to collect data and the question soon arose about the best way to visualise all of this stuff. We started with a simple time series graph, which quickly showed we needed to distinguish between movement and activity.

Activity was simply a number of movements within a given period. This was to exclude false positives and establish that someone was around.

Talking this through with friend we both felt that some form of timeline was needed. The first cut was too noisy you couldn’t see the wood for the trees. So we created a filter that showed a single activity/movement for each hour. This has been refined over time the and current incarnation is built using JQuery Mobile.

Evidence of absence

We soon realised that showing no activity was equally as important, visually we show this by a brake in the timeline. I then installed monitor Mk2 in our kitchen and started to monitor the family.

Being parents meant we were out of the kitchen by 10pm and up again after 6am. So it was quite a surprise, to me, to find my mother in law was a night owl often active at 1am!

The other thing my partner and I’ve have recently noticed is that Grandma is being seen less in the afternoon. We create an alert if someone is up but not seen for 4hrs. It turns out she’s been having an afternoon nap more often.

Alerts and notifications

When electricimp offered their cloud Agents we had the platform to start creating a wider set of alerts and notifications.

At first we used the timeline to check on Grandma now we just rely on notifications. So much so they have become an integral part of our daily lives. My five year old says “Grandma’s up!” on hearing the special “ring tone” on her mum’s phone.

This has been positive for Grandma too. Recently she was called in succession by me and her daughter when we both got the “Not up!” alert. She said without prompting “I feel reassured that someone is looking out for me”. No worries from her about big brother a common concern among the elderly.  There is sufficient evidence that fear of falling is a significant predictor of future falling, so we’re hoping that the monitor is helping in this regard.

We found the language you use in alerts is important, so we started subtlety changed things so we could detect a bit late from late when someone got up in the morning.  We also had to allow for single and plurals  “Dad’s up!” or “Mum & Dad are up!”

Temperature and humidity sensing

Temperature and humidity have a well documented and important role to play in well being. However one surprise was correlating humidity to activity. It’s shown us that you can imply that some form of cooking is going on. In bathroom it could show a bath or shower is running.

Device monitoring

One thing I learnt quickly when first installing wireless sensor networks is there are three key indicators for reliability; energy level, signal strength and the time of the last transmission. The electricimp has exceptional WIFI performance better than any other device I have seen including commercial grade wireless building automation technology. Signal strength is a great commissioning tool as you can often get the device to work but you don’t know if your on the edge. We alert and display on all three key indicators of a device’s health.

Machine learning (ML)

Data science is out of my league but we have clear activity profiles. I’m sure you could predict or hint at when someone’s activity pastern might change. I need to find a friendly data scientist and get their interest!

That said I’m wondering if ML could deal with unexplained activity changes. Last summer Grandma started to get up early on certain days of the week. I asked her why? “ow I get up to get the milk in and go back to bed” she still has the milk delivered and didn’t want it going off.

What next

Given that you know someone is up and about it would be a good time to call them a with a friendly reminder “remember mum, the health visitor is coming at 11 today”.  Given we already use twilio this would be quite a simple addition and the phone isn’t something that the elderly are intimidated by.

I also use pushover for push notifications. Pushover allows for priority and alert acknowledgements which would allow us to escalate or create round robin alerts to ensure someone responds when a critical issue is raised.  But I love the fact with pushover you can change the alert ring tone via the API the tug boat one still makes me jump on hearing it!

We’ve got a simple messaging function in the app that adds a comment to the timeline. It would be good to include SMS messages between carers in that too. Also at friends parent’s house we’re monitoring external access, so adding camera snap shots to the timeline would also make sense.

We’ve ordered a Scanadu Scout it would be great to monitor Grandma’s vital signs too. And when we get our Lifx lamps I’m going hook in alerts to those as well.

On the hardware side electricimp have made great strides in reducing imp power requirements. But I’m still short of my goal of one years of battery life. One way to squeeze a bit more life would be to batch event updates to the cloud if they were not critical by staying offline.

I’m also looking forward to the 3/4g version of the imp. We have some friends whose elderly parents live in two different locations so having one monitor that can take with them would be a great solution.

Monitor: electricimp & sensors


ss_iphone_4

ss_device_status
Andriod_pushover

CyberChimps