This is an old revision of the document!
Password-Protected Alarm System
Introduction
This project implements a password-protected alarm system using the ATmega328P microcontroller board.
What it does: The system activates a passive buzzer alarm that can only be silenced by entering the correct password via push buttons. A green LED confirms a correct entry, while a red LED and an intensified alarm sound signal an incorrect attempt. A reset button and an LCD display are also integrated.
General Description
The system is structured around the following hardware and software modules:
Hardware Modules:
ATmega328P X-Mini — the central processing unit
Passive Buzzer — driven by PWM (Timer1) to produce variable-frequency alarm tones
Push Buttons (4x) — used to input the password digits (e.g. a 4-button combination lock)
Reset Button — triggers a software or hardware reset of the system state
Green LED — indicates correct password entry
Red LED — indicates wrong password entry
16×2 LCD Display — displays system status messages
Bill of Materials:
| Component | Quantity | Notes |
| —————————- | ———- | ———————————— |
| ATmega328P X-Mini board | 1 | 16 MHz, 5V |
| Passive buzzer | 1 | Sound |
| Push buttons | 4 | Password input, pull-up resistors |
| Reset button | 1 | Reset purpose |
| Green LED + 220Ω resistor | 1 | Correct password indicator |
| Red LED + 220Ω resistor | 1 | Wrong password indicator |
| 16×2 LCD (HD44780) | 1 | I2C adapter |
| Breadboard + jumper wires | - | Prototyping |
| USB cable | 1 | For flashing the ATmega328P |
Electrical Notes:
All push buttons are wired with the internal pull-up resistors enabled (INPUT_PULLUP equivalent in bare metal: set DDRx bit to 0 and PORTx bit to 1). Buttons are active-low.
LEDs are connected through 220Ω current-limiting resistors to GND.
Algorithms and Structures:
The system uses a simple finite state machine with 5 states:
`IDLE` — system waiting, buzzer silent
`ARMED` — alarm active, buzzer playing alarm melody via PWM
`INPUT` — user is entering the password sequence
`CORRECT` — correct password: green LED on, buzzer off, LCD shows “ACCESS GRANTED”, auto-return to IDLE after timeout
`WRONG` — wrong password: red LED on, buzzer plays intensified tone, LCD shows “ACCESS DENIED”, auto-return to ARMED
Laboratories Used:
*The implementation of this project is based on the concepts studied in the following laboratories:
Laboratory 0 GPIO - Used for basic interfacing. I configured the pins for the LEDs as outputs and the pins for the push buttons as inputs with internal pull-up resistors enabled.
Laboratory 1 UART - Integrated for debugging purposes. The system transmits the current state and the entered sequence to a Serial Monitor, allowing for real-time monitoring of the logic.
Laboratory 2 Interrupts - Used for the reset button and potentially for handling button presses to ensure immediate response from the microcontroller without constant polling in the main loop.
Laboratory 3 Timers - Essential for the acoustic feedback.
Results
Conclusions
Download
Journal
Bibliography / Resources