Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Code lock control module. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Home, household, hobby

Comments on the article Comments on the article

The use of modern components, in particular microcontrollers, makes it possible to reduce the weight and dimensions of electronic devices and increase the number of functions they perform. This article describes a combination lock module made using a PIC controller.

The device is intended for use as a security unit (electronic lock cylinder) in combination locks, alarm control systems or other devices, access to which must be restricted completely or in certain modes.

The module provides the appearance of a high logical level at its output when typing a seven-digit decimal number - a code - from the keyboard. When it is dialed again, a low level appears at the output. The module contains two channels independent from each other, each of them controls one output. Channel access codes can be specified (modified) by the user in a special preset mode. The channel goes into it when you type the seven-digit preset code from the keyboard (each channel has its own code). From this mode you can modify both the access code and the preset code itself. All codes for both channels are stored in the module's electrically programmable data memory (EEPROM), which is writable by software.

The module diagram is shown in Fig. 1. Its basis is the PIC16F84 microcontroller from MICROCHIP, which ensures low power consumption and minimal costs [1]. All functions are implemented in software. The pins of port B of the microcontroller DD1 (RBO-RB6) are used to connect a standard 12-key keyboard. RB0-RB3 are programmed for data input, and RB4-RB6 are programmed for output. Pin RB7, programmed as an output, is used to supply audio signals.

Combination lock control module
(click to enlarge)

Each time you press any key, which is detected and evaluated by the program as “true,” a burst of 13 pulses appears at pin 1 of DD124 with a period between them of about 4 ms. A short beep sounds. When you hold down the key, the bursts follow each other without pauses (constant signal). When the correct code (access or preset) is dialed, 1240 such pulses appear on this pin (a sound signal lasting about 5 s).

On elements R5, R6, C4, VD1 there is an external reset unit for the microcontroller when the power is turned on. The pins of port A of the RAO-RA4 microcontroller are programmed as outputs. RAO is the preset mode enable flag for both channels. The setting of this flag (enabling the preset mode) is indicated by the lighting of the HL1 LED. The flag is set by pressing the “*” button on the keyboard, and is reset by pressing the “#” button or upon completion of code modification in the preset mode in any channel or at the time of a system reset (when turning off the power).

RA1 and RA2 are flags of the preset modes of channels 1 and 2. Each of them is set when the corresponding preset code is dialed, and is reset when the “#” button is pressed or after modification of the codes in the preset mode in the corresponding channel is completed or upon a system reset. The setting of each of these flags is indicated by the lighting of the corresponding LED HL2, HL3. Modification of codes in the selected channel is possible only if the preset mode flag of this channel and the preset mode enable flag are set.

RA3 and RA4 are outputs of channels 1 and 2, respectively. Each of them goes high when the corresponding access code is dialed, and clears when the code is dialed again or the system is reset. RA3 has TTL levels, and RA4 is an open drain output. Actuators are connected to the channel outputs.

From the above it follows that the module is actually four-channel: in addition to two “full” channels, which are set and reset only by a set of access codes, there are two more “incomplete” channels (RA1 and RA2). They are set by a set of preset codes, and reset by pressing the “#” button, i.e. they limit access only to turning on actuators, but not to turning them off. To avoid erroneous modification of codes in EEPROM. When using "incomplete" channels, make sure that the preset mode enable flag is reset.

A simplified block diagram of the program's operation algorithm is shown in Fig. 2. After turning on the power, a system reset occurs, resetting all flags and outputs of port A. Next, the program begins to poll the keyboard. When a pressed key is detected, polling pauses until the key is released. Anti-bounce protection for key contacts is implemented in software. The typed code is accumulated in the register RAM of the microcontroller.

Combination lock control module
(click to enlarge)

After entering the seventh digit, the dialed code is compared with the preset code of channel 1. In case of a mismatch, it is compared with the preset code of channel 2. When the dialed code matches one of these codes, the program sets the corresponding preset mode flag and resets the dialed code. If it does not match, it is compared sequentially with the access codes of channels 1 and 2. If the dialed code does not match with them, it is reset.

Following each digit entered from the keyboard, the program checks whether the preset mode enable flag is set. Having made sure that this has happened, the program sequentially checks whether the preset mode flags for channels 1 and 2 are set. If at least one of them is set, the transition to preset mode will occur. As a result of each press of the “0”-“9” keys in this mode, the code of the corresponding digit is written to the EEPROM cell, “erasing” the code that was previously there. After entering fourteen digits (seven digits of the access code and seven digits of the preset code), the preset mode is automatically exited (all flags are reset).

You can also exit the preset mode by dialing any number of digits (less than fourteen), for example, when you only need to modify the access code. To do this, press the "'#" button after dialing seven digits.

The program was prepared in the MPLAB environment [2]. When programming the crystal, you should set OSC=XT, WDT=Off, PWRTE=On, CP=Off, and write code 00h to all addresses in the EEPROM data.

To power the module, you can use a DC voltage source of +7,5...+15 V. The current consumption of the microcontroller DD1 from the integrated stabilizer DA1 with the LEDs HL1-HL3 off is about 1 mA. Any quartz resonator ZQ1 can be used at a frequency of 2...4 MHz (can be replaced with an RC circuit), however, it should be taken into account that the tone of the audio signals at pin 13 of DD1 depends on the frequency of the clock generator. Piezo emitter NA1 - ZP-3.

To match the logical levels at the output of channel 2 (pin 3 of DD1) with the actuator, the lower output of resistor R12 in the circuit is disconnected from the stabilizer and connected to the positive terminal of the actuator's power supply.

The design of the module must be such as to exclude outside access to its output circuits.

The device does not require setup, however, before starting operation, the user must enter his own codes into the memory of both channels. This is done as follows. After turning on the power for the first time, you need to press the “0” button seven times. The HL2 LED should light up and a long beep should sound. Then click on the “*” button. The HL1 LED should now light up. The next operation is for the user to enter fourteen digits from the keyboard, the first seven of which will be the access code for channel 1, and the rest will be the preset code for this channel.

When fourteen digits are dialed, the HL1, HL2 LEDs will go out. By repeatedly pressing the “0” button seven times (the HL3 LED should light up and a long beep should sound), and then the “*” button (the HL1 LED should light up), the user enters another fourteen digits - the access code and the channel 2 preset code. LEDs HL1 and HL3 go out. The module's EEPROM now contains the user's own codes.

If the user has forgotten his access code, it is simply replaced with a new one from the preset mode. If you forget the preset code, you can only see it using the programmer by reading the EEPROM of the PIC controller data. The preset code for channel 1 is located there at addresses 19h-1Fh, and for channel 2 at addresses 27h-2Dh.

It should be noted that EEPROM has a limited number of controller data write cycles, so it is not recommended to modify the codes very often.

With the "#" button, you can forcefully reset the dialed code in case of an error in typing.

Firmware table

Literature

  1. Modern microcontrollers: architecture, design tools, application examples, Internet resources. Telesystems". Edited by I. V. Korshun - M.: Akim, 1998.
  2. CD-ROM. Modern microcontrollers: documentation, development tools, examples of use. Telesystems", 1998.

Author: P.Redkin, Ulyanovsk

See other articles Section Home, household, hobby.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Machine for thinning flowers in gardens 02.05.2024

In modern agriculture, technological progress is developing aimed at increasing the efficiency of plant care processes. The innovative Florix flower thinning machine was presented in Italy, designed to optimize the harvesting stage. This tool is equipped with mobile arms, allowing it to be easily adapted to the needs of the garden. The operator can adjust the speed of the thin wires by controlling them from the tractor cab using a joystick. This approach significantly increases the efficiency of the flower thinning process, providing the possibility of individual adjustment to the specific conditions of the garden, as well as the variety and type of fruit grown in it. After testing the Florix machine for two years on various types of fruit, the results were very encouraging. Farmers such as Filiberto Montanari, who has used a Florix machine for several years, have reported a significant reduction in the time and labor required to thin flowers. ... >>

Advanced Infrared Microscope 02.05.2024

Microscopes play an important role in scientific research, allowing scientists to delve into structures and processes invisible to the eye. However, various microscopy methods have their limitations, and among them was the limitation of resolution when using the infrared range. But the latest achievements of Japanese researchers from the University of Tokyo open up new prospects for studying the microworld. Scientists from the University of Tokyo have unveiled a new microscope that will revolutionize the capabilities of infrared microscopy. This advanced instrument allows you to see the internal structures of living bacteria with amazing clarity on the nanometer scale. Typically, mid-infrared microscopes are limited by low resolution, but the latest development from Japanese researchers overcomes these limitations. According to scientists, the developed microscope allows creating images with a resolution of up to 120 nanometers, which is 30 times higher than the resolution of traditional microscopes. ... >>

Air trap for insects 01.05.2024

Agriculture is one of the key sectors of the economy, and pest control is an integral part of this process. A team of scientists from the Indian Council of Agricultural Research-Central Potato Research Institute (ICAR-CPRI), Shimla, has come up with an innovative solution to this problem - a wind-powered insect air trap. This device addresses the shortcomings of traditional pest control methods by providing real-time insect population data. The trap is powered entirely by wind energy, making it an environmentally friendly solution that requires no power. Its unique design allows monitoring of both harmful and beneficial insects, providing a complete overview of the population in any agricultural area. “By assessing target pests at the right time, we can take necessary measures to control both pests and diseases,” says Kapil ... >>

Random news from the Archive

Biodegradable wireless subcutaneous charger 03.12.2023

Chinese scientists have developed a unique wireless charger designed for subcutaneous use and aimed at improving biodegradable drug delivery systems. The prototype is biodegradable and flexible, providing new prospects in the field of medical implants.

The innovative biodegradable charger opens new horizons for medical technology and could become a key element in the development of future implantable devices. However, despite its potential, its actual implementation requires further research and development.

Traditional biodegradable energy sources have previously experienced power limitations, but the new device successfully combines high energy capacity with flexibility and compatibility with human tissue. Its magnesium coil and zinc-ion hybrid supercapacitors provide an efficient power source.

The advantage of a biodegradable charger is that it reduces the need for surgery to replace or recharge batteries, which is important for non-biodegradable counterparts. Although the invention is at an early stage of development, its potential for medical research is enormous.

The technology could also change the way we charge everyday wireless devices such as smartphones and laptops. Scientific research continues to scale up the technology and its widespread implementation in medicine and everyday life.

Other interesting news:

▪ 1,8" SAS SSD

▪ Muscle tone without physical activity

▪ Intel Tunnel Falls silicon qubit processor

▪ Artificial intelligence will predict magnetic storms

▪ Updated Efinix Titanium FPGA line

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site RF power amplifiers. Article selection

▪ article Hut on chicken legs. Popular expression

▪ article Which animals have a funeral ritual? Detailed answer

▪ article Head of the railway station. Job description

▪ article Radio communication on VHF. Encyclopedia of radio electronics and electrical engineering

▪ article Methods for improving the characteristics of PRPU R-399A, R-381. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024