Arduino-Based Safe Project Report
Arduino-Based Safe Project Report
FACULTY OF ENGINEERING
Arduino laboratory.
Report.
Safe
Jiménez Marco Polo.
Vallejo Martínez Rodrigo.
Professor: Georgina del Carmen Mota Valtierra.
Introduction.
Arduino allows us to develop programs that interact with the world such as sensor networks,
simple robotics, alarms, communication systems.
In this project, we will see the operation of a stereotype of moving a servomotor with some
characteristics that we will give to what we will call safe.
Where we will try to connect all these points based on the functions already seen in Arduino for the
operation of the safe where the interaction with the user will be to send a character that will be the
password that will open the safe.
Objective.
The objective of the safe project is to implement all the programs we have seen in
past practices, such as matrix keyboard, LCD screen, servomotor, LEDs, etc., to incorporate them into a single
project that this will be, in which all the functions seen will perform a single purpose 'to open a safe'
utilizando algunas funciones que nos ofrece arduino.
Necessary materials.
LCD screen
Arduino
Breadboard
Cables
Matrix keyboard
Servo motor
Caimans
Potentiometer
LEDs
Development.
To start with the project, it was necessary to establish how the password for the safe would be stored.
So, for this, the Eeprom.h library was used, which allows storing a certain amount of data in memory.
internal of the arduino. Where the vector of the password used was saved in addition to a key of
administrator giving the possibility to forget the password. In addition to being used as a device
a matrix keyboard as input and an LCD screen as output where the password being typed is displayed
how it works when the safe opens and closes, the actuator used was a servomotor which turned 90
degrees to open and it showed closed as the default option, the servo's propeller worked as
box insurance in cooperation with a piece of wood located in the box.
For the assembly of the circuit and the Arduino, it was placed behind the door of the box, and a hole was made in
one of the sides to provide power to the box via the USB cable, the servo was placed on it
door yes like the LCD screen and the matrix keyboard.
For the assembly of the components needed for the operation of the safe, we used the
data that we already had from the other practices, that is, how the screen was connected to the keyboard, the cables of
servo motor and the wires of the potentiometer.
Diagrams and connections.
Code.
#include <Keypad.h> // Controls the keyboard
#include <LiquidCrystal.h> //controls the LCD
#include <Servo.h> //Control of the servomotor
#include <EEPROM.h> //Input/Output Control EEPROM
//*****************************************
//*** Declaration of local variables *****
//*****************************************
Servo secure; //servomotor
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //display LCD
const byte rows = 4;
const byte columnas = 4;
byte pinsRows[rows]= {9,10,11,12};
byte pinsColumns[columnas] = {14,15,16,17}; //A0,A1,A2,A3
char keys[rows][columns] = {
{'1','2','3','A'}, Keyboard Declaration
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'},
};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, columnPins, rows, columns);
void setup(){
void loop() {
cl[contador] = [Link](); // store in the position counter the key pressed
if (cl[counter] != NO_KEY){ If a key was pressed then
//*****************************************//
Check if the password is correct
//******************************************//
case 'A':
lcdtextoizq(" **Correct**");
[Link](15); open door
green light();
delay(600);
Press B to close
delay(600);
Close
//*************************************//
Close the door if B is pressed
//*************************************//
case 'B':
lcdtextocentrado("Cerrado");
delay(500);
[Link](90); //closes the lock
redled();
for(int i = 0 ; i<4;i++){ // deletes the temporary saved code
cl[i]='0';
} // end of for
lcdnumber();
break; //end of case B
case 'C':
repeatpass();
if (comp>=4){ //if the password matches then
Correct password
delay(500);
nuevapass();
return(); //re-enter
} //function change password
else{
lcdtextoizq("Could not change");
lcdnumber();
lcdtitulo(" **PASSWORD** ");
break;//end case c
default:
write(cl);
//*********************************
//*****Functions section********
//*********************************
void lcdnumero(){ //reseta los valores del cursor del lcd asi como del contador
[Link](0,1); second line
");
[Link](6,1);
[Link]("____");
cursorr=6;
counter=0;
} //end of lcdresetparanumero
void lcdtextocentrado(String A){ //write the message second line 1st box
[Link](0,1);
[Link](" ");
[Link](6,1);
[Link](A); //prints the entered value
} //end of lcdresetparatexto
void lcdtextleft(String A){ //writes the message second line 6to square
[Link](0,1);
");
[Link](0, 1);
[Link](A); //prints the entered value
} //end of lcdresetparatexto
void writeValue(char *v){ //writes the value of an array at the current position of the counter
[Link](cursorr, 1);
[Link](v[counter]);
v[contador+1]= (' ');
delay(250);
[Link](cursor, 1);
*
cursorr++;
counter++;
[Link](0,0);
[Link](" ");
[Link](0,0);
[Link](a); //prints the entered value
} //end of lcdresetparatexto
void repeatPassword() {
int i = 0;
lcdtitle("Enter password");
delay(800);
previous step
delay(1000);
Finish with *
lcdnumber();
while (i<=4){ //will do this 4 times
switch (cl[counter]){
case '*': // checks if the entered password is the same as the previous one
comp=0;
comp = check(cl, co);
if (comp>=4){ //if it is equal
centredlcdtext("Correct");
ledgreen();
delay(300);
ledrojo();
i=5;} //end if comp<=4
else{
centeredLCDtext("Error");
ledrojoblink();
i=5;
}//end else
break; //end of case *
default:
write(cl);
i++;
}//end of the switch
} // end of if no key
}//end of if counter==4
//end of while
}//end of the function repeatpass
void newpass() {
lcdtitle("New password intro");
End with 'D'
delay(1500);
ONLY NUMBERS
delay(1500);
lcdnumber();
while(counter<=4){ //four times the cycle
cl[contador] = [Link]();
if (cl[counter] != NO_KEY) { //if I wrote something
switch (cl[counter]){
case 'D':
if (counter >= 4) { // if they have already written 4 numbers
Re-enter it
delay(1000);
counter=5;
} // end of if counter == $
else { // if he didn't write 4 numbers
Password error
delay(500);
[Link](0,1);
lcdtextleft(" ");
[Link](counter);
counter = 5;
}//End of else
break;
default:
write(cl);
} // end of the switch
//end of if
}//fn del if no key
}//end of while
void returns() {
lcdtitle("Write again");
Finish with '#'
delay(1500);
lcdnumber();
while(counter <= 4) { //four times the loop
cn[counter] = [Link]();
if (cn[counter] != NO_KEY) { //if I wrote something
switch (cn[counter]){
case '#':
if (counter >= 3) { // if they have already written 4 numbers
Password read
counter=5;
}//end of if counter==$
else { // if did not write 4 numbers
Password error
delay(500);
[Link](0,1);
lcdlefttext(" ");
[Link](counter);
}//End of the else
break;
default:
write(cn);
}//end of the switch
//end of if
} //fn delete if no key
//end of while
}
find return pass
void admin(void){
admin pass
'*' = Accept
delay(1500);
lcdnumber();
cursorr=4;
while(counter<=8){
cal[contador]=[Link]();
switch (cal[contador]){
case '*':
comp = verification(cal, ca);
if (comp>=6){
Hello admin
contador =20;
adminpass();
}
//end of if counter==$
else { // if you did not write 4 numbers
Password error
counter = 20;
**PASSWORD**
lcdnumber();
}
break;
default:
write(cal);
}//end of the switch
//end of if
} //fn del if no key
}//end of while
} //find admin
void adminpass() {
New password
Finish with '#'
delay(1500);
lcdnumber();
while(counter<=4){ //four times the loop
cn[counter] = [Link]();
if (cn[counter] != NO_KEY) { //si escribi algo
switch (cn[counter]){
case '#':
if (counter >= 3) { // if he/she has already written 4 numbers
Password read
for(int i =0;i<=4;i++){
[Link](i,cn[i]);
for(int i =0;i<=4;i++){
co[i]= [Link](i);
delay(500);
Password updated
counter = 10;
delay(500);
**PASSWORD**
Confirm with 'A'
} // end of if counter==$
else { // if did not write 4 numbers
Password error
delay(500);
[Link](0,1);
lcdtextoizq(" ");
[Link](counter);
} //End of else
break;
default:
write(cn);
}//end of the switch
//fin del if
}//fn del if no key
}//end of while
}
find return pass
Applications.
The use of the tools that Arduino offers us is reflected in different fields of life.
daily, an example of this is in the safes that work with arduino, where we incorporate
the Arduino techniques for its operation, some applications that use functions of
Arduino is seen in a robot that emulates a spirograph, which is capable of painting and creating drawings of
geometric shapes on a whiteboard, another example is where a traditional microwave is
turns into a smart device in which we would use a tablet and a board of Arduino that
It would reduce the wait time in the kitchen; the safe can also be called a secure briefcase.
where we can incorporate a GPS module among other examples.
Conclusions.
Arduino is an open-source hardware platform that can be used to develop objects.
autonomous interactives or can be connected computer software, as we did in the project
from the safe. Through the entry pins and a range of sensors, the user introduces the
The password must be four characters long, and if it is correct, the box will open; otherwise, it will beep.
As an error. In previous practices, we saw the operation of some Arduino accessories such as the
matrix keyboard, the servomotor, the LCD screen, which we now combine into a single project that was
the safe.