Background
I was thinking of ways to use a keypad component when I had an epiphany to use it as a secure safe.
A safe is a container used to store valuables. It can only be opened by entering the PIN of the safe. The keypad will be used to receive user input. If we add an LCD to display the UI and a buzzer for audio feedback, then we’re 87% on the way to building a real product.

The Theory
For a comprehensive deep-drive on the operation of a keypad, please read 23. Intro to Keypad.
The keypad is used to enter a 4-digit PIN. The safe will only unlock with a correct 4-digit PIN. I thought Anvil could toggle a solenoid when the correct PIN is entered however, since this is a MVP I kept it simple. Perhaps a feature for v2. An LED will be used to indicate the safe is unlocked.
Product Details:
- Captures 4-digit PIN via keypad
- Detects incorrect and correct PINs
- Submitted keys are masked using
* - Auto-lockout after 3 incorrect attempts to prevent forced entry
- After the user successfully enters the correct PIN, Anvil remains unlocked for 10 seconds
- Enters screensaver mode after 30 seconds of inactivity
Hardware Connections
Components include: ATmega328P, keypad, LCD, buzzer, 2 LEDs.
LCD is configured in 4-bit mode with backlight adjustment via RV1.
The schematic is available at my GitHub repository.
The Software
Full source code is located in my GitHub repository.
