Sleep Halo

Initial Research

NREM sleep has 4 stages. It takes around 30 minutes to reach deep sleep. After waking up, sleep inertia takes around 30 minutes to leave the body. Sleep inertia is the lethargy commonly associated with waking up in the morning where the body wants to continue staying asleep. Average sleep heart rates are around 40–50. A resting awake heart rate is between 60 and 100. Blue light inhibits melatonin creation. Melatonin is the hormone the brain makes that causes a person to feel sleepy. Studies show that warmer colors work the best for sleep. This is why the blue light filter on screens often cause things to look “yellower”. The body also has an internal clock called a Circadian rhythm that causes people to feel sleepy at night and awake during the day. When a person’s Circadian rhythm becomes inconsistent, waking and sleeping becomes incredibly hard.

Initial RGB Testing

This is video of us familiarizing ourselves with the RGB LED code

Circuit Playground

Playing with the adafruit circuit playground

We decided to not use the circuit playground. It was capable of running LEDS and heart rate monitoring separately, but we were not sure of its capabilities doing both at the same time. Also the RAM required to run 397 addressable LEDS was more than the circuit playground could provide.

Input Output

playing with input and output. we were able to change the LED color depending on distance of cup.

Prototype 1

We create our first prototype (5 feet by 3 feet) to test out scale. It was incredibly immersive but we realized that it was too big to be feasibly made. I definitely felt like I could “dive” into it like Alice in Wonderland. We also played thought about how many rings we need to make an effective animation.

prototype 1, 5 feet tall 3 feet wide

Planning out different animations

We found that having each consecutive ring be the same color is more calming. We plan on testing this out further with the lights.

Prototype 2

prototype 2 is a downsized version of the planned final prototype. The intension was to use it to play with colors and some of the animations we had designed above.

Initially we used 5050 SMD 12V RGB LEDS which required a MOSFETs and an external 12V power supply. We realized that upscaling the prototype may cause the amperage and voltage jumps to fry our Arduinos. We also realized the 12v may be overkill and too bright for what we needed.

mosfets that provide power to the LED strips
Red shows that there is not enough power

Above is the first iteration of prototype 2 with 5050 SMD 12V LED strips before it was replaced with WS2812B Addressable LEDS. You may notice that all rings are changing together instead of individually.

Combining heart rate sensing with light animations

The rings are coded to shine when there is a heart rate. It works pretty well but it is very inconsistent. The animation code and the heart rate sensing code seem to be interfering with each other.

Wire Soldering

We both learned to solder in order to get all 6 separate strips connected.

The LED strip has to be cut to ring length and reconnected using wires that are strung wired from the back. The code addresses each LED by calling its number in a list. We had to count the LEDS in each ring. For example ring 6 were LEDS 0 to 136. 137 to 232 is ring 5.

soldering using solder station at techspark
\
finished product with all LED strips attached

Power and RAM Issues

A single Arduino could not provide enough amperage for all the LEDS so we needed to connect an external power supply. When the lights are connects the light and Arduino shut off. I was able to come up with a temporary solution by splitting the amperage of the LED strips between 3 Arduinos.

We also had to switch from an Arduino Uno to an Arduino Mega as the Arduino Uno did not have enough RAM to individually address all 397 LEDS.

Diffusion

We tried milk jug plastic, acrylic, and wax paper. We decided on Frosted plastic sheets from Blicks. We decided that it provided good enough diffusion while also being extremely lightweight. We also added extra layers of cardboard to add more distance between the diffuser and the LEDs. We found that if the user can see each LED, then the effectiveness of the ambient lighting is drastically reduced. We want to reduce how jarring the lights are, especially when sleeping.

Heart Rate Monitor — MAX30102

The monitor we decided to use is the MAX30102 which could be attached to a long wire and then to the Arduino controller. The code we used is a modified version of code form this website.

https://create.arduino.cc/projecthub/SurtrTech/measure-heart-rate-and-spo2-with-max30102-c2b4d8

Running 2 Arduinos Using I2C

We eventually realized that in order for our codes to not interfere with each other, its best to have 2 Arduinos running simultaneously. I used this link’s code and modified it to our project.

https://www.arduino.cc/en/Tutorial/LibraryExamples/MasterWriter

Final Circuit

Both Arduinos and the LEDS are powered by the 5V power supply. Since both Arduinos have only 1 SDA and SCL port, the SCL and SDA wires had to be wired through a breadboard.

The long wire connects to the heart rate sensor. Arduino Mega is on the left, breadboard is in the middle, and the secondary Arduino Uno is on the right.

Final Mounted Prototype Animations- some variations

We had no intention of using this animation, but we did want to test the limits of how fast we could go.

Final Code

Master Code

The master code runs the ring animations and requests an input form the servant Arduino every 10 minutes. Once it takes in a heartrate metric from the servant Arduino, it adjusts its awake or asleep state (reflective of the users current sleep state). After eight hours it goes from “sleepstate” (state where Arduino is trying to make the user fall asleep) to “wakeupstate”. There is also a “multiplier” variable that is multiplied to the heart rate to define the delay time for the animation. For a faster rhythm the heart rate is divided by the multiplier and for a slower rhythm the heart rate is multiplied. We had to run some user tests to find a good multiplier value.

Servant Code

The Servant Arduino runs the MAX30102 heart rate code and sends a heart rate average as requested by the master Arduino.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store