PicoSleep is a program that helps you fall asleep.
It runs on the raspberry pico platform and pulses the onboard led (or a soldered RGB led) with a slowly decreasing frequency.
Synchronize your breathing with the led pulses to decrease your heart and breathing rates and help yourself fall asleep.
Click to see it in action:
raspberry pico are inexpensive computing platforms that interact with the world.
See the official raspberry site to get one and set it up.
Here's a very brief and simple way to do it:
- Buy a raspberry pico board (~ $4)
- Download the official micropython UF2 image from raspberry.org (or directly here)
- Connect it to a PC in media mode
- connect the USB cable to your pico board
- hold down the pico board
BOOTSEL
switch while you're plugin it to your PC - release the bootsel button when the pico board appears as a drive
- drop the UF2 file you dowloaded on the drive and eject it
- Install Thonny and configure it for the raspberry pico
There are several ways to do this, please refer to the official doc to understand how.
Keep in mind that you should upload two files on your raspberry:
pulseled.py
(a helper module to deal with leds and pulsing)main.py
(the main program)
Once this is done, you can disconnect the pico and plug it again to a power source : the onboard green led should now be pulsing
Done : you can enjoy your sleep aid platform :)
RGB Leds are inexpensive devices that can produce a colored light.
Try to find a LED reseller somewhere and keep in mind that you want a 4 pins led.
Here's what they look like:
The most important thing to note is that the longest pin is the ground and it should be soldered to a pico GND
pin.
-
At first, no need to solder anything, just insert your freshly bought RGB led in the pico holes labeled
GP13
-GND
-GP14
-GP15
. The longest pin should go into theGND
hole. -
Make a slight change to
main.py
program by changingUSE_RGB_LED = False
toUSE_RGB_LED = True
-
Disconnect and reconnect your pico : you should see the led change color at each breathing cycle
Satisfied ? Just solder the led to your pico board and voilà :)
Although your PicoSleep is finished now, you may want to cover the led with a cover to contain and smoothen the led's light
I made an origami star led cover, see this tutorial for how to do it:
Note: I used a 1.5 cm x 30 cm band of plain paper for the cover.
Most important parameters are at the top of main.py
file, here's a description for them:
BREATHING_FREQ = (11, 5)
controls the breathing rate at (start, end) of the experience. They're set to 11 breathing per minute at start down to 5 breathing per minute at endDURATION = 10
controls the duration of the experience (10 mn by default)
LED_PIN = 25
the pin that controls the led (by default, this is the onboard led but you can solder any led betweenGND
andGPxx
and put thexx
number here)MAX_LIGHT = 255
the led maximum power in the range [1 - 255]
-
RGB_PINS = (13,14,15)
the GPIOs where you soledered (respectively) the led's Red, Green and Blue pins -
MAX_RGB_VALUE = 0.6
the maximum light power for the RGB led in the range [0 - 1.0]. Use this to tune the intensity of the RGB led. -
MAX_RGB_LIGHT = (255,210,160)
this is a preset of the relative power of each led and depends on the led maker and model and acts as a color balance. If you feel that the colors lack of Red, Green or Blue, try to change each channel intensity here (lack of blue ? increase the value 160 to 180. Too much green ? decrease the 210 value to 190...) -
USE_RGB_LED = False
whether to use the soldered RGB led (set this toTrue
) or the onboard monochromous led (leave this toFalse
)