Electronic Safe
Introduction
Welcome to this step-by-step guide on building your own Locker Safe System! This project will help you create a secure locker using a 4x4 keypad, servo motor, LEDs, LCD display, and other components. This guide assumes you have a basic understanding of electronics and have already built a multivibrator circuit. Keep your valuables safe with your own DIY Secure safe locker. Let's get started!
Keypad Input:
The code continuously checks for a key press from the keypad.
If a key is pressed, it checks if the key is '*' or '#' or if the entered password is 4 characters long (end of input).
Password Validation:
The entered password is compared to the correct password.
If the password is correct:
The servo motor moves to the unlocked position if it was locked, or to the locked position if it was unlocked.
The LCD displays "Safe opened" or "Safe closed".
The isUnlocked flag is toggled to reflect the new state.
The multivibrator is powered on for 5 seconds.
If the password is incorrect:
The LCD displays "Wrong password".
The LEDs on pins 11 and 12 blink four times to indicate an incorrect password.
Reset and Display:
After processing the password, the entered password is reset, and the LCD prompts the user to enter the password again.
Partial Password Display:
As each key is pressed, it is added to enteredPassword, and a '*' is displayed on the LCD to indicate the entered character.
This code essentially creates a secure system where a servo motor controls a lock mechanism, and user interaction is managed through a keypad and an LCD display.
Supplies
Wiring the Servo Motor
Connect the servo motor:
- Red wire to 5V on the Arduino.
- Brown wire to GND on the Arduino.
- Orange wire to digital pin 9 on the Arduino.
- Place the 10 µF capacitor between the 5V and GND pins to stabilize the power supply.
Connecting the Keypad
Attach the 4x4 keypad to the Arduino:
- Connect the keypad pins to digital pins 2 through 9 on the Arduino.
- Reference the code provided earlier for exact pin connections.
Setting Up the LEDs
Place the LEDs on the breadboard:
- Connect one LED's positive leg to pin 11 on the Arduino through a 330 ohm resistor.
- Connect the other LED's positive leg to pin 12 on the Arduino through a 330 ohm resistor.
- Connect both LEDs' negative legs to GND on the Arduino via breadboard .
Connecting the LCD Display
Connect the LCD display:
- Connect the SDA pin to A4 on the Arduino.
- Connect the SCL pin to A5 on the Arduino.
- Connect Vcc to 5V and GND to GND on the Arduino via breadboard .
Power and Ground Connections
Ensure all components are properly grounded:
- Use the ground rail on the breadboard to connect all GND pins from the Arduino and components.
- Connect the 5V power rail on the breadboard to the 5V pin on the Arduino.
Connect the Multivibrator (Optional)
Connect the multivibrator output to pin 10 on the Arduino.
- Ensure the multivibrator is powered correctly and its ground is connected to the Arduino GND.
Attach the Door Slide Lock:
- Fix the slide lock onto a stable surface like a door or box, ensuring it can move freely without obstruction.
- Unwind a paper clip and wrap one end around the servo motor arm securely.
- Attach the other end of the paper clip to the slide lock in such a way that when the servo motor turns, it will either pull the lock open or push it closed.
- Test the mechanism manually to ensure the lock moves as desired with the servo motor’s motion.