Risk AI is a real-time IoT and AI-powered dashboard designed to predict industrial hazards before they happen. It monitors environmental conditions (Temperature, Humidity, CO2, Acetone) and uses a predictive algorithm to detect gas leaks and critical trends in real-time.
(Replace this link later with a screenshot of your actual dashboard)
- Real-time Monitoring: Live updates every 2 seconds from ESP32 sensors.
- AI Risk Prediction: Algorithms analyze the rate of change (slope) to predict leaks before hazardous levels are reached.
- Critical Alerts: "Zooming" Red Alert overlay when danger is detected.
- Historical Analytics: Aggregates data by "Hour of Day" to show long-term safety trends (e.g., "Is 2 PM always dangerous?").
- Dark Mode Dashboard: Professional React-based UI with Recharts visualization.
Microcontroller: ESP32 (NodeMCU / Wemos)
Sensors:
- DHT11 (Temperature & Humidity)
- MQ-135 (Air Quality / Gas)
Actuators:
- Relay
- WaterPump
- Buzzer
- Servo motor
Wiring:
- DHT11 Data โ Pin D4
- DHT11 VCC โ Pin 3V3
- MQ-135 Analog โ Pin D34
- Servo โ Pin D27
- waterpump โ red โ NC , Black โ VCC powersupply
- Relay "in" โ Pin D26 , GND โ GND ESP , VR โ 5V ESP , COM โ common groung , NC โ Pump
- Buzzer โ Pin D18 , small leg โ ground
You can run this project in two ways: Docker (Recommended) or Manual Setup.
This method requires no installation of Python or Node.js. It runs the entire system in an isolated container.
- Windows: Install Docker Desktop.
- Linux:
sudo apt install docker.io docker-compose-v2
git clone git@github.com:mohammedmokhtar2/RiskAI-IoT-System.git
cd RiskAI-IoT-Systemdocker compose up --build- Frontend: http://localhost:5173
- Backend: http://localhost:5000
If you want to edit the code, run it manually.
- Python 3.9+
- Node.js 20+
# Open a terminal in the root folder
python3 -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
pip install -r requirements.txt
python app.py# Open a NEW terminal
cd frontend
npm install
npm run dev- Power on the ESP32.
- It will create a WiFi Hotspot named RiskAI_Hotspot.
- Connect your laptop WiFi to this hotspot.
- Password:
12345678
- Password:
- Once connected, the Python Backend will automatically start fetching live sensor data.
If testing without hardware, open
app.pyand setMOCK_MODE = Trueto simulate sensor data.
RiskAI/
โโโ app.py # Flask Backend (API & Database Logic)
โโโ risk_ai.db # SQLite Database (Auto-created)
โโโ requirements.txt # Python Dependencies
โโโ docker-compose.yml # Docker Orchestration
โโโ frontend/ # React Frontend
โ โโโ src/
โ โ โโโ App.jsx # Main Dashboard Logic & Charts
โ โ โโโ App.css # Dark Mode Styling
โ โโโ Dockerfile # Frontend Container Config
โโโ README.md # Documentation
- Hardware Engineer:ย Hossam Mostafa
- Software Engineer: Mohammed Mokhtar , Eyad Rezk , Tarek shereen , Amr Khaled
Built with React, Flask, Recharts, and ESP32.