Calibrating the device is easy. Start by examining your bed for a “safe” spot, where the phone can be left for the night. It has to be on your mattress. Next, find a source of power to keep the phone charging through the night.
Quick Calibration
This option is the quickest and easiest. The phone does not have to be at rest. Simply click “Quick calibration” and wait for the calibration bar to fill up. The calibration activity closes after it is done (may take a few seconds after the bar fills up).
Note: On some Samsung and Droid phones, the bar fills up very slowly. In such cases, take the phone and gently roll it around in your hand until the bar fills up. I tested this on a Droid phone and it took about 60 seconds.
Extended calibration: Pass 1
Some phones will require more precise calibration, as the built- in filter may not work for your device. In such case, you will need to perform an extended calibration:
- go to Preferences:Calibrate device sensors.
- Change calibration duration to 15 minutes.
- Click calibrate accelerometer
- On the accelerometer screen touch “extended calibration”
- Wait for the yellow bar to fill up, graphs will be shown after that. If your phone’s graph does not fill up, you may have to move it yourself. (I still need to test this).
When you see output like this, you can calibrate the app’s filter:
Now you may move the phone slightly, the graph will update next minute and show your movement. The image below registers device being rolled around in my hand. Notice that the blue line follows the output slower, resulting in larger activity count.
The goal is to find a value of R (Kalman Filter process noise covariance) high enough to produce output close to 0 when phone is at rest, yet responsive enough to movement. For example:
- I start the app and leave it flat on a desk without vibration.
- After a minute, I look at the calibration output. The activity counts (below the graph for each axis) that I see are: xFiltered Low R 15000, xFiltered 1000, xFilteredHighR 50;
- Activity counts for both xFilteredLow and xFiltered are too large for phone being at rest. I would like to reduce them. To do so I’ll need a new value of R
- The difference between the value of R for filtered, low filtered and high filtered is 10 times.
- This means that if the filter uses value R =0.0004 to filter the X axis output, the low R is 0.00004 and high R is 0.004.
- Based on the numbers I observed, I know that the output should be close to 0 when the phone is at rest on a table.
- To reduce the activity count output, I need to make R parameter larger. It is easy – I just assign the high R value for the next iteration.
- To change the value, I open the menu (menu button>Adjust R)
- I multiply the current value by 10: instead of 0.0004 I enter 0.004 for x R.
- I repeat the process, tweaking the R value until the app shows activity count close to 0 on all axis when the phone is at rest.
I then test the app with light vibration. Activity counts should be significantly higher than 0. If they are not, I may proceed to lower the R value for the axis which does not respond to vibration.
Extended Calibration: pass 2
Now that you have tweaked the value of R for your phone, you may leave the phone in an extended calibration mode for 15-60 minutes (configure this in preferences>Calibrate Device Sensors>Calibration Duration). This will adjust the sleep scoring constant based on the output of your device.
The default settings produce a constant of 0.0034, which is suitable for most beds and devices. If your bed is really stiff, you may want to lower the sensitivity threshold: Preferences> Sensitivity Tunin> Adjust Cole constant. Then Override cole constant.
The default setting is anything less than 44 activity counts a minute will be considered sleep. If your bed is stiff, you may wish to lower this value to 25 or so.
, so the app is more responsive to small movements.




Pingback: Lucid Dreaming App Calibration fix » Lucid Dreaming App
I can’t seem to get it to work through a complete extended calibration. I’ve had it on my bed for up to an hour and the bar has hardly moved. I have it set for the 7 minutes. Am I doing something incorrectly? I do have an air filter which is fairly noisy but I use it at night so I thought it should be on to be consistent.
Hi Jeanette,
If your app would not calibrate (some Motorola or Samsung phones for example), you may download the latest version of the app from the market and use “quick calibration” button to calibrate the app. To do so, you need to pick up the phone and roll it in your hand until the calibration bar fills up and the calibration activity exits to the clock screen. It should only take 60-120 seconds to do that and you are set!
Dear Alexander,
first of all congratulations for developing this app – this is finally the degree of detail in movement analysis that I every wanted to experience for an app.
Although I like the nice overview given in the app “Sleep-as-an-Droid” by summarising the overall sleep dept and giving the movement graphs of the nights together with the evaluation “stars”, there is much in-depth information missing in that app. His “sleep-stats”-addon-app is -although there is money charged for- only giving simple summaries and has some serious statistical mistakes.
But back to your application. I like how much effort and detail you put into developing this app. I spent several evenings with handling your app and I think I still have some issues with calibration.
I am using two mobile devices: Motorola milestone and a Viewsonic PAD, both placed on my matress and connected with the power supply. While I have some general issues with grounding in my flat (therefore I can not operate the touch screen properly while connected to power), this works fine and I do not need to take care of the issues with dimming and battery discharging.
Now, I tried the detailed calibration for about 20 minutes on both devices. While the audio level and the amplitude of movement is about the same measured on both devices, I get different results on filtering the REM-phases.
With the quick calibration I get results that are similar and ok, but I wanted to fine tune the motion detection. After the extended calibration I get on the Viewpad a detection of a non-interupted sleep thoughout the whole night, while the milestone reports that I just had 1h of REM phase out of 8h spent in bed.
I uploaded the data from both devices today by using your “scientific contribution” app, but maybe it is a better idea to send the files directly to you?
Last but not least: 11 years ago I was in charge of motion analysis at a motion capture lab in the university, so I am keen on discussion some aspects of motion analysis later on when both of us have time.
By the way: Probably due to just dealing with the subject of lucid dreaming I already achieved my first lucid dream last week while your app was recording
Cheers,
Frank.
Hi Frank,
It’s great that you had your first lucid dream !
You are getting different data on two phones, because their accelerometers have different resolution and they may sample the data at different rates. When the app is running, you may select “list” from the menu and see minute by minute data that the app is collecting. One piece of this data is how many events the app processed that minute.
This difference in the frequency of events causes the underlying filter implementation to behave slightly differently. In the latest version of the app I’ve added the “R” parameter to the calibration (available from the menu). There”s a description of how to adjust it here: http://luciddreamingapp.com/help-how-to/calibrate-the-app/ The goal is to raise R enough, so it produces close to 0 activity count while the phone is motionless and large (over ~150) activity count while the phone is slightly moved (ex: you turned over on your bed).
After you adjust R, you may calibrate the app again for a few minutes.
Hi! Thanks for your hard work at developing the best lucid dreaming ap
I have a ZTE Blade (it’s not the best device, I know xD) and I already, have 5 nights of analysis and in all of them I have a lot of noise (pretty normal) but the XYZ activity and sleep score is 0 almost all night. It must be an error because I ALWAYS move while sleeping xD
So, I’ve calibrated the app many times, but every night it has the same error. Also I’ve tried to override Cole constant to a lower value, and still 0.
I think there’s no problem with my accelerometers because they are pretty sensitive on the calibration process.
Some help please? Thanks!
hi,
It looks like after calibration all the values are 1.
When trying to capture my sleep at night, al it gives is one big line (blue) which tells me that I haven’t moved at all during the night…
I find that hard to believe…
I’m using the HTC Desire with the Leedroid ROM.
If you go to list view at night, are all of your sleep score values staying at 1.000? or are they above 1?
Hi,
Thanks for the replay, would it help if I send you my graph?
Sorry, I cannot diagnose calibration issues based on the graph alone. For that, I need a physical device to see what’s causing the accelerometer to behave randomly, and I only have access to one smart phone.
First of all, I have to thank you for your hard work.
Then there’s an issue. I have SGS II and I can’t get past extended calibration stage. It’s impossible to change R, since after touching “change”, even if nothing was changed, it briefly displays 4.0… or something (like the way small amounts are measured), and when I open the adjust R menu again it’s back to default.
At the comletion of quick calibration, there’s no clock screen, actually the screen turns off.
BTW the bar is green, not yellow. Not like it matters.
Hey,
i have the following Problem with calibration:
I have a se Xperia Mini Pro btw.
the x and y values are fine. The lines are approximately 0 at rest.
the z valus reacts to shaking and moving. The line looks pretty smooth too. Unfortunately i have an offset of +10. Is this negatively affecting measurements? How can i correct this?
Thanks.
The Zvalue reflects the acceleration of gravity, which is 9.8 meters per second, pointing towards the center of the earth. This is why the Z axis has a certain offset. The user acceleration is measured as a change in acceleration. I wouldn’t worry about the Z axis, as it is the least sensitive axis for measurements from the mattress!
Thank you for your response alexander.
Minutes after i hit submit comment, I recognized the value, which is abput 9,84 on my phone as the gravity constant. thanks for your response anyway.
My other issue with your app (which is absolutely great) is on the schedule for the next version: filtering out background noise. The audio level kurtosis messes up the first impression of the graphs, because it has lots of spikes (my room is very quiet… apart from my midnight brabbling).
Hi,
first of all congrats… Great job… Now the issue. I have the same problem as Alex above. I can not change R… After touching “change”, even if nothing was changed, it briefly displays 4.0… or something (like the way small amounts are measured), and when I open the adjust R menu again it’s back to default. I have HTC Desire HD phone…
Thanks for answer… (and app
) I hope we will fix it somehow
You should not be trying to change R. That parameter should only be tweaked if your app does not produce an expected sleep graph. I’ve tested with the Desire Image, and it should be working. R is primarily for Droids and Samsung phones that are finicky
I having problem calibrating my phone.
At nights it says I have 0min sleep time, and the graph is going crazy.
I have been playing around in this extended calibration mode and think the X and Y are ok. But the blue line on Z is laying around 10 all the time, it has spikes that looks ok, but it seams to has 10 as a strat poin and not zero, and what ever i am doing it wont stop ”evolving” around 10. is this ok aslong as the blue line seams to react correctly? exept its always on 10..
Anyway thanks seams like a great app!
I read its a gravity constant now, sorry about that!
AMAZING app, so happy you made it.
I also have questions about calibration, i’m using a Galaxy s 2 and I can’t seem to get the calibration running like your graphs are doing. Also would sleeping with a fan on mess up all results? Because usually I do sleep with a fan on, is there a setting for that?
My graphs are all messed up when i look at them in the morning.
Thanks in advance!
If the graphs are messed up, you need to adjust the app’s sensitivity. There’s a link to that in help and how-to. I hope at one point I will have enough energy to fix that setting and make it more intuitive.
Thanks for the quick response. How long did it take you to put this app together? so would sleeping with a fan on mess with the results or would the audio level just be high?
The app does not process audio signal, just displays it for your reference.
The Android app was developed over 2.5 moths (March 15 2011-may 30 2011), working 12+ hours a day, the iPhone app was started with the Android base and was developed over 2.5 months, also with 12 hours a day of development work.
Thanks. Great app
Hello Alexander.
I’ve got a Samsung Galaxy S and after I start the app and leave it flat on a desk without vibration, it shows 0 for all the axis (not matter how Low I set the R value). While turning it gently in my hand gives a general value of 73.
You said that while doing an extended calibration, the values should tend to be 0 while the phone is at rest, but no exactly 0. Is this normal?
If you tap the desk/bed, the phone should pick up the vibration and register 5-10. 73 seems really low for rolling the phone in your hand, you should be seeing number in the 1-2k range. Seems like you need to increase the sensitivity of your device.
Hello, how do you increase sensitivity? The cole override actually decreases sensitivity? thank you and sorry for my english.
Hi
Thanks for a great app.
All was working well on my galaxy tab 10.1. But after about 5 nights the graph is showing strangely, funnily enough the same as its showing on my galaxy s 3. It basically shows the far left axis (total sleep duration) down to -1.0 so that means my sleep line sits in the middle at 0.0 as the axis goes up to 1.0.
I keep trying to calibrate but with no success. Do you have any tips on this as it did work for the first few nights and now it doesnt display properly.
Cheers
Tony
The only thing I can think of is that the app does not calculate total sleep duration correctly, and don’t really know how to fix that. With the Android app, you can re-install it, and all of your graph and configuration data would still be saved on the memory card, so you can view it again. Maybe this would help
Hi,
First of all thank’s for your work.
But I have a problem with the z axis calibration. I always get a straight line on 10 on the graph but the Activity count is low <50.
Is it normal?
Accelerometer measures acceleration, and acceleration along the Z axis is -9.81 due to earth’s gravity, so the app is working correctly.