Parkinson's Measurement Home  
Research by PwP for PwP

     Lean app

Get ready (sec)      
Baseline (sec)
Vibration duration (ms)
Warning angle (°)
Grace period, warning (ms)
Grace period, punish (ms)
Long term allowance
Report period (sec)  



This app causes a smartphone to vibrate when tilted. If worn on the body, it can be used to monitor posture.

Default use

  1. Press the START button.
  2. You feel the smartphone vibrate briefly.
  3. You now have 60 seconds to get ready for the baseline:
    • with the phone fixed securely to the body;
    • with you sitting or standing with a good posture.
  4. The phone vibrates again to tell you that baselining has now started.
  5. Stay with a good posture for 10 seconds to get a baseline.
  6. Vibrate again to tell you that baselining is now finished.
  7. The system is now monitoring your posture.
  8. The phone will warn you, by vibrating, if the lean continuously exceeds its limit of 10 degrees for more than 5 seconds.
  9. If no action has been taken after a further 20 seconds, you will given a short term punishment, a loud noise will be played.
  10. A long term punishment is possible for other reasons as described below.

Other uses

By increasing the acceptable angle of lean and the grace period you stop the warning vibrations and the punishment noises occuring. In this case the app will continue to report the lean angle. Thus, becoming a pure measuring device. Additionally, it is possible, but untested, that the app may impact on falls and sleep attacks.


Duration to prepare (sec). Default 60 sec. The time to get ready for the baseline.

Duration of baselining (sec). Default 10 sec. The time to sit or stand with a good posture. The program averages the accelerometer readings. This approximates to local vertical.

Duration of vibration (ms). Default 250ms, i.e. 0.25 sec.

Warning angle (degrees). Default 10°. When the angle between the baseline vertical and the present vertical exceeds this value for a long enough period of time the vibration will be fired.

Grace period warning. Duration of continuous fails required to raise vibration (ms). Default 5000, i.e. 5 sec. This is the important part of the algorithm. It removes many false positives. For instance, looking down briefly should not trigger the vibrations. This also filters out most accelerations due to movement.

Grace period punish. Duration of continuous fails required to raise a short term punishment, a loud noise (ms). Default 20000, i.e. 20 sec.

Long term behaviour control (in the tens of minutes). Initial credit for long term cumulative behaviour. Default 10000, i.e. with 50 samples per second, in the worst case this is used up in about 3 minutess. This intervention seeks to reward good long term behaviour, rather than a gaming approach of just doing enough to stop a punishment. You are given an initial credit. For each reading in which your lean is less than a half of the warning angle your credit is incremented by 1 and for every reading for which you are more than the warning angle this is decremented by 1. If the running value goes below 0, a loud noise is played. The cumulative value is then reset to the initial credit. The actual value used is a randomly selected value taken from a uniform distribution with range 0 to twice the initial credit. The random setting of the new credit is done in order to make it difficult for the user to estimate the credit level, forcing the user to work hard from the beginning.

Duration of group (sec). Default 60 sec. Statistics of the lean are written to the screen. every 1 minute.


The phone continuosly monitors your lean. It warns you, by vibrating, when you go outside the set limits for the whole of the grace period: getting into the allowed limits only once is enough to reset the grace period. If you are continuously outside of the limits for a longer period, a loud sound is played as a punishment. However, this punishment encourages a game playing approach of doing just the minimum required to avoid the punishment. To get aroung this there is also a punishment, which comes without warning, for long term behaviour.


For the app to work your smartphone needs to have an accelerometer. The easiest way to check if this is the case is to try to run the app and see if it works: if there's no output, there's no accelerometer.

You need to be on-line to use this app for the first time. The app is cached automatically cached. So, on subsequent uses you do not need to be on-line.

The app has only been tested on Android smartphones using a Chrome browser.

Avoid the smartphone going into sleep mode

For the app to work it is necessary to overcome two competing problems:

Smartphones go into sleep mode if they are not being used. This can occur after as little as 15 seconds. If this happens, the app does not work. There are two options available:

You can extend the time before your smartphone goes into sleep mode. You can do this by going into Settings, Display, Sleep. Unfortunately, a typical upper value is 30 minutes, which is too short for most work.

Alternatively, you can download a free app, like Keep Screen On!, which does what its name says.

Positioning on the body

The phone needs to be securely attached to a part of your body that best represents your posture. For many people this will be their head. A simple, rough and ready solution is to velcro the phone to the underside of a tight fitting ski hat.

If worn on the head, with the smartphone face up, horizontal and pointing forwards, the app will measure:

The "lean" figure that is calculated is the combined effect of the lean and the stoop. The twist is not calculated, because it would be difficult to distinguish a twist from a turn.

Effect on posture

Identifying poor posture does not in itself lead to better posture. Users are encouraged to seek medical advice on what is the best posture for them.

Release history

19th October 2017. John Turner. Initial release.
9th July 2018. John Turner. Off-line use allowed. Punishment noise added.