2- Digit Combinational lock Using VHDL


Title: 2- Digit Combinational lock Using VHDL

Aim:  To design 2-Digitl combinational lock with the help of 4-bit magnitude comparator.




  1. To study the Digital Circuit.
  2. To design 2-Digit combinational Lock.
  3. To verify the Circuit by examiner.

 Software & Hardware Requirement:

  1. Thumb Wheel Switch
  2. Buffer IC-74240, IC-7485 magnitude comparator, IC-7805, IC-7421.
  3. +5V Power Supply.


  • TWS convert decimal to BCD code but output of this switch is active low so we need inverter or buffer IC, active low input is converted in to active high output. Output of this IC is given to 4 inputs (A0 to A3) of magnitude comparator IC-7485.
  • IC 7485 other 4 inputs (B0 to B3) used to set code lock condition.
  • When used set code using TWS matching with set code (B0 to B3) the output of IC 7485 goes high(A=B)
  • In similar way remaining 2-digit also work & all 3-digit on TWS matches with set code switch all 3 IC 7485, A=3 output.
  • This high output is input AND gate IC 7421 causing AND gate enable i.e. output of AND gate high forcing relays driver XOR to become forward bias.
  • Relay coil gets energized and pole position changes from normally closed to normally open causing system lock to get open.

Introduction: Digital comparator circuit are used as integrated part of arithmetic and logic circuit. The comparison of two number is greater than or less than or equal to combinational lock the code of lock which is adjusted unless and until the user code matches with adjusted one the lock will not be open the comparator output A=B used to bias relay driver transistor.



  • Build the circuit as shown in figure.
  • Set the lock code using switches at input to B3 of each IC-7485.
  • Using TWS try to match input of A0 to A3 of each IC 7485 with input B0 to B3.
  • When B0 to B3 matches with A0 to A3 of each IC 7485 then A=B is fed to AND gate.
  • AND gate switches “ON” and output of AND gate is fed to LED.


  • It is used in Home security system.
  • It is used in banking system.

Combinational Lock: Combinational lock is type of lock in which a sequence of numbers or symbol is used to open the lock is called combinational lock.


Successfully tested with two digit combinational lock and obtained result.

Leave a Reply

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