This project integrates a Smart Hose System with IoT capabilities, encompassing two main components: an Arduino-based control system for accessing the house and an ESP32-based system for home automation and security. Additionally, a Flask web application serves as an API to facilitate remote control and monitoring.
- ESP32
- Arduino UNO
- Servo Motor
- 4x4 KEYPAD
- Light Sensor (LDR 4 pins)
- Temperature & Humidity Sensor (DHT11)
- Motion Sensor (PIR)
- Relay Module 1 channel
- Adapter 12v output
- Fan
- LEDs
- Wires
- Resistors
The Arduino code (enteringHouseWithPasswd_Arduino.ino
) controls house access using a password-based mechanism. Key features include:
- Keypad Input: Utilizes a 4x4 keypad for password entry.
- Servo Control: Manages a servo motor to lock and unlock the door.
- Password Protection: Allows configuration of a password to unlock the door.
- Intrusion Detection: Monitors unsuccessful attempts and triggers an intrusion alert if the maximum limit is reached.
- Set the correct
servoPin
,ROW_NUM
,COLUMN_NUM
, and keypad layout. - Define the correct
correctPassword
. - Adjust
maxWrongAttempts
as needed. - Upload the code to your Arduino device.
The ESP32 code (homeSmartSystem_esp32.ino
) focuses on home automation and security, incorporating the following features:
- WiFi Connection: Connects to a WiFi network for remote access.
- Sensors Integration: Utilizes a PIR motion sensor, DHT11 temperature and humidity sensor, and a light sensor.
- Home Automation: Controls a relay module to manage lights and a fan based on environmental conditions.
- Email Notifications: Sends email notifications in case of an intrusion attempt.
- Set the correct
ssid
andpassword
for your WiFi network. - Configure the email settings in the code (SMTP server, sender credentials, etc.).
- Customize the pins for sensors and actuators as needed.
- Upload the code to your ESP32 device.
The web server
directory contains a Flask web application (app.py
) acting as an API for remote control and monitoring of the smart home system. Features include:
- User Authentication: Supports user sign-up and login functionalities.
- Warnings System: Logs warnings for intrusion attempts.
- Remote Control Endpoints: Provides endpoints to control lights, fans, and reset the system remotely.
- Navigate to the
web server
directory. - Install the required dependencies using
pip install -r requirements.txt
. - Set environment variables (e.g.,
SECRET_KEY
) in a.env
file. - Run the Flask server with
python app.py
.
The database.py
file manages SQLite3 database operations, including user data storage, warnings logging, and authentication.
- Update the
ESP32_IP_ADDRESS
inapp.py
with the correct IP address of your ESP32 device. - Ensure the
SECRET_KEY
environment variable is set for Flask.
Feel free to contribute to this project by opening issues or submitting pull requests. Your input is valuable!
This project is licensed under the MIT License.