Introduction
Read moreIn this project we are making a pattern lock using Arduino and solenoid lock.
The lock will only get opened when the correct pattern is entered. the pattern is a combination of long and short press of the pattern switch.
- Avoid the relay in the circuit, I have not used them
- The code will constantly monitor the enter switch and patter switch state and store it.
- Whenever I press the pattern button,
- The time from millis() function will be stored in two variables, one for press time and one for release time.
- Then the time difference between the release and press will be calculated and stored.
- Then using a if condition the program will check whether the time difference is less-than or greater-than the predefined time for short and long press.
- Then the code will check whether there is any space for the last detected press and if will be stored to the nearly available NULL space in the pattern lock array until all the array is filled.
- Now if we press the enter button the program will compare the default pattern and the patter which you just entered.
- If the pattern is true then the transistor will turn on and all the values stored to the pattern array will be erased.
- If the pattern is false then the transistor will remain off and all the values stored to the pattern array will be erased.
- Also, I have added some LEDs for indication.
Connect the Circuit as shown,
- Digital pin 2 and 3 for enter and pattern button.
- Digital pin 5 and 6 for red and green LEDs.
- Digital pin 12 to transistor base.
- Transistor emitter to GND.
- Transistor collector to solenoid ground.
- 12v to solenoid VCC.
- Don't forget to connect ground of 12 to ground of Arduino.
- Diode in between vcc and ground of solenoid.
- and don't forget all the resistors.
Read in my blog: https://www.diyusthad.com/2019/04/arduino-project-secrete-pattern-lock-using-arduino.html
Comments