Security is important everywhere. To secure things using the digits, keypads are used to take the input from the user. For this purpose, components that you need are:

Microcontroller: At89c51

Microcontroller At89c51

Keypad: cellular phone keypad (4×3)

Microcontroller At89c51 programming

 

Suppose we are using a motor that open the door when it rotates in clockwise and close the door when it rotates anticlockwise.




First check the circuit diagram:

hardware programming

We will make a program which will store the inputs that pressed from the user and store it. Then pressed digits will be compared with the set password combination of digits.

To do all this we make a function in program that will detect the key pressed from the user.

These pattern of keys will be stored in a character array.

Then this array will be compared to set password array.

If password will be matched. Motor will start rotating in clockwise.




I had connected motor directly to the microcontroller. In software it works fine. But for hardware you have to connect the motor using relay (previously discussed) or driver IC because current from the microcontroller is too much low that could not rotate the motor.

Once password is accepted motor will start rotating in clockwise (as door open) then after few second motor will rotate few seconds in anticlockwise to close the door again.

Check the commented C Language program for the security lock.

c language program

c language software

Once the password of 1470 is pressed, the motor will start to rotate clockwise:

Microcontroller At89c51 hardware programming

 

This article was prepared for you by Hafiz Abdul Haseeb Tariq from FAST-National University of Computer and Emerging Sciences-Pakistan. He’s an Electronics & Embedded system engineer and has practical experience in circuit designing, networking, assembling, PCB making, 8051 & Arduino programming.




You can check out his previous article in the below link:

http://jestineyong.com/introduction-to-8051-microcontroller/

About

Jestine Yong works as an Electronics Repair Lecturer in Kuala Lumpur Malaysia and his training website is http://www.NoahtechElectronicsTraining.com. You can check out his repair blog at http://www.JestineYong.com