P(illow) Rested

by devhkell in Circuits > Clocks

273 Views, 0 Favorites, 0 Comments

P(illow) Rested

P(illow) Rested
IMG_4289.JPG
IMG_4290.JPG

Crimsonbot Coderz: Devin Keller, Michael Foster, & Charles Cochren

-Idea Behind the Product: Do you find it hard to get a good nights rest while dealing with outside lights and noises? These distractions can make it hard to fall asleep and even harder to wake up in the morning. The P(illow) Rested combines an apparatus that makes your sleeping area completely dark with a sleep and wake alarm that allows you to get the perfect night's rest.

-How it Works: The black acrylic frame is designed to fit perfectly around a twin mattress and sit inside the outer bed frame. This gives you plenty of room to move around in bed while keeping the sleeping area completely dark. Through the program which is written to be run in the Raspberry Pi terminal, you can set your own times that you would like to go to sleep and when you would like to wake up in the morning. When the clock reaches your sleep time, the speakers in the box will begin playing a relaxing white noise to help you sleep. This will play for one hour to ensure you fall asleep. After a good nights rest, speakers and lights will turn on at your desired wake up time. The speakers will go off for ten seconds and the bright lights will stay on for three minutes to ensure you get up. Thanks to the P(illow) Rested, you are now rested and ready to take on the day.

Gather Materials

IMG_E4280.JPG
IMG_4292.JPG
Screenshot (12).png
IMG_4291.JPG
IMG_4303.JPG
IMG_E4278.JPG
IMG_4276.JPG
IMG_4277.JPG
IMG_E4279.JPG

For this project you will need the following materials:

- (3) 48”-24” clear acrylic sheets

https://www.amazon.com/Lexan-Sheet-Polycarbonate-T...

- 10 yards Black Fabric

https://tableclothsfactory.com/products/90x132-bla...

- Black Foam

https://www.amazon.com/gp/product/B007MQMXWS/ref=o...

- Wired Speaker with Aux and USB

https://www.amazon.com/gp/product/B01N6ZFYIM/ref=o...

- (9) LED Lights

https://www.newark.com/adafruit/299/5mm-red-led-br...

- Breadboard

https://www.digikey.com/product-detail/en/twin-ind...

- Raspberry Pi 3 Model B Project Board

https://www.target.com/p/raspberry-pi-3-model-b-pr...

- Wires

https://www.adafruit.com/product/1956?gclid=EAIaIQ...

- Small Cardboard Box

https://www.uline.com/Product/Detail/S-19040/Corru...

Create Code

IMG_4282.JPG

This code, written in Python, takes user input and sends power to the pins of the Raspberry Pi project board to turn on and off the speakers and/or LEDs at your desired times.

Go to https://github.iu.edu/devhkell/E101-final-code/bla... to see the code used

Wire the Speakers to Microcontroller

IMG_4306.JPG
IMG_4305.JPG

The first step to attach the speakers to wires that can be used on the Raspberry Pi Microcontroller is to cut off the USB plugin of the speaker and strip roughly two inches of the outer covering. This will reveal two wires inside, a red power wire and a black ground wire. Next, strip about one-half inch of these wires to get to the small copper wire beneath. Once this is done, find two small female-to-male straight wires that can hook up to the Raspberry Pi. Wrap the copper wire around the male end of the other wires and solder them so they will stay. Is then best to wrap the joint with electrical tape to sturdy it up and ensure the fine copper wire won't break. Lastly, hook up the power wire to a GPIO pin and the ground wire to a GND pin on the Raspberry Pi. We used GPIO pin 14 so it would be best to do the same if using the same code.

Build Frame Out of Acryllic

IMG_E4283.JPG

The first step in building the frame is measuring out all the dimensions to fit your bed and cutting them out using a table saw. When you have the individual sheets, put together the back of the frame with the sides. Start by pushing the back sheet all the way up to a wall making a 90 degree angle, then place the side sheet on top of it with hot glue applied. Do the same with the other side so you have the back and two walls. Lastly, place the top sheet on and hot glue it from the inside. With the acrylic being so thin, the top piece might sag in the front, so it is best to add a piece of wood along the front inside edge to add more support under it. Once it is all hot glued and standing up by itself, put duct tape around the sides and corners because they may be a bit sharp from the table saw.

Cover Frame With Foam and Fabric

IMG_4290.JPG
IMG_4287.JPG

To ensure your sleeping area is dark, you should add some black fabric over the outside of the acrylic. It is also best to add some black foam on the inside to make it is completely dark and also make it softer on the inside. First, measure and cut out all the lengths of fabric that you need to cover the entire outside. Lay this on the outside before hot gluing so you know it will cover. Once you are sure you have all the fabric you need cut out, apply it with hot glue. Any extra material hanging off the sides or corners can be cut off or glued down. You should then do the same thing with the foam on the inside. You might need to move the frame around to be able to apply it all at the right angles, but once it is all on you will have completed the frame of the P(illow) Rested.

Wire LEDs

IMG_4300.JPG
IMG_4299.JPG

The next step is supplying power to all the LEDs that will be used to wake you up in the morning. The most important part is connecting male-female wires to the Raspberry Pi and the bread board. The male end of one wire should go into the power terminal of the breadboard and the female end should go into the longer prong of the LED. Then connect the male end of another wire into the ground terminal of the breadboard, with the female end connecting to the shorter prong of the LED. You should repeat this for all 9 LEDs. This allows you to stretch the LEDs out so they can be evenly spread out across the bottom surface of the box.

Attach Speakers & Box With All Electronic Elements

IMG_4310.JPG
IMG_4309.JPG

The speakers for this project come with small clips to be able to be attached to the box. Attach the speaker clips to the wood glued onto the top of the acrylic and have them facing in on the sleep subject. The box of electronics should start with sticking the bread board with all of the LEDs and wires to the bottom of the box. Then, place the Raspberry Pi into the open space in the box a little off center. Next, holes need to be cut for the micro USB power cord and the speaker cord to be plugged into the raspberry pi. Also, you should mark out and cut holes for the LEDs After plugging everything in, hold the raspberry pi to the box by putting electrical tape on it to secure it. Finally, cover the box with the black cloth and poke holes for the LEDs to come out of the box and cloth then hot glue the fabric around the box and eventually to the inside top of the acrylic in the center.

Create Audio Clip & Interface Raspberry Pi to Laptop

IMG_E4285.JPG

Download these audio clips to the Raspberry Pi from the internet:

White Noise: https://youtu.be/0CTEj4fbSbk

Alarm Noise: https://youtu.be/A2nirOjpz70

After downloading both audio clips, use an editor to put them together for however long you think you will be sleeping. The white noise should play for at least an hour, then switch it over to the alarm. The alarm should be running most of the time when you are asleep, but since there is no power being supplied to the speakers until it is time to wake up, it will not be disturbing you. You can then end the program once you get out of bed

To be able to run the program, it is best to connect the Raspberry Pi interface to your personal laptop. To do this, all you will need is your Raspberry Pi with SD card installed, an ethernet cable, your personal laptop, and a micro USB cable. Once you connect all of the cables, you need to allow for connection sharing over ethernet through your wifi. This will allow you to view the IP address of your Raspberry Pi. You then just have to connect to your Raspberry Pi over vnc server and vnc viewer. Once done, it will bring up the Raspberry Pi interface where you can copy and paste the code into a document and run that document in the terminal.

For more complete instructions in setting up the Raspberry Pi interface, visit https://www.instructables.com/id/How-to-connect-ra...

Sleep!

Once you have done all of the above steps, you simply have to run the program in the Raspberry Pi terminal. To do this, simply type import followed by the document you used to save the code. It will prompt you to put in when you want to sleep and wake in HHMMSS format (using 24 hour time). You can then lay down and enjoy the darkness and peaceful sounds that will give you a restful night of sleep, making it easy to get up to the morning alarm and lights.