🎯 Objective
Implement a system that utilizes temperature and vibration sensors in vehicles. The collected data is uploaded to the FAVORIOT IoT platform, where it’s analyzed to detect damage patterns and schedule proactive maintenance.
🧰 Hardware Components
- ESP8266 NodeMCU (for WiFi connectivity and microcontroller functionality)
- LM35 or DS18B20 Temperature Sensor
- SW-420 or GY-521 (with MPU6050) Vibration Sensor
- Jumper wires & Breadboard
- USB Cable for programming
🌐 FAVORIOT Platform Setup
- Register/Login at https://platform.favoriot.com.
- Navigate to Developer > IoT Devices.
- Click on + Add Device and fill in the required details:
- Device Name: e.g.,
VehicleSensorNode - Device Developer ID: e.g.,
vehicle_sensor_node - Description: e.g.,
Vehicle sensor node for predictive maintenance - Template: Select Custom
- Device Name: e.g.,
- After creating the device, copy the
Access Tokenprovided. This token will be used for authenticating API requests from your hardware.
🧪 Wiring Diagram
LM35 Temperature Sensor
- VCC → 3.3V
- GND → GND
- OUT → A0
SW-420 Vibration Sensor
- VCC → 3.3V
- GND → GND
- D0 → D1 (GPIO5)
📟 Arduino Source Code
Ensure you have the necessary libraries installed in your Arduino IDE.
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
// Replace with your network credentials
const char* ssid = "Your_SSID";
const char* password = "Your_PASSWORD";
// FAVORIOT settings
const char* serverName = "https://apiv2.favoriot.com/v2/streams";
const char* accessToken = "Your_DEVICE_ACCESS_TOKEN"; // Use the Access Token from FAVORIOT
#define TEMP_SENSOR A0
#define VIBRATION_SENSOR D1
void setup() {
Serial.begin(115200);
pinMode(VIBRATION_SENSOR, INPUT);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
}
void loop() {
// Read temperature from LM35
int tempReading = analogRead(TEMP_SENSOR);
float voltage = tempReading * (3.3 / 1024.0);
float temperature = voltage * 100.0; // LM35 outputs 10mV per degree Celsius
// Read vibration sensor state
int vibrationState = digitalRead(VIBRATION_SENSOR); // 1 = no vibration, 0 = vibration detected
// Prepare JSON payload
String jsonPayload = "{";
jsonPayload += "\"device_developer_id\": \"vehicle_sensor_node\",";
jsonPayload += "\"data\": {";
jsonPayload += "\"temperature\": \"" + String(temperature) + "\",";
jsonPayload += "\"vibration\": \"" + String(vibrationState) + "\"";
jsonPayload += "}}";
// Send data to FAVORIOT
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(serverName);
http.addHeader("Content-Type", "application/json");
http.addHeader("accessToken", accessToken); // Use 'accessToken' as the header key
int httpResponseCode = http.POST(jsonPayload);
if (httpResponseCode > 0) {
String response = http.getString();
Serial.println("Response: " + response);
} else {
Serial.println("Error in HTTP POST: " + String(httpResponseCode));
}
http.end();
} else {
Serial.println("WiFi Disconnected");
}
delay(15000); // Send data every 15 seconds
}
📊 Visualizing Data on FAVORIOT Dashboard
- Access Data Streams:
- Navigate to Data Streams > My Data Stream to view incoming data from your device.
- Create Dashboard:
- Go to Dashboard > My Dashboard.
- Click on + Create Dashboard and provide a name and description.
- Add Widgets:
- Within your dashboard, click on + Widget to add visual components:
- Line Chart: Plot temperature over time.
- Gauge: Display real-time temperature.
- Indicator: Show vibration status (e.g., Normal or Alert).
- Within your dashboard, click on + Widget to add visual components:
📈 Analyzing Data for Predictive Maintenance
- Vibration Analysis:
- Continuous readings of
vibration = 0may indicate abnormal vibrations or potential mechanical issues.
- Continuous readings of
- Temperature Monitoring:
- Consistently high temperatures (e.g., above 80°C) can signal overheating components.
By setting up Rules in FAVORIOT, you can trigger alerts or notifications when certain thresholds are crossed, facilitating proactive maintenance.
🚀 Further Enhancements
- GPS Integration: Add a GPS module to log the vehicle’s location alongside sensor data.
- Machine Learning: Utilize historical data to train models that predict failures before they occur.
- Notifications: Integrate with messaging services to send real-time alerts to maintenance teams.
References
- Favoriot Platform Registration (FREE and Paid)
- Favoriot Full Documentation (Official)
- Favoriot Github
- How-To Use Favoriot Platform Video Playlist
Disclaimer
This article provides a step-by-step guide and only serves as a guideline. The source code may need adjustments to fit the final project design.
Feel free to reach out if you have any questions or need further assistance setting up your predictive maintenance system using FAVORIOT.
![[Tutorial] : Predictive Vehicle Maintenance Using Sensors and FAVORIOT](https://iotworld.co/wp-content/uploads/2025/04/ChatGPT-Image-Apr-9-2025-07_00_21-AM.png)





Leave a Reply