Built-in Alarm Clock

This is a step by step guide showing you how you can make your very own built-in alarm clock that should fit seamlessly into your bed.

The goal of this project is to build an alarm clock which can be placed within your bed. Once an alarm is triggered the alarm clock will detect whether or not someone is laying within said bed and will not stop making sound until you effectively get out of bed.

I ended up accomplishing this goal by building this project which consist out of two parts: a box holding all of the electronics, acting as the clock and a sort of pressure plate which should go inside the bed in order to detect when you're still in it or not.

Supplies:

  • raspberry pi
  • 4 x Weight sensors (50kg)
  • hx711
  • LED
  • 16 x 2 LCD display
  • Buzzer
  • Button
  • Male - Male cables
  • Male - Female cables
  • Female - Female cables
  • plywood (about 20cm x 100cm)

More information about the materials used can be found in my bon of materials

Step 1: The Circuit

Important: make sure the wires of the weight sensors are correctly attached or it will not work.

Important: calibrate the weight sensors to get correct values, more on that later

These are the pins I used on the raspberry pi:

  • GPIO16:Buzzer
  • GPIO20: LED
  • GPIO21: Button
  • GPIO17: HX711 DT
  • GPIO27: HX711 SCK
  • GPIO26: LCD RS
  • GPIO19: LCD E
  • GPIO13: LCD D4
  • GPIO06: LCD D5
  • GPIO05: LCD D6
  • GPIO22: LCD D7

Step 2: Building a Temporary Circuit

First I built the circuit outside of my box just to see if everything was working properly.

Step 3: Building the Box

I created this box entirely out of plywood which I got from a local wood shop. I used some leftover wood to create a sort of pressure plate to mount the sensors onto.

I've also included some sketches with measurements to make it a bit more clear how the box is built.

Dimensions:

Box: 22cm x 10cm x 10cm

Pressure plate: 22cm x 22cm

(note that some the dimensions are different from my initial sketch due to the simple reason that I bought the wrong plywood)

Extra info:

The box is held together using wood glue, the opening mechanism is made using hinges.

The pressure plate is simply duct taped together, this is to allow it to flex so that the weight sensors can function properly.

The box is painted using spray-paint. (accidentally bought glitter spray-paint so I ended up scraping most of the glitter off using sandpaper which resulted in a rather nice looking texture)

Step 4: Putting the Circuit in the Box

Once the box and the circuit is ready it is time to put the two together. I did have to rewire some parts since the breadboard just barely didn't fit into the box so instead I just plugged everything directly into the raspberry pi. Just make sure you look at the pin layout of the board properly or things won't work as they should.

Step 5: Database

This is the schema for my database that was used in this project. It is very basic with only a table for sensor id en datacapture. The alarms can are also stored within the datacapture table so there is no need to put them separately.

I created the database in mysql workbench then imported it on the raspberry pi.

Step 6: Code

You can grab all of the code for both the front and backend of this project from my GitHub page.

For this project I made use of a LCD library which I got here and a hx711 library which I found here.

Step 7: The End Product

This is what the project ended up looking like. The box is the actual alarm system that holds most of the electronics. The pressure plate is supposed to be placed within the bed to check weather or not someone is still within the bed. Once an alarm is triggered the system will not stop making sound unless you effectively get out of bed.

The button on top is used to toggle between what should be displayed on the LCD display. It also acts as a snooze button when an alarm is triggered.

The LED acts as a sort of indicator system. It emits light when the system is turned on, flickers in certain patterns to indicate things happening and if you put a bright enough LED in it, it can be used as a nightlight.

Share

    Recommendations

    • Barbecue Challenge

      Barbecue Challenge
    • Beauty Tips Contest

      Beauty Tips Contest
    • Stone Concrete and Cement Contest

      Stone Concrete and Cement Contest

    Discussions