Electronic projects

[Electronic projects][bleft]

Arduino Projects

[Arduino Projects][bleft]

Metal detectors

[Metal detectors][bleft]

Home projects

[Home projects][bleft]


 The site already had many combination locks - with a full-digit keyboard , two buttons, and one too. But this device also has a right to exist because of its simplicity and reliability. Implemented a project on MK Attiny-13 and of course one micro-button. Of course, this scheme will not protect the safe in the bank, but something simple and small is quite enough to restrict access from, for example, children or colleagues at work. The circuit can also act as a switch, or simply as an immobilizer for a car or motorcycle. In general, this gadget will definitely come in handy for someone, so we post a full description. 

 Lock icon button Royalty Free Vector Image - VectorStock

Attiny code button diagram 

A few words about the resistor at the output of the microcontroller. The relay used can draw less than 20 mA (the higher the voltage, the lower the holding current of the coil), which with a current gain of about 200 gives about 0.1 mA of base current. When the output from the board is about 5V and the base-emitter drop is about 0.7V, the base resistor can be 4.3V / 0.1mA or 43k ohms. Any less value guarantees full saturation in this range. So 4.7 kOhm will already give full saturation.

The program is written in BASCOM and after compilation it takes exactly 1024 bytes. Bin file for programming in attachment . Clock frequency 1.2 MHz. The operation of the encryption button is somewhat similar to Morse code, when the code is pressed short and long at the right time. We have 256 combinations in total. It may be a little, but hardly anyone wants to spend so much time brute-force typing code (you also need to know what you need to do in general). After turning on the power for 1.5 seconds, the circuit performs an internal cleaning and is ready for operation. 

Shutdown mode 

The relay is off and the code is pending. In fact, this is the only function in this mode. The button turns on the device (switches to ON mode) after entering the 8-bit code (as with serial transmission). Button press time: 

  • 1- short pulse "0" 25 ms - 150 ms 
  • 2- long pulse "1" 150 ms - 1 s
  • 3-the maximum time between pulses when entering the code is 1.5 seconds - after this time, the code must be entered again. 

 The red LED is active as long as the button is held down (for convenience and to make sure the button is pressed). 

Mode enabled 

Switching off is performed by briefly pressing the button (it will not respond for a long time). Any configuration of the button is also possible in this mode: 

  • [A] hold the button for 2 to 3.5 seconds - a one-time code request, provided that you switch to OFF mode. Then the green LED flashes every 0.5 s (the moment of entering this function is invisible). Now, if we do not enter the code, then we will not turn off the device. 
  • [B] holding the button for 4 to 5.5 seconds - deactivates the code request. The button then works like a regular button (no code). The system is switched on or off by short pressing the button for a long time (no reaction). The mode is active until the button is again held in the on mode for 4 to 5.5 seconds or until the power is turned off (the moment of entering this function is invisible). 
  • [C] holding the button for 6 seconds - enter to change the code. After this time, the green LED starts blinking rapidly every 75 ms and blinks until you close the code change option. 

The procedure for changing the code is as follows: we introduce a new code with time for the button, which was written about earlier. After entering the last eighth state, press the button again and hold for 6 seconds until the LED stops flashing. The pause time from entering the code to confirmation cannot exceed 1.5 seconds - after this time, the circuit will automatically exit the code change mode without changing it. You can also exit this mode by holding the button for 6 seconds after entering an incomplete code (the program checks if there were 8 characters). The entered code is saved in the EEPROM memory, so after turning off the device and turning it on again, it will still be valid.

What happens if we forget the code? Just turn off the power supply, hold down the button again, turn it on and we have a temporary code "00000000" - in the EEPROM memory, however, it is better to immediately enter the ON mode and change it to a more complex one.


No comments:


Arduino Projects

[Arduino Projects][twocolumns]