An Ambient Assisted Living Scenario: Remember when taking medicines

We’re going to describe how Paraimpu sensors and actuators can be combined and merged to help people in an activity of daily living.
In such a case, it is a typical Ambient Assisted Living (AAL) scenario:

Remember to take the asthma drug tablet at the right time and notify that the patient took it to her family and doctor.

Forget to take medicines is a common lack for everybody but in case of elderly and mild cognitive people, it could be a key task to perform everyday.

The scenario
Robert is affected by asthma and he goes to doctor for a cure relaxing the pathology. After the visit, he prescribes to take one asthma drug tablets 3 times per day.
As almost of people, Robert often forgets the right time to take the right medicine so the doctor sets a Paraimpu timer sensor with the hours to take it. Such as sensor is shared with Robert and it is used to activate the Paraimpu-enabled objects in patient’s home.

Robert places the medicine box on the table “augmented” with the Paraimpu things and its Karotz on the desk.

At the time set by the doctor, the Robert attention is attracts by the Paraimpu things: Karotz lights on and, rotating its ears, he tells to take the asthma drug tablets. The LED on the table lights on.
Robert takes the asthma drug box, takes the tablet and replaces the box on the table. The LED switches off and a tweet is automatically send on its Twitter account. It’s like “Don't worry dear! I took my asthma drug tablets! (October 5, 2011 09:01:15 AM CEST)”.
Family and doctor read the tweet and don’t worry on the asthma of their dear.





What we need 
Hardware parts:
  •     2 sensors able to identify presence/absence of an object (we used 2 light sensors)
  •     1 led
  •     1  220ohm resistor
  •     2 arduino boards (we used 1 Arduino Uno and 1 Arduino Diecimila)
  •     2 arduino ethernet shield
  •     1 internet enabled object with a TextToSpeech (we used Karotz)
The 5 Paraimpu things involved:
  •     Timer Sensor: send a message when it’s the time to take the asthma drug tablet
  •     Arduino Ethernet Sensor: get data when the drug box is taken or released
  •     Arduino Ethernet Actuator: switch on/off the led and the sensors
  •     Twitter Actuator: notify to family and doctor, he took the tablet
  •     Karotz Actuator: tell that he must take the tablet

Wiring the electronic parts


Setting the 5 Paraimpu Things

Timer Sensor
Instance a Timer Sensor by clicking on and filling the field form as the following image:


Settings:
  • Name: Asthma Description: 
  • Remember when Robert must take the asthma drug tablet 
  • The timing is: 12,16:30, 22:10 
  • each: day 
  • Message: asthma 
  
Arduino Ethernet Sensor
Instance a Arduino Ethernet Sensor by clicking on and filling the field form as the following image:

Settings:
  • Shortname: AsthmaSen 
  • Description: Sensor on asthma drug box actions
On AsthmaSen detail page, set the information to download your specific sketch:
  • MAC Address (you could find it under the Ethernet shield) 
  • IP Address to assign to the shield 
  • Sensor Mode: Trigger 
  • Advanced Set:
    • A1:    1 <= value <= 1023  
    • A4:    1 <= value <= 1023
 
To install the sketch on Arduino board, please follow the tutorial on the AsthmaSen detail page or read one of the previous post on Arduno or watch a related video on Paraimpu youtube channel.

Arduino Ethernet Actuator
Instance a Arduino Ethernet Actuator by clicking on and filling the field form as the following image:

Settings:
  • Shortname: AsthmaAct 
  • Description:Actuator to remember the asthma drug tablets

As for the AsthmaSen, on the AsthmaAct detail page you must fill the MAC and IP addresses and download the sketch. It must be installed on the board.


Twitter Actuator
Instance a Twitter Actuator by clicking onand giving the authorization to Paraimpu as required by Twitter.

Karotz Actuator
Instance a Karotz Actuator by clicking on and filling its form.


Settings:
  • Shortname: RememberMedicins 
  • Description: Tell me on medicins to take
Connecting Things
Your Paraimpu workspace has sensor and actuators like next image.


Now we need to connect sensors and actuator instances. They will be: 
  • Asthma    ---> RememberMedicins 
  • Asthma    ---> AsthmaAct 
  • AsthmaSen ---> AsthmaAct
  • AsthmaSen ---> Twitter Service 
Your workspace becomes like:

Configuring Connections 

Asthma ---> RememberMedicins
Open the Connection Detail page and set the filter and one mapping like next image. Please remember to save the configuration.





Settings:
  • Filter: Asthma == ‘asthma’ 
  • Mapping
    • Match: Asthma == ‘asthma’ 
    • Replace:
      • Message Text: It is the time to take the asthma drug tablet 
      • LED Color: FF0000
      • Left Ear degrees: 90 
      • Right Ear degrees: 90 
Asthma ---> AsthmaAct
On the Connection Detail page, set the filter and one mapping like next image.

Setting:
  • Filter: Asthma == ‘asthma’ 
  • Mapping
    • Match: Asthma == ‘asthma’ 
    • Replace: 
      • D08 = HIGH    (ligth on the LED) 
      • D06 = HIGH    (activate Sensor 1)
AsthmaSen ---> AsthmaAct
It is the more complex configuration with 2 mappings. The configuration is:

  • Filter: (AsthmaSen.A1>1 && AsthmaSen.A1<200) ||(AsthmaSen.A4>400) 
  • Mapping 1 (related to values given by Sensor 1)
    • Match: AsthmaSen.A4>400 
    • Replace:
      • D06 = LOW    (switch off the Sensor 1)
      • D04 = HIGH    (activate Sensor 2)  
  • Mapping 2 (related to values given by Sensor 2)
    • Match: AsthmaSen.A1>1 && AsthmaSen.A1<400 
    • Replace:
      • D08 = LOW    (switch off the LED)
      • D04 = LOW    (switch off the Sensor 2)


AsthmaSen ---> Twitter Service
On the Connection Detail page, set the filter and one mapping in this way:

  • Filter: (AsthmaSen.A1>10 && AsthmaSen.A1<400) 
  • Mapping
    • Match: AsthmaSen.A1>10 && AsthmaSen.A1<400%>
    • Replace: Don't worry dear! I took my asthma drug tablets! (<%(new Date()).toLocaleString()%>)
Setting and configuration done!
Please, remember to: 
  • active the 4 connections 
  • power on the Arduino boards and Karotz, 
  • connect the ethernet cables to the shields, 
  • wire the electronics parts according the schema on the top of this post
And we have a remotely monitored a configurable solution able to support people, in special way elderly and mild cognitive impaired people, in an everyday action like to remember to take a medicines.

9 responses to “An Ambient Assisted Living Scenario: Remember when taking medicines

  1. I may be the wrong person to have ALPHA access. I can't even get to this part...
    Unpack the archive, enter the pyserial-x.y directory and run

    I've downloaded the files. I think installed.. but I can't find that directory. It just isn't there.

    A video that covers all of this would be great.

    Bryan

  2. Hi Bryan,
    don't worry! We need feedback to improve Paraimpu.

    Please, give us more details. What files did you not find?

    We suppose you would like to use a sensor or an actuator based on Arduino USB and you performed the pyserial installation successfully. Probably you don't find the controller*.py or the sketch for Arduino USB.
    They must not be installed but their environments (Python and Arduino IDE), yes! It must be done according the instructions on their web sites.

    In this AAL scenario we used Arduino Ethernet instances, to get more indications on the files required by Arduino USB, you could read on http://paraimpu.blogspot.com/search/label/arduino%20USB

    Enjoy!

  3. now, when it says run controller.py in terminal shell I get message...


    Last login: Fri Dec 2 09:43:13 on ttys006
    Sea-Hursts-MacBook-2:~ seahurst$ python controller.py
    /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'controller.py': [Errno 2] No such file or directory
    Sea-Hursts-MacBook-2:~ seahurst$ cd /Users/seahurst/Downloads
    Sea-Hursts-MacBook-2:Downloads seahurst$ python controller.py
    Traceback (most recent call last):
    File "controller.py", line 6, in
    import simplejson
    ImportError: No module named simplejson
    Sea-Hursts-MacBook-2:Downloads seahurst$


    Also... on MAC there is no browser that will download sketch when clicked. I had to go to page source to find the right link/file.

    Thanks

    Bryan

  4. Hi Bryan!

    On MAC, easy_install should be installed ... please, on shell, just type:
    easy_install simplejson

    The sketch downloading was a bug. Sorry ... Now it works fine.
    Thanks to report it! You are a great Alpha User!

    Regards

  5. Great. Now, I am able to get the Arduino connected to the computer. So far it turns on and off if I enter the data in the arduino. Also my Twitter sensor is picking up my messages, but so far not triggering the arduino. I'll keep at it!

    As a total newbie here are some thoughts for your Alpha work.

    When it comes to all the installations required to connect with the Arduino through a USB serial connection....

    1. Sounds obvious, but be sure to tell them all the downloads should be in one folder.
    2. Add that info about the Json.
    3. As a newbie I didn't really know about TERMINAL. I found that online.
    4. I'd say you'll know it's working if the terminal window is looking for the Arduino in the USB port. And then it asks if the light is on or not.
    5. After a while it seems to have disconnected... but it didn't announce that fact to me. I'd say to check that the unit is still connected now and then.

    Thanks for making this available. I am really stretching my mind! ;-) And I have always liked the idea of remote sensing.
    Bryan

  6. I got it working, but used the match/replace code from the PUMPKIN TWITTER example.
    Nice to get it working after all these hours! ;-)
    Thanks

    Bryan

  7. Great!

    Thanks for the suggestions! We add Arduino USB help changes in roadmap.

  8. This is the right webpage for anyone who wants to find out about this topic. You know a whole lot its almost hard to argue with you (not that I really would want to…HaHa). You definitely put a fresh spin on a subject that's been written about for years.
    Wonderful stuff, just great!

  9. Great. Now, I am able to get the Arduino connected to the computer.

Leave a Reply

© 2014-2015 Paraimpu Srl . Powered by Blogger.