Built to order

TinyML Machine Anomaly Detection using ESP32

A predictive-maintenance node built on the ESP32: an MPU6050 accelerometer samples machine vibration, and a quantized autoencoder running entirely on the microcontroller scores every window against the learned "healthy" signature. Anything it cannot reconstruct is flagged as an anomaly — no labeled fault data and no cloud needed for detection. Scores stream over Wi-Fi/MQTT to a live web dashboard with threshold visualization and an event log. Suitable for B.E./B.Tech final-year projects in Electronics, Electrical, IoT and related branches.

TinyML Machine Anomaly Detection using ESP32 - project prototype demo screenshot
More project photos (2)

The problem

Unplanned machine downtime is expensive, yet most small workshops cannot afford industrial condition-monitoring systems. Vibration is one of the earliest indicators of developing faults: bearing wear, imbalance and looseness all change a machine's vibration signature long before failure. TinyML makes it possible to run that analysis on a low-cost microcontroller: an ESP32 samples an accelerometer, runs a quantized neural network entirely on-device, and reports only anomalies instead of streaming raw data. This project builds that system around the MPU6050 accelerometer and a dense autoencoder trained on healthy vibration windows, with a web dashboard for live scores and event history. Because detection is unsupervised, the project needs no labeled fault recordings — the model only ever learns "healthy".

How it works

  1. The MPU6050 streams 3-axis acceleration to the ESP32 over I2C while the machine runs normally; firmware logs healthy windows.
  2. The training notebook converts windows to 24 features and trains a dense autoencoder to reconstruct healthy inputs.
  3. The model is quantized to int8, converted to TensorFlow Lite Micro and flashed to the ESP32 with a calibrated threshold.
  4. In operation, firmware extracts features per window, runs the autoencoder and computes reconstruction error as the anomaly score.
  5. Scores below threshold mean normal operation; crossings light the on-board indicator and publish an MQTT alert.
  6. The dashboard plots the live error curve against the threshold line and appends every event to the log.

Tech stack:

  • ESP32 DevKit, MPU6050 accelerometer (I2C)
  • TensorFlow Lite Micro (int8 quantized autoencoder)
  • Arduino IDE / ESP-IDF (firmware)
  • Python 3.10, TensorFlow/Keras (training notebook)
  • MQTT (Mosquitto), HTML/CSS/JS web dashboard
Parameter Value
Controller ESP32 DevKit (240 MHz dual-core, 520 KB SRAM)
Sensor MPU6050 6-axis accelerometer/gyroscope over I2C
Model Dense autoencoder 24-16-4-16-24, int8 quantized (TensorFlow Lite Micro)
Features 24 per window: RMS, FFT-band energy, time-domain statistics
Inference Design target: under 50 ms per window, under 100 KB model RAM (buyer-measured during build)
Detection Unsupervised reconstruction-error scoring with calibrated threshold
Telemetry Wi-Fi + MQTT to local broker; live web dashboard
Output On-board indicator, optional OLED, dashboard event log

Project features

  • [On-device autoencoder inference] Quantized int8 dense autoencoder (24-16-4-16-24) running in TensorFlow Lite Micro on the ESP32, no cloud needed for detection
  • [Vibration sensing pipeline] MPU6050 3-axis sampling over I2C with fixed windowing and 24-feature extraction (RMS, FFT-band energy, time-domain statistics)
  • [Unsupervised anomaly scoring] Mean-squared reconstruction error as the anomaly score — trained only on healthy data, so no fault labels required
  • [Live web dashboard] Real-time reconstruction-error curve with threshold line, anomaly score gauge, device status and event log
  • [MQTT/Wi-Fi telemetry] Scores and window features published to a local broker; dashboard updates live
  • [Threshold calibration procedure] Buyer-run routine that sets the detection threshold from the machine's own healthy baseline
  • [Local alert output] On-board indicator and optional OLED display showing live status without the dashboard
  • [Artificial-fault demo procedure] Documented method to introduce a controlled imbalance and watch the detector flag it

What is included

  • Complete ESP32 firmware source (sensor driver, feature extraction, TFLite Micro inference, MQTT)
  • Python training notebook (feature pipeline, autoencoder training, quantization, threshold calibration)
  • Live web dashboard (error curve, threshold, gauge, event log)
  • Wiring diagram and component list
  • Project report PDF (TinyML background, model design, quantization, evaluation, honest scope)
  • PPT presentation for final review
  • Viva Q&A preparation document (autoencoders, quantization, I2C, MQTT, anomaly scoring)
  • Setup and calibration guide (collecting baseline, setting threshold, fault-demo procedure)

Limitations & prerequisites

  • Detection is only as good as the healthy baseline: if the training data includes faulty operation, the model learns it as normal — the calibration guide stresses clean baseline collection.
  • The autoencoder flags that something changed, not what changed: it cannot name the fault type (bearing vs imbalance) without labeled data, which is documented future scope.
  • Sensor mounting matters enormously: loose mounting or a different machine position changes the signature, so the threshold must be recalibrated per installation.
  • Wi-Fi range and reliability bound the dashboard telemetry; core detection keeps running on-device even if Wi-Fi drops, but events will not reach the dashboard until reconnect.
  • This is an academic prototype, not certified industrial condition-monitoring equipment.

Frequently Asked Questions

Which controller and sensor are used?

An ESP32 DevKit with an MPU6050 accelerometer connected over I2C. The ESP32 was chosen for its 240 MHz dual-core CPU and 520 KB SRAM, which comfortably fits the quantized autoencoder.

Do I need recordings of broken machines to train it?

No — that is the point of the unsupervised design. The autoencoder trains only on healthy vibration; anything it cannot reconstruct scores as anomalous. You do need a clean healthy baseline recording from your own machine.

How accurate is the detection?

There is no single accuracy number because there are no labeled fault classes in the base build. Performance is characterized by the false-alarm rate on held-out healthy windows and by the documented artificial-fault demo, both measured during your build — the report presents your numbers, not invented ones.

Does it need internet?

No. Detection runs fully on-device. Wi-Fi is only used to send scores to the local dashboard; a local Mosquitto broker on a laptop is enough.

Is this project suitable for a final-year project?

Yes — it is listed under IoT & Embedded and suits Electronics, Electrical and IoT students. It demonstrates embedded ML, quantization, sensor interfacing and MQTT telemetry.

What will I receive with the project?

ESP32 firmware, training notebook, web dashboard, wiring diagram, project report PDF, PPT, viva Q&A and the setup/calibration guide. Suitable for B.E./B.Tech final-year projects in Electronics, Electrical, IoT and related branches.

Components & software requirements
  • ESP32 DevKit, MPU6050 accelerometer (I2C)
  • TensorFlow Lite Micro (int8 quantized autoencoder)
  • Arduino IDE / ESP-IDF (firmware)
  • Python 3.10, TensorFlow/Keras (training notebook)
  • MQTT (Mosquitto), HTML/CSS/JS web dashboard
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of an ESP32 development board at the centre, with sensor nodes, data-flow arrows and a circuit-brain motif representing an AI agent reasoning and sending decisions back.Engineering students building IoT or embedded final-year projects who want to add local AI agent behaviour with ESP32, MQTT and a small language model.

AI Agents on ESP32: Agentic IoT Final-Year Projects

An agentic IoT system observes, reasons, acts, remembers and explains. On ESP32 that means a split architecture: the chip senses and acts while a small local model (Ollama on your laptop) reasons over MQTT — a full LLM needs gigabytes of RAM the chip doesn't have. This guide covers three working patterns (host-reasoned agent, on-device tinyML on ESP32-S3, and a hybrid of both), plus Wi-Fi CSI presence sensing, parts and budget for India, code shapes, and honest limits to state in your report.

Read guide
Technical illustration of three electronic control units linked by a twisted-pair CAN bus cable carrying signal pulses between them.Electronics, E&TC, IoT and robotics students who keep hearing “CAN bus” in EV, automotive and industrial project ideas and want to understand it properly before wiring anything

CAN Bus Basics for Students: How ECUs Communicate

CAN bus is the shared network that lets dozens of controllers in a car, EV or robot communicate over two wires. This guide explains message IDs, arbitration, the physical layer, frame structure, error handling and CAN FD, then walks through building a working two-node bench network with an ESP32 and a transceiver.

Read guide
Illustration of a quadcopter drone build showing labeled parts including frame, motors, propellers, ESCs, flight controller, and battery.B.E./B.Tech Electronics, Mechanical, and Computer Science students planning to build a quadcopter drone who need to select compatible parts without wasting money on mismatched

Drone Build: Parts Selection Guide

Picking drone parts that actually work together is a sizing problem, not a shopping problem. This guide walks the compatibility chain — frame to props to motors to ESCs to battery — with the thrust math, firmware choices, LiPo safety, and the bench-test order that prevents disasters.

Read guide
Get a quotation