SenseView: an ESP32-C6–Based Zigbee IoT Platform for Environmental Monitoring With MQTT, InfluxDB, and Grafana

by NikhilS48 in Circuits > Wireless

750 Views, 4 Favorites, 0 Comments

SenseView: an ESP32-C6–Based Zigbee IoT Platform for Environmental Monitoring With MQTT, InfluxDB, and Grafana

SenseView_Showcase.jpeg

Environmental monitoring plays a crucial role in modern agriculture, smart greenhouses, research laboratories, and precision farming. While many IoT projects demonstrate basic sensor integration, few provide a complete end-to-end solution that combines custom hardware, embedded firmware, wireless communication, and real-time data visualisation.

In this project, I designed and built SenseView, a modular IoT environmental monitoring platform centred around the ESP32-C6 microcontroller and Zigbee wireless communication. The system continuously measures environmental parameters including temperature, humidity, atmospheric pressure, light intensity, soil moisture, carbon dioxide (CO₂), and battery voltage before transmitting the data wirelessly to a central gateway.

Rather than sending data directly to a cloud service, the platform uses a scalable edge-to-cloud architecture consisting of Zigbee2MQTT, Mosquitto MQTT, Telegraf, InfluxDB, and Grafana, enabling real-time visualisation, historical analysis, and long-term data storage.

A custom two-layer PCB was designed to integrate the sensors, power management circuitry, battery monitoring, and communication interfaces into a compact, modular device. The project emphasises low-power operation, expandability, and ease of integration with additional sensors or future IoT deployments.

This project was originally developed as part of my Master's thesis on IoT-enabled environmental monitoring for plasma-treated seed research. Although the biological experiments were outside the scope of this work, the resulting platform serves as a flexible monitoring system suitable for agriculture, research laboratories, greenhouses, environmental monitoring, and many other IoT applications.

Features

  1. 🌱 Real-time environmental monitoring
  2. 📡 Zigbee wireless communication using ESP32-C6
  3. 📊 Live dashboards with Grafana
  4. 🗄️ Time-series data storage using InfluxDB
  5. 🔌 MQTT-based data pipeline
  6. 🔋 Battery-powered operation with voltage monitoring
  7. 🛠️ Custom-designed PCB
  8. 🧩 Modular architecture for future expansion
  9. 💻 Fully open-source hardware and firmware


Supplies

Main Components

  1. ESP32-C6 Development Board
  2. Custom SenseView PCB
  3. BME680 Environmental Sensor
  4. TSL2591 Light Sensor
  5. SCD40 CO₂ Sensor
  6. Capacitive Soil Moisture Sensor SEN0193
  7. LiPo Battery (3.7 V, 1500mAh)
  8. Zigbee Coordinator (Sonoff Zigbee USB Dongle)
  9. USB Type-C Cable

Software

  1. Arduino IDE
  2. Zigbee2MQTT
  3. Mosquitto MQTT Broker
  4. MQTT Explorer
  5. Telegraf
  6. InfluxDB
  7. Grafana
  8. KiCad (PCB Design)
  9. Solidworks

Meet SenseView

SenseView_Architecture.png

Before we start building, here's a quick overview of how the system works.

SenseView combines custom hardware, embedded firmware, Zigbee wireless communication, and a local data pipeline to monitor environmental conditions in real time.

The ESP32-C6 sensor node collects data from multiple sensors and transmits it wirelessly over Zigbee. The data is received by a Zigbee coordinator, forwarded through MQTT, stored in InfluxDB, and finally visualised using Grafana dashboards.

This modular architecture makes the system easy to expand with additional sensors or multiple sensor nodes in the future.

System Overview

Sensors

↓

ESP32-C6

↓

Zigbee

↓

MQTT

↓

InfluxDB

↓

Grafana

In the following steps, we'll look at each part of the system in detail.

Build the Sensor Node

pcb_assembly.jpeg.jpeg
SideView_1.jpeg
SideView_2.jpeg
SideView_3.jpeg

The SenseView sensor node is built around the ESP32-C6 and combines four sensors for environmental and plant monitoring:

  1. BME680 — temperature, humidity and atmospheric pressure
  2. TSL2591 — ambient light intensity
  3. SCD40 — CO₂ concentration
  4. SEN0193 — soil moisture

The BME680, TSL2591 and SCD40 share the I²C bus, while the soil-moisture sensor and battery monitor use the ESP32-C6's analog inputs. The node also provides a GPIO output for controlling the irrigation valve.

The main pin assignments used in the firmware are:

  1. Soil moisture ADC : GPIO 2
  2. Battery voltage ADC : GPIO 3
  3. Irrigation status LED: GPIO 4
  4. I²C SDA : GPIO 5
  5. I²C SCL : GPIO 6

Wiring reference: For the full wiring and pin diagram, refer to the schematic in the SenseView GitHub repository.

The soil sensor's raw ADC value is converted into a moisture percentage using calibrated dry and wet reference values. Battery voltage is measured through an ADC input and calculated using the voltage-divider and calibration factors defined in the firmware.

The ESP32-C6 then processes these measurements and exposes them through the Zigbee endpoints used by the rest of the system.

Custom PCB

PCB 3d design.png

After validating the sensor node with the development-board prototype, I designed a custom two-layer PCB in KiCad to bring the main hardware together into a more compact and reliable platform.

The PCB integrates the ESP32-C6, sensor connections, battery/power circuitry, analog inputs, I²C interface, and expansion headers. This replaces the loose prototype wiring with a more robust platform suitable for repeated testing and deployment.

The PCB was then manufactured and assembled for the SenseView prototype. The complete KiCad project, Gerber files, and BOM are included in the GitHub repository for anyone who wants to examine or reproduce the hardware.

Program the ESP32-C6

CodeSnip.jpg

The SenseView firmware is developed using the Arduino framework and handles sensor acquisition, data processing, Zigbee communication, and local control functions.

During startup, the firmware initializes the I²C bus, ADC inputs, sensors, and Zigbee endpoints. The BME680, TSL2591 and SCD40 communicate through I²C, while soil moisture and battery voltage are measured through the ESP32-C6 ADC inputs.

The firmware also performs basic sensor processing. Soil-moisture readings are converted into a calibrated percentage using the defined dry and wet reference values, while the TSL2591 adjusts its gain according to the measured light level.

Irrigation logic: the firmware compares the calibrated soil-moisture percentage against a defined threshold. When moisture drops below the threshold, the irrigation output is triggered — in this build, that output drives an onboard LED rather than a physical valve, since actuating a real valve was outside the scope of the thesis. The logic itself (threshold comparison, GPIO trigger) is identical to what would drive a valve or relay, so it's a straightforward swap for anyone wanting to add irrigation hardware.

The sensor values are then assigned to dedicated Zigbee endpoints for transmission.

The full firmware source is available in the GitHub repository.

Connect SenseView to Zigbee

Zigbee2MQTTDashboad.png

The ESP32-C6 acts as the Zigbee sensor node, sending the processed sensor measurements wirelessly to a central coordinator.

For this project, a Sonoff Zigbee USB Dongle is used as the Zigbee coordinator. Zigbee2MQTT runs on the host computer and manages the Zigbee network, allowing the ESP32-C6 node to be paired and its measurements to be received.

Once the node joins the network, Zigbee2MQTT exposes the sensor data through MQTT. This creates the connection between the wireless sensor node and the data-processing pipeline used in the following step.

Build the Data Pipeline

Once Zigbee2MQTT receives the measurements from SenseView, the data is passed through the following pipeline:

Zigbee2MQTT → Mosquitto MQTT → Telegraf → InfluxDB

Mosquitto acts as the MQTT broker and handles the messages published by Zigbee2MQTT. Telegraf subscribes to the MQTT topic containing the SenseView data and processes the incoming messages.

An important part of the Telegraf configuration is specifying the MQTT topic that it should subscribe to. This allows Telegraf to receive the Zigbee2MQTT data and write it to InfluxDB, which is configured as the output in the same Telegraf configuration.

InfluxDB stores the measurements as time-series data together with their timestamps, making both current values and historical trends available for visualization.

This separation between the wireless network, messaging layer, data processing, and database keeps the system modular and makes it easier to expand with additional sensor nodes.

Visualize the Data With Grafana

Grafana dashboard.png

With the measurements stored in InfluxDB, Grafana is used to create a real-time monitoring dashboard.

The SenseView dashboard displays:

  1. Temperature
  2. Humidity
  3. Atmospheric pressure
  4. CO₂ concentration
  5. Light intensity
  6. Soil moisture
  7. Battery voltage

The dashboard provides both a real-time overview and historical trends, making it possible to monitor changing environmental conditions, soil moisture, and battery level over time.

Test the Complete System

After assembling the hardware and configuring the software, the complete SenseView system was tested from sensor acquisition to data visualization.

The sensor node was tested to verify that measurements were correctly collected by the ESP32-C6, transmitted over Zigbee, received by Zigbee2MQTT, passed through the MQTT and data-processing pipeline, stored in InfluxDB, and finally displayed in Grafana.

The system was also tested using multiple sensor nodes to verify wireless communication and data reporting between the nodes and the central gateway.

Results and Battery Operation

The completed SenseView node was operated from a 3.7 V LiPo battery and tested with different reporting intervals to evaluate its practical runtime. The same battery was used across both tests, allowing a direct comparison between reporting modes.

Two operating modes were compared:

  1. Continuous / near-1-second reporting (no sleep): the node reported sensor data approximately once per second, keeping the radio and sensors active almost continuously. Under this mode, the battery lasted approximately 14 hours.
  2. Deep sleep mode: the ESP32-C6 alternated between an active phase of roughly 10–20 seconds (sampling sensors and transmitting over Zigbee) and a deep-sleep phase of 115 seconds, giving a total cycle time of about 2.1–2.25 minutes. Under this mode, battery life extended to more than 2 days.

This significant improvement in runtime highlights how much reporting frequency and sleep behavior affect battery-powered operation — waking briefly to report and then sleeping is far more efficient than keeping the radio and sensors active continuously.

The prototype therefore demonstrated that SenseView can operate as a battery-powered Zigbee environmental monitoring node, while also highlighting the potential for further power optimization (e.g. longer sleep intervals, lower-power sensor duty cycling) in future versions.

Final Result and Project Files

IMG_5516.png
qr-code_page-0001.jpg

SenseView brings together custom hardware, embedded firmware, Zigbee communication, and a complete IoT data pipeline into a single environmental monitoring platform.

The final system can collect environmental measurements, transmit them wirelessly, store the data as time-series measurements, and display the results through Grafana.

Enclosure: the blue case housing the sensor node was designed in SolidWorks and 3D-printed to hold the PCB, battery, and sensors while keeping the unit compact enough to mount directly on a plant pot. The enclosure design files are not yet included in the GitHub repository — they may be added in a future update.


The project is open source, and the GitHub repository contains the firmware, KiCad PCB design, schematics, and supporting project files.

GitHub: https://github.com/niksaw/SenseView-IoT

Want to explore the project on your phone?

Scan the QR code to open the SenseView GitHub repository directly.

If you want to build upon the project, the GitHub repository is the best place to start.