Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
Bettesworth Construction
Blynk

Smart Home Temperature and Humidity Monitor with ESP32 and Blynk

Build a phone-accessible indoor temperature and humidity monitor with an ESP32 and Blynk. This updated guide resolves the original DHT11/DHT22 mismatch and uses timer-based uploads.

By Bettesworth Construction Team 8 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build a phone-accessible indoor temperature and relative-humidity monitor with an ESP32, a DHT11 or DHT22 sensor, Wi-Fi, and Blynk. The sensor connects to physical GPIO4; the readings travel through Wi-Fi to Blynk Cloud and appear in mobile or web dashboard widgets.

This is a practical beginner IoT project, not a calibrated environmental instrument. For the most useful hobbyist build, use a DHT22, configure the firmware for DHT22, and send readings with a timer rather than continuously from loop(). The original project is published as Smart Home Temperature & Humidity Monitor with ESP32 and Blynk; “Bly” is a truncated or misspelled reference to Blynk.

How the monitor works

DHT11 or DHT22
        ↓
ESP32 on GPIO4
        ↓
Wi-Fi
        ↓
Blynk Cloud
        ↓
Blynk mobile or web dashboard

The DHT sensor measures temperature and relative humidity. The ESP32 reads those values, connects to your Wi-Fi network, and sends them to two Blynk virtual datastreams:

  • V5: temperature
  • V6: relative humidity

V5 and V6 are software channels. They are not physical ESP32 pins and do not mean GPIO5 and GPIO6. Blynk describes virtual pins as channels for exchanging values between hardware, dashboards, and apps; see its virtual-pin documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
DHT11 Temperature and Humidity Sensor Module 2-Pack, for Arduino, ESP32, ESP8266, Raspberry Pi, IoT DIY Projects, Built-in Resistor for Easy Integration
  • RELIABLE TEMPERATURE AND HUMIDITY SENSING – DHT11 module provides accurate and stable readings, ideal for monitoring environmental conditions in electronics and IoT projects.
  • 2-PACK VALUE FOR MULTIPLE PROJECTS – Includes two modules for use in redundant setups, multiple builds, or classroom and prototyping environments.
  • BUILT-IN RESISTOR FOR EASY CONNECTION – Simplifies wiring by allowing direct connection to Arduino, ESP32, ESP8266, or Raspberry Pi without a breadboard.
  • COMPATIBLE WITH POPULAR MICROCONTROLLERS – Fully supported by widely available libraries and sample code for Arduino IDE, MicroPython, and more.
  • ONLINE TUTORIALS AVAILABLE – Easy-to-follow tutorials for Arduino, Raspberry Pi, ESP32, and ESP8266 projects are available online by searching: DIYables DHT11 sensor.

Parts and software

  • ESP32 development board with USB programming
  • One DHT11 or DHT22/AM2302 sensor
  • Breadboard and jumper wires
  • USB cable and a USB power source
  • 4.7–10 kΩ pull-up resistor if using a bare sensor rather than a module with onboard support
  • Arduino IDE
  • Blynk account and mobile or web dashboard

Choose the sensor before wiring and coding:

Sensor Use case Qualification
DHT11 Lowest-cost demonstration More limited measurement capability and useful range
DHT22/AM2302 More useful hobbyist monitoring Still not a substitute for a calibrated instrument
SHT31, SHTC3, BME280-class sensor Better stability, accuracy, or additional measurements Requires different code and often I2C wiring

Important DHT11 versus DHT22 correction

The source project contains a material inconsistency: its component list and schematic refer to a DHT22, while its written instructions and sketch use DHT11. The physical wiring may be similar, but the firmware must match the sensor installed.

Use one of these definitions:

#define DHTTYPE DHT22

or:

#define DHTTYPE DHT11

Check the package, label, module markings, and product listing. Do not assume that a three-pin breakout has the same pin order as every other DHT module.

Wire the sensor to the ESP32

Sensor connection ESP32 connection
VCC 3.3 V, subject to the sensor or module specification
GND GND
DATA GPIO4

For a bare DHT sensor, connect a 4.7–10 kΩ resistor between DATA and VCC. Some breakout boards already include this resistor.

Be careful with board labels. A pin marked D4 is not universally equivalent to GPIO4, so check the pinout for your exact ESP32 board. Also avoid pins reserved by the board’s boot circuitry, flash interface, onboard LED, or provisioning hardware.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Place the sensor away from the ESP32 regulator, USB connector, direct sunlight, heaters, humidifiers, and enclosed heat sources. Leave it exposed to room air, but do not press it against a cold surface where condensation could form.

Rank #2
3pcs ESP32 DHT11 Temperature Humidity Sensor Module for Arduino, 3.3V-5V Digital Temperature Humidity Sensor with Wires, Humidity Measure 5%-95% Temperature Measure 0-50℃, DIY Electronic Practice
  • What It Is: DHT11 Temperature and humidity sensor is a sensor based on the digital temperature and humidity sensor DHT11, it is a combination of temperature and humidity sensor, it converts the physical temperature and humidity through the temperature, humidity sensor and the corresponding circuit into a digital quantity that is convenient for data acquisition equipment to read directly.
  • Reliable & Easy Integration: DHT11 is composed of resistive humidity sensing device and NTC coefficient temperature sensing device, and has the function of calibrating digital signal output. Using a single bus serial interface, the output data a total of 5 bytes, respectively: Humidity integer, humidity digit, temperature integer, temperature digit and checksum, where the checksum is the low 8-bit binary complement of the result of adding each byte of data.
  • Excellent Quality & Precision: This digital sensor module offers accurate environmental readings, measuring humidity from 5% to 95% RH with a precision of ±5% RH, and temperature from 0°C to 50°C with an accuracy of ±2°C. Operating on a DC voltage of 3.3V to 5V, this sensor provides digital output that easily connects to microcontrollers via its simple 3-wire interface (VCC, GND, Sign), simplifies integration into various applications, offering a hassle-free experience for your projects.
  • Wide Compatibility: Our temperature humidity monitor sensor module are made with top-of-the-line electronics components, ensuring reliable and long-lasting performance. This digital sensor module is equipped with a power indicator light for easy status monitoring. Easy installation makes it suitable for various settings such as education, IOT, weather station, temperature and humidity regulator, etc.
  • Compact & User-Friendly: Each module is thoroughly tested and carefully packaged, comes with necessary connection wires included for effortless setup. It has long-term stability, fast response, anti-interference ability, high cost and other advantages. And the simple communication protocol greatly reduces the programming effort required.

Set up the current Blynk project

Older tutorials often describe creating a “new project” and waiting for an emailed Auth Token. Current Blynk setup is template- and device-oriented. The labels can change slightly between interfaces, but the required objects are the same.

  1. Create or sign in to your Blynk account and open Blynk.Console.
  2. Open Developer Zone → Templates and create a template for an ESP32 Wi-Fi device.
  3. Create a numeric virtual datastream on V5 for temperature. Select °C or °F and use a sensible indoor range, such as 0–50 °C.
  4. Create a numeric virtual datastream on V6 for humidity. Use percent as the unit and a 0–100% range.
  5. Add dashboard display widgets and connect them to the V5 and V6 datastreams.
  6. Create a device from the template.
  7. Copy the generated BLYNK_TEMPLATE_ID, BLYNK_TEMPLATE_NAME, and BLYNK_AUTH_TOKEN.

Blynk’s current guidance covers template code preparation, manual device activation, and supported ESP32 variants, including ESP32, ESP32-S2, ESP32-S3, ESP32-C3, and ESP32-C6 families.

Install Arduino support and libraries

  1. Install the ESP32 board package through Arduino IDE’s Board Manager.
  2. Install the Blynk library through Library Manager.
  3. Install the DHT sensor library and its required support library if Arduino IDE requests one.
  4. Select the correct ESP32 board and serial port.

Use placeholders in published code. Never post your Wi-Fi password or Blynk token in a public repository.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Upload this corrected firmware

#define BLYNK_PRINT Serial

#define BLYNK_TEMPLATE_ID "YOUR_TEMPLATE_ID"
#define BLYNK_TEMPLATE_NAME "Temperature Humidity Monitor"
#define BLYNK_AUTH_TOKEN "YOUR_AUTH_TOKEN"

#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>

char ssid[] = "YOUR_WIFI_SSID";
char pass[] = "YOUR_WIFI_PASSWORD";

#define DHTPIN 4
#define DHTTYPE DHT22   // Change to DHT11 if that is the sensor installed

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

void sendSensorData() {
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();

  if (isnan(temperature) || isnan(humidity)) {
    Serial.println("Failed to read from DHT sensor");
    return;
  }

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.print(" °C, Humidity: ");
  Serial.print(humidity);
  Serial.println(" %");

  Blynk.virtualWrite(V5, temperature);
  Blynk.virtualWrite(V6, humidity);
}

void setup() {
  Serial.begin(115200);
  dht.begin();

  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

  timer.setInterval(5000L, sendSensorData);
}

void loop() {
  Blynk.run();
  timer.run();
}

Replace the five placeholders before uploading. Keep the DHTTYPE definition consistent with the installed sensor.

Why this code is safer

  • dht.readTemperature() and dht.readHumidity() obtain a fresh pair of readings.
  • isnan() prevents invalid sensor results from being sent to the dashboard.
  • BlynkTimer uploads every five seconds instead of flooding Blynk.
  • Blynk.run() maintains the Blynk connection.
  • timer.run() executes scheduled work without blocking the connection.

Five seconds is a practical starting interval, not a universal rule. DHT sensors should not be sampled excessively, and Blynk warns against calling virtualWrite() continuously inside loop(). See the virtual-pin firmware API.

Rank #3
Sale
TempPro TP50 Digital Hygrometer Indoor Thermometer Room Thermometer
  • Wellness Indicator: This humidity meter with humidity level icon indicates air conditions - DRY/COMFORT/WET, allowing this humidity sensor to ensure you’re always aware of changes to your home/household with just a quick glance
  • High Accuracy & Quick Refresh Rate: This inside thermometer features a high accuracy of +/-2 to 3%RH and +/-1°F, making it ideal for measuring fluctuating readings like those found in a greenhouse, data measurements are updated every 10 seconds to give you the latest updates on your environment
  • High & Low Records: This hygrometer digital thermometer displays high/low temperature and humidity levels to allow you to make proper comparisons using your home’s data
  • Healthier Home & Environment: This thermometer hygrometer with temperature and humidity monitor ensures proper indoor humidity that achieves important health benefits for skin and allergen, can also serve as a refrigerator thermometer, freezer thermometer, reptile thermometer, soil thermometer, humidor hygrometer, cigar hygrometer, and more
  • Practical Design: This indoor room thermometer features a tabletop stand and a magnetic back, place the temperature monitor on your counter or fridge; °F/°C selector; Includes 1 AAA battery

Test the sensor before testing Blynk

Open Arduino IDE’s Serial Monitor at 115200 baud. First confirm that the ESP32 produces valid local readings. A successful reading looks like:

Temperature: 21.8 °C, Humidity: 48.6 %

If you repeatedly see “Failed to read from DHT sensor,” stop and fix the sensor circuit before investigating the cloud dashboard. Blynk’s sensor-data guidance likewise recommends proving that the sensor works and printing valid values before sending them online.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

After local readings work, confirm that:

  • the ESP32 obtains a local IP address;
  • Blynk reports the device online;
  • temperature appears on V5;
  • humidity appears on V6;
  • values update at the configured interval.

Allow the sensor to stabilize after powering on. Compare it with a household thermometer/hygrometer, but do not treat one comparison as calibration. Gently moving it to a more humid or dry location should produce a gradual response.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

“Failed to read from DHT sensor”

  1. Verify that the physical sensor is really a DHT11 or DHT22 matching DHTTYPE.
  2. Check the module’s pin order; it is not universal.
  3. Confirm DATA is connected to the GPIO number used in code.
  4. Check VCC and GND.
  5. Add the pull-up resistor if the sensor is bare.
  6. Inspect loose breadboard connections.
  7. Increase the interval and test with a short standalone DHT sketch.
  8. Replace the sensor if readings remain invalid.

The ESP32 never connects to Blynk

Read the serial output first. Recopy the Template ID, Template Name, and Auth Token, and verify the Wi-Fi SSID and password. Check that the selected board matches the actual ESP32. Networks using captive portals or enterprise authentication can prevent simple device connections; test with a conventional home network. Also check whether your board and router setup support the available Wi-Fi band.

The dashboard is blank

Make sure the device is online, the firmware writes to V5 and V6, and each widget is attached to the matching numeric datastream. If Serial Monitor shows NaN or sensor failures, no valid value will be sent. Add one widget at a time and confirm the datastream settings were saved.

Rank #4
Teyleten Robot DHT11 Digital Temperature and Humidity Sensor Module for Arduino Raspberry 5pcs
  • Humidity measuring range: 20% -95% and humidity measurement error: + - 5%
  • Temperature measuring range: 0 degrees -50 degrees
  • Operating Voltage 3.3V-5V
  • Weighs about 8g each
  • temperature measurement error: + - 2 degrees

Readings look implausible

Move the sensor away from the ESP32, USB connector, sunlight, vents, windows, hands, heaters, and humidifiers. Improve airflow without exposing it to condensation. DHT sensors are convenient and inexpensive but vary in quality and are not intended to replace calibrated instruments.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Useful improvements

  • Alerts: Configure notifications for high humidity, low temperature, or other thresholds.
  • History: Add charts if your Blynk plan and selected data-storage behavior support the history you need. Do not assume unlimited storage on every plan.
  • Local display: Add an OLED for readings when the phone or cloud is unavailable.
  • Better sensor: Move to an SHT31, SHTC3, or BME280-class sensor when stability or additional measurements matter.
  • Multiple rooms: Use one device and sensor per location, or expand the firmware carefully with separate datastreams.
  • Automation: Add a fan or humidifier relay, but observe mains-voltage safety and use properly rated, enclosed hardware.
  • Battery operation: Deep sleep can reduce power use, but continuous Wi-Fi and cloud connectivity is poorly suited to long battery life.

Blynk, MQTT, or a finished product?

Option Best for Main trade-off
Blynk Fast mobile/web dashboards, alerts, and beginner-friendly cloud access Internet, account, platform, and plan dependence
MQTT + Home Assistant Local-first automation, history, and broad smart-home integration Requires a broker, credentials, configuration, and usually a server such as a Raspberry Pi
Adafruit IO Educational cloud feeds and browser dashboards Separate account, libraries, and dashboard workflow
Commercial monitor Fast installation, enclosure, display, and battery operation Less control and dependence on the manufacturer’s ecosystem

Blynk is the simplest choice if you want to learn ESP32 wiring and see readings on a phone quickly. MQTT with Home Assistant is more appropriate when the monitor must remain useful during an internet outage or participate in a local automation system. Public MQTT brokers are not suitable for private household telemetry unless properly secured.

A finished alternative is the TP-Link Tapo T315. TP-Link lists a 2.7-inch E-ink display, app alerts, graphs, export, ±0.3 °C temperature accuracy, ±3% RH humidity accuracy, and a two-second refresh speed. Its smart features, including remote monitoring and automation, require a Tapo Hub. A U.S. listing observed on August 18, 2026 showed $17.99 sale pricing and a $19.99 list price; prices and availability can change.

The Tapo is a convenience product, not an equivalent replacement for a programmable ESP32. Choose it when installation and a finished display matter more than open firmware, custom sensors, local MQTT, or control over the data path.

What this project can—and cannot—promise

The corrected build can provide near-real-time indoor temperature and humidity readings remotely, subject to the sensor, wiring, Wi-Fi, Blynk availability, and upload interval. It should be described as a hobbyist monitor rather than an accurate or calibrated environmental instrument. Sensor placement, condensation, airflow, pull-up resistors, sensor quality, and cloud-plan behavior all affect the result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The most dependable version is therefore not the original sketch copied unchanged: use a verified sensor type, GPIO4 wiring, current Blynk template/device configuration, a timer-controlled upload interval, invalid-reading checks, and a local serial test before relying on the dashboard.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Site Office

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.