Introduction: Self Snoozing Alarm Clock

Getting up in the morning is hard. Who hasn't placed an alarm clock on the other side of the room to try to make themselves get out of bed to turn it off?

What if we could make that easier? What if we could automate something to snooze the alarm for us?

You're going to need just a few parts:

1 Alarm clock

1 Picture of a hammer

1 servo

1 LCD display

1 step down transformer

1 breadboard

1 relay

2 resistors, at 2.2 k

some wires, some solder, some patience, and some tunes.

I built a wooden box for this project to live inside of/on top of, but cardboard (or nothing at all) would work just as well.

Step 1: Take Apart the Alarm Clock

We're going to open up the alarm clock we plan on using. The one I used, in addition to being the cheapest possible option on Amazon Prime, had a nicely labeled control board and a big empty 9 volt battery compartment. Since I was going to be running the clock on wall power, a pair of pliers ripped out the battery compartment and I had some room to work with.

I hooked up to two places inside. I attached 2 wires to the leads on the snooze button, and tapped the wires going to the speaker inside. These I ran through the bottom of the alarm clock through the big open spot where the 9 volt battery would have gone.

Step 2: Coding and Electronics

This operation is really just some simple steps. The way I have it set up, the arduino is monitoring the voltage going to the speaker in the alarm clock. When it senses the voltage change, it triggers the alarm mechanism to act.

I have the mechanism divided into different parts- the LCD display, the hammer action, and then the auto snooze function. The program triggers each sections individually, and then returns to its monitoring state.

For electronics, I'm using an LCD display, a hobby servo, a relay, a TIP120 transistor, a step down DC to DC transformer, and a few 2.2k resistors.

My code is embedded below.

The tap from the wires going the alarm clock speaker were carrying 12 volts, so I put them through a step down converter to 5 volts for the Arduino to handle. I also added a transistor for backfeed protection. If you remove the arduino's power supply, but still have voltage going into the analog pins from the alarm clock, the Arduino will backwards power itself through the analogue pin. BAD! This transistor serves as a gate, and breaks the circuit when the Arduino is off. When the Arduino is powered on, one of the first things it does is send a control signal to the transistor to allow the monitor feed to open to Analog pin 1.

The snooze button is actuated from digital pin 4, which is sending signal to a normally open relay. The two wires connected to the snooze button are inserted into the common and normally open contacts on the relay, and fed 5 volts power from a power supply. This allows the arduino to signal the relay to close short the connection, triggering the snooze button on the clock.

Also connected are the LCD display and the servo, both powered from the 5 volt power supply.

#include Wire.h

#include LiquidCrystalI2C.h

#include Servo.h
// Set the LCD address to 0x3f for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x3f, 16, 2);</p><p>Servo myservo;  // create servo object to control a servo</p><p>int pos = 160;    // variable to store the servo position
int hammertime = 3;  //how many times hammer will smash
const int InPin = A1;  //InPin is monitoring the voltage to speaker
const int powergate = 2;  //Digital Pin two will output voltage to open transistor on Analog read circuit
const int snoozebutton = 4;  //Digital Pin 4 will trigger relay to short snooze button wires
int involt = 0;  //beginning value for voltage in
int outputValue = 0;  //beginning value for voltage read output</p><p>void setup() {
  // put your setup code here, to run once:
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  myservo.write(pos);  //moves servo to start position
  pinMode(powergate, OUTPUT);  //sets powergate on digital pin 2 to an output
  pinMode(4, OUTPUT);  //sets our relay control to digital pin 4
  digitalWrite(2, HIGH);  //sends voltage to transistor on powergate to open circuit
  Serial.begin(9600);  //serial monitor
  lcd.begin();  //turns on LCD
  lcd.backlight();  //turns on LCD backlight
  lcd.print("Hello, world!");  //test LCD
  digitalWrite(snoozebutton, LOW);
}</p><p>void loop() {
  // put your main code here, to run repeatedly:</p><p>  involt = analogRead(InPin);  //read involt
  outputValue = map(involt, 0, 1023, 0, 1000);  //maps involt between 0 and 1000
  lcd.print("wait for it");   //put LCD display into standby message</p><p>  Serial.print("sensor = ");  //serial monitor
  delay(400);  //  gives a slight pause on each read cycle</p><p>  if (outputValue <= 800) {  //voltage drops below a certain amount.  Adjust to taste.
    alarmprint();  //LCD display method
    delay(3000);   //allow 3 seconds of terrible beeping to occur
    smash();       //hammer method
    snooze();      //snooze button actuation method
  }</p><p>delay (3000);    //wait 3 seconds
hammertime = 3;  //reset hammertime int to 3
}</p><p>//end program    </p><p>//----------------------------------------------------------------</p><p>void alarmprint() {</p><p>  Serial.println("ALARM!");  //print alarm to serial monitor
  lcd.print("ALARM!!!!");  //clear and print alarm to LCD
void smash() {
  while (hammertime > 0) {
    for (pos = 170; pos >= 20; pos -= 1) { // goes from 20 degrees to 160 degrees
      // in steps of 1 degree
      myservo.write(pos);              // tell servo to go to position in variable 'pos'
    }</p><p>    for (pos = 20; pos <= 170; pos += 1) { // goes from 160 degrees to 20 degrees
      myservo.write(pos);              // tell servo to go to position in variable 'pos'
      delay(10);                       // waits 15ms for the servo to reach the position
    hammertime --;        //countdown hammer 
  myservo.write(165);  //returns hammer to ready position
   hammertime = 3;     //resets hammer count
}</p><p>//----------------------------------------------------------------</p><p>void snooze() {
  digitalWrite(snoozebutton, HIGH);  //powers relay to short snoozebutton leads
  digitalWrite(snoozebutton, LOW);  //resets relay

Step 3: Sleep Soundly

Now, your mornings can be blissfully uninterrupted.