# Activity monitoring for seniors living alone

#### Identifying Critical Events

If a sensor uses water within an observation period, but the water does not flow all the time, there is probably nothing to worry about. Critical cases are those in which no water flows or water flows for a long time (see cases A and B). To identify critical cases K, the behavior vector is normalized and a case distinction is performed (Listing 1).

Listing 1

Identifying Critical Cases

#LaTeX formula
\begin{eqnarray*}
\|v\| & = & \sqrt{v^2_1 + v^2_2 + + v^2_n} = \sqrt{\sum_{i=1}^n{v^2_i}}\\
K & = & \begin{cases}
1 & \textrm{falls } \|v\| = 0 \\
1 & \textrm{falls } \|v\| = \sqrt{n} \\
0 & \textrm{sonst}
\end{cases}
\end{eqnarray*}

At K=1, Seheiah queries the database for each value in the behavior vector v, as it appeared at that time in the past. The tolerance is considered and whether events need to be checked for weekdays or weekends/holidays. All events found in period t±(n×l) seconds are summed and divided by the number of days monitored. These steps are used to form the Laplace probability P(e_t), as shown in Listing 2.

Listing 2

Calculating Laplace Probability

\begin{eqnarray*}
P(e_t) & = & \frac{number\:events\:at\:time\:t \pm (n \ast l)\:sec}{number\:of\:recorded\:days}\\
& = & \frac{\sum_{i=1}^D{e_{i_{t \pm (n \ast l)}}}}{D}
\end{eqnarray*}

If you are dealing with an "ideal" senior, who is at home every day and consumes water at the same time within the tolerance period, the probability is 100 percent [P(e_t)=1]. Because retirees and their lives are usually not ideal in the mathematical sense, the probability will be lower in many cases. Thus, a threshold u for fairly safe behavior (thresholdProbability=u) is set; this value also takes into account that the subject might have a lazy day from time to time, or that the regular daily routine might differ occasionally. If a probability below this threshold is determined, none of the related events are taken into account, and the probability is set to [P(e_t)=0]. This approach also prevents infrequent events (e.g., a visitor uses the bathroom, asks for a glass of water, etc.) from being evaluated.

The probability values are entered into a the historical behavior vector h, which comes from the same vector space as v. The vectors v and h are then compared for cosine similarity \cos(\varphi), where \varphi is the angle between v and h (Listing 3).

Listing 3

Comparing Historical Behavior Vectors

\begin{eqnarray*}
\cos(\varphi) & = & \frac{v \cdot h}{\sqrt{\|v\|} \ast \sqrt{\|h\|}}\\
& = & \frac{\sum_{i=1}^n{v_i \ast h_i}}{\sqrt{\sum_{i=1}^n{v^2_i}} \ast \sqrt{\sum_{i=1}^n{h^2_i}}}
\end{eqnarray*}

In this example, \cos(\varphi)=1 would mean a complete match, whereas v and h are orthogonal to one other at \cos(\varphi)=0 and do not resemble one another one iota. To detect unusual behavior, a threshold value s is also is set for the cosine similarity (thresholdCosSimilarity=s), depending on the number of the intervals observed (n). For example, s=0.7 represents a good initial threshold for the default value of n=3. If \cos(\varphi)<s occurs several times in succession (3n), the alarm cascade is triggered (Figure 2).

The system also can be informed about periods of absence. If the senior politely says "Seheiah bye bye" when leaving the apartment, critical events are not evaluated. When water is used later, the system is automatically re-enabled.

In case of an alarm, the alarm cascade is responsible for notifying family members or caregivers about a suspected fall. The alarm cascade communicates with the activity monitor and voice recognition via a Unix socket. All messages received there (ALARM, UNEXPECTED BEHAVIOR, FINE, WATER FLOW) are interpreted. If the activity detector identifies deviant behavior, it sends the message UNEXPECTED BEHAVIOR to the alarm cascade. This event triggers playback of an audio file (<path_to_seheiah>/mp3s/unexpected_behavior.mp3), in which the senior is asked to confirm her well-being (message FINE). She has two minutes in which to comply.

False alarms can occur relatively frequently, depending on the values set for intervals, behavior vectors or thresholds, or behavior changes, such as sleeping longer in the morning. Assuming that the senior really is feeling fine, she can cancel the alarm by a simple voice command ("Seheiah alarm off"). For the senior, a false alarm is no more than an annoying error that costs significantly less than a fall that goes unnoticed.

If the senior does not confirm her well-being within this period or if the alarm cascade receives an ALARM message, an alarm is triggered. To do this, the webcam grabs a snapshot and then mails it – along with the request to take care of the senior – to a list of recipients (Figure 3).

Express-Checkout as PDF

Pages: 8

Price \$2.95
(incl. VAT)

SINGLE ISSUES

SUBSCRIPTIONS

## Related content

• Controlling the LM75 temperature sensor on the I2C bus

The programmable output port of the LM75 digital temperature sensor teams up with a Raspberry Pi to form a temperature monitoring system.

• Arduino watches for a kitchen catastrophe

Using Arduino to monitor for smoke or water damage.

• All the Pi

Raspberry Pi users think small and dream big, imagining ingenious projects that put the unobtrusive Raspberry Pi to work on practical problems. And along the way, they learn things you don't ever discover by pointing and clicking with a smartphone or MacBook.

• Automated plant watering with Arduino

House plants are fairly self-sufficient, but they do need certain care from people to survive. With a few Arduino sensors and a little programming, you can take the guesswork out of watering your plants.

• Automate and monitor the physical systems in your home

Three Raspberry Pis, four Arduinos, and other readily available components create a custom-built home automation system that monitors and controls about 50 different devices.