VOOZH about

URL: https://dev.to/god_of_night/green-sensor-sim-ai-powered-predictive-maintenance-5h04

⇱ Green Sensor Sim: AI-Powered Predictive Maintenance - DEV Community


DEV Weekend Challenge: Earth Day

This is a submission for Weekend Challenge: Earth Day Edition

What I Built

I built a Python CLI tool that simulates edge hardware monitoring for predictive maintenance. Specifically, it mocks an ESP32 board detecting a motor vibration anomaly and then uses AI to recommend an energy-saving mitigation strategy before the part fails.

As an ECE undergrad currently making a project on vibrational analysis and anomaly detection usinf ESP32-S3, MPU 6050 and edge impulse. I wanted to use this Earth Day challenge to explore how cloud-based AI could complement edge-level detection to reduce industrial energy waste. Tho for my project I am not using cloud.

Demo

Here is the script in action, pulling down a mitigation strategy from the AI based on the simulated vibration data:

👁 Image of my beautiful linux rice

👁 yes, i could have just uploaded the terminal, but i really wanted to show the rest

Code

import asyncio
from backboard import BackboardClient

async def main():
 # Insert your actual API key here
 client = BackboardClient(api_key="YOUR_API_KEY_HERE")

 # Simulating a predictive maintenance anomaly 
 simulated_data = "ESP32 Node 04: Motor vibration frequency shifting outside normal parameters. High probability of bearing wear detected. Energy draw increasing."

 print(f"Reading from sensor...\n{simulated_data}\n")
 print("Consulting Backboard for an Earth Day mitigation strategy...\n")

 # Using the pre-initialized thread ID from the Backboard dashboard
 session_id = "ca3b4407-54ee-40a0-b771-425244ff3301"

 # Sending the prompt to Backboard
 response = await client.add_message(
 thread_id=session_id,
 content=f"Analyze this simulated predictive maintenance data: '{simulated_data}'. Give me one short, creative, Earth-friendly tip to reduce the energy waste caused by this anomaly before the part fails.",
 memory="Auto",
 stream=False,
 )

 print("--- AI Environmental Tip ---")
 print(response.content)

if __name__ == "__main__":
 asyncio.run(main())

How I Built It

I wrote this in Python on my Arch Linux setup using asyncio and the backboard-sdk. Since I don't have my physical ESP32 on hand this weekend, I mocked the payload.

The core technical decision was passing this mock sensor data directly to a pre-initialized Backboard thread. This allowed me to easily get instant, context-aware AI advice on how to handle the mechanical anomaly without unnecessarily wasting electricity while waiting for maintenance.

Prize Categories

  • Best Use of Backboard