A Sleep Monitor For Minimum Outlay

There are a variety of instruments used in sleep studies to measure bodily activity during sleep and consequent sleep quality. Many of them use techniques that perhaps aren’t so easy to replicate on the bench, but an EEG or electroencephalograph to measure brain waves can be achieved using a readily-available module. [Ben Jabituya] shows us a sleep monitor using one of these modules, an EGG Mikroe Click.

The brains of the operation is an Adafruit Adalogger Feather M0, which is hooked up to a headband containing the sensing electrodes. The write-up gives us a round-up of the available boards, which should be handy for any experimenters in this field. The firmware meanwhile was written using the Arduino IDE. It collects raw sampling data to an SD card, and one surprise comes in just how relatively small a space it requires to store a night’s results.

Finally, a Python script was used to process the data and turn it into a spectrogram to look at brain activity through the night. He envisages using the device for triggering lucid dreaming during REM sleep, but we can see it might be rather useful for sleep disorder sufferers, too. Take a look at it in the video below the break. Continue reading “A Sleep Monitor For Minimum Outlay”

AI-Generated Sleep Podcast Urges You To Imagine Pleasant Nonsense

[Stavros Korokithakis] finds the experience of falling asleep to fairy tales soothing, and this has resulted in a fascinating project that indulges this desire by using machine learning to generate mildly incoherent fairy tales and read them aloud. The result is a fantastic sort of automated, machine-generated audible sleep aid. Even the logo is machine-generated!

The Deep Dreams Podcast is entirely machine-generated, including the logo.

The project leverages the natural language generation abilities of OpenAI’s GPT-3 to create fairytale-style content that is just coherent enough to sound natural, but not quite coherent enough to make a sensible plotline. The quasi-lucid, dreamlike result is perfect for urging listeners to imagine pleasant nonsense (thanks to Nathan W Pyle for that term) as they drift off to sleep.

We especially loved reading about the methods and challenges [Stavros] encountered while creating this project. For example, he talks about how there is more to a good-sounding narration than just pointing a text-to-speech engine at a wall of text and mashing “GO”. A good episode has things like strategic pauses, background music, and audio fades. That’s where pydub — a Python library for manipulating audio — came in handy. As for the speech, text-to-speech quality is beyond what it was even just a few years ago (and certainly leaps beyond machine-generated speech in the 80s) but it still took some work to settle on a voice that best suited the content, and the project gradually saw improvement.

Deep Dreams Podcast has a GitLab repository if you want to see the code that drives it all, and you can go to the podcast itself to give it a listen.

Rock-A-Bye Baby, On The Mechatronic Crib Shaker

While an engineering mindset is a valuable tool most of the time, there are some situations where it just seems to be a bad fit. Solving problems within the family unit would seem to be one such area, but then again, this self-rocking mechatronic crib seems to be just the cure for sleepytime woes.

From the look of [Peter]’s creation, this has less of a rocking motion and more of a gentle back-and-forth swaying. Its purpose is plainly evident to anyone who has ever had to rock a child to sleep: putting a little gentle motion into the mix can help settle down a restless infant pretty quickly. Keeping the right rhythm can be a problem, though, as can endurance when a particularly truculent toddler is fighting the urge to sleep. [Peter]’s solution is a frame of aluminum extrusion with some nice linear bearings oriented across the short axis of the crib, which sits atop the whole thing.

A recirculating ball lead screw — nothing but the best for [Junior] — and a stepper drive the crib back and forth. [Peter] took care to mechanically isolate the drivetrain from the bed, and with the selection of the drive electronics and power supply, to make sure that noise would be minimal. Although thinking about it, we’ve been lulled to sleep by the whining steppers of our 3D printer more than once. Or perhaps it was the fumes.

Hats off to [Peter] for a setup that’s sure to win back a little of the new parent’s most precious and elusive commodity: sleep.

This Bunny Reminds Toddlers That It’s Night Time

It’s easy to spot recent parents, they are the people who look as though they haven’t slept in months. Sometimes the little bundle of joy responsible isn’t even a babe in arms but a toddler; old enough to wake up and find their parents for some solace but not old enough to understand that not everyone is up for being woken at 3 am. [Eyal] approached this problem in some style, by modifying a rabbit night light to indicate the time by changing colour, reminding the youngster when it’s a bit early to be rousing the grown-ups.

The bunny in question is a plastic moulding, sold with a white LED providing illumination, This was removed, and replaced with a rather nice custom PCB sporting a ring of addressable LEDs surrounding a Wemos ESP8266 board. In the darkest hours of the night, it is lit as a soft red to indicate sleep time. When an appropriate wake-up point is reached it bursts into a vibrant light show of many colours. Thus the recalcitrant early-riser can be taught to give Mum & Dad a little rest through the medium of light and colour.

This isn’t the first kids night light we’ve seen, indeed some of them have been rather elegant.

DodowDIY Is A Homebrew Sleep Aid

The Dodow is a consumer device that aims to help users sleep, through biofeedback. The idea is to synchronise one’s breathing with the gentle rhythm of the device’s blue LEDs, which helps slow the heartrate and enables the user to more easily drift off to sleep. Noting that the device is essentially a breathing LED and little more, [Daniel Shiffman] set about building his own from scratch.

An ATTiny85 runs the show; no high-powered microcontrollers are necessary here. It’s hooked up to three 5mm blue LEDs, which are slowly ramped up and down to create a smooth, attractive breathing animation. The LEDs are directed upward so that their glow can be seen on the ceiling, allowing the user to lay on their back when getting ready for sleep. It’s all wrapped up in a 3D printed enclosure that is easily modifiable to suit a variety of battery solutions; [Daniel] chose the DL123A for its convenient voltage and battery life in this case. The design is available on Thingiverse for those looking to spin their own.

It’s a neat example of where DIY can really shine – reproducing a somewhat-expensive gadget that is overpriced for its fundamental simplicity. Now when it comes to waking up again, consider building yourself a nifty smart alarm clock.

Counting Is For Sheep: Use A Light To Fall Asleep

How do you get to sleep at night? For some of us, it can be the most difficult thing we do all day. Worrying about falling asleep and letting other intrusive thoughts in night after night only compounds the problem, as less sleep leads to depression which (for us) leads to even less sleep. We lay there, trapped inside a vortex of churning thoughts, imprisoned in a mind that feels like it’s malfunctioning and half-wishing for a future where instructor-led meditation videos can be beamed to the insides of our eyelids. In the meantime, there is FADing, the Fall Asleep Device.

FADing takes its cues from a relaxation technique that uses light to focus your attention and control your breathing. The light’s intensity waxes and wanes on a schedule designed to get you down from the average eleven breaths per minute to a zen-like six breaths per minute. You surrender to the light, breathing in as it intensifies and breathing out as it fades. There are commercial products that bring this technique to the bedroom, but they aren’t cheap and don’t offer much control. Fail to fall asleep in the prescribed window and you’re back to square one with one more thing to think about: buyer’s remorse.

[Youz] was inspired by these devices but dissatisfied with the price tag and lack of options, so he created his own version with a flexible window of operation that appeals to both back- and side-sleepers. It uses an Arduino Nano and two momentaries to control two LEDs, a relay to hold the power after startup, a 9V, and a diode to protect the Nano. One LED projects on the ceiling, and the other radiates through a slice of acrylic which has been shaded blue. One button is for power, and the other lets you add time by two-minute increments. You can see the build video after the break and then tell us how you’d do it with a 555, a coin cell, and a chunk of uranium glass in the comments.

Once you can focus on your breathing without a light, reuse that Nano to measure the quality of all that sleep you’re getting.

Continue reading “Counting Is For Sheep: Use A Light To Fall Asleep”

Final Project For Better Sleep

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.

Continue reading “Final Project For Better Sleep”