Monitoring PLMS with a smartphone

For everything and anything else not covered in the other WED/RLS sections.
Frunobulax
Posts: 161
Joined: Mon Jun 02, 2014 7:41 pm

Monitoring PLMS with a smartphone

Postby Frunobulax » Wed Jun 18, 2014 8:46 pm

Hi,

I think I found a reference to this somewhere on the board, but the search function turned up nothing.

Is it possible to monitor PLMS with a smartphone attached to a leg? The sensors of a modern smartphone should be easily precise enough to pick this up.

I tried "Sleep as android", but it does not distinguish between PLMS and just generic movement. It does show some increased activity when I wake up due to WED leg movement/twitching though, when I wake up with dancing legs then I often find that "Sleep as Android" shows a preceding phase of 30-90 minutes with increased activity. Still, in some nights there is some activity where I have no idea if I had PLMS or not. (Since I am always tired, chances are that I do - but how often?)

It should be very easy to make out the distinctive, rhythmic movements if the recording of the movement sensors was specific enough: Define movement "events" as movement separated by at least 5 seconds of inactivity, where the movement time is shorter than the inactivity time. Calculate a number_of_events per hour, say a moving average or exponential moving average calculated over the duration of 20 minutes, recalculated every 2-5 minutes or so. Make a graph out of it, and perhaps an excel sheet.

So, has anybody done that? Or does somebody at a WED research center has the resources to develop such an app? I would be extremely interested.

My personal background:

One poblem of PLMS is that their frequency and duration is not always obvious to a patient. I do have significant PLMS, which was confirmed in a sleep laboratory trip, but I was not aware of them in these nights - I just realised that I was very tired, which I attributed to the lack of sleep due to 30 electrodes attached to my body. My wife often notices that I'm moving my legs though.

My doctor says that my WED medication (Tilidin, an opioid which is not available in the US but which is commonly used in Europe to treat WED) relieves the leg twitching enough to allow me to get to sleep, but does not suppress the PLMS sufficiently. He added Clonazepam to address the latter part, which worked sensationally for one night, but that was it - after 2 weeks my WED symptoms with Clonazepam were worse than without Clonazepam. (It seems to be more an augmentation-like effect than an paradoxical effect, if this is possible - since reducing the Clonazepam just increased the symptoms.)
Now I'm taking just some L-Dopa with the Tilidin, to get the Clonazepam out of my system, and we may have to add something else if PLMS is still a major problem. Still, my nights are very much disturbed by my sleep, and I think it would be very interesting to know if, and how long and often, I do move my legs - if just to find some correlation with environmental factors like food, exercise and so on.

Regards, F.

Polar Bear
Moderator
Posts: 7525
Joined: Tue Dec 26, 2006 4:34 pm
Location: N. Ireland

Re: Monitoring PLMS with a smartphone

Postby Polar Bear » Thu Jun 19, 2014 2:07 am

I am sure that all of us would be very interested to know just what goes on whlle we are sleeping.
Just would like to say, be careful regarding the Leva Dopa. It is ok for use now and again but regular use causes augmentation in about 80% of users. If using it, it is best to try to do so only 3 or 3 times per week.
Betty
http://www.willis-ekbom.org/about-rls-wed/publications
Opinions presented by Discussion Board Moderators are personal in nature and do not, in any way, represent the opinion of the RLS Foundation

ViewsAskew
Moderator
Posts: 15690
Joined: Thu Oct 28, 2004 6:37 am
Location: Los Angeles

Re: Monitoring PLMS with a smartphone

Postby ViewsAskew » Thu Jun 19, 2014 6:17 am

I have read of such apps....but I am still in the stone ages and do not have a smartphone - so I haven't bothered to look.

One of the US sleep docs - Dr Rye, who also has WED and PLMS - said that he bought a used device they use in sleep studies. But, I have no idea how a regular person would get one. New they cost quite a bit. I haven't looked for years - about ten years ago they were $600 USD or more, if I remember correctly.

I just looked - they are inexpensive these days....but you can't tell anything if you do not have the very expensive software (starts at $1500 USD!)

http://www.actigraphcorp.com/products/

In Europe (maybe Canada, too, just not the US) Philips sells the Actiwatch. http://www.healthcare.philips.com/main/ ... efault.wpd
Ann - Take what you need, leave the rest

Managing Your RLS

Opinions presented by Discussion Board Moderators are personal in nature and do not, in any way, represent the opinion of the RLS Foundation, and are not medical advice.

badnights
Moderator
Posts: 5241
Joined: Tue Mar 10, 2009 4:20 pm
Location: Northwest Territories, Canada

Re: Monitoring PLMS with a smartphone

Postby badnights » Sat Jun 21, 2014 5:50 pm

We need a programming nerd with WED/RLS, or who has a friend with WED/RLS, and then there will be an app. You're right, it should be straightforward.

A sleep lab might be able to set you up with an actigraph for a couple of weeks, but that might be more trouble than it's worth to you.

I echo polar bear - do not stay on the L-dopa for long. Two weeks is enough in my opinion, not that I have a medical background. That med will cause augmentation - apparently it wont' in 20-25% of daily users, and I believe we had one of those post here a year or two back, so they do exist! but I would not take the chance that my body would fall into the 20% and not the 80%. (Well, actually I know, because I have augmented on it).

Have you had your serum ferritin level checked? And other iron markers? Ferritin should be over 100 ng/ml, though older papers say 75 is good enough, before you take a dopaminergic or dopamine medication, otherwise the risk of augmentation is higher. Your ferritin level reflects the iron stores in your body, and can be low even without anemia. In many cases, increasing ferritin by oral supplements relieves or alleviates WED symptoms.
Beth - Wishing you a restful sleep tonight
Click for info on WED/RLS AUGMENTATION & IRON
I am a volunteer moderator. My posts are not medical advice. My posts do not reflect RLS Foundation opinion.

Frunobulax
Posts: 161
Joined: Mon Jun 02, 2014 7:41 pm

Re: Monitoring PLMS with a smartphone

Postby Frunobulax » Sun Jun 22, 2014 8:32 pm

badnights wrote:We need a programming nerd with WED/RLS, or who has a friend with WED/RLS, and then there will be an app. You're right, it should be straightforward.


You could do what I did - check out a few of the apps that promise to measure sleep cycles (they must already detect motion), write to them and request a PLMS monitoring. If they get several requests (and not just from me), they might do it. (I told them that I wouldn't be the only one to spend a few bucks on such a feature. :) )

badnights wrote:I echo polar bear - do not stay on the L-dopa for long. Two weeks is enough in my opinion, not that I have a medical background. That med will cause augmentation - apparently it wont' in 20-25% of daily users, and I believe we had one of those post here a year or two back, so they do exist! but I would not take the chance that my body would fall into the 20% and not the 80%. (Well, actually I know, because I have augmented on it).

Have you had your serum ferritin level checked? And other iron markers?


There seems to be a difference between american and eurpean doctors. Over here two specialists both kept me on L-Dopa (200mg/d). I agree that I should get rid of it, the sooner the better. But it's not easy if there is no fallback plan, at least none that my doctor approves of.

Ferritin levels are fine (>200 in two tests, I'm going to do another one soon), as are the other iron-related values.

Frunobulax
Posts: 161
Joined: Mon Jun 02, 2014 7:41 pm

Re: Monitoring PLMS with a smartphone

Postby Frunobulax » Thu Aug 14, 2014 8:53 am

Polar Bear wrote:I am sure that all of us would be very interested to know just what goes on whlle we are sleeping.


Well, I've cobbled together a simple android application doing just that. It will track movements and detect PLMS. It is highly experimental and I'm planning on adding some more features in the future, but if you want to give it a try then contact me per private message. Be aware that the thing still has a few warts that you'll have to live with until I fix them...

PLMS detection follows the PLMS definition given in the Buchfuhrer, Hening and Kushida book (“Restless Legs Syndrome: Coping with Your Sleepless Nights”).

You'll need a somewhat recent android phone (I think running android 4.2 or better, my phone runs 4.4 "KitKat"), with a way to strap it to one of your feet. I use a standard armband case that I picked up at amazon for 10$ or so. There is no iPhone version since I don't own either a Mac or an iPhone, sorry. If we feel it is worthwile then we should try to find an iPhone developer who ports the thing.

The output generated by the app is a list of movements (time and duration), plus a report card that looks like this (red are sleep interruptions, yellow are PLMS periods). I ran a two-night verification by videotaping my sleep and crosschecking the video to the app, and so far the app seems to be pretty reliable.


Sleep time: 06.08.2014, 22:55-06:00
Sleep intervals
22:55 - 02:39
02:43 - 06:00
Sleep duration: 07:01:00
PLMS duration: 01:00:31
Total movements: 179
Movements per hour: 25,5
Average movement speed: 0,7
PLMS periods: 5 (PLMS Movements: 112)
02:01 - 02:07 (8 Movements, averaging 78 moves/hour)
02:19 - 02:24 (9 Movements, averaging 105 moves/hour)
03:11 - 03:24 (28 Movements, averaging 128 moves/hour)
03:26 - 03:53 (49 Movements, averaging 111 moves/hour)
05:46 - 05:56 (18 Movements, averaging 111 moves/hour)


It can be postprocessed after downloading it to a computer, generating a graph like this:

Image

ViewsAskew
Moderator
Posts: 15690
Joined: Thu Oct 28, 2004 6:37 am
Location: Los Angeles

Re: Monitoring PLMS with a smartphone

Postby ViewsAskew » Thu Aug 14, 2014 8:33 pm

Very cool!
Ann - Take what you need, leave the rest



Managing Your RLS



Opinions presented by Discussion Board Moderators are personal in nature and do not, in any way, represent the opinion of the RLS Foundation, and are not medical advice.

badnights
Moderator
Posts: 5241
Joined: Tue Mar 10, 2009 4:20 pm
Location: Northwest Territories, Canada

Re: Monitoring PLMS with a smartphone

Postby badnights » Sun Aug 17, 2014 5:59 pm

Well, I've cobbled together a simple android application doing just that.
Nice! You didn't even mention that you were the nerd we were looking for! My phone runs 2.3 (dark ages) so I guess it's not worth trying.
Beth - Wishing you a restful sleep tonight
Click for info on WED/RLS AUGMENTATION & IRON
I am a volunteer moderator. My posts are not medical advice. My posts do not reflect RLS Foundation opinion.

Frunobulax
Posts: 161
Joined: Mon Jun 02, 2014 7:41 pm

Re: Monitoring PLMS with a smartphone

Postby Frunobulax » Mon Aug 18, 2014 4:38 pm

badnights wrote:
Well, I've cobbled together a simple android application doing just that.
Nice! You didn't even mention that you were the nerd we were looking for! My phone runs 2.3 (dark ages) so I guess it's not worth trying.


Well, I used to work as a software developer until a few years ago. I never did something with Java or Android, but since I couldn't find anybody to do this thing for me I had to do it myself...

Not sure about older android versions, I think they had an issue that they couldn't keep the application running when the screen was off. And not turning off the screen will drain the power rather fast. I can mail you the app anyway, it doesn't hurt to try - my sample size consists of exactly one phone (mine) runing Android 4.4.

sleepdancer2
Posts: 207
Joined: Sun Jun 29, 2014 7:46 am

Re: Monitoring PLMS with a smartphone

Postby sleepdancer2 » Wed Aug 20, 2014 5:06 am

With my long history with PLMD I find all this fascinating. Have to keep it in mind if I get a smart phone - hey maybe it's a good excuse to get one. :D I've had numerous sleep studies both on and off meds, as well as without and with use of a TENS Unit for my legs. I would love to do and document my own series of "sleep studies" comparing the effectiveness of the TENS with different settings and/or electrode placement. Oh I could have a ball with this!
My Augmentation Sleep Video: https://www.youtube.com/watch?v=jE7WA_5c73c

Frunobulax
Posts: 161
Joined: Mon Jun 02, 2014 7:41 pm

Re: Monitoring PLMS with a smartphone

Postby Frunobulax » Wed Aug 20, 2014 9:19 am

One can become obsessed with it, that's for sure :-)
So far I found that my PLMS highly correlates with WED symptoms. So if I'm having a hard time with WED, I tend to have a lot of PLMS. No big surprise here. But more surprising is that I have quite severe PLMS eposides (120 twitches per hour or more) without waking up, while in other nights I wake up with severe WED symptoms with only a short or less active PLMS period.

It would also be interesting to monitor both legs. From videotaping me I found that I often move just one leg. It's a 50-50 chance to catch it with the smartphone.,

User avatar
Neco
Posts: 2294
Joined: Tue Oct 04, 2005 10:18 am
Location: Somewhere in the midwest
Contact:

Re: Monitoring PLMS with a smartphone

Postby Neco » Wed Aug 20, 2014 1:28 pm

I've got a Galaxy S3 if you need some beta testing done. I don't know which firmware or Android version I'm running atm but the phone should be up to date. Drop me an e-mail through my web site in my signature.

You might also want to try digging through any API/Android documentation; there has GOT to be an API call, or some way to write a callback to either ignore or bypass any screen state checks, I would think?? I know I had one music program where it would not advance through the playlist after my phone hit the idle limit to turn my screen off; but it always resumed playing if you turned the screen back on. Oddly it would play through the current song even if the screen idled itself to off.

I figured it had to be poor coding on the developers part.


In case anyone was wondering what the hell I am nerding out about, programming was also a side-hobby of mine until my recent medication troubles these past few months. I have always wanted to build a rich, interactive, Text based role playing game. Been working on it slowly for years :lol:

Frunobulax
Posts: 161
Joined: Mon Jun 02, 2014 7:41 pm

Re: Monitoring PLMS with a smartphone

Postby Frunobulax » Wed Aug 20, 2014 6:29 pm

Neco wrote:You might also want to try digging through any API/Android documentation; there has GOT to be an API call, or some way to write a callback to either ignore or bypass any screen state checks, I would think??


Well, without access to a phone running an old OS I can't even check it out :shock:
But I've read this on the website for "Sleep as android" (https://sites.google.com/site/sleepasandroid/doc/trouble#screen):

Unfortunately, quite a lot Android devices out there do not support gathering accelerometric data (sleep tracking) with screen-off. This is duo to a bug which is on 100% of devices with Android version 1.6 to 2.3.4, on many +2.3.5 device and even on several devices with +4.0


So I guess there is nothing I can do about it.

I don't need betatesters (yet), since I've got a lot of work left. But since there were a few people interested I figured I should make a pre-version available, since I will need some time to complete the program.

samairahsethi
Posts: 1
Joined: Tue Mar 12, 2019 9:26 am
Contact:

Re: Monitoring PLMS with a smartphone

Postby samairahsethi » Wed Mar 13, 2019 4:09 am

Excellent information here. Great help!!!


Return to “General Topics: RLS/WED”

Who is online

Users browsing this forum: No registered users and 1 guest