This is the first real step forward in creating an intelligent alarm clock, the final project for my Computer Interfacing course.
The idea is to have the clock monitor body movements and go off when you're in "light sleep," rather than at a fixed time. The obvious advantage of this is you will wake up feeling good every morning. This project was inspired by the iDreamSaver Kickstarter project.
From "Evaluation of Body Movement During Sleep Using an Infrared Motion Sensor" K.Jo, H.Hagiwara, Transactions of the Japanese Society for Medical and Biological Engineering:
Analysis of the relationship between body movement intervals and depth of sleep showed that the interval between body movements was longer during deep sleep and shorter during light sleep.
I got a PIR Motion Sensor yesterday and hooked it up to my Arduino and wrote a sketch to print the timestamp to the serial terminal whenever motion was detected. (View Source) I then wrote a Powershell script to input from the serial port and write the data to a text file. (View Source)
This morning I put the data into Excel and plotted it. This is what I saw:
This graph shows an "x" at every point throughout the night where the sensor detected motion. Not very useful but we do see some areas where there are groups of "x"s and some areas where there are very few.
I then ran the data through a PHP script to group the data into number of motions detected (limited to 1 per second) per minute. (View Source) Graphing this shows something more interesting:
Here we see after about 30 minutes body motion was minimal. This suggests I was in a deeper stage of sleep during that time. This is in line with what Hagiwara and Jo report in their paper. (I was only able to find the abstract in English so I was not able to get the details of their findings.)
The spike at 250 minutes (around 4:30AM) is when I woke up only to realize I could sleep for couple of hours longer. I recall the time being 4:38 when I looked at my clock and I was already facing it. This means I turned around to face the clock but actually "woke up" 8 minutes later to see the time, and then turned back around (indicated by the shorter spike at 265).
The data suggests I was not able to sleep very well (compared to the time period between 30 and 240 minutes) after waking up once and finally got up at 400 minutes (7:00AM), when I shut everything down.
This is really cool! I'm a little surprised at how well it worked. The most interesting part of the graph is the spike at 250 minutes when I woke up to look at the clock. I hadn't made the connection between the two until I realized 250 minutes was around 4 hours and I remembered waking up at around 4:30!
I'll be posting more often with updates on this project. Stay tuned!