Components and supplies
5 mm LED: Red
5 mm LED: Green
Garage Door Fob
LED, Blue Green
Resistor 220 ohm
Tactile Switch, Top Actuated
Arduino Nano R3
SG90 Micro-servo motor
Resistor 10k ohm
5 mm LED: Yellow
Tools and machines
3D Printer (generic)
Soldering iron (generic)
Apps and platforms
Arduino IDE
Project description
Code
Garage Door Keypad
arduino
See instructions in code
1// Garage Door Opener using servo to press remote button 2// 3// Correct entry of 4 digit code will illuminate the Green LED 4// Incorrect entry of 4 digit code will illuminate the Red LED 5// 6// To change the code: 7// Press the "#" button on keypad and the Blue LED will illimunate 8// While Blue LED is illuminated, enter the initial password 9// Correct entry will illuminate the Blue and Yellow LEDs 10// Incorrect entry will illuminate the Red LED (must start over and press "#" on keypad) 11// While the Blue and Yellow LEDs are illuminated, enter the new password. 12// Successful change of password will illuminate the Green LED. 13// 14// To reset the password to 1234, press the reset button 15 16#include<Keypad.h> 17#include<EEPROM.h> 18#include<Servo.h> 19 20 Servo ServoMotor; 21 22 char password[4]; 23 char initial_password[4],new_password[4]; 24 int i=0; 25 int LED_G = 14; 26 int LED_R = 15; 27 int LED_B = 16; 28 int LED_Y = 17; 29 char key_pressed=0; 30 31 const int Reset = 12; 32 int value1 = HIGH; 33 34 const byte rows = 4; 35 const byte columns = 3; 36 char keys[rows][columns] = { 37 {'1','2','3'}, 38 {'4','5','6'}, 39 {'7','8','9'}, 40 {'*','0','#'} 41 }; 42 43 byte row_pins[rows] = { 7, 2, 3, 5}; 44 byte column_pins[columns] = { 6, 8, 4}; 45 Keypad keypad_key = Keypad( makeKeymap(keys), row_pins, column_pins, rows, columns); 46 47 //#define LED_R 10 // define red LED 48 //#define LED_G 11 // define green LED 49 50void setup() 51 { 52 Serial.begin (9600); 53 pinMode(Reset, INPUT); 54 pinMode(LED_R, OUTPUT); 55 pinMode(LED_G, OUTPUT); 56 pinMode(LED_B, OUTPUT); 57 pinMode(LED_Y, OUTPUT); 58 delay(1000); 59 ServoMotor.attach(13); 60 61 // check if the password has been changed 62 if (EEPROM.read(256) != 123) { // not equal to 123 63 EEPROM.write(256, 123); // write value of 123 to byte 256 64 initialpassword(); // set first password to 1234 65 } 66 else { // if byte 256 is equal to 123 67 EEPROM.get (0, password); // get last password before power failure 68 } 69 } 70 71void loop() 72{ 73 digitalWrite(LED_R, LOW); 74 digitalWrite(LED_G, LOW); 75 key_pressed = keypad_key.getKey(); 76 77 value1 = digitalRead (Reset); 78 if (value1 == HIGH) 79 initialpassword(); 80 81 if(key_pressed=='#') 82 change(); 83 84 if (key_pressed) 85 { 86 87 password[i++]=key_pressed; 88 Serial.println(key_pressed); 89 } 90 91 if(i==4) 92 { 93 delay(200); 94 for(int j=0;j<4;j++) 95 initial_password[j]=EEPROM.read(j); 96 if(!(strncmp(password, initial_password,4))) 97 { 98 99 Serial.println("Password Accepted"); 100 digitalWrite(LED_G, HIGH); 101 ServoMotor.write(78); 102 delay(delay); 103 ServoMotor.write(90); 104 Serial.println("Press # to change"); 105 delay(delay); 106 Serial.println("Enter Password:"); 107 i=0; 108 109 } 110 111 else 112 { 113 digitalWrite(LED_R, HIGH); 114 Serial.println("Wrong Password");; 115 Serial.println("Press # to change"); 116 delay(delay); 117 Serial.println("Enter Password"); 118 119 i=0; 120 } 121 } 122} 123 124void change() 125 126{ 127 int j=0; 128 Serial.println("Current Password"); 129 digitalWrite(LED_B, HIGH); 130 while(j<4) 131 { 132 char key=keypad_key.getKey(); 133 if(key) 134 { 135 new_password[j++]=key; 136 Serial.println(key); 137 } 138 key=0; 139 } 140 delay(delay); 141 if((strncmp(new_password, initial_password, 4))) 142 { 143 Serial.println("Wrong Password"); 144 Serial.println("Try Again"); 145 delay(200); 146 digitalWrite(LED_B, LOW); 147 digitalWrite(LED_R, HIGH); 148 delay(delay); 149 digitalWrite(LED_R, LOW); 150 } 151 else 152 { 153 j=0; 154 Serial.println("New Password:"); 155 digitalWrite(LED_Y, HIGH); 156 while(j<4) 157 { 158 char key=keypad_key.getKey(); 159 if(key) 160 { 161 initial_password[j]=key; 162 Serial.println(key); 163 EEPROM.write(j,key); 164 j++; 165 } 166 } 167 Serial.println("Password Changed"); 168 delay(200); 169 digitalWrite(LED_B, LOW); 170 digitalWrite(LED_Y, LOW); 171 digitalWrite(LED_G, HIGH); 172 delay(delay); 173 digitalWrite(LED_G, LOW); 174 } 175 Serial.println("Enter Password"); 176 key_pressed=0; 177} 178 179void initialpassword(){ 180 for(int j=0;j<4;j++) 181 EEPROM.write(j, j+49); 182 for(int j=0;j<4;j++) 183 initial_password[j]=EEPROM.read(j); 184}
Garage Door Keypad
arduino
See instructions in code
1// Garage Door Opener using servo to press remote button 2// 3// Correct entry of 4 digit code will illuminate the Green LED 4// Incorrect entry of 4 digit code will illuminate the Red LED 5// 6// To change the code: 7// Press the "#" button on keypad and the Blue LED will illimunate 8// While Blue LED is illuminated, enter the initial password 9// Correct entry will illuminate the Blue and Yellow LEDs 10// Incorrect entry will illuminate the Red LED (must start over and press "#" on keypad) 11// While the Blue and Yellow LEDs are illuminated, enter the new password. 12// Successful change of password will illuminate the Green LED. 13// 14// To reset the password to 1234, press the reset button 15 16#include<Keypad.h> 17#include<EEPROM.h> 18#include<Servo.h> 19 20 Servo ServoMotor; 21 22 char password[4]; 23 char initial_password[4],new_password[4]; 24 int i=0; 25 int LED_G = 14; 26 int LED_R = 15; 27 int LED_B = 16; 28 int LED_Y = 17; 29 char key_pressed=0; 30 31 const int Reset = 12; 32 int value1 = HIGH; 33 34 const byte rows = 4; 35 const byte columns = 3; 36 char keys[rows][columns] = { 37 {'1','2','3'}, 38 {'4','5','6'}, 39 {'7','8','9'}, 40 {'*','0','#'} 41 }; 42 43 byte row_pins[rows] = { 7, 2, 3, 5}; 44 byte column_pins[columns] = { 6, 8, 4}; 45 Keypad keypad_key = Keypad( makeKeymap(keys), row_pins, column_pins, rows, columns); 46 47 //#define LED_R 10 // define red LED 48 //#define LED_G 11 // define green LED 49 50void setup() 51 { 52 Serial.begin (9600); 53 pinMode(Reset, INPUT); 54 pinMode(LED_R, OUTPUT); 55 pinMode(LED_G, OUTPUT); 56 pinMode(LED_B, OUTPUT); 57 pinMode(LED_Y, OUTPUT); 58 delay(1000); 59 ServoMotor.attach(13); 60 61 // check if the password has been changed 62 if (EEPROM.read(256) != 123) { // not equal to 123 63 EEPROM.write(256, 123); // write value of 123 to byte 256 64 initialpassword(); // set first password to 1234 65 } 66 else { // if byte 256 is equal to 123 67 EEPROM.get (0, password); // get last password before power failure 68 } 69 } 70 71void loop() 72{ 73 digitalWrite(LED_R, LOW); 74 digitalWrite(LED_G, LOW); 75 key_pressed = keypad_key.getKey(); 76 77 value1 = digitalRead (Reset); 78 if (value1 == HIGH) 79 initialpassword(); 80 81 if(key_pressed=='#') 82 change(); 83 84 if (key_pressed) 85 { 86 87 password[i++]=key_pressed; 88 Serial.println(key_pressed); 89 } 90 91 if(i==4) 92 { 93 delay(200); 94 for(int j=0;j<4;j++) 95 initial_password[j]=EEPROM.read(j); 96 if(!(strncmp(password, initial_password,4))) 97 { 98 99 Serial.println("Password Accepted"); 100 digitalWrite(LED_G, HIGH); 101 ServoMotor.write(78); 102 delay(delay); 103 ServoMotor.write(90); 104 Serial.println("Press # to change"); 105 delay(delay); 106 Serial.println("Enter Password:"); 107 i=0; 108 109 } 110 111 else 112 { 113 digitalWrite(LED_R, HIGH); 114 Serial.println("Wrong Password");; 115 Serial.println("Press # to change"); 116 delay(delay); 117 Serial.println("Enter Password"); 118 119 i=0; 120 } 121 } 122} 123 124void change() 125 126{ 127 int j=0; 128 Serial.println("Current Password"); 129 digitalWrite(LED_B, HIGH); 130 while(j<4) 131 { 132 char key=keypad_key.getKey(); 133 if(key) 134 { 135 new_password[j++]=key; 136 Serial.println(key); 137 } 138 key=0; 139 } 140 delay(delay); 141 if((strncmp(new_password, initial_password, 4))) 142 { 143 Serial.println("Wrong Password"); 144 Serial.println("Try Again"); 145 delay(200); 146 digitalWrite(LED_B, LOW); 147 digitalWrite(LED_R, HIGH); 148 delay(delay); 149 digitalWrite(LED_R, LOW); 150 } 151 else 152 { 153 j=0; 154 Serial.println("New Password:"); 155 digitalWrite(LED_Y, HIGH); 156 while(j<4) 157 { 158 char key=keypad_key.getKey(); 159 if(key) 160 { 161 initial_password[j]=key; 162 Serial.println(key); 163 EEPROM.write(j,key); 164 j++; 165 } 166 } 167 Serial.println("Password Changed"); 168 delay(200); 169 digitalWrite(LED_B, LOW); 170 digitalWrite(LED_Y, LOW); 171 digitalWrite(LED_G, HIGH); 172 delay(delay); 173 digitalWrite(LED_G, LOW); 174 } 175 Serial.println("Enter Password"); 176 key_pressed=0; 177} 178 179void initialpassword(){ 180 for(int j=0;j<4;j++) 181 EEPROM.write(j, j+49); 182 for(int j=0;j<4;j++) 183 initial_password[j]=EEPROM.read(j); 184}
Downloadable files
Schematic
Schematic
Schematic
Schematic
Documentation
Servo_fob_arduino_mount
This positions the servo to press the button on the fob. Wayne Dalton fob. Custom needed for other brands
Servo_fob_arduino_mount
Servo_fob_arduino_mount
This positions the servo to press the button on the fob. Wayne Dalton fob. Custom needed for other brands
Servo_fob_arduino_mount
Keypad case
Allows the keypad to be mounted to wall and adds the LEDs. Uses Adafruit Keypad 3845.
Keypad case
Comments
Only logged in users can leave comments
ddsitzmann
0 Followers
•0 Projects
Table of contents
Intro
6
0