ambhatt
Published © LGPL

Arduino based LOCK/UNLOCK ALARM with LCD

The arduino is used to indicate the door/drawer/locker is properly locked or not

BeginnerFull instructions provided3,295
Arduino based LOCK/UNLOCK ALARM with LCD

Things used in this project

Hardware components

Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Arduino UNO
Arduino UNO
×1
Buzzer, Piezo
Buzzer, Piezo
×1
5 mm LED: Red
5 mm LED: Red
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Breadboard, 270 Pin
Breadboard, 270 Pin

Story

Read more

Schematics

arduino lock-unlock indicator circuit

arduino is used to indicate either door/locker/drawer/device is properly locked or not

Code

program for lock-unlock indication using arduino

C/C++
the program is to use arduino to indicate device is locked or unlocked
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8,9,10,11,12,13);
int new_input_state,old_input_state=LOW;
void setup() 
{
  lcd.begin(16, 2); // set up the LCD's number of columns and rows:
  pinMode(2,INPUT);
  pinMode(3,OUTPUT);
  digitalWrite(3,LOW);
  lcd.clear();
  lcd.print("door is locked");
  lcd.setCursor(0,1);
  lcd.print("properly");
}

void loop() 
{
 new_input_state = digitalRead(2);
 if(new_input_state!=old_input_state)
   {
      if(new_input_state==HIGH)
        {
          lcd.clear();
          lcd.print("door is not");
          lcd.setCursor(0,1);
          lcd.print("properly locked");
          digitalWrite(3,HIGH);
          tone(4,1000,2000);
        } 
      else
         {
             lcd.clear();
            lcd.print("door is locked");
            lcd.setCursor(0,1);
            lcd.print("properly");
            digitalWrite(3,LOW);
             noTone(4);
          } 
        }
      old_input_state = new_input_state;
      delay(100);
  }   

Credits

ambhatt

ambhatt

5 projects • 39 followers

Comments