-
Notifications
You must be signed in to change notification settings - Fork 4
G6 : Smart Home Control System
| Name | GitHub |
|---|---|
| Mostafa Gaafar | 900214463 |
| Omar Saqr | 900223343 |
| Farida Bey | 900212071 |
Github Repo: https://github.com/mostafa21314/Guest-Comfort-Management-System
- The Proposal
- System Architecture
- Hardware Design
- Software Implementation
- Testing, Validation & Debugging
- Results & Demonstration
- Project Management
- Progress Status
- Appendices & References
Walking into a poorly lit, stuffy, cold, or hot room is a common experience, especially if we forgot to open the windows or adjust the thermostat. Adjusting lights, temperature, and air quality manually is inconvenient and slow to take effect. Despite the rise of smart homes, most solutions either require constant manual control or are overly complex and expensive for everyday needs. No unified system handles presence awareness, automated control, and energy savings together.
We propose a Presence-Aware Home Control System that automatically manages the ambience of a space based on occupancy and environmental conditions, with remote control for effects that take time. As soon as someone enters, the system welcomes them, turns on the lights, and activates the air atomizer. When the space is vacated, the system automatically powers down all actuators to conserve energy. Users can also remotely pre-configure the environment(especially temperature) before arrival via a WiFi-connected mobile interface.
- Detect human presence using sensors
- Automatically turn on lights when someone enters
- Play a welcome message/music through a speaker
- Activate an air freshener system upon entry
- Count the number of people entering and leaving the room
- Automatically turn off lights, speaker, and air freshener when the room is empty
- Remote control via Wi-Fi to allow users to set the environment before arriving
- Mobile app interface for user-friendly control
| # | Requirement | Description |
|---|---|---|
| FR-1 | Presence Detection | Detect guest entry/exit and maintain an accurate room occupancy count |
| FR-2 | Automated Lighting | Turn on LED/Desk Lamp when occupied and dim; turn off when empty |
| FR-3 | Climate Control(stretch goal) | Activate AC remotely and report temperature readings from DHT22 |
| FR-4 | Air Quality Control | Activate air atomizer based on occupancy or user command; deactivate when room is empty |
| FR-5 | Audio Feedback | Play welcome sound or music on first entry |
| FR-6 | Remote Control | Allow user to send manual override commands and receive live status updates via WiFi/MQTT |
| FR-7 | Auto Shutdown | Power down all actuators automatically when room is unoccupied |
Stretch Goals:
- Start an AC using the remote control feature
- Multi-room extension by replicating the sensor/actuator setup across more than one room simultaneously
## 2.2 System Visualization:
This subsystem detects people entering or leaving the room and maintains an accurate count of occupants. It consists of:
- Two IR transmitter–receiver pairs configured as beam-break sensors, mounted on the door frame, one on the exterior side and one on the interior side. The order in which the beams are broken determines the direction of movement (entry vs. exit).
- A PIR (passive infrared) motion sensor used to validate detections and filter out false triggers, such as pets passing through or accidental beam interruptions.
- An occupancy counter that increments on confirmed entries and decrements on confirmed exits, maintaining a real-time count of people inside the room.
This subsystem controls an ultrasonic atomizer that disperses air freshener into the room. It activates automatically when people begin entering, or on demand when the homeowner enables it remotely before arriving home, and it shuts off automatically once the room is empty. It consists of:
- An ultrasonic atomizer module that generates a fine mist to release scent and add humidity to the air.
- A dedicated driver module that supplies the high-frequency drive signal required by the atomizer.
- An NPN transistor wired to bypass the module's onboard pushbutton, allowing the MCU to switch the atomizer on and off electronically rather than mechanically.
This subsystem plays welcoming, calming music for occupants as they enter the room, and stops automatically once everyone has left. It consists of:
- A DFPlayer Mini module that handles audio decoding and playback, controlled by the MCU over a serial (UART) interface.
- A speaker connected to the DFPlayer Mini's amplified output to reproduce the audio.
- A microSD card that stores the welcome and ambient music tracks read by the DFPlayer Mini.
This subsystem automatically switches the room lighting on and off according to occupancy, turning the lights on when the room is occupied and off when it is empty. It consists of:
- A relay module driven by the MCU to safely switch the mains-powered lighting load.
- A lamp that serves as the controlled lighting source.
This subsystem provides remote monitoring and control by linking the system to the cloud. The ESP32 connects to a local Wi-Fi network and authenticates with a Firebase backend, where it publishes its operational logs (occupancy count, sensor readings, and actuator states) and listens for commands issued by the user. This allows the homeowner to view live status and pre-configure the environment before arriving. It consists of:
- The ESP32's onboard Wi-Fi radio, used to join the local network and maintain an internet connection.
- A Firebase backend, which the ESP32 logs into to upload status data and from which it retrieves user commands.
- A bidirectional data link: the ESP32 publishes logs upward to Firebase and subscribes to command updates pushed down from the user-facing interface.
Sourcing will be through RAM Electronics and the CSCE department primarily.
| Component | Image | Category | Purpose | Cost | Datasheet |
|---|---|---|---|---|---|
| IR Beam Break | ![]() |
Sensor | Detect entry/exit direction, count occupants | 50 EGP | — |
| PIR Sensor | ![]() |
Sensor | Supplementary presence detection | — | HC-SR501 Datasheet |
| DHT22 | ![]() |
Sensor | Monitor ambient temperature and humidity | 150 EGP | DHT22 Datasheet |
| ESP32 | ![]() |
Processing | Run all logic, FreeRTOS tasks, WiFi/MQTT | ~$6 (≈300 EGP) | ESP32-WROOM-32 Datasheet |
| STM32 Nucleo (if needed) | ![]() |
Processing | Secondary MCU for distributed control | ~$15 (≈750 EGP) | STM32 Nucleo-64 User Manual |
| Relay Module | ![]() |
Actuator | Switch lights and mist maker | $2 (≈100 EGP) | SRD-05VDC Relay Datasheet |
| TSOP382 IR Receiver | ![]() |
Actuator | Receive IR signals | 30 EGP | TSOP382 Datasheet |
| TSAL6200 IR Emitter | ![]() |
Actuator | Send IR commands to AC unit | 5 EGP | TSAL6200 Datasheet |
| Ultrasonic Atomizer | ![]() |
Actuator | Scent and humidity control | 250 EGP | — |
| DFPlayer Mini | ![]() |
Actuator | Welcome/goodbye audio playback via MicroSD | ~$5.50 (≈275 EGP) | DFPlayer Mini Datasheet (DFRobot) |
Board layout - entrance/exit and occupancy counting subsystem:

A table listing component names, part numbers, quantities, costs, and links to datasheets.
Calculations ensuring your power supply can handle the peak current draw of all components combined.
Description of the firmware design (e.g., Bare-metal Superloop, Interrupt-driven, or RTOS).
Visual diagrams mapping out the core logic, state transitions, and interrupt service routines (ISRs).
Explanations of any complex logic used (e.g., PID control loops, digital filtering, sensor fusion).
ESP-IDF, Kiel, and STM-CubeMX
How individual hardware components and software functions were tested in isolation.
How the system was tested as a whole.
A log of major bugs, hardware failures, or design flaws you encountered, and the engineering steps you took to solve them.
High-quality photos of the completed build.
A link to a short video showing the system working in real-time under various conditions.
Data showing how well the project met its initial objectives (e.g., "Response time was measured at 12ms, well within our 50ms goal").
| Name | Contribution |
|---|---|
| Mostafa Gaafar | Project Proposal, Sensors and Actuators needed, Timeline |
| Omar Saqr | System Architecture, Timeline |
| Farida Bey | System Architcture, Project Proposal |
- Formed team of three: Mostafa Gaafar, Omar Mokhtar, and Farida Bey
- Decided on project idea: Presence-Aware Guest Comfort Management System
- Submitted team formation through the wiki page
- Delivered in-class proposal presentation
- Prepared hardware/software block diagram
- Refined proposal according to comments and feedback
- Finalize problem statement & proposed solution
- Prepare component list and confirm sourcing
- Define functional and non-functional requirements
- Implement guest presence detection (IR beams)
- Implement ultrasonic mist maker control
- Implement LED lighting control via relay
- Implement DFPlayer speaker for greeting
- Implement temperature regulation using DHT22 and AC IR emitter
- Add humidity sensing to regulate mist output
- Implement temperature regulation using DHT22 and AC IR emitter
- Implement people counter with entry/exit logic
- Report integration status; run scenario tests & power check
- Add WiFi remote control; allow pre-arrival environment adjustment
- Finalize mobile app interface and complete wiki & final presentation
To be added.
| Subsystem | Status |
|---|---|
| Entrance/exit detection and occupancy counting | Done |
| Mist maker control | Partially done |
| Speaker control | To be done |
| Lights control | To be done |
| Wi-Fi connectivity | Partially done |
| Temperature control | To be done |


Refer to Schematics and Wiring for the breadboard layout.
Github Repo: https://github.com/mostafa21314/Guest-Comfort-Management-System
Embedded Project Proposal SP26.pdf
Links to datasheets, tutorials, academic papers, and course materials used during development.









