Real Easy Morning R.E.M.

Group Members: Patrick Essner groundattack David Wright lespaul.

Our project is designed to help people wake up during a lighter stage of sleep so they will be able to wake up feeling more refreshed and alert. Studies show that during R.E.M. sleep people are the most awake, and they wake up much more alert.

The main feature of R.E.M will be an alarm clock. The user will set a window of time they would like to be woken up in. During the window whenever the user enters REM sleep the alarm will sound. If the end of the window is reached without the user entering REM sleep then the alarm will sound.

Background

There are 5 stages of sleep: Stage 1, Stage 2, Stage 3, Stage 4, and Rapid Eye Movement (R.E.M.). When a person first falls asleep they go right into Stage 1 and then proceed in order to Stage 4 and then backwards to Stage 1 again. After Reaching Stage 1 for the second time the next stage is R.E.M. From here the stages of sleep continuously cycles from R.E.M. to deeper states of sleep and then back again. The odds of getting into stages 3 and 4 decrease everytime the cycle is traversed. This causes the length and frequency of the R.E.M. stage to increase. A graph of the sleep stages versus time is shown below.

The R.E.M. stage, followed by stages 1 and 2, is the lightest stage of sleep and therefore will be the optimal time to wake up.

It is proven that heart rate increases during R.E.M. sleep. Your resting (awake) heart rate should be about equal to your R.E.M. heart rate and all the other stages of sleep have a much lower heart rate. R.E.M. sleep is when you dream which gives you brain the effact of being awake which is why your heart rate raises back to your resting heart rate level. The graph below shows average heart rate for each stage of alseep as well as the resting heart rate.

Goals

  • Have an alarm window in which the user chooses the start and end time.
  • Monitor heart rate throughout the night, and use that data to calculate the heart rate which will be considered the low cutoff for REM
  • Sound alarm when the users heartbeat goes above the previously calculated level, or sound it at the end of the window if the heartbeat never goes above that level.
  • Use itunes music as an alarm.

Components

Our project is using all off the shelf products. The main component is the ez430-Chronos Sports Watch made by Texas Instruments. Information on the ez430-Chronos can be found on its Wiki. We use the usb emulator, pictured top right below, that came with the ez430 to connect it to the computer to program and debug. The RF access point, pictured bottom right, is used to transmit live data from the ez430 to the computer for processing.

BMI innovations teamed with Texas Instruments and made a wireless heart rate monitor specifically to be used with the ez430. Information on the chest strap including the user guide and data sheet can be found here;

News

1/14/10

We have started the basic logic of the alarm clock that doesn't require the hardware.

1/16/10

Downloaded the IAR Embedded Workshop program to write code to the watch. Read a few sections in the user's guide and looked at some basic tutorial programs.

1/21/10

Started coding the logic changes. Most of our work is being done in the alarm code. We have changed the functionality of the alarm by adding a start window to the alarm. Right now we have it predefined as 5 min, so we can test it. Eventually we plan on allowing the user to chooses the length of the window. We are using a simulated heartbeat to do testing. If the simulated heartbeat goes above 65 bpm (REM Heartbeat) during the alarm window, the alarm will go off, otherwise it will go off at the end of the window. The 65 bpm is arbitrary, our goal is to have the REM heartbeat calculated during sleep before the alarm window.

The coding that we have done is posted here.

A demo of what we have done is on YouTube.

1/25/10

We have added the functionality for the user to set a window time rather than it being pre-determined. When setting the alarm on the watch it used to display the alarm time on the top row and nothing on the bottom. It now displays what the window time is set to. It can be changed in the same way as the alarm. We tested some conditions to make sure it functioned properly and the things we found are as follows:

  • The window has to be set before the that time passes. For example, if the window is set for 1:00 pm at 1:05 pm it wont start the window till 1:00 pm the next day.
  • If the user wants to use the regular alarm without the heartbeat monitoring, they can disregard the time the window is set for, as the alarm will go off at the alarm time regardless.
  • When in the window the heartbeat is checked every minute.

The coding that we have added or modified is posted here.

A video of our progress is now up on YouTube.

1/27/10

We implemented a possible algorithm for determining the heart rate at which the user's current heart rate must be above to conclude that the user is in R.E.M. sleep. Now it is set so that when the user turns on the alarm the watch will start calculating the average heart rate at the beginning of each minute given that the watch is receiving a signal for the heart rate. If the watch is not receiving a signal then the average will not be affected. If the heart rate monitor were to suddenly stop transmitting for a duration of time during sleep, the average would simple not include any data points from that time period.

When the window begins then every minute the watch will check to see if the current heart rate is above the average. If the heart rate is above the average during the window then the alarm will sound, otherwise the alarm will simply sound at the end of the window. The average algorithm should work given the research that we have done, but we will see if it needs to be modified once we begin collecting data ourselves.

The coding that we have added or modified is posted here.

2/1/10

We had trouble recording data over the period of one night. The monitor needs to stay in complete contact with your skin to record data and if connection is lost, it will stop recording. We have half a nights worth of data which is pictured below. This shows that our function for detecting REM will work. Tonight we are going to tape the monitor to the subject to try and keep contact for a full night, so we have a full nights worth of data.

You can see that the first 30 minutues of the captured data fluctuates greatly between 60 and 80 bpm, this is when the test subject was still awake. Then when the subject falls asleep the heart rate levels off at around 60 bpm. The data spikes at about an hour after falling asleep which is right where our research predicted that the subject would reach the R.E.M. sleep stage. Right before the data is cut off the heart rate looks like it is starting to spike again which matches up almost perfectly with our research as well. Although our data did not record for the whole night, it appears to match our predictions extremely well.

The average heartrate recorded is 62.557 bpm, however it is pretty clear that a good heart rate level at which the watch can conclude that the subject is in R.E.M. sleep is much higher than the average.

2/3/10

Based on our findings we decided that a good heart rate to conclude the user is in R.E.M. is 10 bpm above the average. We have another set of data from another users sleep below.

After analyzing the data, we were able to determine where the R.E.M. stage occured in each set of data. The two sets of data were resized accordingly and placed below the graph of sleep stages versus time so that they are easier to analyze. Highlighted in the red rectangles are the portions of data in which the user has entered R.E.M. sleep.

The thin grey lines that run horizontally across the heart rate data are seperated by 10 beats per minute. It is easy to see that the R.E.M. stage has a significantly higher heart rate level than all other stages of sleep so it should be fairly simple to detect the R.E.M. stage. Each set of data was collected from a different user and it shows that the length of the R.E.M. stage varies from person to person. Even though the two sets of data look quite different, the watch should have no problem finding the R.E.M. stage for either person.

Future

Make itunes play as the alarm.

Remove the unused functions on the watch and make it a more user friendly application to use.

 
Back to top
projects/realeasymorning.txt · Last modified: 2010/02/04 00:25 by lespaul
 
 
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0