AWS Builder Center
How I Designed an IoT Predictive Maintenance System Using ESP32, MQTT, and AWS

How I Designed an IoT Predictive Maintenance System Using ESP32, MQTT, and AWS

A behind-the-scenes look at designing AssetSense, an IoT-based predictive maintenance platform. Learn how sensor data, MQTT messaging, and AWS services can work together to monitor industrial equipment in real time.

Building backends & ML systems on Cloud
Industrial equipment failures are expensive, disruptive, and often preventable. In many environments, motors continue operating until a fault becomes severe enough to trigger downtime, resulting in production losses and increased maintenance costs.
To explore how modern cloud technologies can help address this challenge, I designed AssetSense, an IoT-based predictive maintenance system that combines edge sensing, real-time telemetry, and cloud-native services to monitor motor health continuously.

The Problem

Traditional maintenance strategies generally fall into two categories:
  1. Reactive Maintenance – fixing equipment after failure.
  2. Scheduled Maintenance – servicing equipment at fixed intervals regardless of actual condition.
Both approaches have limitations. Reactive maintenance increases downtime, while scheduled maintenance can lead to unnecessary servicing.
A more effective approach is condition-based monitoring, where maintenance decisions are driven by actual equipment behavior.

System Overview

AssetSense is designed to monitor three key indicators of motor health:
  • Vibration
  • Temperature
  • Current Consumption
The system collects sensor data at the edge, transmits telemetry through MQTT, processes events in the cloud, and generates actionable insights through dashboards and alerts.
The architecture follows a simple principle:
Collect → Analyze → Visualize → Act

Edge Layer

The edge device is built around an ESP32 microcontroller.
Three sensors are connected:

MPU6050

Used to capture vibration characteristics.
Abnormal vibration patterns are often early indicators of:
  • Bearing wear
  • Shaft misalignment
  • Mechanical imbalance

ACS712

Measures motor current consumption.
Unexpected current spikes may indicate:
  • Increased load
  • Electrical faults
  • Mechanical resistance

DS18B20

Measures operating temperature.
Rising temperature trends frequently correlate with:
  • Friction
  • Poor lubrication
  • Overloading
The ESP32 aggregates readings and publishes telemetry at regular intervals.

Communication Layer

For device-to-cloud communication, MQTT was selected.
MQTT is lightweight, efficient, and widely adopted in IoT systems.
A typical telemetry message contains:
  • Device ID
  • Timestamp
  • Temperature
  • Current
  • Vibration metrics
Using MQTT allows thousands of devices to communicate with minimal bandwidth overhead.

Cloud Architecture on AWS

Rather than building custom infrastructure, the architecture leverages managed AWS services.

AWS IoT Core

AWS IoT Core acts as the secure entry point for telemetry.
Responsibilities include:
  • Device authentication
  • Message ingestion
  • Secure communication
  • Rule-based routing
This removes the operational burden of managing MQTT brokers manually.

AWS Lambda

Incoming telemetry events trigger Lambda functions.
These functions are responsible for:
  • Data validation
  • Threshold evaluation
  • Event enrichment
  • Alert generation
Because Lambda is serverless, compute resources scale automatically based on incoming traffic.

Amazon DynamoDB

Telemetry and processed events are stored in DynamoDB.
Reasons for choosing DynamoDB:
  • High scalability
  • Low operational overhead
  • Millisecond latency
  • Native AWS integration
This enables efficient storage of large volumes of sensor data.

Amazon CloudWatch

CloudWatch provides observability for the system.
Metrics include:
  • Device activity
  • Message throughput
  • Lambda execution metrics
  • System health indicators
Operational visibility is essential when managing large fleets of connected devices.

Dashboard and Analytics

Raw telemetry becomes valuable only when transformed into insights.
The dashboard presents:
  • Motor health score
  • Temperature trends
  • Current consumption trends
  • Vibration analysis
  • Active alerts
Operators can quickly identify abnormal behavior before a failure occurs.
Instead of reacting to breakdowns, they can make informed maintenance decisions proactively.

Design Considerations

Several architectural decisions influenced the design.

Edge vs Cloud Processing

Not every calculation belongs in the cloud.
Basic filtering and preprocessing can occur on the ESP32, reducing bandwidth consumption and cloud costs.
More computationally intensive analytics can remain in AWS.

Scalability

The architecture is designed to support growth from a single device to thousands of devices without significant redesign.
Managed services provide elasticity while minimizing operational complexity.

Reliability

Industrial systems require high availability.
Using managed AWS services reduces infrastructure management effort and improves system reliability.

Future Enhancements

The current implementation focuses on monitoring and alerting.
Future iterations will explore:
  • Predictive machine learning models
  • Remaining Useful Life (RUL) estimation
  • AWS SageMaker integration
  • Real-time anomaly detection
  • Automated maintenance recommendations
The long-term goal is to move beyond monitoring and enable intelligent maintenance decision-making.

Final Thoughts

Building AssetSense helped me understand the challenges of designing real-world IoT systems that span edge devices, messaging infrastructure, and cloud-native services.
The project reinforced an important engineering principle: collecting data is easy; designing systems that transform data into actionable decisions is where the real value lies.
This article is the first in a series documenting the evolution of AssetSense. In future posts, I will explore AWS IoT Core implementation details, data pipelines, and predictive maintenance workflows in greater depth.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article