FADing (Fall Asleep Device)

36K27063

Intro: FADing (Fall Asleep Device)

This device is a gift I have made and offert several times since 2 years. The version I made for this tutorial is the most complete of all because it takes into account the suggestions I've had in the past. I would also point out that English is not my fluent language but i hope to be understandable.

There are devices that helps you to wake up or fall asleep "naturally" with light. The device I present helps you fall asleep by synchronizing your breathing with the variations of light intensity emitted by it. Inspire by this https://www.mydodow.com/en but with more control and option on it.

With it, you will be able to relax more easily and put aside your thoughts that prevent you from sleeping. Depending on who the device works on and who has tested this principle, you may fall asleep easily in 5 to 15 minutes if it works on you.

The device emits a light whose intensity varies several times per minute. When the intensity of light increases, breathe in, when the intensity decreases, breathe out. During the full cycle, the frequency slowly decreases from 11 to 6 breaths per minute.

UPDATE 1 (27 january 2018) : I added new photos, changed the color of the LEDs as suggested in the comments, add a new LED (blue) inside the box, use thinner wires, sanded the box, redone the bottom plate so that it is slightly larger than its housing so that it stays in place by adjustment, and add Fritzing file. The next update to come will be the rewriting of the program taking into account some brillants comments bellow.

STEP 1: The Box


The first models I made were simpler than the one I'm going to detail. These models used only one LED.

A simple small box that can hold an arduino, a relay and a 9V battery can be enough. A LED lights the ceiling, the second added in this tutorial illuminates the device for people who do not fall asleep on their back and now can watch it from the side.

I took advantage of the remaining pieces of wood and Solidworks software to size the box.

For a box with harmonious dimensions that doesn't look too high or too big, I use the golden ration which is 1.61. The base is a cube of 60mm, its total height has been defined by the calculation 60 x 1.61 that give around 97mm.

I used a circular saw to cut to size and a router to dig the inside of the box.

Acrylic cutting and drilling was done between 2 pieces of wood to prevent it from breaking.

I had planned to keep the bottom cover with magnets but the use of too big wires does not leave me enough space. While waiting for a next update with the use of thin wires, the lid is held in place tightened in its housing.

The upper part is screwed from the inside of the box.

The LED and inside acrylic are painted blue with a marker. /!\ Update. I sandpaper the blue on the acrylic inside the box to manage different light color from inside.

STEP 2: The Electronics

You just need :

  • 1 Arduino Nano
  • 1 10K Resistor
  • 1 Diode 1N4007
  • 2 LED (1 more for the update)
  • 2 push buttons
  • 1 9V batterie connector
  • 1 4.5V Relay
  • 1 small prototyping board piece

I use the free software Fritzing to think about the schematics and draw a prototyping board trace.

There is no battery discharge when the unit is turned off. A long press on the start button allows the arduino, once it finish start, powering the relay itself with its D4 output.

The diode protects the arduino from the 9v battery.

The resistor is for pull up of the mode push button.

One push button is for the startup, the other one is use for several features.

STEP 3: The Program

Here the program :

STEP 4: How to Use It

To turn the unit on, press the power button until the LED flashes twice. The default operating time of the unit is 8 minutes. If you want to add time, you have 5 seconds after startup to add 2 minutes by short press the mode button. Once the 5 seconds have elapsed, the unit will blink the number of times you have pressed the button and start operation using the ceiling LED.

During operation, if you want to switch between LEDs, press the mode button briefly.

The unit turn off automatically at the end of operation but you can press the mode button for more than one second to shutdown.

STEP 5: Conclusion

The device will work best if you don't just spend an hour using your smartphone and you're not too awake.

Not to mention the device, it is important to get in good condition before going to bed and having a quiet time away from the screen 30 minutes before going to bed. With food, sleep is the most important thing for the human body. Food gives strength while sleep gives energy. The lack of sleep leads to depression. It's essential to be able to relativize on all the worries and stress that overcome, to have the mind and body rest to deal with all our problems.

I coming soon update with another pictures and more explanation on the program.

If you need more information for the realization or comprehension of the device, feel free to ask.

- Stéphane

39 Comments

Hello,

great project! I was checking your code and I bumped ito this :

intervaL = 21.0 / ( (float)md2 * 6.0 ); //21 is the interval between brightness change from starting 11 breath per minute (20 ms) to ending 6 breath per minute (41 ms) how do you get this formula? and how do you know that you always start with 11 breath per minute and always finish with 6 bpm? Another question here:
cyclecompt = 0;
while (cyclecompt < 220) {
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if ( brightness <= 10 ) { // On ending invert fadeAmount for next fade in
fadeAmount = -fadeAmount;
delay(1000);
} why do you use 220?

Thanks in advance! I will try to replicate your device as soon as my arduino arrives!
I wrote this program 1 years ago so it's hard to get in after a long time. I take time to understant it again, my 2 days ago answer is wrong. The 220 is the number of change value for the LED. The right max value for the LED brightness is 115 ( if ( brightness >= 115 ) ). It around 2.2 volts because max voltage is to bright in the dark.
About the 21, from 10 bright to 115 bright, there is 105 step. For the first 11 breath by minutes whe have 60 secondes / 11 = 5.45 secondes. Less 1 seconds for pause and divide by 2 there is 2.22 seconds for the first fade in. 2.22 / 105 = 0.021 seconds.

Wow! Definitely I need more coffee :) Thanks a lot for your support! I will be experimenting with your code,there is a lot of room for new features ,maybe adding a cheap mp3 player to be controlled with the arduino so it will play white noise or relaxing music and adding those flat speakers inside your pillow or to a sleep mask?

I will be voting for your project for the contests by the way :)

Hello. I chose to use 11 and 6 breathing because these are standards for most people. For the 220, i don't go to 255 because it send arround 5V and white LED usualy can handle up to 3.3V. If you make math, the right value like to be arround 170 but it's pwm voltage and far from here, i never have burn LED. Maybe you can try to go up but 220 is safe.
I see, it just I do not understand what are you doing here:

intervaL = 21.0 / ( (float)md2 * 6.0 ) I mean why 21.0? maybe I just need more coffee :)

While waiting for my arduino I got inspired to make a very similar project ,based in attiny85, intended for both fall asleep during the night and I added a trainer mode to learn breathing (lower your blood pressure, boost your immune system,clear your mind, and
even help you sleep better): 4 seconds to inhale,7 seconds to keep breath,then 8 seconds to exhale based in TedTalks of Max Strom Breathe to heal. https://www.youtube.com/watch?v=4Lb5L-VEm34 There is a mode for relaxation previous to sleep,simply follow the fading light breathe in during fade in and breath out during fade out, the rhythm is tuned near 6 breathes per minute.
The problem of course is that I am not a good programmer so I move very sloooowww coding ,so when I saw your work I was like hey this is so cool ! I almost understand everything but I got stuck with your formula above.
Could you give a little more detail on the relay?
Great !! If the top light was more inside the box, at the bottom of a hole, the projection on the ceiling will be a well drawn circle.
Can i usa a attiny chip instead of using a full arduino? (sorry if it's a dumb question i'm new to eletronics)
You can use an attiny85 but you'll have to add a voltage regulator to drop the 9v to 5v.
Sorry i don't know how attiny works.
Not sure what colour of light is better. The project that inspired you (dodow) writes this:

Dodow's light signal is too dim to have any impact on the secretion of melatonin. Dodow's blue light will not delay your sleep; on the contrary, it has been shown that exposure to blue reduces stress. This is why we chose a blue light over an orange one.
Do you have the Fritzing files that you could share? It would help for trying to replicate.
Thank you. I am rather new at this, I got the Fritzing file, thanks again!
Hi AshJ7. Tomorrow i update the instructables and i had Fritzing file.

Nice device - looks lovely. I actually wrote an android app, mainly for my own use, which does the same thing;

https://play.google.com/store/apps/details?id=com....

I see you are simply ramping the light up and down linearly in your code, with a 1 second pause. Some things I learnt as part of building that app is that you don't breathe like that. You breathe in, out, then pause, and the pause is quite significant at higher breathing rates. At a 10 bps rate, you might breathe in for 2s, out for 2s, pause 2s. At slower rates, e.g. 4bps, the pause is almost zero. Also, the breathing cycle is not linear, and nor is the LED brightness response, so you ideally need a non-linear rise and fall.

Fortunately, because you use arduino, you can easily change the pattern.

Hi millmore;
I understand that we breathe in, breathe out and then pause. If the pause is too long, sleep apnea might be a problem. What do you mean by a 10 bps rate? I first thought it might be breaths per second until I got to the part where you said 4bps. There is no way I can take 10 or even 4 breaths in a second. Please explain. I am confused.
That's a typo by me - I meant bpm. Breaths per minute. 10 breaths per second would indeed be impossible!
I agree that the pause cannot be too long, which is why I reduce it to almost zero at slower breathing rates.
More Comments