This project implements a complete smart home automation and security system integrating multiple sensors, actuators, and a web application. The smart home system comprises three Raspberry Pi units, each interfaced with different sensors and actuators.
The smart home system consists of three Raspberry Pi devices, each responsible for different sensors and actuators.
Communication & Data Flow:
- Raspberry Pi devices send sensor and actuator data via MQTT protocol to a Flask-based server for storage in InfluxDB and visualization in Grafana.
- Web application interfaces allow users to monitor sensor readings, control actuators, and view historical data.
- Each sensor and actuator can operate in simulated or real mode, which can be configured in the
settings.jsonfile.
Technology Stack:
- Programming & Server: Python, Flask
- Communication: MQTT
- Database: InfluxDB
- Visualization: Grafana
- Web Application: React
Hardware: Raspberry Pi, GPIO sensors and actuators
- When DPIR1 detects motion, DL1 is turned on for 10 seconds.
- When DPIR1 detects motion, determine whether a person is entering or exiting the building based on the distance measured by DUS1 in the previous few seconds.
- Same logic for DPIR2 and DUS2 as written above
- Maintain and update the real-time count of occupants inside the building.
- If a signal from DS1 or DS2 is detected for more than 5 seconds, activate the ALARM until the DS state changes. This simulates an unlocked door.
- Enable activation of the security alarm via the DMS component.
- When a 4-digit PIN code is entered, the system activates after 10 seconds.
- If the system is active, trigger the ALARM when a signal is detected on DS1 or DS2, unless the correct PIN is entered via the DMS component.
- Entering the PIN deactivates the ALARM and disarms the system.
- If the number of people inside the building (as per point 2) is zero, trigger the ALARM when motion is detected by any of the RPIR1-3 sensors.
- If the GSG (attached to the Slava icon) detects significant movement, trigger the ALARM.
- Display the temperature and humidity from DHT1-3 on the LCD, cycling through the readings from each DHT sensor every few seconds.
- Enable kitchen timer settings.
- Allow the timer duration to be set via the web application. Display the time on the 4-digit 7-segment (4SD) display.
- Allow pressing the button (BTN) to add N seconds to the timer. N is the number of seconds configured via the web application.
- When the timer expires, the 4SD display should blink showing 00:00. Pressing the button (BTN) stops the blinking.
- Enable turning the BRGB light on/off and controlling its colors via the remote control and IR sensor, as well as through the web application.
- Display the webcam video on the web application.
- Clone the repository
- git clone
https://github.com/natasakasikovic/smart-home.git - cd smart-home
- git clone
- Start Docker services (terminal docker)
- cd docker
- docker compose up -d
- Run Raspberry Pi simulators (in separate terminals)
- python main.py PI1
- python main.py PI2
- python main.py PI3
- Start the server (terminal server)
- python -m server.server
- Start the frontend (terminal frontend)
- cd frontend
- npm install
- npm run dev