GOOB - a Smart Alarm Clock

by JensKrijgsman in Circuits > Sensors

2481 Views, 11 Favorites, 0 Comments

GOOB - a Smart Alarm Clock

20190613_190331.jpg

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 !

Supplies

These are the components you would need.

1.Coppertape (Aliexpress)

2.ESP32 X 1 (Aliexpress)

3.IR distance sensor Sharp 2y0A21 X 1(Aliexpress)

4.Resistors and other small components

4a. 2K resistor

4b. 1Kresistor

4c. cabels

5.Wireless charger (Aliexpress)

6.Button X 1

7.TIP120 X 1 (Aliexpress)

8.LCD X 1 (Aliexpress)

9.Ledstrip (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))

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)

5. Sandpaper

6. Boxcutters

7. Drill

8. Powertools (optional)

Starting With the Circuit Diagrams

ProjectFrizing.png

The ESP32

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.

The ledstrip

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.

Making the Circuit Diagram

20190529_152348.jpg
20190530_193401.jpg

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.

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

Making the Databas Shematic

SchemaV3.jpg

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.

The Code(Pi and ESP)

For coding I use Pycharm an easy to use program that i use at school.

Programming the ESP32 I have chosen to use the arduino IDE. You need to install some extra boards onto the IDE in order to be able to send code to your ESP (tutorial here).

For the code you can go to my GitHub page

The ESP32 Side of Things

20190604_182129.jpg
20190612_215808.jpg

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 !

Making the Casing

20190607_114133.jpg
20190607_114140.jpg

Cut up your wood in smaller pieces and glue them into a box shape (don't glue the top on)

Draw Out Where You Want Your Holes/deepened Parts

20190607_120112.jpg

Drawing on it with a pencil looked like the best way for me.

Make the Holes and Cuts

20190607_170327.jpg
20190607_170344.jpg

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.

Soldering Components Onto a Pcb

20190607_172516.jpg
20190607_220656.jpg

This step is not obligated but gives the components a cleaner look and it will be easier to mount into the wooden casing.

Mounting Everything in the Case

20190608_022717.jpg
20190608_022726.jpg

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.

Finishing Touches: the Exterior

20190609_152221.jpg

I have chosen to use a large sticker wich gives the exterior an extra nice look. you could also choose for paint.

Making Some Exterior/interior Adjustments

20190612_214108.jpg
20190612_214139.jpg

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.

The Result

20190609_172754.jpg
20190612_220108.jpg
20190613_190331.jpg

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.