It’s that time of year again, and students around the world are scrambling (or have already scrambled) to finish their final projects for the semester. And, while studying for finals prevents many from sleeping an adequate amount, [Julia] and [Nick] are seeking to maximize “what little sleep the [Electrical and Computer Engineering] major allows” them by using their final project to measure sleep quality.
To produce a metric for sleep quality, [Julia] and [Nick] set out to measure various sleep-related activities, specifically heart rate, motion and breath frequency. During the night, an Arduino Nano mounted to a glove collects data from the various sensors mounted to the user, all the while beaming the data to a stationary PIC for analysis and storage. When the user awakes, they can view their sleep report on a TFT display at the PIC base station. Ideally, users would use this data to test different habits in order to get the best nights sleep possible.
Interestingly, the group chose to implement their own heart rate sensor. With an IR transmitter, IR phototransistor and an OP amp, the group illuminates user’s fingers and measure reflection to detect heartbeats. This works because the amount of IR reflected from the user’s finger changes with blood pressure and blood oxygen level, which also happen to change when the heart is beating. There were some bumps along the road when it came to the heartbeat sensor (the need to use a finger instead of the wrist forced them to use a glove instead of a wristband), but we think it’s super cool and totally worth it. In addition to heart rate, motion is measured by an accelerometer and breath is measured by a flex sensor wrapped around the user’s chest.
With all of their data beamed back by a pair of nRF24L01s, the PIC computes the sleep “chaos” which is exactly what it sounds like: it describes just how chaotic the user slept by looking for acyclic and sudden movement. Using this metric, combined with information from breathing and heart rate, the PIC computes a percentage for good sleep where 100% is a great night and 0% means you might have been just as well off pulling an all-nighter. And, to top it all off, the PIC saves your data to an SD card for easy after-the-fact review.
The commented code that powers the project can be found here along with a parts list in their project write-up.
This device assumes that sleeping is the issue, but if waking up if your problem, we’ve already got you covered, aggressive alarm clock style. For those already on top of their sleep, you might want some help with lucid dreaming.
Video of the project explained by [Julia] and [Nick] after the break.
Thanks to [Nick] for sending this in!
I need to drink some energy drinks before sleep, without them I just can’t sleep.
I also know how it feels to have deeply broken my circadian rhythm.
Interesting project. In addition I always though about open-hardware wake-up-light with sunrise simulation using Arduino and probably RGB LEDs and recorded sounds. This would require to do some analyses of colors and intensity changes in real sunrise video recording but could result in really nice solution.
My idea was to use big flat round wall mounted glass light covered with milky glass so the resulting power could be big enough to flood common room with light as with real sunrise. I hoped this would make especially waking up early in the winter much better. It could be controlled by wirelless unit using some low power radio or via Bluetooth so you can use your smartphone or something looking like common alarm clock on your bedside table.
Maybe some students will find this interesting for some school project as I still do not have enough free time to turn this idea in real device.
Alarm clock for the deaf uses a 1/8 or 1/4 hp motor as a vibrator attached to bottom of bed. It is surprisingly effective as cannot ignore it, excessively irritating. Downside is wake up angry. Put that cancel alarm button far far away… preferrably in bathroom or kitchen by coffee pot.
Simulated natural lighting. By the time you have enough light in the room, the room is getting too hot to in sleep anymore and Electric Utility may flag your home as “growing something”. Insure your wiring is full quality and outlets are not warming up due to wear with age. Check the breakers for warming too. Perhaps to avoid lighting the whole room you use a smaller light panel directly overhead…. right… doesn’t work… you can just roll over to escape it.
Are you still in bed? Oil filled pressure sensor tubed to 2 or all 4 bedposts is reliable method to see if you’ve gotten up.
Flex sensors around chest for breathing are great and will indicate the easiest solution is to “JUST LOSE SOME WEIGHT”, but also put one flex sensor on calf of each leg, may find you have PLMD aka PLMS. Ever have instances of waking up in middle of night because legs are “tickling” or “hurting”? Don’t bother with a sleep study that does NOT include monitoring the legs. Sleep docs tend to lack awareness and training on PLMS or PLMD because sleep apnea gives them plenty of income, check if they’ve gotten updated education for PLMS/PLMD this and go find a different doc if they don’t have a clue.
Pets turned out to be the best alarm clock I ever had. Forget dogs… too obedient. Cats however, don’t take ‘chit off anybody and are persistent.
If you have a diagnosis of hypersomnia/insomnia…. pay attention to the above.
“enough light”
I just meant the approx. same “amount” of light as common room lighting provides you – probably something similar to 100 W lightbulb. I currently have a LED equivalent of normal fluorescent tube (tube about 1 meter long, I think it is about 30W) on the ceiling. Not sure about the light output but it is similar to those old fluorescent tubes I used years ago.
I have a Philips wake-up light on my bedside table but it only gradually increases light output of the warm white LEDs on the small disc (about 20 cm diameter) and cannot play custom sounds. Despite this it really makes waking up better.
Many years ago I had a Soviet made digital alarm clock and the alarm sound (something between cow mooing and freight train siren) was so terrible that I always woke up before the alarm. But it was not a pleasant awakening which would make you start the new day in a good mood.
Our cat sometimes comes to sleep in my bed so rather than waking me up it would make me sleep longer during workweek :-)
You sound fine, I’m referencing the unfortunate with sleep disorders.
Cat problem simple. Change feeding to only early AM. Result will be stomping all over bed, “NOW!” not “Meow and cute rub then lay down to sleep.” Will NOT quit till fed.
Daylight alone can wake a person reliably. Camping in tent is great, no alarm needed. We evolved using the sun to set start of day. Home light bulbs are just enough to scatter the melatonin initiated cycle triggered by your eyes and get you out of step with day/night. If you try to create enough light in the home to simulate natural sunlight for morning wake-up the energy consumption and heat rise will suprise you, even with LED.
ahh, you mean this:
https://www.youtube.com/watch?v=w0ffwDYo00Q
:-D
I’m super confused, and awake… how does this help me sleep? Do I need an alarm clock?
Confusion is a symptom of sleep deprivation.
Getting up on schedule is more than half the solution to re-establishing a normal sleep cycle. Everybody seems to remember the other step of trying to go to sleep, (not at the right time though), but not the getting up step.
You need the sun instead of these artificial tick-tock waking apparatus. With the right window it’ll get you up. Too bad most of the world takes a perfectly good, perfectly natural rise time phenomenon like the sun and destroys it with local daylight saving corruptions. It’s a plot! They care less about us than they do about trains and conductors that can’t do math.
Next… quit all these little artificial electric suns you bribe with $ to keep you up. Keep ’em, but corral them after a certain hour. What hacker does not have dimmers?
The problem with designing/using devices to measure ‘sleep quality’ or to try to improve it is, they are based on assumptions about sleep that have yet to be proven conclusively. It assumes there is some overall general ‘heart rate and breathing and activity’ correlates with what they report as a good nights sleep, which is entirely subjective. ” “Sleep trackers” from Fitbit and the like only record ‘activity’ using an accelerometer. You still have to tell it when you go to bed, and when you wake up – and it is only that information that a doctor will use, something that can be recorded with pen and paper. The technology gives the user a sense of ‘science’ when in reality it only really has merit for already-diagnosed disorders like night terrors, sleep walking etc..
We have all heard the ‘sleep cycles are 90 minutes’ thing, its bollocks. In fact the definition of ‘sleep cycle’ is really down to who reads the electroencephalogram, and can vary greatly from person to person. Then there’s how much sleep? The common ‘7 to 9’ hours is based on how much most people get, not what is actually required or ‘good’ for us. It might sound like semantics but it matters because it means people assume we know a lot about sleep, when really we don’t.
I’m not trying to piss on their chips here, good on them for trying to collect data from as many possible sources from people with suspected or known sleep problems. If they can get a large enough data-set I hope it furthers our understanding in some way. should they engineer it to be less invasive, and have reasonable repeatability (= reliability in the data) it will help with adoption. As long as marketting doesn’t get in the way.
I’ve used about 5 different sleep tracker watches – 2 Fitbit, 3 cheap ones (one because it was cheaper than a new band for the Fitbit :-) The Fitbit and the latest cheap Chinese one use your motion to detect when you’ve gone to sleep (the other two needed you to tell them, which is so not the point.) The two Fitbits usually agreed on when I went to sleep and got up, but differed widely on sleep quality (one thinks I’m awake about 1/3 of the night, the other generally tracked what I remembered of waking up.); the Chinese one thinks I’ve gone to sleep if I’ve sat in one place not typing much, and not much convinces it that I woke up or shifted at night.
“And, while studying for finals prevents many from sleeping an adequate amount, [Julia] and [Nick] are seeking to maximize “what little sleep the [Electrical and Computer Engineering] major allows” them by using their final project to measure sleep quality.”
Learning the skill of time management.
Should add a camera to the mix to watch for state changes in the sleep cycle. Things like tightening and loosening of the eyelids as well as eye motion allow you to estimate what frequency of sleep the user is experiencing. There’s a specific progression of frequencies that allow for reaching rejuvenating sleep most effectively and while it’s no ECG, the eyes still reveal a lot even when closed. Used that approach when experimenting with light glasses and refining patterns that help induce an awakened or sleepy feeling. It’s surprising just how much control over sleep you have when you have scripts controlling LEDs from a laptop’s LPT and Serial ports.
How would you manage to have the camera record state of the eyes at least most of the time? While there would probably not be problem with the light – you can use BW CCTV camera with IR light – there would be problem with changing the position of the sleeping person during night.
I remember I once woke up with my head on the other side of the bed. Maybe something like this could help better:
http://www.instructables.com/id/DIY-EEG-and-ECG-Circuit/