Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

DHT11 with Wemos D1 mini — temperature, humidity, feels-like

Wire a DHT11 to a Wemos D1 mini on D5 at 3.3 V, keep D1/D2 free for an I2C shield, and print temperature, humidity and the heat index in Arduino C++.

Arduino C++Verified — core esp8266 3.1.2, DHT sensor library 1.4.7, 3 Nov 2026Compile-only

Community draft — report a mistake

The DHT11 is the cheapest temperature and humidity sensor in any Indian kit, and it pairs naturally with a D1 mini for a room monitor. Its DATA goes to D5, power comes from 3V3.

D5 is a deliberate choice on a board with only 11 GPIOs: it leaves D1/D2 free for an OLED or other I2C shield stacked on top. The sketch also prints a “feels like” temperature, which says more about a humid 33 °C afternoon than the thermometer alone.

Wiring

Wemos D1 miniOnly the pins used are shown · 3.3 V logicDHT11D53V3GNDVCCDATAGND
Every connection
Wemos D1 miniDHT11WireNotes
3V3VCCredPower from 3V3 so DATA stays at 3.3 V.
D5DATAyellowD5 = GPIO14. The blue 3-pin module already has the pull-up.
GNDGNDblack

3.3–5.5 V part, 3.3 V board. Power it from your board's logic voltage so the data line matches the GPIO: 3.3 V on ESP32 and Pico, 5 V on Uno.

Board quirks

  • D5 is used so the I2C pins D1/D2 stay free for an OLED or sensor shield. Any of D1, D2, D5, D6 and D7 works; avoid D3, D4 and D8, which set the boot mode, and D0, which the DHT library’s timing doesn’t like.
  • The DHT11 reports whole degrees and whole percent, with ±2 °C and ±5 %RH accuracy. That’s fine for “is the room hot?” — for a logger, the DHT22 or a BME280 is worth the extra rupees.
  • The heat index uses the US NWS formula and is meant for warm, humid air — exactly an Indian summer. Below about 27 °C it simply tracks the air temperature.
  • The DHT library briefly disables interrupts while reading. On the ESP8266 this is short (about 5 ms) and doesn’t upset Wi-Fi at one reading every 2 s.

Code

dht11-d1mini.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// DHT11 on a Wemos D1 mini (ESP8266) with a heat-index ("feels like") reading.
// VCC → 3V3, DATA → D5 (GPIO14), GND → GND. 3-pin modules already carry the pull-up.
// D5 leaves D1/D2 free for an OLED or other I2C shield.
#include <DHT.h>

const uint8_t DHT_PIN = D5;  // GPIO14
DHT dht(DHT_PIN, DHT11);

void setup() {
  Serial.begin(115200);
  Serial.println();
  dht.begin();
  Serial.println("DHT11 on D5 (GPIO14) - one reading every 2 s");
}

void loop() {
  delay(2000);  // the DHT11 can't be read faster than about once a second
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor - check wiring and the sensor type");
    return;
  }
  float feels = dht.computeHeatIndex(t, h, false);  // false = Celsius
  Serial.printf("Temp %.0f C  Humidity %.0f %%  Feels like %.1f C\n", t, h, feels);
}

Library: DHT sensor library (Adafruit (also install Adafruit Unified Sensor)) — compiled with DHT sensor library 1.4.7.

Expected serial output

Serial Monitor · 115200Output
DHT11 on D5 (GPIO14) - one reading every 2 s
Temp 33 C  Humidity 64 %  Feels like 42.6 C
Temp 33 C  Humidity 63 %  Feels like 42.0 C

Common errors

“Failed to read from DHT sensor”

DATA isn’t on D5, the sensor type in the code is DHT22 instead of DHT11, or a bare sensor is missing its 10 kΩ pull-up. Full fix.

Humidity stuck at the same value

Normal for a DHT11 in a steady room — it only reports whole percent. Breathe on it to see it change.

↑↓ to move · Enter to open