I have started migrating content to my Hugo blog at https://blog.cavelab.dev, already migrated pages will redirect there.
Security keypad with programmable PIN
This module was part of the rack box project — which was terminated when I moved out of my first apartment.
Keypad with programmable PIN code, two outputs (modes) and protection against repeated incorrect PINs. Uses an AVR ATtiny2313 microcontroller.
Details
This module uses an AVR microcontroller to interface a cheap numeric keypad. The PIN code is set by the user and stored in EEPROM. If entered correctly; a one second pulse is sent on either output 1 or 2, depending on the selected mode. A tamper pin will be shorted to 0V when the module is connected. This keypad module is not itself meant to control anything, but it provides trigger signals for other control modules to act upon (like the Intruder alarm system controller). It has three LEDs (green, red and alarm) which can be used to convey messages from that other control module. Powered by: 5V.
Video
Operation
Modes
Mode 1
To activate mode 1 enter PIN + *
(star), a one second green light indicates correct PIN and confirms command.
Mode 2
To activate mode 2 enter PIN + #
(number sign), a two seconds green light indicates correct PIN and confirms command.
PIN code
Change PIN
To change PIN enter current PIN + 0
(zero), a yellow light indicates that a new PIN can be entered. The new PIN is entered and confirmed with #
, a green light indicates a successful change. Any button other than #
will reject the new code and keep the old one, a red light indicates this.
Wrong PIN
When the wrong PIN is entered you get a red light. If the wrong PIN is entered three times the panel will not be usable for one minute. The red light will flash during this period.
I/O
Inputs
- PD2 Keypad R1
- PD3 Keypad R2
- PD4 Keypad R3
- PD5 Keypad R4
Outputs
- PB0 Keypad K1
- PB1 Keypad K2
- PB2 Keypad K3
- PB3 Mode 1 signal
- PB4 Mode 2 signal
- PB5 Green LED indicator
- PB6 Red LED indicator
- PB7 Lifesignal (to Module stability monitoring unit 2)
D-Sub 9-pin
Pin | Color | Function |
---|---|---|
1. | Pink | 5V |
2. | Grey | 0V |
3. | Yellow | Channel 1 |
4. | Black | Channel 2 |
5. | Green | Tamper N.C |
6. | Blue | Lifesignal (to Module stability monitoring unit 2) |
7. | Red | Alarm LED from Alarm unit |
8. | Purple | Green LED from Alarm unit |
9. | Brown | Red LED from Alarm unit |
Keypad
- n/a
- K3
- K2
- K1
- R1
- R2
- R3
- R4
Source code

https://github.com/thomasjsn/AVR-Programmable-keypad