Contents
System Overview
Prevent breakdowns and reduce maintenance costs by monitoring vehicle health in real-time. MQTT provides lightweight, reliable messaging for vehicle data.
Monitored Parameters:
- Engine temperature
- Oil pressure & level
- Battery voltage & current
- Coolant level
- Brake pad wear
- Tire pressure (TPMS)
- Fuel quality & water detection
Sensor Integration
| Parameter | Sensor | Normal Range | Alert Threshold |
|---|---|---|---|
| Engine Temp | DS18B20/Thermocouple | 85-95°C | >105°C |
| Oil Pressure | 5V Pressure Sensor | 25-65 PSI | <20 PSI |
| Battery Voltage | Voltage Divider | 12.5-14.5V | <11.5V |
| Coolant Level | Float Sensor | MIN-MAX |
Hardware Setup
- ESP32: Main controller
- ADS1115: 16-bit ADC for analog sensors
- MAX31855: Thermocouple amplifier
- INA219: Current/voltage monitor
- CAN Bus Module: Vehicle data
MQTT Architecture
# ESP32 MQTT Publisher
#include
WiFiClient espClient;
PubSubClient client(espClient);
void publishHealthData() {
StaticJsonDocument<512> doc;
doc["vehicle_id"] = "VH001";
doc["engine_temp"] = readEngineTemp();
doc["oil_pressure"] = readOilPressure();
doc["battery_voltage"] = readBattery();
doc["timestamp"] = millis();
char buffer[512];
serializeJson(doc, buffer);
client.publish("vehicle/health/VH001", buffer);
}
void connectMQTT() {
client.setServer("mqtt.broker.com", 1883);
while (!client.connected()) {
client.connect("VehicleHealth_VH001");
}
}
Alert System
# Node-RED Alert Flow
[
{
"id": "health-subscriber",
"type": "mqtt in",
"topic": "vehicle/health/+",
"broker": "mqtt-broker"
},
{
"id": "threshold-check",
"type": "function",
"func": "if (msg.payload.engine_temp > 105) {\n msg.alert = {type: 'CRITICAL', message: 'Engine Overheating!'};\n} else if (msg.payload.oil_pressure < 20) {\n msg.alert = {type: 'WARNING', message: 'Low Oil Pressure';\n}\nreturn msg;"
},
{
"id": "notification",
"type": "sendgrid",
"api": "SENDGRID_API_KEY"
}
]
Predictive Maintenance
Machine learning for failure prediction:
- Battery: Voltage trend analysis
- Engine: Temperature pattern recognition
- Brakes: Wear rate calculation
- Tires: Pressure loss trends
Installation Safety:
- Use automotive-grade wiring
- Add inline fuses (2A for electronics)
- Route wires away from hot surfaces
- Secure all connections
- Test before road use
Next Steps
- Add vibration analysis
- Implement OTA firmware updates
- Connect to service center API
- Add driver behavior scoring
Related: OBD-II Monitor | Fleet Fuel Management