DEV Community

Shyam Desigan
Shyam Desigan

Posted on

Hermes-Pi Factory Guardian

Hermes Agent Challenge Submission: Build With Hermes Agent

What I Built
Hermes-Pi Factory Guardian — an always-on industrial monitoring system that runs Hermes Agent on a Raspberry Pi 5 to watch over factory cameras and GPIO sensors in real-time, using Hermes' closed learning loop to continuously improve its anomaly detection accuracy with every shift it monitors.

Factory monitoring today is broken. Cameras record footage nobody watches. Vibration sensors only alert after something breaks. Maintenance schedules are based on calendar dates instead of actual machine condition. Static thresholds can't distinguish between a normal Tuesday afternoon pattern and a genuine anomaly on a quiet Sunday. And when systems generate too many false alarms, operators start ignoring all of them — including the real ones.

I built Factory Guardian to fix this. The system combines computer vision (OpenCV + YOLOv8-nano) with physical sensor data (vibration via ADXL345, temperature via DS18B20, current draw via ACS712) to create a unified threat model processed through five cooperative Hermes skills: anomaly detection, vibration baseline (FFT analysis for bearing fault prediction), camera monitor (adaptive zone-based motion detection), alert routing (shift-aware multi-channel dispatch), and shift report (automated handover summaries with recommendations).

The key insight: Hermes doesn't just detect anomalies — it learns from them. When a bearing fails on one CNC mill, Hermes extracts the pre-failure vibration signature and creates a detection skill it applies to every other CNC mill on the floor. When rainstorms cause false camera triggers at the loading dock three nights in a row, the system automatically creates a rule to reduce sensitivity during high luminance variance — no retraining, no config change, no software update. Every shift it monitors makes it smarter.

Demo
Hermes-Pi Factory Guardian Dashboard

The dashboard shows the system architecture (Pi 5 connected to cameras, sensors, and the Hermes Agent core) alongside a live monitoring view with machine health statuses, recent alerts, and real-time sensor readings. The five Hermes skills form a cooperative pipeline where each skill feeds its outputs into the next — anomaly detection identifies deviations, alert routing dispatches notifications, and shift report closes the feedback loop by identifying patterns that improve future detection.

Code
github.com/Cubiczan/hermes-pi-factory-guardian

My Tech Stack
Component
Technology
AI Agent Hermes Agent (Nous Research)
Platform Raspberry Pi 5 (8GB)
Computer Vision OpenCV 4.9, YOLOv8-nano
Edge Accelerator Google Coral TPU
Vibration Sensor ADXL345 (SPI, 3200 Hz)
Temperature Sensor DS18B20 (1-Wire)
Current Sensor ACS712 (MCP3008 ADC)
Camera Raspberry Pi Camera Module v3
Alerts Telegram Bot API, Slack Webhooks, SMTP Email, GPIO Buzzer
Language Python 3.11
Containerization Docker, docker-compose
Logging structlog
Configuration YAML

How I Used Hermes Agent
Hermes Agent is the intelligence core of the entire system — not just a chatbot bolted onto a monitoring dashboard, but the reasoning engine that ties together sensor fusion, pattern recognition, and self-improvement.

Skill Architecture: I created five Hermes skills, each defined as Markdown files with YAML frontmatter specifying triggers, inputs, and outputs. The anomaly_detection skill triggers on every sensor reading and camera motion event. It builds per-machine baselines during a 72-hour learning period using Z-score analysis, then correlates across modalities — if vibration RMS is high and temperature is rising and current draw is spiking on the same machine, the severity is automatically bumped because the multi-sensor correlation almost always indicates a real problem.

Closed Learning Loop: This is where Hermes delivers real value. The anomaly_detection skill creates new detection rules from confirmed incidents. When an operator replies "CONFIRM" to a Telegram alert about a hydraulic pump failure, the skill extracts the pre-incident sensor window (typically 30 minutes before), identifies the distinguishing features (rising high-frequency FFT content above 0.5mm/s), and stores it as a reusable skill with an estimated lead time and confidence score. The next time any machine on the floor shows that pattern, Hermes catches it hours earlier. This isn't generic transfer learning — it's the agent reasoning about mechanical similarity across machines.

Adaptive Behavior: The camera_monitor skill demonstrates Hermes' ability to adapt to environmental changes. When the shift_report skill identifies a correlation between rainstorms and false motion alerts at the loading dock (by analyzing three consecutive night shifts of data), the camera monitor automatically creates a sensitivity reduction rule with an auto-revert timer. No human had to notice the pattern, write a rule, or deploy a config change. Hermes observed, learned, and adapted on its own.

Alert Intelligence: The alert_routing skill uses Hermes' contextual reasoning to prevent alert fatigue — one of the most common reasons factory monitoring systems get abandoned. It merges repeated alerts from the same machine within 5 minutes, auto-escalates severity after 3 repeated alerts, and routes notifications based on shift schedules and responder availability. A LOW alert at 3 AM on a night shift goes to the on-call engineer only, while the same alert at 10 AM on a day shift goes to the shift lead via Telegram and logs it for the daily email summary.

The result is a monitoring system that runs 24/7 on a $100 device and genuinely gets better at its job every week — exactly the kind of self-improving agent the Hermes Agent Challenge was designed to showcase.

Top comments (0)