Quick link to the project page RealEasyMorning. Back to my home page.
Starting out
1/10/10
My partner and I had decided on a project idea and began planning. Our project is to design and build an alarm clock that will monitor your heart rate and wake you up at a time when you are most awake during your sleep cycle. We have decided that our price range will probably be around $30 - $50. We also have set up our IRC accounts and tested them.
Week Two
1/14/10
We have received the watch that has the ability to receive a wireless signal from a heart rate monitor. We have been reading a lot about how the watch works and are still trying to figure out how to program it. The programming portion will be done in Eclipse which is helpful because both Pat and myself have some familiarity with Eclipse. We began coding the 13th so that we won't be behind when we get the watch up and running.
1/16/10
Today we realized that we can not begin coding until we obtain all of the existing code from the watch. The watch has a micro controller built in and all of its applications are programmed into it. We will need to access the code and add functions that will manipulate the existing code. We are in the process of acquiring all of the already written code and analyzing what each part does.
1/17/10
After learning more about the watch, it seems that there is a “data logger” mode which allows the watch to recieve information such as the constant heart beat from the sensor and store it within the watch. We will need to have this information transferred to the computer so that we can analyze patterns and try to figure out the optimal way of detecting R.E.M. sleep. Also we need to set an alarm off when R.E.M. is detected but the alarm opperates in a different mode. We are hoping to be able to write our own mode so that we can perform all of these things without requiring the user to manually change modes on the watch.
1/18/10
We downloaded all of the original code for the watch and tried to make a simple change to the alarm function but an error message came up that said access denied. We can't change any of the code but from what the user guide says it seems like we should be able to. The coding shouldn't take too long to complete, however, we still need to figure out why we can't change any of the original code.
1/19/10
Tonight we finally were able to save our changes to the original watch code. We had to create a new folder on the desktop and copy the watch code files into it and change to properties so that its not read-only. We will start coding tomorrow.
1/20/10
We ran into yet another problem today, the alarm was not working on the watch. We tried reloading the original code onto the watch but for some reason the alarm would still not go off. Fortunately for us there was more than one watch ordered and we tried a different one to see if it was a hardware problem and as it turns out it was. The new watch worked so we are going to put the code one the new one instead.
Week Three
1/21/10
We worked all day today on the code and got a lot accomplished. We were able to adjust the alarm function so that when you set the alarm time a five minute window is actually created starting five minutes before the alarm time. Then the watch reads in the wireless signal from my computer simulating a heart beat (the actual heart rate monitor should be coming in shortly). If the heart rate rises above a specific rate (currently it is set to 65) then the alarm will sound if and only if the time is within the window. If the heart rate never goes above 65 beats per minute then the alarm will go off anyway at the time that the user set the alarm for.
1/25/10
This weekend we programmed the watch to be able to receive a user input for the window starting point as well as the alarm time (the end of the window). In an attempt to make setting the window and alarm time as easy for the user as possible we were able to have the alarm time appear on the top line of the display and the window time appear on the bottom line. This way both times are shown simultaneously and it is easy to see the times that have been set. We also spent a lot of time running tests to make sure the alarm works the way we want it to in all different situations. Some of the tests we ran included: one where we set the window time to a time after the alarm time, and one where the watch was not picking up a wireless heart rate signal. In both of these cases the alarm went off at the specified alarm time (the time designated for the end of the window). These two tests for example, were used to make sure that if something was not set up correctly or if you just wanted to use the regular alarm function without the heart rate monitor, the alarm function still works. Tomorrow we plan on figuring out how to store data with the data logging feature so that once we get ahold of the heart rate monitor hardware, we will begin to start running tests immediately.
1/27/10
Today we worked on an algorithm for calculating the desired heart rate at which the watch can decide if the user is currently in R.E.M. sleep. Because we still haven't received the heart rate monitor in the mail yet we can only guess from our research what a good algorithm would be. Right now we have coded a function that calculates the average oheart rate being transmitted while the alarm is turned on and if the current heart rate rises above that average while in the user specified window then the alarm will sound. We have tested it using my computer to simulate a wireless heart rate and all the tests have gone accordingly. We even coded in a way to make sure that if the alarm is on and the transmitter is not then the average will not be affected. Next we are going to look into replacing the alarm sound from the watch with a wireless signal to trigger iTunes to play a specific song.
Week Four
2/1/10
We finally received the heart rate monitor and we were able to collect some data. Unfortunately we ran into more problems. We tested the data logging function on the watch so that we could begin collecting data and everything worked perfectly so far. But when we tried to collect data during sleep we awoke the next morning to find that no data was recorded. We played around with the heart rate monitor a lot to figure out what went wrong and found that when you roll around in bed sometimes you loose the signal which might cause the heart rate syncing function to turn off. The next night we tried putting on the chest strap a little tighter to prevent it from moving around as much and we were able to record for half a night. The information is posted on the project page.
We are going to try a third time only with the strap taped on. Although this obviously is not how we want our finalized project to work, we are virtually no time left and we still need to record more data so we need to be certain that data will actually be collected. My partner Pat wore the strap the first 2 nights and I am going to wear it tonight (Monday Feb. 1st) so that we can see the difference in heart rates between different people. From the data we recorded last night it appears that our average function will not work as well as we had hoped. We have an idea to make it more accurate but we need to collect data from myself first to make sure our new algorithm is not specific to Pat's heart rate.
2/3/10
I wore the heart rate monitor to bed and logged the data. Only 3 hours had been recorded once again but we got enough information to analyze and make our final changes to the code. After collecting my sleeping heart rate data we compared it with Pat's and we decided that adding 10 bpm to the average should produce an accurate heart rate level to determine whether or not the user is in the R.E.M. stage. We changed the algorithm and now everything should be able to work together. The only problem is that the heart rate stops transmitting after 3 hours. We searched through all the code and could not find any functions that would turn off the heart rate monitor. I wore the monitor during the day while it was transmitting and was careful not to make any movements that would cause a disconnection. The heart rate was successfully transmitted for over 4 hours and we decided that the problem is that the connection is lost while tossing and turning during sleep. It appears that the heart rate monitor that we have was not made to be worn while sleeping and until we can acquire one that is we will not have a reliable product.
We also looked a lot into making iTunes work with the alarm but had no success there. We were able to get the watch to sync up with the computer when the alarm goes off and at that point all you have to do is hit one button on the watch to start playing music. We figured out how to trigger that button press and what function we need to trigger the button press in, however we could not gain access to that function. The only way to get the iTunes to start playing automatically is if we can change that function but the function definition is not located in the workspace where we can access it. The only way I can think of to make iTunes work is to somehow find out everything that the function does and create an exact replica of it ourselves so that we can modify it that way. Without more time or information there is no way for us to daccomplish that.