I Simulated a Complete IoT Factory Sensor System Without Any Hardware — Here Is Exactly How I Did It
9 min read
You do not always need hardware on your desk to develop and test firmware. Simulators let you build and debug logic, state machines, and communication before you plug in a single wire. This post walks through building a complete IoT factory sensor system — temperature and vibration monitoring with alerts and WiFi transmission — using the Wokwi simulator for ESP32. Zero hardware. I will show the firmware architecture, the sensor reading logic, the alert system, and how WiFi transmission is simulated. Every tool and decision is named so you can reproduce it or use the same approach for your own project. This post is for engineers and CTOs evaluating how to develop IoT firmware and for hardware founders who want to see that real systems are built with real engineering discipline.
- A factory monitoring node that:
- Reads "temperature" and "vibration" from simulated sensors.
- Compares them to thresholds and triggers an alert when exceeded.
- Sends readings and alerts to a simulated backend (or a real one if you point it there) over WiFi.
- Runs in a loop with configurable interval, so we can test timing and state.
In Wokwi, the ESP32 is simulated; we can attach simulated sensors (e.g. a temperature sensor component) or emulate sensor values in code for speed. The focus here is firmware structure and logic — the same structure runs on real hardware with real sensors.
- Main loop (or RTOS tasks): One task/loop for sensor read, one for threshold check and alert, one for network (or a simple state machine in a single loop if we keep it minimal).
- Sensor layer: Functions that "read" temperature and vibration. In simulation they return values from Wokwi components or from test vectors; on hardware they read ADC or I2C/SPI sensors.
- Alert logic: Compare readings to configurable thresholds. If exceeded, set a flag or push to an alert queue. In a full system we would blink an LED or send to cloud; in sim we log or send a message.
- Network layer: Connect to WiFi (in Wokwi, WiFi is simulated), then send HTTP or MQTT to a server. For sim we can use a mock server or a real cloud endpoint.
We define a structure for a reading (timestamp, temperature, vibration, unit). The "sensor" read function in sim returns values we inject (e.g. ramp temperature up to test threshold). On real hardware we would read ADC, apply calibration, and convert to physical units. The important part is that the rest of the firmware (threshold check, network) only sees "a reading" — so we can swap sim for real without changing the upper layers.
If temperature > T_max or vibration > V_max, we set an alert state and optionally send an alert payload. We might also implement a debounce (e.g. alert only if threshold exceeded for N consecutive samples) to avoid noise. In the post I would show a minimal version: one threshold check per reading, immediate alert.
In Wokwi, ESP32 WiFi is simulated. We can call the same WiFi and HTTP/MQTT code we would use on device. The simulator can connect to the internet, so we can actually hit a real server or a test endpoint. We send a JSON payload: timestamp, temperature, vibration, alert flag. On the server side we could use a simple Flask or Node server, or a cloud IoT service.
- Doing this in simulation shows that:
- We separate layers (sensor, logic, network) so that testing and porting are straightforward.
- We can run the same logic with simulated or real sensors.
- We think about state, timing, and failure (e.g. what if WiFi is down?) from the start.
That is how we build production firmware at Hendoi — with clear architecture and testability. If you have a real hardware challenge (factory sensors, industrial IoT, or any embedded product), we can take this discipline and apply it to your design. Contact us for a free technical review.
Frequently asked questions
We use this as an internal teaching and demo example. We can walk through the structure and decisions in a call. For full project sharing we would adapt it for your use case and deliver as part of an engagement.
We use sim for early logic and integration when hardware is not ready. Final validation is always on real hardware. We can also help you set up Wokwi or another simulator for your chip and sensors. 📞 +91-9677261485 | 📧 support@hendoi.in | [Contact us](/contact)
Showing slide 1 of 6. Use the buttons below to change slide.
Recommended posts
View all posts (opens blog listing)Custom Barcode Engine for Logistics, Healthcare & Retail
How custom barcode generation and decoding engines fit logistics, healthcare, and retail. Compliance, throughput, integration. USA Canada Chennai.
Read moreBarcode Symbologies: Code 128, Data Matrix, EAN—Which to Use When
Code 128, Data Matrix, EAN/UPC, and others: when to use which barcode type. Retail, logistics, healthcare. USA Canada Chennai.
Read moreCustom Barcode Engine vs Library: When to Build Your Own
When to use a generic barcode library vs building a custom barcode generation or decoding engine. Symbologies, throughput, industrial use. USA Canada Chennai.
Read moreCustom QR Code Engine: Server, Mobile, or Embedded—Where to Run It
Where to run a custom QR code engine: server-side API, inside mobile apps, or on embedded devices. Trade-offs and use cases. USA Canada Chennai.
Read moreHigh-Throughput QR Code Generation: Batch vs Real-Time Engines
Batch QR generation for tickets and labels vs real-time encode APIs. Design choices and when to use each. USA Canada Chennai.
Read moreCustom QR Code Engine vs Off-the-Shelf Library: When to Build Your Own
When to use a generic QR library vs building a custom QR code generation or decoding engine. Throughput, format, integration. USA Canada Chennai.
Read moreCustom Database Engine as a Data Warehouse Alternative
When a custom engine can replace or complement a data warehouse. Real-time, cost, and use cases. USA Canada India.
Read moreOLAP vs OLTP: When to Use a Custom Engine for Each
OLAP (analytics) vs OLTP (transactions). When a custom engine fits each, and when to keep them separate. USA Canada India.
Read moreWhat Is VeloxDB? Custom Database Engine by Hendoi
VeloxDB is Hendoi’s custom database engine offering. Purpose-built for hot-path workloads. USA Canada India.
Read moreHow to Choose a Custom Database Engine Development Agency in India
What to look for when hiring an India-based agency for custom database engine development. USA Canada clients.
Read moreSub‑Millisecond API Latency: How a Custom Engine Hits p99
How custom database engines achieve sub‑ms p99 latency for APIs. Design choices and when it matters. USA Canada India.
Read moreBuild vs Buy Database Engine: CTO Decision Framework 2026
When to build a custom database engine vs buy (managed DB). Decision framework for CTOs. USA Canada India.
Read moreCustom Barcode Engine for Logistics, Healthcare & Retail
How custom barcode generation and decoding engines fit logistics, healthcare, and retail. Compliance, throughput, integration. USA Canada Chennai.
Read moreBarcode Symbologies: Code 128, Data Matrix, EAN—Which to Use When
Code 128, Data Matrix, EAN/UPC, and others: when to use which barcode type. Retail, logistics, healthcare. USA Canada Chennai.
Read moreCustom Barcode Engine vs Library: When to Build Your Own
When to use a generic barcode library vs building a custom barcode generation or decoding engine. Symbologies, throughput, industrial use. USA Canada Chennai.
Read moreCustom QR Code Engine: Server, Mobile, or Embedded—Where to Run It
Where to run a custom QR code engine: server-side API, inside mobile apps, or on embedded devices. Trade-offs and use cases. USA Canada Chennai.
Read moreHigh-Throughput QR Code Generation: Batch vs Real-Time Engines
Batch QR generation for tickets and labels vs real-time encode APIs. Design choices and when to use each. USA Canada Chennai.
Read moreCustom QR Code Engine vs Off-the-Shelf Library: When to Build Your Own
When to use a generic QR library vs building a custom QR code generation or decoding engine. Throughput, format, integration. USA Canada Chennai.
Read moreCustom Database Engine as a Data Warehouse Alternative
When a custom engine can replace or complement a data warehouse. Real-time, cost, and use cases. USA Canada India.
Read moreOLAP vs OLTP: When to Use a Custom Engine for Each
OLAP (analytics) vs OLTP (transactions). When a custom engine fits each, and when to keep them separate. USA Canada India.
Read moreWhat Is VeloxDB? Custom Database Engine by Hendoi
VeloxDB is Hendoi’s custom database engine offering. Purpose-built for hot-path workloads. USA Canada India.
Read moreHow to Choose a Custom Database Engine Development Agency in India
What to look for when hiring an India-based agency for custom database engine development. USA Canada clients.
Read moreSub‑Millisecond API Latency: How a Custom Engine Hits p99
How custom database engines achieve sub‑ms p99 latency for APIs. Design choices and when it matters. USA Canada India.
Read moreBuild vs Buy Database Engine: CTO Decision Framework 2026
When to build a custom database engine vs buy (managed DB). Decision framework for CTOs. USA Canada India.
Read more