electronic door locks, electronic door lock pic,electronic lock pic,pic electronic door lock, pic electronic lock, pic door lock, microcontroller door lockHello friends, hope you are having fun. Today, I am going to share two types of Electronic Door Locks design using PIC Microcontroller and simulated in Proteus ISIS software. We all know about Electronic Door Locks as we have seen them in many homes. In electronic door locks, there’s some password which is only known to some persons. Now if you enter the wrong password then the door won’t open up and will ask for password again. And if you keep on trying the wrong password then it will start the buzzer or can alert the concerned person via SMS etc. So, such electronic door locks are quite common in our society.

Today, I am going to share a similar project in which I have simulate Electronic Door lock using PIC Microcontroller. I have used PIC-18F452 Microcontrolelr and the compiler I have used for designing the code in MikroC Pro For PIC and the simulation in designed in Proteus ISIS. The code and the Proteus simulation in given for download below. You can also design this project using Arduino or any other microcontroller like 8051 Microcontroller. Let’s start with this project.


Electronic Door Locks using PIC Microcontroller

I have divided this Electronic Door Locks Project in few parts, and I have explained them separately. You can download the complete project along with Proteus simulation by clicking the below button. But as I always suggest don’t just download it, also design it on your own so that you learn more from it:

Download Code & Simulation

  • In this electronic door lock project, I have used a solenoid along with relay.
  • We all know that in order to lock a door we have to use either DC Motor or some solenoid, which is get connected with the manual lock of the door.
  • Now, all we need to do is to move that motor according to our needs automatically. Like if I move the motor in one direction, the door goes locked and if I move it in opposite direction then it got unlocked.
  • So, in my simulation, I have used solenoid valve for locking purposes and I have represent it using Inductors in my simulation.
  • Moreover, I have used Serial Terminal as an communication medium, means we are gonna input for password etc in the serial monitor.
  • I have also used EEPROM in this project to save the current password.
  • There’s an option in this project to change the password, so if user changed the current password then the new password will be saved in EEPROM.
  • So, even if the device restarts, the new changed password will remain active as its saved in EEPROM.
  • If the user entered the wrong password then the system will for the password again.
  • But if the user entered the wrong password for three consecutive times, then the system will shut down and will start blinking the RGD lights, which I have used as an indication.
Schematics Diagram
  • Let’s first design the schematics diagram of Electronic Door Locks using PIC Microcontroller.
  • I have designed the schematic in Proteus ISIS software as its the best simulating software.
  • The schematic diagram is shown in the below figure:

electronic door locks, electronic door lock pic,electronic lock pic,pic electronic door lock, pic electronic lock, pic door lock, microcontroller door lock

  • Its quite clear from the above figure that I have used a PIC Microcontroller as the brain of the system.
  • I have serial serial terminal, which is used to take inputs from user.
  • I have used two relays and in order to drive those relays I have used transistors.
  • Transistors are converting 5V coming from Microcontroller into 12V which are driving relays.
  • Moreover, I have also used opto couplers which are just used for protection.
  • Finally, I have used three LEDs which are acting as RGB and will just indicate the wrong password.
  • These two relays are actually actuating the solenoid which will lock or unlock the door.
  • There’s no active solenoid comonent available in Proteus that’s why I have used a simple inductor just for indication.
  • Now, let’s have a look at the programming code for this project.
Programming Code
  • I have designed the programming code for PIC Microcontroller in MkiroC Pro for PIC compiler.
  • You should have a look at these Top 3 PIC C Compilers and can select one you like.
  • The PIC Microocntroller used in this Electronic door locks project is PIC18F4520. You can also use other PIC Microcontrollers like PIC16F877a etc.
  • You can use any other PIC Microcontroller, if you want. You just need to change it in simulation and in code settings.
  • Now here’s the complete programming code for Electronic Door Locks using PIC Microcontroller:

  • The code is quite self explanatory.
  • I have placed checks on Enter button like when user press Enter button then it will check either password is correct or wrong and then will decide and either on or off the respective relays.
  • Moreover, the third option is for change password and you can see rite after the change password, I have used EEPROM commands to save the password for later use.
  • Let’s now start the simulation and test our project.
  • We have seen all the details about the project and I am quite confident that now you can quite easily design this project on your own.
  • So, now let’s start the simulation and have a look at the results.
  • When you start your simulation then you will have such a screen:

electronic door locks, electronic door lock pic,electronic lock pic,pic electronic door lock, pic electronic lock, pic door lock, microcontroller door lock

  • Now you can see, its asking for password in the Virtual Terminal.
  • The default password set is “123”. So, I am gonna give it 123.

Electronic Door Lock using PIC Microcontroller

  • Now, when I gave it correct password, it asked for the correct option.
  • I have added total 3 options in it, which are shown in above figure.
  • So, if user press Y then it will lock the door and if he presses N then it will unlock the door and last option is to change the password which is set for C.
  • So, that’s how this project is working.
  • Similarly, if I gave it wrong password the nit will ask for try again for 3 times and then will set off the RGB lights to warn.
  • Complete demonstration and working of this project is given in the below video:

That’s all for electronic door locks project using PIC Microcontroller. I hope you have enjoyed it. Will meet you guys in the next tutorial soon. Till then take care and have fun. 🙂


    • Hi,

      Yeah we can provide you the complete code for it. Kndly add me on Skype and we will discuss it in detail. My Skype id is theenggprojects.


    • Hi,

      Yeah we can provide you the complete code for it. Kindly add me on Skype and we will discuss it in detail. My Skype id is theenggprojects.


  1. hi Zain Nacir
    may be U are the Salvatore, in fact I’m working on several projects at the same time my goal is to get one of them to manipulate my safe door opening with a password but all of them have something wrong in simulation and cant find the reason neither the solution for exemple this line :if(!memcmp(actual_password, given_password, 6)). the error msg i s: Undeclared identifier ‘memcmp’ in expression
    Another project gives me the same error msg with the function ; ;;;strcmp
    I think if U send me a program writen in MicroC pro with // Comments I can find my way
    RABAH from Algiers Algeria

    • Hi,

      Please understand the code first. It’s an old project so i don’t have its files. Compile your code and check what errors you are getting and then try to debug them. If you still got the issues then please post your problems in our Forum and one of our experts will surely help you out.


Leave a Reply

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

Post comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.