Introduction: Silent Alarm

About: An Electronic freak loves designing Embedded circuits.

Silent Alarm: Arduino Based Alarm Clock which will help you to sleep peacefully

A alarm clock that lets you sleep peacefully without loud annoying sound for you to wake up to. Well that’s something new isn't it? This is a very simple and unique alarm clock which has helped me & my wife sleep peacefully.

A little about myself I am a Sleep deprived Dad to a 6 month old baby boy, who does not sleep for more than 45 minutes at a stretch be it day or night. If he gets up and we are not there for him he will create a ruckus and it becomes very hard for us to make him go back to sleep. So the only solution we came up with was my wife would sleep for half the time and I would sleep the other half. In this sleep deprived state it becomes very difficult work on your daily routine. So finally on one such night at 2:00 AM I came up with the idea to make an Arduino based Silent alarm.

I still have to getup after every 40 minutes but atleast now I can sleep peacefully knowing the Silent Alarm is going to wake me up. This project is dedicated to all Sleep deprived newbie parents.

Step 1: Components Used

Components Required for making this project can easily be procured most of the hobbyist may already have almost all the components with them

Step 2: How It Works?

As the name suggests “Silent Alarm” there is no buzzer to wake us up (we don’t want to wake up the baby) instead we will be using a vibrating motor and the LCD backlight to indicate time to wake up. Since the arrival of baby we have become very light sleeper. The vibrating motor vibrates and creates enough sound to wake us up. You can use a buzzer instead if you want.

The keypad is used to Select the time after which we need to wake up. We will be controlling the LCD backlight using PWM technique so even when its complete dark we will be able to see the LCD.

This being not just a hobby project I decided not to play around with the batteries and directly use a 1500 mah power bank that I had. Moreover the power bank has a High power LED which can act as a torch as well.

Step 3: LCD & Keypad Shield

This LCD & Keypad Arduino shield was the reason I could implement this project in a very short time. Removed all the wiring hassle and was able to directly start with the coding. On LCD’s 1st line we are displaying the time after which alarm should be sounded and in the second line we are displaying the elapsed time. When the time is over i.e. the elapsed time= alarm time the LCD backlight is blinked. When alarm is sounded you can press and switch to deactivate the alarm.

Interested in learning more about how to interface the LCD & Keypad Shield?

Five Tactile switches are provided on the shield for user interface. Out of which we have used 4 switches are used for time select

  • Switch Right: 10:00 alarm.
  • Switch Left: 20:00 alarm
  • Switch Up: 30:00 alarm.
  • Switch Down: 40:00 alarm.
  • Switch Select: 00:20 (20 seconds for testing purpose)

Step 4: Vibrating Motor

The vibrating motor is the same as the ones used in our Mobile works on 3.3 -3.6 Volts. I tried using the 3.3V output of the Arduino board but the current was not sufficient to drive the motor. So instead I used two 1N4007 diode in series of 5 volts. There is approximately 0.7 volt drop across diode so when I connected two diodes in series I should get 1.4 volt drop i.e. 5v-1.4v= 3.6 volts instead I got 3.7 volts. I tested the motor on 3.7 volt and it worked perfectly.

I have used BC 547 NPN transistor as a switch to turn ON the motor. The 3.7 volt is provided directly via the diodes to TURN ON the vibrating motor whereas the ground is provided via the transistor. The complete driver circuit was mounted on the Zero board.

Step 5: Coding

/*
Code was implemented & Tested by Amol Shah
For DNA Technology Online Electronic Component Store
*/
<liquidcrystal.h>
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );
char low_intensity     = 30;
char high_intensity     = 255;
char sw_press     = 0;
int adc_reading  = 0;
char mins,secs;
char set_mins,set_secs;
char in_loop;
#define btnRIGHT  1
#define btnUP     2
#define btnDOWN   3
#define btnLEFT   4
#define btnSELECT 5
#define btnNONE   0
int LCD_BACKLIGHT_PIN = 10;   
int vibrating_motor = 13;   
void setup() {
  lcd.begin(16, 2);
  pinMode(LCD_BACKLIGHT_PIN, OUTPUT);      
  pinMode(vibrating_motor, OUTPUT);      
  lcd.setCursor(0,0);  
  lcd.print("  Silent Alarm   ");
  lcd.setCursor(0,1);  
  lcd.print(" Plz Select Time  ");
  analogWrite(LCD_BACKLIGHT_PIN, low_intensity);        
  digitalWrite(vibrating_motor,LOW);
  delay(1000);
  mins=0;
  secs=0;
  set_mins=0;
  set_secs=0;
}
void loop() {
  while(read_LCD_buttons()==btnNONE);
  get_set_time(); 
  secs=0;
  mins=0;
  in_loop=1;
  while(in_loop){
  delay(1000);
  inc_time();
  disp_curr_time();
  compare_time();
  }
  lcd.setCursor(0,0);  
  lcd.print("  Silent Alarm   ");
  lcd.setCursor(0,1);  
  lcd.print(" Plz Select Time  ");
  int read_LCD_buttons(){               // read the buttons
  adc_reading = analogRead(0);       // read the value from the sensor 
  if (adc_reading > 1000) return btnNONE; 
  if (adc_reading < 50)   return btnRIGHT;  
  if (adc_reading < 250)  return btnUP; 
  if (adc_reading < 450)  return btnDOWN; 
  if (adc_reading < 650)  return btnLEFT; 
  if (adc_reading < 850)  return btnSELECT;  
  return btnNONE;                // when all others fail, return this.
}
  
void compare_time(void){
  if((mins==set_mins)&&(secs==set_secs)){
  sw_press=0;
  digitalWrite(vibrating_motor,HIGH);
  analogWrite(LCD_BACKLIGHT_PIN, 255);          
  while(sw_press==0){
  sw_press = read_LCD_buttons();   // read the buttons
  analogWrite(LCD_BACKLIGHT_PIN, high_intensity);          
  delay(500);
  analogWrite(LCD_BACKLIGHT_PIN, low_intensity);            
  delay(500);
  }
  digitalWrite(vibrating_motor,LOW);
  in_loop=0;
   while(read_LCD_buttons()!=btnNONE);
     delay(500);
  }
}  </p><p>void disp_set_time(void){
   lcd.setCursor(0,1);  
   lcd.print("Set Time:  ");
  lcd.write((set_mins/10)+48); 
  lcd.write((set_mins%10)+48);   
    lcd.write(':');
  lcd.write((set_secs/10)+48); 
  lcd.write((set_secs%10)+48); 
}
void disp_curr_time(void){
   lcd.setCursor(0,0);  
  lcd.print("Cur Time:  ");
  lcd.write((mins/10)+48); 
  lcd.write((mins%10)+48);   
    lcd.write(':');
  lcd.write((secs/10)+48); 
  lcd.write((secs%10)+48);     
}void inc_time(void){
 secs=secs+1;
if(secs==60){
 secs=0;
 mins=mins+1;
} 
}void get_set_time(void){
  char loop1=1;
            set_mins=0;
            set_secs=20;
  disp_set_time();
  while(loop1){
 sw_press = read_LCD_buttons();   // read the buttons
 
   switch (sw_press){               // depending on which button was pushed, we perform an action
 
       case btnRIGHT:{             //  push button "RIGHT" and show the word on the screen
            set_mins=10;
            set_secs=00;
            disp_set_time();
            break;
       }
       case btnLEFT:{
            set_mins=20;
            set_secs=00;
            disp_set_time();
             break;
       }    
       case btnUP:{
            set_mins=30;
            set_secs=00;
            disp_set_time();
             break;
       }
       case btnDOWN:{
            set_mins=40;
            set_secs=00;
            disp_set_time();
             break;
       }
       case btnSELECT:{
             loop1=0;
             break;
       }
       case btnNONE:{
             break;
       }
   }
  } 
}
Home Hacks Challenge

Participated in the
Home Hacks Challenge