16

Ignore the stalker-like title.

I am thinking about creating a project with Arduino that can sense you sleep habits, when you're asleep, and how much you sleep. It would be convenient to not have to turn it on/off at night; it should know how to do this.

Some ideas that I have:

  • Motion sensor
  • Breathing patterns (if an Arduino microphone could even pick that out... I would be surprised if it could)
  • A RTC clock could assist in deciding It's midnight. Usual, Steve isn't asleep at this time on Fridays. He's probably not sleeping now. It won't always be there to help you, but you might be able to try to get more accurate results this way

How can I accomplish this? (Extra points for some sort of algorithm that can tell dozing off from a deep sleep.)

Anonymous Penguin
  • 6,365
  • 10
  • 34
  • 62

1 Answers1

13

I actually did something like this, using a PIR Motion sensor.

The motion sensor is good enough to detect a person turning in their sleep, and my simple algorithm just counts movements per minute and when its over a threshold (found by trial and error), it sounds the alarm to wake you up.

enter image description here

The image above represents my body movements during a night. The spikes represent a high movements/minute.

Here we see after about 30 minutes body motion was minimal. This suggests I was in a deeper stage of sleep during that time.

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.

Here are a couple of posts from my blog that have a lot more information.

sachleen
  • 7,565
  • 5
  • 40
  • 57