Introduction: GOOB - a Smart Alarm Clock
GOOB is an acronym for "Get Out Of Bed", a well fitting name for my project. I wanted to create a device that can help waking me up in the morning since it isn't the easiest task. The main idea is that the alarm clock doesn't stop the alarm before you get out of bed and stay out of bed for more than some minutes. I also wanted to add some other benefits like a night light with wake up function and a wireless charger. So let's get right to the build !
These are the components you would need.
2.ESP32 X 1 (Aliexpress)
3.IR distance sensor Sharp 2y0A21 X 1(Aliexpress)
4.Resistors and other small components
4a. 2K resistor
5.Wireless charger (Aliexpress)
6.Button X 1
7.TIP120 X 1 (Aliexpress)
8.LCD X 1 (Aliexpress)
10.Potentiometer X 1
11.Buzzer X 1
12. MCP 3008 X 1 (Amazon)
13. SN74HC595N X 1
14. PCB (for soldering onto)
15.RaspberryPI X 1
16.Wood (min 25X70 cm)
17.Sticker tape (exterior)
18.Wireless dongle (Amazon)
the total price of all the components should be between 90 and 170 euro (depends on if you have time or not (aliexpress))
Step 1: Tools Required
1. A soldering iron/station(if you want to solder it onto the PCB)
2. Some basic woodwork tools
3. Wood glue
4. Hot glue gun (for securing the parts to casing)
8. Powertools (optional)
Step 2: Starting With the Circuit Diagrams
The plan for the ESP32 is to post to a webserver on the Pi if the person enters or leaves his bed. That is why the ESP doesn't directly connect to the Pi.
The IR distance sensor sharp 2y0A21
You would need an MCP3008 to transform the analog data into readable digital data. if you would like to add other analog sensors you could just connect them to the remaining free pins on the MCP
The LCD screen
Here i chose to use an LCD with a shiftregister to save some GPIO pins from the pi. You could also choose to connect the LCD directly to the pi or you could even use an oled display if you would prefer that.
I have used a ledstrip that i found at home it is a non-RGB model. For my use that was what i had in mind. If you would like to further expand the design and use an rgb ledstrip, you could do so.You would more transistors and you would have to change some things in the code too.
Step 3: Making the Circuit Diagram
By using all the items mentioned and looking at the diagram you can recreate the circuit.
I started with building the circuit on a breadbord for easy testing and tinkering, but if you prefer to directly solder it onto a PCB you could also do that.
Step 4: Setting Up the Pi
Before programming the components there are some steps that have to be taken with the pi.
Step 1: Setting up WLAN as static and using WLAN 1 as wifi connection
For this step I am going to drop the link to the official site of Raspberry where you can just follow the steps (you can find the steps here)
Step 2: Setting up a Mysql database on the pi
This is required to get sleep data out of later. On this you can also find enough tutorials on the internet so i am not going to explain it all here. (link to one of the tutorials here)
Step 3: Setting up apache webserver
This one is pretty simple. You just need to do 'sudo apt install apache2' and that's it. Now you can change the site in the directory '/var/www/html' to the html,css and js found on my github
Step 5: Making the Databas Shematic
For the database I have chosen a simpel design with access to the most necessary things I want to log with even some extra things for further expansion.
Step 6: The Code(Pi and ESP)
Step 7: The ESP32 Side of Things
Here it is pretty simple. With the code you can find on my github, you just need to connect a copper tape wire to pin 4 (a capacitive touch pin) and you could just put it inside a pillow or under you spread.
To connect the esp32 to the pi you just need to connect with the access point called ESP32 connect with the password 12345678 and go to the routerpage via your smartphone. There select the menu and choose new acces point. Here you select the name of your pi's acces point and give in the password, thats all !
Step 8: Making the Casing
Cut up your wood in smaller pieces and glue them into a box shape (don't glue the top on)
Step 9: Draw Out Where You Want Your Holes/deepened Parts
Drawing on it with a pencil looked like the best way for me.
Step 10: Make the Holes and Cuts
For the deepened parts I found the easiest way to do it with a box cutter and further smooth it by sanding with some sandpaper. That was possible because of my type of wood. For the other holes I would recommend using powertools, but drilling a hole and using a fretsaw would work as well.
Step 11: Soldering Components Onto a Pcb
This step is not obligated but gives the components a cleaner look and it will be easier to mount into the wooden casing.
Step 12: Mounting Everything in the Case
See if everything fits in the case. you could start hot glueing some of the parts but remember that you still need to put the plastick sticker on to make the exterior look nice, so i would recommend to wait with the hotglue.
Step 13: Finishing Touches: the Exterior
I have chosen to use a large sticker wich gives the exterior an extra nice look. you could also choose for paint.
Step 14: Making Some Exterior/interior Adjustments
Now is the time for hot glueing some parts to the casing and if you would like to finish up the LED lights like me you could go to you local hobbyshop and look for some milk plastic like material to diffuse the lighting. You could slice off some thin lines and place them above the LED's like shown.
Step 15: The Result
A working alarm clock that can be controlled from a website with wireless charging capabilities and also usable as an night lamp. There wil be no snoozing after u install this alarm clock.
Participated in the