Bridge Health Monitoring Using Flex Sensor
-
ESP32 inbuilt Bluetooth (Classic)
-
Bluetooth Terminal app (like Serial Bluetooth Terminal)
-
Same flex sensor logic
📡 Bridge Health Monitoring Using Flex Sensor (Bluetooth Version)
// Bridge Health Monitoring System
// Using ESP32 + Flex Sensor + Bluetooth
#include "BluetoothSerial.h"
BluetoothSerial SerialBT; // Create Bluetooth object
const int flexPin = 34; // Analog pin connected to flex sensor
int flexValue = 0; // Variable to store analog value
int threshold = 2500; // Bending limit (Adjust after calibration)
void setup() {
Serial.begin(115200); // Serial Monitor
SerialBT.begin("BridgeMonitor"); // Bluetooth device name
pinMode(flexPin, INPUT);
Serial.println("Bluetooth Started! Connect to BridgeMonitor");
}
void loop() {
// Read flex sensor
flexValue = analogRead(flexPin);
// Send to Serial Monitor
Serial.print("Flex Sensor Value: ");
Serial.println(flexValue);
// Send to Bluetooth Terminal
SerialBT.print("Flex Sensor Value: ");
SerialBT.println(flexValue);
// Compare with threshold
if (flexValue > threshold) {
Serial.println("⚠️ BEND DETECTED - Bridge Under Stress!");
SerialBT.println("⚠️ BEND DETECTED - Bridge Under Stress!");
} else {
Serial.println("✅ No Bend - Bridge is Safe.");
SerialBT.println("✅ No Bend - Bridge is Safe.");
}
Serial.println("-----------------------------");
SerialBT.println("-----------------------------");
delay(1000);
}
🧠 Code Explanation (Bluetooth Added Part)
1️⃣ Include Bluetooth Library
This library enables ESP32 Bluetooth Classic communication.
2️⃣ Create Bluetooth Object
This object is used to send and receive Bluetooth data.
3️⃣ Start Bluetooth
“BridgeMonitor” is the Bluetooth device name.
When you open your mobile Bluetooth, you will see:
👉 BridgeMonitor
4️⃣ Sending Data to Bluetooth
SerialBT.println(flexValue);
This sends data directly to the Bluetooth Terminal App.
Same as Serial Monitor, but wireless.
📱 How to Connect Bluetooth Terminal App
Step 1:
Install Serial Bluetooth Terminal (Play Store)
Step 2:
Turn ON mobile Bluetooth
Step 3:
Open app → Devices → Pair new device
Select:
👉 BridgeMonitor
Step 4:
Connect
Now you will see live data like:
✅ No Bend – Bridge is Safe.
—————————–
Flex Sensor Value: 2950
⚠️ BEND DETECTED – Bridge Under Stress!
—————————–
📊 How Result Appears in Bluetooth App
When bridge is straight:
✅ No Bend – Bridge is Safe.
—————————–
When bridge bends:
⚠️ BEND DETECTED – Bridge Under Stress!
—————————–
It updates every 1 second.
🔎 Complete System Logic (For Viva – Bluetooth Version)
-
Flex sensor changes resistance when bridge bends.
-
Voltage divider converts resistance change into voltage.
-
ESP32 ADC converts voltage to digital value (0–4095).
-
ESP32 compares value with safety threshold.
-
If value > threshold → Stress detected.
-
Warning message sent to:
-
Serial Monitor (wired)
-
Bluetooth Terminal (wireless)
-
-
Engineer can monitor bridge health remotely using mobile.
🎓 Extra Viva Questions (Very Important)
❓ Why use Bluetooth instead of only Serial Monitor?
✔ Remote monitoring
✔ No USB cable required
✔ Real-time field monitoring
❓ Why GPIO 34 is used?
✔ It is an ADC-only pin
✔ Suitable for analog sensors
❓ What is ADC resolution of ESP32?
✔ 12-bit
✔ Range: 0 – 4095