ESP32 DHT11 Dashboard with Blynk: Gauge and History Chart
This project publishes temperature and relative humidity from a DHT11 to Blynk 2.0. The dashboard displays current values and a history chart, giving you a practical sensor-telemetry example rather than only remote control.
Model each measurement explicitly: temperature in degrees Celsius and humidity in percent. DHT11 is a basic sensor, so don't display excessive decimal precision or treat readings as laboratory calibration. Verify wiring and the installed library APIs before relying on the data.
Hardware and datastreams
You need an ESP32 development board, DHT11 sensor/module, jumpers, Arduino IDE, DHT sensor library and Blynk library. Connect DATA to GPIO 4 for this example. Check whether your breakout has a pull-up resistor; a bare sensor may need one, and its supply voltage depends on the sensor/module.
In Blynk.Console create:
- V1 — Temperature C, numeric with a suitable range for your application.
- V2 — Humidity %, numeric with a range from 0 to 100.
Create gauges for each datastream. Configure a chart according to the current Blynk widget options; chart retention and features may depend on current plan limits, so confirm official docs before promising a duration.
1. Upload the sketch
Install the DHT sensor library and Blynk library from Arduino IDE Library Manager. Replace all placeholders locally and use your actual template ID and token. BlynkTimer schedules updates; the code does not call virtualWrite continuously on every loop pass.
2. Build the dashboard and history chart
Add a gauge for V1 labelled Temperature (°C). Add another for V2 labelled Relative humidity (%). Set ranges appropriate to your use case; widget range is a presentation choice, not a sensor accuracy statement.
Add a chart widget using the datastreams and history settings supported by your current Blynk account. Start by proving live updates work before debugging history. Blynk's guide to displaying sensor data explains the general data path.
3. Respect the sensor update rate
The example samples about every 2.5 seconds, a conservative interval for a DHT11. If an update fails, it skips the upload and logs an error. That is preferable to publishing zero, which can look like a valid measurement. In a more complete dashboard, show last-update time and validity/availability so missing updates do not appear fresh.
Do not use Blynk.virtualWrite on every pass through loop. Use a timer or meaningful value-change strategy, and check current service policies before setting production write rates.
Troubleshooting
Device offline: verify Wi-Fi, template ID, token, library and device configuration.
Sensor returns NaN: check pin, supply, ground, data wiring, pull-up and sampling interval.
Gauge shows the wrong value: confirm widget/datastream mapping, labels, units and range.
No chart history: first prove live uploads work, then inspect current chart setup and account capabilities.
Too many cloud writes: check that updates are timed rather than sent continuously.