The Sunrise Alarm Clock

Ever woken up in the morning, looked at your alarm clock, and wished you’d woken up about 5 hours earlier? I know I have. As one of the dreamiest sleepers in the world, I have not found a single alarm clock (or a combination of them) that has ever been loud enough to wake me up permanently. Thus, this project. This project started with an article I read about how “dawn-simulating” clocks are far more effective at waking people up than just regular alarm clocks. So I thought, why not build one? And then I got started.

Its finally done. Undoubtedly one of my most gruesome and excruciating builds, this clock put all my skills to the test and forced me to learn a lot about electronics. But at the end of it all, I think I have a decent alarm clock, that is for me, the first time I have been able to wake up on time. Check out the complete instructable here!

Update: While the alarm clock did work well, I had received some criticism that said that the project did not look very nice. A few people rightly said that the way I had painted my wood had made all the imperfections stand out in it. While experimenting with different finishes, I came across a sheet of card stock. I used this to finish my project by printing a large sheet of card stock black, and then using it as a laminate to cover all sides of my project. Unexpectedly, the LEDs turned out looking quite nice inside the card stock, and I think the entire project has an improved look. Let me know what you think!

sun2

For the extra code that I promised on my instructable, here it is!

The code to generate raw speaker code from any tone set. The reason this is useful is because the tone library doesn’t seem to work well with arrays on the larger projects for some reason, especially this one. This specific tone set is Maroon 5’s Payphone. I use the Serial print command to generate raw code from the array and the for loop.

Note:¬†You will need to have the Pitches.h library for this code to work, but it comes pre-installed with the Arduino IDE, so a majority of people shouldn’t have a problem.

/*
  Melody
 
 Plays a melody 
 
 circuit:
 * 8-ohm speaker on digital pin 8
 
 created 21 Jan 2010
 modified 30 Aug 2011
 by Tom Igoe 

This example code is in the public domain.
 
 http://arduino.cc/en/Tutorial/Tone
 
 */

// notes in the melody:
int melody[] ={
659,698,784,1175,0,1047,1047,988,784,698,0,698,698,659,523,698,659,587,523,659,587,0,659,698,784,1175,0,1047,1047,988,784,698,0,698,698,659,523,698,659,587,523,659,587,0,
0,523,659,784,784,659,587,659,587,0,523,659,784,784,659,587,0,659,0,523,659,784,784,659,587,659,587,0,523,659,784,784,880,659,0,659,
0,523,659,784,784,659,587,659,587,0,523,659,784,784,659,587,0,659,0,523,659,784,784,659,587,659,587,698,0,659,0,523,698,0,659,0,523,
659,659,659,0,659,0,587,659,659,659,0,659,0,587,659,659,659,0,659,0,587,587,494,494,0,523,0,784,
659,659,659,0,659,0,587,659,659,659,0,659,0,587,659,659,659,0,659,0,587,587,
659,698,784,1175,0,1047,1047,988,784,698,0,698,698,659,523,698,659,587,523,659,587,0,659,698,784,1175,0,1047,1047,988,784,698,0,698,698,659,523,698,659,587,523,659,587,0,
659,698,659,587,587,523,523,523,587,587,659,0,659,698,659,587,587,523,523,523,784,587,0,
659,698,659,587,587,523

              };

int noteDurations[] = {
               8,8,8,4,8,4,8,8,8,4,8,4,8,8,8,4,4,8,8,8,2,8,8,8,8,4,8,4,8,8,8,4,8,4,8,8,8,4,4,8,8,8,2,8,
               8,8,8,8,8,16,8,16,8,8,8,8,8,8,16,8,16,8,8,8,8,8,8,16,8,16,8,8,8,8,8,8,16,8,16,8,
               8,8,8,8,8,16,8,16,8,8,8,8,8,8,16,8,16,8,8,8,8,8,8,16,8,16,8,8,16,8,16,8,8,16,8,16,8,
               4,4,8,16,8,16,8,4,4,8,16,8,16,8,4,4,8,16,8,16,8,4,4,8,16,8,16,8,
               4,4,8,16,8,16,8,4,4,8,16,8,16,8,4,4,8,16,8,16,8,2,
               8,8,8,4,8,4,8,8,8,4,8,4,8,8,8,4,4,8,8,8,2,8,8,8,8,4,8,4,8,8,8,4,8,4,8,8,8,4,4,8,8,8,2,8,
               8,8,8,8,4,4,8,8,8,4,2,8,8,8,8,8,4,4,8,8,8,2,8, 
               8,8,8,8,4,1
               };

void setup() {
  // iterate over the notes of the melody:
  delay(3000);
  for (int thisNote = 0; thisNote < 240; thisNote++) {
    int noteDuration = 1000/noteDurations[thisNote];
    tone(10, melody[thisNote],noteDuration);
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    noTone(10);
    
    //#(  *)
    Serial.print("tone(10,");
    Serial.print(melody[thisNote]);
        Serial.print(",");

    Serial.print(noteDuration);
    Serial.println(");");
    Serial.print("delay(");
    Serial.print(pauseBetweenNotes);
    Serial.println(");");
    Serial.println("noTone(10);");
    Serial.println();
  }
}

void loop() {
  // no need to repeat the melody.
}

Leave a Reply

Your email address will not be published. Required fields are marked *