The reference template for local sensing on GROUU: an ESP32 that reads a sensor and publishes JSON over WiFi + MQTT, with reconnect logic and over-the-air updates. Complete, documented firmware you can clone, configure and flash.
This node is complete as a firmware template. It runs on a stock ESP32 dev board, so there's no custom PCB — just source, a minimal parts list, and documentation.
Joins WiFi with automatic reconnect.
Publishes / subscribes over MQTT via PubSubClient.
Reads DHT22 and sends {"t2":x,"h2":x} every 3 s.
OTA updates, armed remotely via a control topic.
Accepts a remote reboot command.
Each node is named by the GROUU convention, so its topics derive automatically:
Derived from the host name — swap in your own:
Libraries: WiFi, Adafruit_Sensor + DHT, ArduinoJson, PubSubClient, ArduinoOTA.
src/main.cpp — read the DHT22, publish JSON over MQTT
void publishValues() {
JsonDocument doc;
char output[80];
float newT = dht.readTemperature();
float newH = dht.readHumidity();
if (isnan(newT)) {
Serial.println("Failed to read from DHT sensor!");
} else {
doc["t2"] = newT;
doc["h2"] = newH;
serializeJson(doc, output);
client.publish(MQTT_room_sensors_PUBLISH_TOPIC.c_str(), output);
}
}
| Part | Role | Source |
|---|---|---|
| ESP32 dev board | MCU + WiFi (the PlatformIO env targets a XIAO ESP32-C3) | — |
| DHT22 (AM2302) | Temperature + humidity, data on pin D7 | — |
| 4.7k–10k pull-up | On the DHT data line | — |
| MQTT broker | Any — e.g. the GROUU Stack | Server Stack |
Pull the WiFi node folder from the repo.
Set installation, WiFi and broker; wire the DHT22.
Build & upload with PlatformIO.
Any MQTT broker — e.g. the GROUU Stack.