A multi-disciplinary solution for monitoring infrastructure integrity, focusing on bridges. This system integrates IoT sensors, Computer Vision (CV), and Machine Learning (ML) to provide real-time data analysis, predictive maintenance alerts, and lifespan estimations.
The system operates across several layers, from hardware data collection to a centralized web dashboard.
graph TD
subgraph "Hardware Layer (IoT)"
A[Arduino + HX711 Load Cells] -->|Serial| B[NodeMCU/ESP8266]
B -->|HTTP/GET| C[Tomcat Java Server]
end
subgraph "Processing Layer (ML & CV)"
D[Computer Vision: Vehicle Counting] -->|Data| E[Python ML Servers]
F[Weather Data] -->|Updates| E
E -->|UDP/Socket| G[Backend API]
end
subgraph "Application Layer (Dual Backend)"
C --> H[(MySQL Database)]
G --> H
I[Node.js Backend] <-->|API Data| J[React Frontend]
K[Java Tomcat Backend] -->|Core Logic| H
end
This project utilizes a Dual-Backend Architecture to handle different aspects of the system:
- Frontend (
Final UI): A modern React application built with Vite. It serves as the primary interface for users to visualize bridge health, traffic loads, and maintenance alerts. - Node.js Backend: Handles dynamic API requests, user authentication, and serves as a middleware for frontend-to-database communication.
- Java Tomcat Backend (
Bridge Maintenance): Manages core business logic through a series of Servlets. It handles critical data ingestion from IoT devices (IoTAPI), processes ML results (MLAPI), and manages administrative tasks like adding bridges and users.
- Prediction Server: Handles real-time lifespan prediction and durability analysis using pre-trained
.pklmodels. - Recommendation Server: Processes structural data to generate maintenance schedules and repair suggestions.
- Models Included:
durability_model.pkl: Predicts the structural durability based on load and environmental factors.lifespan_model.pkl: Estimates the remaining service life of the bridge.maintenance_model.pkl: Determines when the next maintenance cycle should occur.CrackDetection.py: An image-processing module for identifying structural cracks.
- Vehicle Detection: Uses OpenCV to monitor traffic flow.
- Counting Logic: Tracks the number of vehicles passing over the bridge to calculate cumulative load stress.
- Arduino Program: Interfaces with HX711 Load Cells to measure weight/stress.
- NodeMCU Program: Acts as a WiFi gateway, sending sensor data from the Arduino to the central server via HTTP requests.
- Tomcat Servers: Handle specific data ingestion tasks and legacy integration.
- Updation Services: Background Java programs (
weatherUpdation,RecommendationUpdate) that periodically sync environmental data and recalculate ML parameters.
| Layer | Technologies |
|---|---|
| Frontend | React, Vite, Axios, Chart.js/Recharts |
| Backend | Node.js (Express), Java (Tomcat Servlets) |
| ML/CV | Python 3, OpenCV, Scikit-learn, Pandas, NumPy |
| Database | MySQL |
| IoT | C++ (Arduino), ESP8266/NodeMCU, HX711 Load Cells |
| Servers | Apache Tomcat, Python UDP/Flask Servers |
The Java components (Tomcat Servlets and Background Update programs) require specific libraries for database connectivity and JSON processing. These programs now use Environment Variables for sensitive data like API keys.
These files are already included in their respective WEB-INF/lib or project folders:
mysql-connector-j-9.1.0.jar: MySQL JDBC driver for database communication.json-simple-1.1.1.jar: Lightweight library for JSON encoding/decoding.servlet-api.jar: Required for compiling Tomcat servlets (standard in Tomcat's/libdirectory).
The weather and air quality programs in Java Updatation Program/weatherUpdation are configured to read the OPENWEATHER_API_KEY from the system environment.
Tip
When running these Java programs, ensure the OPENWEATHER_API_KEY is set in your system environment variables or passed during execution.
To manually compile the Java servlets, use the following command structure (ensure paths match your local Tomcat installation):
javac -cp "path/to/tomcat/lib/servlet-api.jar;WEB-INF/lib/*" -d . *.javaThe Node.js backend requires environment variables to connect to the database. These are stored in a .env file within the backend directory.
Create a file named .env in UI - react and node(backend)/Final UI/backend/ and configure the following:
PORT=5000
DB_HOST=localhost
DB_USER=your_username
DB_PASSWORD=your_password
DB_NAME=bridge_maintainance
OPENWEATHER_API_KEY=your_openweather_api_keyOPENWEATHER_API_KEY: Obtain this from OpenWeatherMap. This key is used by the Java background programs to fetch real-time weather and air quality data.
Important
Never commit your actual .env file to version control. It has been added to the root .gitignore to prevent accidental leaks.
The project includes batch scripts to simplify the setup and execution process.
Located at the project root, this script automates the entire initialization of the Web Application layer. It performs the following steps:
- Backend Dependencies: Navigates to the Node.js backend folder and runs
npm install. - Frontend Dependencies: Navigates to the React frontend folder and runs
npm install. - Database Migration: Executes
node import_db.jsto set up the MySQL schema and initial data. - Backend Startup: Launches the Node.js server in a new command window (Port 5000).
- Frontend Startup: Launches the Vite development server in a new command window (Port 5173).
Tip
Run this script with administrative privileges if you encounter permission issues during npm install.
- Install MySQL Server.
- Import the database schema located at
Database/bridge_maintainance.sql.
- Navigate to
UI - react and node(backend)/Final UI. - Run the automated setup:
This will install dependencies for both frontend and backend and start the development servers.
../../start_project.bat
- Install Python dependencies:
pip install pandas numpy scikit-learn opencv-python flask
- Start the Prediction Server:
cd "Python server & Machine Learning Programs/Python Servers/Predictoion Server" python UDPServer.py
- Open
Iot Codes/arduino_program/arduino_program.inoin Arduino IDE. - Upload to your Arduino (connected to HX711).
- Open
Iot Codes/node_mcu_program/node_mcu_program.ino, configure your WiFi SSID/Password, and upload to the NodeMCU.
- Real-Time Stress Monitoring: Live tracking of bridge load using IoT sensors.
- Automated Traffic Load Analysis: CV-based vehicle counting to assess structural fatigue.
- Predictive Maintenance: ML-driven alerts for potential structural failures.
- Environmental Integration: Incorporates weather data to adjust durability predictions.
- User Management: Secure portal for engineers and administrators.
This project is developed for research and educational purposes in infrastructure management and AI application.