How al-sakka/locker-security-system works
Project type and purpose
• This is an embedded security system comprising two ATmega32 microcontrollers (dual‐MCU door lock).
• HMI_ECU handles user interface (LCD + keypad) and communicates passwords.
• Control_ECU verifies passwords, drives the door motor, handles motion detection (PIR), and triggers alarms (buzzer).
File structure
• Top‐level: CONTROL_ECU, HMI_ECU, Simulation, docs.
• Each ECU folder follows a layered architecture:
• Application (business logic)
• HAL (hardware abstractions: sensors, actuators)
• MCAL (microcontroller drivers: GPIO, UART, Timer, I2C, PWM)
• Utils (common types/macros)
• Simulation/Proteus project and documentation assets in docs/.
Key insights from the README
• Dual‐MCU layered design with UART link between ECUs.
• Uses I2C for EEPROM, GPIO for PIR and buzzer, PWM for motor control, Timer for delays.
• Operation flows: password creation → authentication → motorized door control → security lockout.
Main components and interactions
a. Components
• HMI_ECU
• Application layer (main.c, hmi.c/hmi.h)
• HAL: Keypad, LCD
• MCAL: GPIO, UART, Timer
• Control_ECU
• Application layer (main.c, control.c/control.h)
• HAL: EEPROM (I2C), Motor, Buzzer, PIR
• MCAL: GPIO, I2C, UART, PWM, Timer
• External Devices
• 4×4 Keypad
• 8-bit LCD
• External EEPROM chip (I2C)
• H-bridge + DC motor
• PIR motion sensor
• Buzzer
• Communication link
• UART channel (TX/RX pins) between HMI_ECU and Control_ECU
b. Relationships and Data Flows
• User → Keypad → HMI Application
• HMI Application ↔ HAL (LCD updates)
• HMI Application ↔ MCAL UART → Control_ECU MCAL UART → Control Application
• Control Application ↔ MCAL I2C → EEPROM (read/write passwords)
• Control Application ↔ MCAL GPIO/PWM → Motor driver → Motor
• Control Application ↔ MCAL GPIO → PIR sensor, Buzzer driver
• Control ECU ↔ HMI_ECU (status/response via UART) → LCD display
c. Architectural patterns
• Layered architecture: clear separation of Application, HAL, MCAL, Utils
• Producer–consumer flow (HMI produces password requests; Control consumes and responds)
• Event‐driven interrupts (Timer, UART receive, PIR)
d. Technologies & Frameworks
• AVR‐GCC toolchain for ATmega32
• Custom GPIO, UART, I2C, PWM, Timer drivers
• EEPROM over TWI (I2C)
• Proteus for simulation
Diagramming advice
• Use clear, concise labels (e.g., “HMI_App”, “CTRL_HAL_I2C”).
• Rectangles for software modules (layers)
• Rounded for external HW (Keypad, LCD, Motor, PIR, Buzzer)