arduino keypad library


I want to build myself an electronic keypad or lock using a micro controller I’m sure that you will like this tutorial, because it’s a pretty interesting one. What I want to do is insert a password using one of these chip, keypads that I bought from eBay for less than 70 cents. If the password is correct, the door will open using a servo motor that will move a slight lock like this one. But if the password is wrong, an error will show on the LCD screen and I will have to try it once again. I will also add a small buzzer to this project. In order to have some sound signals using two push buttons, I will be able to open and close the door from inside of the room in case of an emergency. So let’s start with a tutorial. Remember all the part list. Examples schematics and codes are in the description down below. We will use Arduino Uno to make the tests, but, finally I recommend you to switch it for an Arduino Nano, because it is a lot smaller. I bought this 4×4 keypad from eBay for under 102 slide the door lock I’ll use this sg9 micro servo. It will be strong enough to slide the lock, but you could use a bigger one if needed, to reduce the pin amount. I use this. I square see LCD screen it’s a very cheap module and I also bought it from eBay. We will also need one active buzzer to push buttons to 1 kilo, ohm resistor for the pull downs, and maybe some LEDs to make this door lock.

Loop, cooler let’s. First, take a look at this example. I have set the password to three zero zero. Seven. I type in that code and press a to confirm, as you can see it says, accepted and the server spins you will have to set the minimum and maximum angle of the servo, depending on your slide lock size. If I’ll try a wrong password, the error will show up let’s try again this time. The password is correct once the door is open to close it just press the beach character. Now we are back in the main password screen. Pressing the open push button. The door will directly open without password. Put these two push buttons inside of the locked room. We’Ll use a nine volt battery to supply the system may be. A permanent transformer will be a better idea, because if the battery’s low, the door would never open and we don’t want that, let’s take a look at the schematic connect the I square C module of the LCD screen to analog pins, a 4 and a 5 which Are data and clock supply 5 volts to the LCD screen and also to the servo motor connect ground as well? Connect digital pin 10 to the signal wire of the servo motor now connect the 8 pin from the keypad from digital pin 2 to digital pin 9 of the Arduino make sure that the connections are in the correct order. If you look close enough, you will see a dot or a 1 on the keypad connector.

This number marks the first thing. We can also see that the columns are marked with white and the rows with black connect them in the same order. If not, you will have to change the code later now: connect the buzzer to ground and digital pin 11. It has to be opposed with modulated, pin if not the buzzer won’t be able to make sounds connect to pulled our resistor from the push buttons to ground connect. The wire from the same pin of the push buttons to digital pin 12 and 13 of the Arduino connect 5 volts to the other side of the push button. In this way, the digital input will be always in the low state, except when the button is pressed, because then we will have 5 volts at the input. The schematic is ready. Let’S now take a look at the code. As always, we import the libraries. Remember that this I square see LCD modules needs a special library in order to work download the liquid crystal I square C library, from a link below open arduino ide, go to sketch, include library, add zip library and open the downloaded zip file in order to install It now we are ready to make our code. These two variables define the maximum rotation of the servo motor. I have set mine from 90 to 180 degrees. We create some extra variables that we will need along the code. Here we configure the keypad. We have to include the keypad library as well download it from a link below and stall it define the rows and columns amount.

This is the layout of my keypad. If you press one key, but a different chapter is printed on the screen. That means that you’ve wired wrong the columns and rows. You can change that or change this layout to match your pressed buttons. These are the pins used for the keypad. You can also change these values. If the keypad doesn’t work properly in the setup loop, we select our servo P. In this case, digital pin, 10 start the screen and print the main text. We also put the servo in the closed position using the server write function now in the infinite loop. We first open or close the door depending on the to emergency push buttons. After that we make the chair turn read. This is all the code that makes the for chapter password right once we arrive at the for character and press the a key we check. If the password is correct in order to open or not the door, if the password is wrong, display the error and start again, if is correct, set the server to the open position and print door open now compile and upload and let’s give it a test. Works. Nice doesn’t, it I’ll mount this system to my door. I will also print a 3d case for the keypad and LCD to give it a nice look. I’Ll leave it functioning with a 9 volt battery for now I’ll install a transformer later. We could always add a Bluetooth connection to this Arduino, connecting a module to pins 1 amp 2 and open the door using our smartphone.

In a previous video, I shown you how to create a Bluetooth app and how to control Arduino pins with it check that video. If you want to make your own app now in the same way, I’ve created this simple app that will send the letter open, open and the letter C when closed download the app and install it to your Android smartphone connect the Bluetooth module to your Arduino pins. Tx and rx I shown in this 2nd schematic now download the second code for the Arduino, Bluetooth, control and upload it to your Arduino. Now you can open the door using the app as well. In this case, the app will be the key to the door, and anyone who has it could open it if you don’t want to use the blue just upload the previous code and you are ready to go well. I hope you liked this video stay tuned for more.


arduino keypad library Video







arduino keypad library news








arduino keypad library Social






👋 Want to bring Tony Stark-like gesture control to your projects? Learn how with the BLE-enabled MKR WiFi 1010 and Nano 33 BLE Sense boards using the ArduinoBLE library.
safe image.php?d=AQDyi1ELcW4VGzhx&w=720&h=720& dChOhNMmeF - arduino keypad library

Arduin-yo ho ho! A fairground favorite, the pirate ship is a fun way to explore the oscillation of a pendulum. How much fun, you ask? Access our Science Kit Physics Lab preview and see for yourself:

🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today:

70537898 550174072395145 8798850142103928832 n.jpg? nc cat=102& nc oc=AQmCfMPwMf1oPpYqFhzbxfnGdbrmsjZXrEEBy1ox5Z8EJtiYMADoFNZ5mnSNRgCCY74& nc ht=scontent - arduino keypad library



Originally posted 2017-09-14 05:03:49.

(Visited 78 times, 1 visits today)

About The Author

You might be interested in

Comment (28)

  1. sometimes the slave adress is not 0x3f. So change it to 0x27 if it dosn’t work when using this function:
    LiquidCrystal_I2C lcd(0x3f,20,4);

    1. is the “active buzzer” just a piezo speaker?or is there more to it or can i just hsarvers the piezo disc speaker out of something?
      also will the .ino fit on a pro mini?

  2. This is a very bad idea on a door that you need access to like a bedroom door. What if there is a fire and the power goes out? You have now trapped yourself in a burning building. What if the cheap components made in China break inside the door (which they will after a while)? You now have to break the door down. This is a nice project for something like a shed door of a lock box, but do not do anything like this on a door that might be a fire escape.

  3. Bro the code gives me error can you please send a code or how to correct this code it says keypad library not found

  4. Hi Electronoobs,

    I’m having a problem where after I include the libraries and upload the code, the screen on the LCD doesn’t show anything and the servo is constantly moving back and forth, and the buzzer is going off non stop. Even the two push buttons don’t do anything. Can you help me?

  5. Hi Electronoobs first off great video. Helped me set up my arduino project. I altered the code to fit what I was wanting, erasing the electronoobs on the LCD and stuff. So far I’ve gotten the keypad to open and close the servo and the inside open push button to open the servo. But I have been unsuccessful on getting the close button to work properly. It could be the code but I’m not an expert. Any Advice?

  6. Great write up. Tried this but my servo keeps “twiching” and the LCD display reads “inside open” & “inside open electronoobs”
    I dont think I have a wiring issue, is there a loop issue in the code? please send help


Your email address will not be published. Required fields are marked *