Sleeping Alarm Clock

Introduction: Sleeping Alarm Clock

This is an equipment for making you accelerate to sleep. Some people will focus on work during the night, so this is the thing that will interfere with you from working. It includes photoresistance, buzzer, and Led light. These little things may help your health. Some types of people will work at night until very late. This device is for this type of person. It will let you be interrupted from working. I am this type of person, this type of person will not want to work in a place which is noisy. I made this for the people same as me.

Supplies

1. Arduino Leonardo x1

2. Photoresistance x1

3. Buzzer x1

4. 10000Ω Resistance x1

5. 100Ω Resistance x1

6. Wire x11

7. Led light x1

8. Cartons x1

9. USB-B x1

Step 1: Make the Circuit

Plug the components on to the Arduino Leonardo board as the schematic diagram.

Step 2: Arduino Code

void setup(){ // put your setup code here, to run once:

Serial.begin(9600); // opens serial port, sets data rate to 9600 bps

}

void loop(){ // put your main code here, to run repeatedly:

Serial.print(analogRead( A0 )); //print message

Serial.print(" "); //print a blank

Serial.println();

if ( analogRead( A0 ) > 550 ) {

if ( analogRead( A0 ) >= 700 ) {

analogWrite(6 , random( 0 , 256 )); //analogWrite values from 0 to 255

Part1();

}

else {

analogWrite(6 , random( 0 , 125 )); //analogWrite values from 0 to 255

Part2();

}

}

else {

analogWrite(6 , 0); //analogWrite values from 0 to 255

noTone(11); //stop generating the tone

}

delay( 1000 ); // waits a few milliseconds

}

void Part1() { //customised function

tone(11, 262, 400); //buzzer or speaker frequency

delay( 500 ); // waits a few milliseconds

tone(11, 1568, 400); //buzzer or speaker frequency

delay( 500 ); // waits a few milliseconds

tone(11, 554, 400); //buzzer or speaker frequency

delay( 500 ); // waits a few milliseconds

tone(11, 1856, 400); //buzzer or speaker frequency

delay( 500 ); // waits a few milliseconds

tone(11, 161, 400); //buzzer or speaker frequency

delay( 500 ); // waits a few milliseconds

}

void Part2() { //customised function

tone(11, 740, 300); //buzzer or speaker frequency

delay( 400 ); // waits a few milliseconds

tone(11, 311, 300); //buzzer or speaker frequency

delay( 400 ); // waits a few milliseconds

tone(11, 1048, 300); //buzzer or speaker frequency

delay( 400 ); // waits a few milliseconds

tone(11, 1660, 300); //buzzer or speaker frequency

delay( 400 ); // waits a few milliseconds

}

Be the First to Share

    Recommendations

    • Summer Fun: Student Design Challenge

      Summer Fun: Student Design Challenge
    • Maps Challenge

      Maps Challenge
    • Metal Contest

      Metal Contest

    Comments