Programming and application of the AT89C2051 microcontroller.
Application of the non-inverting buffer IC CD4050.
Interfacing of the microcontroller output with the LCD.
The Microcontroller based Code Lock is based on the 20-pin ATMEL micro-controller AT89C2051 and employs a 4-digit sequential code with time-out security feature. In addition to the microcontroller, the circuit uses a single additional IC (CD4050) and a transistor to drive a relay.
No. of ICs used: 3
In the circuit, Port-1 of the AT89C2051(IC1) is used to drive the LCD in 4-bit mode with 10-kilo-ohm pull-up resistors. The 10-kilo-ohm potentiometer controls the contrast of the LCD panel. It works better when its wiper is nearer to ground potential.
Timer 0 of 89C2051 is used as an internal counter that increments a variable every second. This variable is used in the project to time out the delay for entering the code.
After initialization, the software switches on ‘Ready’ LED and waits for a 4-digit code to be entered. The valid code for this project is ‘1324.’ The code is entered using the seven input switches that are connected to port-3. Port-3 does not have the bit ‘P3.6’ and hence the same is ignored by the software. Two LEDs at port-1 are interfaced to P1.0 and P1.1 pins to provide ‘Ready’ and ‘Relay On’ indication via respective LEDs.
The P1.1 line is also interfaced to relay driver transistor T1 through a buffer to switch on a 12V relay, which can activate an electrically operated lock.
Timer 0 is started on the first keystroke to validate the remaining three digits, provided these digits are entered within five seconds. If not, the software loops back to the initial state. After three unsuccessful attempts, the circuit will wait for about 10 seconds (before accepting the next keystroke) to avoid unwanted tampering attempts. All these timings can be changed through the software program to suit your specific requirements.
The software is written using BASCOM-51.
Brand: Kits'n'spares, Marketed by: Kits'n'spares
Click To View Circuit Diagram