A comprehensive embedded systems project implementing a smart room automation system using STM32F407 microcontroller with RFID card detection, motion sensing, and automated lighting control.
This project demonstrates a real-time smart room automation system that integrates multiple sensors and actuators to create an intelligent environment control system. The system automatically manages room lighting, fan operation, and security features based on motion detection, RFID card recognition, and user inputs.
- IR Motion Sensor: Detects presence and tracks people passing through the room
- Accelerometer Integration: LIS302DL 3-axis accelerometer for precise motion detection
- Dual Detection System: Combines IR sensor for room occupancy and accelerometer for activity tracking
- Baseline Calibration: Automatic baseline calibration for accurate motion thresholds
- Real-Time Monitoring: Continuous motion tracking with configurable sensitivity
- Movement History: Maintains motion count and timestamps for analytics
- Presence Verification: Distinguishes between static presence and active movement
- MFRC522 RFID Module: Supports RFID card detection and identification
- Card Management: Tracks card UID and detection timestamps
- Access Validation: Card-based authentication for room access
- Multiple Card Support: Can store and validate multiple authorized cards
- Automatic Activation: Lights activate on motion detection or RFID card scan
- Manual Override: Push buttons for manual light control
- LED Management: GPIO-based LED light control with PWM support
- Smart Shutdown: Lights automatically turn off after leaving the room or on manual request
- Buzzer Alerts: Multi-frequency buzzer for different system states
- 330 Hz: Neutral tone (E4)
- 523 Hz: Affirmative/Success (C5)
- 165 Hz: Alert/Warning (E3)
- 1047 Hz: Critical Alert (C6)
- LM35 Temperature Sensor: Real-time temperature monitoring via ADC(DMA)
- Automatic Fan Control: Fan automatically activates when temperature exceeds threshold
- Temperature-Based Adjustment: Fan speed adjusts based on real-time temperature readings
- Precise Temperature Measurement: Analog voltage conversion to Celsius
- Status Monitoring: Real-time fan status and temperature display on LCD
- LCD Display: 16x2 LCD with PCF8574 I2C Backpack (Address: 0x27)
- System Status: Real-time display of system state and sensor readings
- User Feedback: Visual confirmation of user actions
| Component | Model | Interface | Purpose |
|---|---|---|---|
| Microcontroller | STM32F407VGTx | - | Main processor |
| Accelerometer | LIS302DL | SPI2 | Motion detection |
| RFID Reader | MFRC522 | SPI1 | Card identification |
| Temperature Sensor | LM35 | ADC1 | Real-time temperature monitoring |
| LCD Display | 16x2 | I2C (PCF8574) | System feedback |
| Motion Sensor | IR Sensor | GPIO (PC7) | Detects person presence and movement through room |
| Buzzer | Generic | PWM Timer | Audio alerts |
| LED Light | Generic | GPIO (PC9) | Room lighting |
| Fan Motor | Generic | GPIO/PWM | Temperature-controlled ventilation |
| Buttons | Push Buttons | GPIO | Manual control |
- SPI1: RFID Module (MFRC522)
- SPI2: Accelerometer (LIS302DL)
- I2C1: LCD Display (PCF8574)
- ADC1: Analog sensor inputs
- Timer2, Timer3, Timer4: PWM and timing control
- DMA: ADC data transfer
code/
├── Core/
│ ├── Inc/ # Header files (main.h, mfrc522.h, etc.)
│ ├── Src/ # Main source code (actual code logic)
│ └── Startup/ # STM32 startup code
├── Drivers/
│ ├── CMSIS/ # ARM CMSIS headers
│ └── STM32F4xx_HAL_Driver/ # HAL libraries
├── Middlewares/
│ └── ST/STM32_USB_Host_Library/ # USB support
├── USB_HOST/ # USB host configuration
├── Debug/ # Build artifacts
└── *.ioc, *.ld # STM32CubeMX & linker files
- Microcontroller: ARM Cortex-M4F (STM32F407)
- Clock Speed: Up to 168 MHz
- Flash Memory: 1 MB
- RAM: 192 KB
- Peripherals: SPI, I2C, ADC, Timers, GPIO, DMA
- Communication: USB Host support
- STM32CubeIDE
- STM32F407VGTx development board
- Required sensors and components
- Open the project in STM32CubeIDE
- Build the project using the Debug makefile
- Program the STM32F407VGTx using ST-Link debugger
- Modify sensor thresholds in
main.cas needed - Adjust motion detection sensitivity via calibration
- Configure RFID authorized card UIDs
- Set LCD display parameters
- RFID card-based access control
- Motion detection for intrusion detection
- Real-time alert system with buzzer feedback
- Card detection logging with timestamps
| State | Trigger | Action |
|---|---|---|
| Idle | No motion, no card | Lights off, low power |
| Active | Motion detected | Lights on, monitoring |
| Card Detected | RFID scan | Verify access, activate |
| Exit | Exit button pressed | Prepare shutdown |
| Fan Active | Timer enabled | Fan runs for duration |
| Alert | Critical event | Buzzer sounds warning |
- Uses HAL library for hardware abstraction
- DMA-based ADC conversion for efficiency
- Interrupt-driven card detection
- Calibrated motion thresholds for accuracy
- Real-time system monitoring and feedback
For detailed information about the project:
- CEP_Proposal.pdf: Initial project proposal
- CEP_Report.pdf: Comprehensive project report
Status: ⏳ Incomplete Demo Due to Hardware Constraints
Reason: Some hardware components require final integration and calibration
The demo video showcases:
- Real-time motion detection and sensor integration
- RFID card scanning and access validation
- System audio feedback mechanisms (multi-frequency buzzer)
- LCD display real-time updates
- Temperature monitoring and fan control
- Emergency shutdown procedures
Video File: brokendemo.mp4