COMPONENTS DETAILS -:
4X4 KEYPAD MODULES are available in different sizes and shapes. But they all have same pin configuration. It is easy to make 4X4 KEYPAD by arranging 16 buttons in matrix formation by yourself.
Pin Number
Description
ROWS
1
PIN1 is taken out from 1st ROW
2
PIN2 is taken out from 2nd ROW
3
PIN3 is taken out from 3rd ROW
4
PIN4 is taken out from 4th ROW
COLUMN
5
PIN5 is taken out from 1st COLUMN
6
PIN6 is taken out from 2nd COLUMN
7
PIN7 is taken out from 3rd COLUMN
8
PIN8 is taken out from 4th COLUMN
As given in above table a 4X4 KEYPAD will have EIGHT TERMINALS. In them four are ROWS of MATRIX and four are COLUMNS of MATRIX. These 8 PINS are driven out from 16 buttons present in the MODULE. Those 16 alphanumeric digits on the MODULE surface are the 16 buttons arranged in MATRIX formation.
The internal structure of 4X4 KEYPAD MODULE is shown below.
4X4 KEYPAD MODULE Features and Specifications
Maximum Voltage across EACH SEGMENT or BUTTON: 24V
Maximum Current through EACH SEGMENT or BUTTON: 30mA
Maximum operating temperature: 0°C to + 50°C
Ultra-thin design
Adhesive backing
Easy interface
Long life.
Arduino Uno
Description The Arduino Uno is an open-source microcontroller board based on the Microchip ATmega328P microcontroller and developed by Arduino.cc. The board is equipped with sets of digital and analog input/output pins that may be interfaced to various expansion boards and other circuits.
SERVO MOTOR
Aservo motoris an electrical device which can push or rotate an object with great precision. If you want to rotate and object at some specific angles or distance, then you useservo motor. It is just made up of simplemotorwhich run throughservomechanism.
CIRCUIT DIAGRAM
CODE :-
#include <Servo.h> #include <Keypad.h> Servo ServoMotor; char* password = "555"; // change the password here, just pick any 3 numbers int position = 0; const byte ROWS = 4; const byte COLS = 4; char keys[ROWS][COLS] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'} }; byte rowPins[ROWS] = { 8, 7, 6, 9 }; byte colPins[COLS] = { 5, 4, 3, 2 }; Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); int RedpinLock = 12; int GreenpinUnlock = 13; void setup() { ServoMotor.attach(11); LockedPosition(true); } void loop() { char key = keypad.getKey(); if (key == '*' || key == '#') { position = 0; LockedPosition(true); } if (key == password[position]) { position ++; } if (position == 3) { LockedPosition(false); } delay(100); } void LockedPosition(int locked) { if (locked) { digitalWrite(RedpinLock, HIGH); digitalWrite(GreenpinUnlock, LOW); ServoMotor.write(11); } else { digitalWrite(RedpinLock, LOW); digitalWrite(GreenpinUnlock, HIGH); ServoMotor.write(90); } }
youtube video link - https://youtu.be/1LUj7gRxcqU
4x4 Keypad Module Details - https://components101.com/misc/4x4-keypad-module-pinout-configuration-features-datasheet
Komentarze