This is an old revision of the document!
Proiectul reprezinta un sistem simplu de securitate pentru casa, construit pe ATmega328P-Xplained Mini, folosind un senzor de miscare PIR, un keypad 4×4 si un display LCD 16×2. Sistemul poate fi armat si dezarmat prin introducerea unui cod PIN. Odata armat, monitorizeaza miscarea si ofera un interval de timp pentru dezarmare inainte de declansarea alarmei (buzzer si LED). Logica este implementata folosind o masina de stari, pentru un comportament eficient, fara blocaje.
Pe langa functionalitatea de baza, sistemul este proiectat sa poata fi extins cu senzori suplimentari (senzor de fum, senzor de gaz, contact magnetic pentru usi/ferestre) si conectivitate wireless (Bluetooth prin HC-05) pentru trimiterea de notificari in timp real catre utilizator.
Sistemul functioneaza ca o masina de stari cu 4 stari principale:
DEZARMAT → EXIT DELAY → ARMAT → ENTRY DELAY → ALARMA → DEZARMAT
Schema bloc:
Lista de piese:
| Componenta | Model | Rol |
|---|---|---|
| Microcontroller | ATmega328P-Xplained Mini | Unitate centrala de control |
| Senzor PIR | HC-SR501 | Detectie miscare |
| Display LCD | 16×2 + modul I2C (adresa 0x27) | Afisare stare sistem |
| Keypad | Membrana 4×4 | Introducere cod PIN |
| Buzzer | Pasiv 5V | Alerta sonora |
| LED rosu | 5mm + rezistor 220Ω | Indicator alarma |
| LED verde | 5mm + rezistor 220Ω | Indicator sistem dezarmat |
| Senzor gaz | MQ-2 | Detectie fum/gaz |
| Modul Bluetooth | HC-05 | Notificari wireless |
| Breadboard + fire | — | Prototipare |
Conexiuni:
| Componenta | Pin ATmega328P | Directie |
|---|---|---|
| PIR OUT | PD2 (INT0) | Input - intrerupere externa |
| LED rosu | PD5 | Output |
| Buzzer | PD6 | Output PWM |
| LED verde | PD7 | Output |
| HC-05 TX | PD0 | Input UART |
| HC-05 RX | PD1 | Output UART |
| Keypad R1 | PD3 | Output |
| Keypad R2 | PD4 | Output |
| Keypad R3 | PB3 | Output |
| Keypad R4 | PB4 | Output |
| Keypad C1 | PB0 | Input pull-up |
| Keypad C2 | PB1 | Input pull-up |
| Keypad C3 | PB2 | Input pull-up |
| Keypad C4 | PC0 | Input pull-up |
| MQ-2 DO | PC1 | Input |
| MQ-2 AO | PC2 | Input |
| LCD SDA | PC4 | I2C Data |
| LCD SCL | PC5 | I2C Clock |
Mediu de dezvoltare: AVR-GCC + Atmel Studio
| Periferic | Utilizare |
|---|---|
| INT0 | Intrerupere externa PIR |
| Timer0 Fast PWM | Generare ton buzzer |
| Timer1 CTC | Timekeeping non-blocant |
| TWI (I2C) | Comunicare LCD prin PCF8574 |
| GPIO | Scan keypad matriceal, LED-uri |
| UART | Comunicare modul wireless |
Structura software:
main() cu switch(alarm_state)_delay_ms())Hardware:
Software & Tutoriale: