You are on page 1of 30

Name Id

1. Rezaul Khan Ahad 1830187


2. Birupaxha Mondal 1830896
3. Sabrina Yasmin 1821172

Project Name

=>> “Password Based Door Lock System Using Arduino”

Submitted To
Prof.Farruk Ahmed
This is the real picture………
This is the Online Project…
Introduction

As thefts are increasing day by day security is becoming a major concern


nowadays. Often times, we also need to secure a room at our home or office
so that no one can access the room without our permission and ensure
protection against theft or loss of our important accessories and assets.
Doors locked using conventional locks are not as safe as they used to be,
anyone can break in by breaking these locks. We therefore need to make a
framework that will give 24/7 benefit. So a digital code lock can secure our
home or locker easily. It will open the door only when the right password is
entered.  There are so many types of security systems present today but
behind the scene, for authentication they all relay on fingerprint, retina
scanner, iris scanner, face id, tongue scanner, RFID reader, password, pin,
patterns, etc. Off all the solutions the low-cost one is to use a password or
pin-based system. So, in this project, we have built a Password Based Door
Lock System which can be mounted to any of our existing doors to secure
them with a digital password.  The password based door lock system
promises a bold step to the future where mechanical door locks will be
substituted by electronic door locks.
Describe The Project

Components Required:

S.N. Components Name Description Quantity


1 Arduino Board Arduino UNO 1
R3
Developmen
t Board
2 Keypad 4X4 Keypad 1

3 LCD Display JHD1624 1


16x2 LCD
Display
4 Potentiometer 10k 1

5 Servo Motor SG90 Servo 1


Motor
6 Buzzer 5V Active 1
Buzzer
7 Connecting Wires Jumper 20
Wires
8 Breadboard - 1
Arduino

Arduino controls the complete processes like taking a


password from the keypad module, comparing passwords,
driving buzzer, rotating servo motor, and sending status to
the LCD display.

Keypad
The keypad is used for taking the password. This is
programmed using the library <keypad.h>.

LCD Display

LCD is used for displaying status or messages on it. The


library that is used is <liquidcrystal.h>.

Potentiometer
We have used a potentiometer of 10k ohm resistance in
order to adjust the contrast of the LCD.

Servo Motor

Servo motor is used for opening the gate while rotating. This
is programmed using the library <servo.h>.

Buzzer

The buzzer is used for beep sound either indicating the


countdown time or wrong password.
Program code Explanation: Password Security Lock System
Using Arduino & Keypad
---------------------------------------------------------------------------------
For programming Arduino, we have
to include these necessary libraries. We use the keypad.h, servo.h
EEPROM.h, and LiquidCrystal_I2C.h.

#include <Wire.h>
#include <Keypad.h>
#include <Servo.h>
#include <EEPROM.h>
#include <LiquidCrystal_I2C.h>

To save the previous code to the Arduino we will be


using EEPROM. EEPROM stands for Electrically Erasable
Programmable Read-Only Memory. That is a built-in memory of
the Arduino. This memory is non-volatile. So, we are using this in
our Password protected Security Door Lock System Using Arduino &
Keypad project.
int Button = 10; //Push Button

const byte numRows = 4; //number of rows on the keypad


const byte numCols = 4; //number of columns on the keypad

char keymap[numRows][numCols] =

{'1', '2', '3', 'A'},


{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};

char keypressed; //Where the keys are stored it changes very often
char code[] = {'1', '2', '3', '4'}; //The default code, you can change it or make it a 'n' digits one
char check1[sizeof(code)]; //Where the new key is stored
char check2[sizeof(code)]; //Where the new key is stored again so it's compared to the previous one

short a = 0, i = 0, s = 0, j = 0; //Variables used later


Here we have initialized the button. we have declared a variable code
to store the default code. Again we have created two
variables check1 and check2 to check the user entered code is right
o wrong. short variable to use later. We have initialized keypad and
servo.

LiquidCrystal_I2C lcd(0x27, 16, 2);


Keypad myKeypad = Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);
Servo myservo;
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.begin (16, 2);
lcd.setCursor(0, 0);
lcd.print("*ENTER THE CODE*");
lcd.setCursor(1 , 1);

lcd.print("TO _/_ (Door)!!"); //What's written on the LCD you can change
pinMode(Button, INPUT);
myservo.attach(11);
myservo.write(0);
// for(i=0 ; i<sizeof(code);i++){ //When you upload the code the first time keep it commented
// EEPROM.get(i, code[i]); //Upload the code and change it to store it in the EEPROM
// } //Then uncomment this for loop and reupload the code (It's done only once)

let’s discuss the setup part of the program. we have initialized the LCD. then
we have printed information to the LCD. we have configured the button pin
as the input pin. here, we use the button pin to close the door. this is the
pin D11 of Arduino at which the servo is attached. Initially, we gave the servo
to stay at angle zero.

Use of ReadCode Function

Before discussing the loop function, let’s discuss the ReadCode function used


in the keypad. we can only get single characters to type the word. so, we
have used a while loop. let’s discuss it in detail. This while loop does not stop
until you press A. Basically, this while loop stores the password and
display Asterisk * on its behalf. on the second loop, it checks the password
typed is the same or not. It will increment on match and decrement on
incorrect.
void ReadCode() { //Getting code sequence
i = 0; //All variables set to 0
a = 0;
j = 0;

while (keypressed != 'A') { //The user press A to


confirm the code otherwise he can keep typing
keypressed = myKeypad.getKey();
if (keypressed != NO_KEY && keypressed != 'A' ) { //If the char typed isn't A and
neither "nothing"
lcd.setCursor(j, 1); //This to write "*" on the LCD
whenever a key is pressed it's position is controlled by j
lcd.print("*");
j++;
if (keypressed == code[i] && i < sizeof(code)) { //if the char typed is correct a
and i increments to verify the next caracter
a++;
i++;
}
else
a--; //if the character typed is
wrong a decrements and cannot equal the size of code []
}
}
keypressed = NO_KEY;

Getting Code from Keypad

let’s discuss the getNewCode part: Here, we are initializing two


characters i=0 and j=0. This code is just used to print command on LCD. we
have already discussed the while loop part before only one thing is different
that is the check part. it stores characters in the array.

void GetNewCode1() {
i = 0;
j = 0;
lcd.clear();
lcd.print("Enter new code"); //tell the user to enter the new code and press A
lcd.setCursor(0, 1);
lcd.print("and press A");
delay(2000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("and press A"); //Press A keep showing while the top row print ***

while (keypressed != 'A') { //A to confirm and quits the loop


keypressed = myKeypad.getKey();
if (keypressed != NO_KEY && keypressed != 'A' ) {
lcd.setCursor(j, 0);
lcd.print("*"); //On the new code you can show * as I did or change it to
keypressed to show the keys
check1[i] = keypressed; //Store characters in the array
i++;
j++;
}
}
keypressed = NO_KEY;
}

In getNewCode2 we are repeating the same process. we are using


the check2 variable to store the retyped password in the array.

void GetNewCode2() { //This is exactly like the GetNewCode1 function


but this time the code is stored in another array
i = 0;
j = 0;

lcd.clear();
lcd.print("Confirm code");
lcd.setCursor(0, 1);
lcd.print("and press A");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("and press A");

while (keypressed != 'A') {


keypressed = myKeypad.getKey();
if (keypressed != NO_KEY && keypressed != 'A' ) {
lcd.setCursor(j, 0);
lcd.print("*");
check2[i] = keypressed;
i++;
j++;
}
}
keypressed = NO_KEY;
Open Door Function for servo
Finally, we have OpenDoor function. This part belongs to the servo
motor. rotating servo depends upon your requirements. for the
demonstration, I am using 90 degrees.

void OpenDoor() { //Lock opening function open for 3s


lcd.clear();
lcd.setCursor(1, 0);
lcd.print("Access Granted");
lcd.setCursor(4, 1);
lcd.print("WELCOME!!");
myservo.write(90);

Use of changeCode function

Now let’s move towards the change code part. Here LCD asks for an
old password if the password is correct it will enter
the GetNewCode loop. Otherwise, it will enter the else loop. Here, it
will clear the screen and print “Incorrect password, Get Away”

void ChangeCode() { //Change code sequence


lcd.clear();
lcd.print("Changing code");
delay(1000);
lcd.clear();
lcd.print("Enter old code");
ReadCode(); //verify the old code first so you can change it

if (a == sizeof(code)) { //again verifying the a value


lcd.clear();
lcd.print("Changing code");
GetNewCode1(); //Get the new code
GetNewCode2(); //Get the new code again to confirm it
s = 0;
for (i = 0 ; i < sizeof(code) ; i++) { //Compare codes in array 1 and array 2 from two
previous functions
if (check1[i] == check2[i])
s++; //again this how we verifiy, increment s
whenever codes are matching
}
if (s == sizeof(code)) { //Correct is always the size of the array

for (i = 0 ; i < sizeof(code) ; i++) {


code[i] = check2[i]; //the code array now receives the new code
EEPROM.put(i, code[i]); //And stores it in the EEPROM

}
lcd.clear();
lcd.print("Code Changed");
delay(2000);
}
else { //In case the new codes aren't matching
lcd.clear();
lcd.print("Codes are not");
lcd.setCursor(0, 1);
lcd.print("matching !!");
delay(2000);
}

else { //In case the old code is wrong you can't change it
lcd.clear();
lcd.print("Wrong");
delay(2000);
}
}

Testing Arduino Thermal Gun


Once the Arduino code is ready we can upload it to our hardware using an
external TTL programmer or FTDI board since the pro mini does not have one
on-board. Then simply press the push button to trigger the thermal gun and
you will notice the laser beam falling on the object and the temperature of the
object being displayed on the OLED screen as shown below. Here I have used it
to measure the temperature of a component as pointed by the laser beam.

The thermal gun was also tested on soldering iron, 3D printer nozzle, ice cubes
etc and a satisfactory result was observed.

Code
/***********************************
Arduino Contactless thermometer
MLX90614 I2C connection
OLED 4-wire SPI connection
Dated: 7-6-2019
Code by: Aswint Raj
**********************************/

#include <Wire.h>
#include <SparkFunMLX90614.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// If using software SPI (the default case):


#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET,
OLED_CS);

IRTherm therm;

void setup()
{
Serial.begin(9600);
therm.begin();
therm.setUnit(TEMP_C);

display.begin(SSD1306_SWITCHCAPVCC);
display.clearDisplay();
display.setRotation(2);

String temperature;
char runner;

void loop()
{
if (therm.read()) // On success, read() will return 1, on fail 0.
{
temperature = String(therm.object(), 2);
Serial.print("Object: ");
Serial.print(temperature); Serial.println("C");
display.clearDisplay();
runner++;
delay(5);
}

display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(display.width()/4,display.height()/12);

if (therm.object()>=100)
display.setCursor(display.width()/4,display.height()/12);

display.println(temperature);

display.drawLine(display.width()/runner,display.height() -
display.height()/2.5, display.width()/runner+1, display.height() -
display.height()/2.5, WHITE);

display.setCursor(0,display.height()-display.height()/4);
display.setTextSize(1);
display.println(" Arduino Thermlgun");
display.setCursor(display.width()- display.width()/4,display.height()/12);
display.println("deg C");
display.display();

if (runner>20)
runner=0;
}

Discusses The Project useful

Infrared thermometers are a subset of devices known as "thermal


radiation thermometers". A non-contact infrared thermometer is useful for
measuring temperature under circumstances where thermocouples or other
probe-type sensors cannot be used or do not produce accurate data for a
variety of reasons. An infrared thermometer is a thermometer which infers
temperature from a portion of the thermal radiation sometimes called black-
body radiation emitted by the object being measured. They are sometimes
called laser thermometers as a laser is used to help aim the thermometer,
or non-contact thermometers or temperature guns, to describe the device's
ability to measure temperature from a distance. By knowing the amount
of infrared energy emitted by the object and its emissivity, the object's
temperature can often be determined within a certain range of its actual
temperature. Sometimes, especially near ambient temperatures, readings may
be subject to error due to the reflection of radiation from a hotter body—even
the person holding the instrument rather than radiated by the object being
measured, and to an incorrectly assumed emissivity.
The design essentially consists of a lens to focus the infrared thermal
radiation on to a detector, which converts the radiant power to
an electrical signal that can be displayed in units of temperature after being
compensated for ambient temperature. This permits temperature
measurement from a distance without contact with the object to be
measured.
Some typical circumstances are where the object to be measured is moving;
where the object is surrounded by an electromagnetic field, as in induction
heating; where the object is contained in a vacuum or another controlled
atmosphere; or in applications where a fast response is required, the accurate
surface temperature is desired or the object temperature is above the
recommended use point for contact sensors, or contact with a sensor would
mar the object or the sensor, or introduce a significant temperature gradient
on the object's surface.
Infrared thermometers can be used to serve a wide variety of temperature
monitoring functions. A few examples provided include detecting clouds for
remote telescope operation, checking mechanical or electrical equipment for
temperature and hot spots, measuring the temperature of patients in a
hospital without touching them, checking heater or oven temperature, for
calibration and control, checking for hot spots in fire-fighting, monitoring
materials in processes involving heating or cooling, and measuring the
temperature of volcanoes. At times of epidemics of diseases causing fever,
such as SARS coronavirus and Ebola virus disease, infrared thermometers have
been used to check arriving travelers for fever without causing harmful
transmissions among the tested.
In 2020 when COVID-19 pandemic hit the world, infrared thermometers were
used to provide safe and accurate testing. Public health authorities such as
the FDA in United States published rules to assure accuracy and consistency
among the infrared thermometers.
There are many varieties of infrared temperature-sensing devices, both for
portable and handheld use and as fixed installations.
Most people do not consider the infrared thermometer a tool for the kitchen,
but it can help you not only spot-check your meals but ensure your food
remains hot throughout the day. The infrared thermometer can help the
buffet at your local restaurant stay at the right temperature through several
courses and let you know when it’s too cold or has sat too long.The ability to
point and hand infrared guns allows you to measure your food while it is
cooking to make sure it will not burn or remain undercooked with potentially
harmful bacteria. One hundred sixty-five degrees is the ideal temperature for
perfectly cooked foods.

The infrared thermometer is a handy tool for use all over your home for at-
home maintenance to help you stop trouble before it starts.

Automotive repair
One of the main ways an infrared thermometer helps you around the home is
when you are tinkering with your car. The inside of an engine is hot, and taking
temperature readings around the engine can help you spot the trouble can fix
the problem without having to take apart the entire engine first. They are a
diagnostic tool to point at any temperature problems you may have.

Look for weak spots in your insulation


Infrared thermometers are a perfect way to find for you to spot where you can
lower your heating bills in your home. Where your home has less insulation or
holes, you are losing heat or letting it in during the summer. An infrared
thermometer shows you the degree of insulation in your walls and will help
you see where it is thin or lacking insulation.
Backyard Safety and Fun
Along with working in the kitchen with your Infrared thermometer, you can
get the perfect temperature for your steaks and burgers. Improperly cooked
meat can cause serious illness, and meat served too rare can leave you and
your family very sick.

You can use the thermometer to make sure your home playset is not too hot
for your children. Metal slides and chains for swings can quickly become too
hot during the summer, and it only takes seconds for your children to receive a
contact-burn from sitting or grabbing them. The infrared thermometer can let
you know how hot the toys are before you let your children play.

The ThermoPro Infrared Thermometer is a hand-held meter that can help you
around your home and garage with spot-testing your insulation, food, and play
equipment. The ThermoPro Infrared Thermometer is accurate up to 1.5
percent with a distance ratio of 12:1 for response time and reading, which is
good for measuring the boiling or freezing point of food, auto, or home repair
sensitivity.

The infrared thermometer uses a built-in laser to ensure the accuracy of your
reading temperature from a distance no matter what you are doing. The
infrared thermometer has more uses than just one from home repair to arts
and crafts to test for temperature. They are very versatile in their uses, and
you will be surprised at how you will able to use the thermometer.

Many hospitals rely on infrared forehead thermometers for fast, accurate


readings of patients’ temperatures. Why shouldn’t you? A good oral
thermometer is great, but most thermometers you buy at the store aren’t
actually good oral thermometers. A high-accuracy IR thermometer with a built-
in forehead-to-oral-temp algorithm is a great way to check your family’s
health. But that algorithm is important! Your forehead’s surface temp is cooler
than your internal temp, so let the thermometer do the math for you.
One of the benefits of using an IR thermometer is the ability to take
temperature readings at a distance. When you’re elbow-deep in a car engine
and are having a hard time navigating belts, hoses and wires, an infrared
thermometer might be just what you need. An invaluable diagnostic tool, an
infrared thermometer is great for helping you pin down problems on a wide
variety of vehicle systems, including cooling systems, HVAC, transmission,
brake systems, bearings, cv joints, catalytic converters, engine misfires, tires
and alignment, rear differential, under hood thermal mapping and intake air
temperature regulation.
As infrared thermometer technology becomes more advanced and affordable.
Discussion & Criticize

An infrared thermometer has a lens that helps us focus on the desired object
while infrared rays are used to measure the amount of heat generated by the
body or an object. So, these thermometers can even be used to measure the
temperature of dangerous objects or edible products during the processing
stage that cannot be touched. Usually, 6 inches is considered the ideal distance
for using an infrared thermometer and correctly monitoring the temperature.
However, the range can vary depending upon the thermometer we are using.
So, we have to read the instructions before we start measuring the
temperature.

Sometimes people want avoid to go for the clinic, health consultation and
physician try to get hate readings of their body temperature at home. In kids
case they hate keeping this device in their body, between arms for even few
minutes.

If you really want to overcome of these types of challenges then choose the
Infrared Thermometer the biggest benefits of this device that is having the
latest and user friendly features which allow you to check the body
temperature at your home as per your convenience.

This device is also have best for the commercial usage because it can record
the body temperature instantly and gives the perfect results or readings. With
the help of this you can easily get the body temperature readings of infants
and children without any physical contact and can also check while they
sleeping.

The Infrared Thermometer makes just a tiny beep sound while you start the
proceeding and rest of the task will be done silently without disturbing them.

There’s is alarm feature which allow you to adjust the high temperature alarm
when you want to do other important work while get the body temperature
reading without so much disturb them.
The other and most important thing of this device is that they has the large
memory storage which allows you to keep record of temperature readings.

IR thermometers are handy for use in measuring drafts and insulation


breakdown. They can pick up hot spots in electrical systems and bearings and
help monitor cooling systems. They are even used to measure food storage
temperatures and can do this with no cross-contamination. Certainly this
technology has many benefits. However, it also had a few disadvantages.

Advantages:

(i)TempIR gives an almost instantaneous reading, and there is a built-in fever


alarm to indicate if a temperature is very high.

(ii) The thermometer can be used again immediately, which is handy if


you have two sick children, or if you need to check the reading quickly.

(iii) It is hygienic because TempIR does not come into contact with the skin,
the risk of cross infection is minimized.

(iv) Measurements can be taken from a distance for hot surfaces and objects
or for food service purposes where items should not be touched or
contaminated. They are excellent for surface measurements.

(v) Measurements can also be taken of moving parts.

(vi) Infrared thermometers operate well for a variety of applications.

(vii) Memory and advanced measurement functionality is available.

(viii) They are compact, lightweight, and easy to use.


(ix) Once you have purchased TempIR, there is no further outlay.

(x) TempIR is a no contact, non invasive thermometer, so it will not


cause further distress to a sick person.

Disadvantages:

(i) Infrared thermometers cannot take measurements of gas or liquids.

(ii) The environment needs to be clean, without dust, high humidity,


or similar

(iii) Depending on the model, the accuracy can be marginal

(iv) Specialty meters can be very expensive.

(v They get damaged easily if dropped and the battery powering them
eventually runs out.

(vi) IR Thermometers are almost never 100% accurate in reading the


temperature. They usually have a deviation of ±0.4°F from the original value,
but the difference is negligible and does not result in substantial changes

(vii) Since the IR rays are emitted from the surface of an object or a body, the
infrared thermometer’s use cases are limited to surface temperature
measurement.

Infrared sensors offer the same technology and features as infrared


thermometers except they output different signals. They can output
thermocouple, voltage, or analog signals to displays or controllers. These
sensors are excellent for measuring multiple points in a process and are
economical. Use industrial infrared sensors when the high temperature of the
target to be measured could damage or destroy a contact sensor.

How to Get Accurate Temperature Readings


with Infrared Thermometers:

 Take note of Distance-to-Spot(D:S) ratio


Every infrared thermometer has a Distance-to-Spot ratio that tells the
diameter of the area being measured when the device is held at a certain
distance. For instance, 2:1 implies that the diameter of the area measured is 1
inch when the heat detector thermometer is held 2 inches away from the
target. The distance-to-spot ratio various every infrared thermometer gun, so
it is crucial to follow the recommended distance for accurate measurements.

 Not limited to the laser point


Since there is a laser to guide the infrared thermometer gun to a measuring
spot, the measuring point is misunderstood as the diameter of the laser. The
measuring spot is usually wider than the laser point. Be mindful of the
surrounding temperature.
The storage temperature of infrared thermometers can differ from the
surrounding temperature when they are used, leading to slight deviations in
temperature readings. It is recommended to allow the thermometer to sit for
some time (typically 20 minutes) in the working environment before use.

 Watch out for environment interruptions

Since fog, dust, rain, and other environmental conditions can cause deviations
in temperature readings, paying attention to these conditions and using the
thermometer in clear conditions is advisable.

 Clean and maintain your thermometer


Dirty or scratched lenses can also impair the ability of the infrared
thermometer gun to measure the temperature accurately. It is recommended
to maintain the thermometer appropriately to ensure the right functioning of
the device.

 Take some time


To get the most accurate results, allow some time for the thermometer to
come to the temperature of its surroundings.
Infrared Thermometers and the
Coronavirus:

The recent spread of coronavirus has led to an increased interest in using


infrared thermometers to scan for fevers in people. While scanning the
forehead or ear canal of a person can yield a relatively accurate reading of
their body temperature when using a properly calibrated medical infrared
thermometer, these instruments should only be used for preliminary scanning
and not for medical diagnosis. Poor accuracy of many infrared thermometers
when used for diagnosing fever, even in children whose temperatures are
typically easier to read with this technology.

Conclusion

While it’s understandable that many people have concerns about using
infrared thermometers, there really is no danger. Most of these concerns stem
from misunderstandings about the thermometers themselves.

Since the thermometer does not generate infrared radiation, there’s no risk of
if causing any harm to the user through radiation damage. Likewise, on models
which have a laser, the laser exists solely for the purpose of helping to aim the
thermometer, nothing more, and it’s so low powered that there’s no risk of
harm.

Finally, the only times when infrared thermometers have been found to give
inaccurate temperature readings have been situations in which the user did
not follow the instructions properly, and therefore the inaccurate readings
were the result of user error.

As long as you follow the instructions and use it properly, an infrared


thermometer is perfectly safe to use and has a number of advantages over
other thermometer types.

You might also like