Building a Bidirectional IoT SystemBuilding a Bidirectional IoT System

Business

7 min read

Tags

#Engineering

#IoT

#Data Science

Share

A dashboard can tell you the temperature is too high, but it can't switch on a fan or save the plants.

‍

That gap, between knowing and doing, is where Jesús Alcocer Tagua, a Data Science Engineer at Exadel, took his IoT project next.

‍

It Started With Tomatoes

The brief was simple: monitor temperature and humidity for homegrown tomatoes. 

‍

Jesús built a four-stage pipeline:

  • Data collection: ESP32 and Raspberry Pi Pico W microcontrollers with DHT11 and DHT22 sensors captured temperature and humidity readings.
  • Message transport: the devices published readings over Wi-Fi using MQTT.
  • Data ingestion: a Python service subscribed to the MQTT messages and stored the measurements in SQLite.
  • Visualization: a web application displaying current and historical sensor data.

‍

It was a clean four-stage telemetry pipeline: collection, transport, ingestion, visualization. But it only watched.

‍

So the next question became: how can sensor readings trigger real-world responses without relying on third-party cloud services?

‍

Widening the Net With Zigbee

Wi-Fi isn’t the only way to connect devices. Zigbee reaches sensors, smart plugs, and other hardware over a separate wireless protocol, and Zigbee2MQTT bridges it into the existing pipeline.

‍

Integration flow:

‍

Zigbee device → USB coordinator → Zigbee2MQTT → MQTT broker

‍

Zigbee2MQTT acts as the translation layer, so everything lands on the same MQTT broker and new devices join the existing pipeline without custom firmware for each one.

‍

The payoff is practical: new devices join the ingestion pipeline without custom firmware for each one.

‍

Closing the Loop

To move beyond read-only telemetry, the system needed a way to send commands back. Jesús kept two paths deliberately separate:

  • Telemetry path: Sensor → MQTT → Python ingester → SQLite → Dashboard
  • Control path: Dashboard or automation logic → MQTT → Zigbee2MQTT → Smart plug

‍

Sensor readings are stored for observation, while control commands travel through MQTT. The storage layer never doubles as the actuation layer.

‍

The Fan That Doesn’t Flicker

The first automation was a fan on a Zigbee smart plug. The naive rule, “on above 28°C, off below 28°C,” would make the fan chatter whenever the temperature hovers near the threshold. So the system uses two:

  • Above 28°C: turn the fan on
  • Below 25°C: turn the fan off
  • Between 25°C and 28°C: keep the current state

‍

That gap is hysteresis, a small design decision that keeps hardware stable. A manual on/off override on the dashboard sits alongside it.

‍

Where Engineering Judgment Enters

Reading data is forgiving. Controlling hardware isn’t. Before enabling automated actions, the design followed four ground rules:

‍

  1. Define clear boundaries.
    Control logic works within a limited, explicit scope.
  2. Separate observation from actuation.
    Reading sensor data never requires modifying stored measurements.
  3. Monitor device availability.
    Missing readings can mean a device has disconnected or stopped reporting.
  4. Preserve manual control.
    Users can always override automated actions.

None of this is exotic. It’s the same discipline behind every “it works, but is it safe to ship?” decision, applied to a system that can now switch things on in the physical world.

‍

One Data Model, Many Dashboards

The dashboards are configuration-driven. JSON files define connected devices and their locations, available metrics and their meanings, and visualization types (line, bar, and pie charts), plus the context needed to interpret measurements. Because device definitions and visualization settings live outside application code, a single data model supports multiple dashboard views without separate pipelines.

‍

The Full Loop

Together, the pieces form a complete feedback loop: observe, ingest, store, interpret, act. MQTT telemetry, Zigbee integration, structured configuration, and bounded control logic turn a monitoring dashboard into a system that interacts with its physical environment. The same architecture extends to other use cases, such as automated irrigation based on environmental readings.

That’s quite a harvest for a project that began with tomatoes.

Want to build things like this alongside engineers like Jesús?

Explore open roles at Exadel

Resource Hub

Our Latest Stories & Industry Insights

View Resource Hub

Women in Exadel: Let's Talk About Leadership, AI, and the Human Side of Technology

10 min read

October 29, 2026

Legacy Modernization With AI Agents: Build the Test Baseline First

5 min read

October 28, 2026

Building a Bidirectional IoT System

7 min read

October 27, 2026

5 Things Senior Engineers Get Wrong About AI

5 min read

October 26, 2026

What Is an AI Data Engineer? Role, Skills, and How Enterprise Teams Are Evolving

14 min read

October 21, 2026

Exadel Colleague Is Now Available in AWS Marketplace

5 min read

October 20, 2026
Two people sitting at a table with a laptop.

Let’s make your next project faster, safer, smarter.

Get In Touch