Tuesday 11 September 2012

Alzheimer Reminder Device

A friend of the family has an elderly Mother who is still living alone but has early onset Alzheimers. She now needs to be reminded when to take her normal medication but often forgets  the time of day and what she should be doing. Thus we need a device that cycles through the significant events of the day with pictures, prompts and time of day.


Reminder App Running on Chumby8

Hardware Choice

His suggestion was to use something like a Digital Photo frame  and have a Reminder application running on it. Such commercially available frames are reasonably priced (Around EUR80) but, unfortunately, they are low capability and are generally running some kind of RISC chip with specialised firmware rather than a generic OS. Thus, to replace the functionality you would have to flash a new Firmware. The cost saving is outweighed by the effort involved in developing to the platform.

You would not use something like a Kindle, Android or Apple Tablet for this application as you will find that the target user would get confused by the other things that the device does and also by the accidental triggering of other functions via inadvertently pressing the other buttons. My Mother was once given a Kindle but just by holding it with her arthritic fingers she would accidentally touch the various buttons on the side or she would point it at the light and the screen would rotate. They are just too generic and too complicated.


Chumby

Enter the Chumby (http://www.chumby.com/). I have owned an early Chumby Classic (http://www.chumby.com/pages/chumby_classic) for some time now and have been waiting to find an application for it. It is an open Hardware, OS, Software platform developed by Chumby Industries in San Diego, CA. It is a networked (WiFi) ARM based device, running Linux and has a small touch screen with tilt sensors and a few pressure switches on the case. It has two USB ports, Speaker, headphone socket and built in microphone. It runs Flash widgets loaded from the Chumby site. It doesn't hide its internals for those who know (You can easily gain root ssh access) yet still provides an easily configurable and secure user experience - a hard thing to get right.

Overall a great device well designed, with great infrastructure behind it. A big, Thumbs Up to the Chumby guys for their early innovation in this space that is now filled with many ARM based linux devices including Android devices, Arduino (http://www.arduino.cc/) and lately Raspberry Pi (http://www.raspberrypi.org/).

The cream on the top - and this is what makes this device ideal for this application - is that there are hooks in the boot process that allow you to configure and even replace the standard chumby console. Its as simple as creating a .swf application, loading it onto a root of a USB Stick or Flash memory card (For the later devices) using the name "controlpanel.swf". The device will then boot and only run your application.

Software

Thus, using only Open Source tool chain mtasc (.as to .swf compiler) swfmill (.swf resource linker) and gnash (GNU's Flash runner) I wrote a prototype application using simple Flash Action Script 2 that takes a schedule from an XML text file and displays reminders with pictures. It's early days but a running version can be seen online here: http://www.cregganna.com/ReminderApp/ReminderApp.html

Here is a little video of it running on my Chumby 8 in test mode.



As I say, an early prototype but it displays the basic idea. Note - it is running in test mode so the schedule is not running true time - it is just ticking every minute to start with then I trigger the changes myself by touching the screen.

The Schedule for this example is here: http://www.cregganna.com/ReminderApp/ReminderSchedule.xml


Going beyond a Prototype

The best target device would seem to be the Insignia Infocast 8 or Chumby 8 (which I think is no longer produced) as it is an 8 inch frame with a memory card slot.

Improvements and moving it forward to a fully usable application would possibly include:
  1. Providing audio to play for each message - set up in the same way as the pictures.
  2. Changing the idle screen - it is currently a pure white screen with the Hour:Min of the next schedule in the top right. We could have a black screen or just show pictures from a folder on the memory card.
  3. Allow a cancel / confirm action when the chumby top button is pressed or the screen is tapped. This would be used to dismiss the message and go back to the idle screen. We could even have a better way of confirming that the pills have been taken etc.
  4. Allow for pill sequences instead of pictures of all pills - ie take red pill, hit button, take red pill, hit button, take blue pill hit button, With Audio this might work quite well. It could repeat audio if it gets no confirmation
  5. The chumby device is actually networked - there would be opportunities to remotely review the user's responses, alter the schedule and even talk to the user directly.
  6. ...
To use the application one would have to:
  1. Purchase a compatible device - Insignia Infocast 8 seems ideal as it is a Chumby clone. I used a Chumby 8 and Chumby One.
  2. Purchase a USB Key: Any size would be OK - but if we were to make it do the Picture display in idle then the bigger the better. I went for a 4Gb Cruzer Fit as it is compact and does not extend beyond the back of the device.
  3. Unzip the application (ReminderApp.zip)  on to your usb key.
  4. Take pictures of the events and pills that need to be taken at each time and put them on the usb key - probably best to give them relevant names.
  5. Edit the ReminderSchedule.xml for your schedule and refer to the pictures you've taken.
  6. Boot and configure your device to connect to your network - you'll need a network to allow the date/time to be set correctly initially.
  7. Turn the device off.
  8. Stick the usb key in the device and boot.

More Pictures:


Scrolling text in Flash

Interestingly this proved hard to implement. There was lots of rubbish implementations on the internet using timers and the like so here is the implementation I put together base on MovieClip.scollRect.
function createScrollingText(container:MovieClip, fieldName:String, depth:Number,
    x:Number, y:Number, width:Number, height:Number,
    content:String) {

    container.createTextField(fieldName, depth, x, y, width, height);
    var field:TextField = container[fieldName];

    field.multiline = false;
    field.wordWrap = false;
    field.autoSize = "left"; // Needed to force render of whole string
    field.antiAliasType = "normal"; // Needed to allow scrolling whole string
    field.gridFitType = "none"; // Needed to force scrolling whole string
    field.text = content;

    var format:TextFormat = new TextFormat();
    format.font = "sans";
    format.size = height;
    format.bold = true;
    format.color = 0x000000; // Black
    reduceToHeight(field, format, height);

    // Utils.traceTextField(fieldName, field);

    if (field.textWidth <= width) {
        // trace("No Scroll required");
        // Just center it
        field.autoSize = "center";
        return;
    }

    // Double up text to make it look smoother
    field.text = " -- " + field.text + " -- " + field.text;
    // Reapply format
    field.setTextFormat(format);

    // Scroll by using horizontal scroll rectangle
    var scrollRegion:Rectangle = new Rectangle(x, y, width, height);
    var scrollLimit:Number = -1 * (field.textWidth / 2);
    container.onEnterFrame = function() {
        var newX = field._x - 1;
        if (newX < scrollLimit) {
            newX = 0;
        }
    field._x = newX;
    }
    container.scrollRect = scrollRegion;
}

No comments:

Post a Comment