← Back to blog
BLOG

DHT11 Sensor Module with Arduino Guide & Price in Pakistan | CircuitHub

Areesha Rubab·Sep 24, 2026
DHT11 Sensor Module with Arduino Guide & Price in Pakistan | CircuitHub

The DHT11 temperature and humidity sensor is the first real-world sensor most people connect to an Arduino, and the module version is the cheapest way to start. This guide covers the Arduino DHT11 sensor from purchase to working readings: price in Pakistan, DHT11 vs DHT22, wiring for the module and the bare sensor, the sketch that reads it, and the fixes for “NaN” readings.

DHT11 Sensor Module vs DHT22: Which to buy?

Specification

DHT11

DHT22 (AM2302)

Temperature range

0 to 50 °C

-40 to 80 °C

Temperature accuracy

±2 °C

±0.5 °C

Humidity range

20–80% RH

0–100% RH

Humidity accuracy

±5% RH

±2–5% RH

Fastest reading

Once per second

Once per 2 seconds

Price in Pakistan (module)

About Rs 250–400

About Rs 700–1,200

Buy the DHT11 for learning, indoor room monitors and school projects where a couple of degrees does not matter. Buy the DHT22 for egg incubators, greenhouses, weather stations, server rooms and anything you will log or control from – its resolution is 0.1 °C, while the DHT11 only reports whole degrees.

Wiring the DHT11 Sensor Module to an Arduino

Both sensors run on 3.3V or 5V and use a single digital data pin, so the wiring to an Arduino Uno is identical whether you have the DHT11 temperature humidity sensor module or the bare sensor:

  • DHT11 sensor module (3 pins on a small blue PCB): + to 5V, − to GND, OUT or S to pin 2. The pull-up resistor is already on the board.

  • 4-pin bare sensor (grille facing you, pins left to right: VCC, DATA, NC, GND): VCC to 5V, DATA to pin 2, GND to GND, and a 10k resistor between DATA and VCC. The third pin is unused.

With the pull-up in place the data wire can run up to about 20 metres, which is enough to put the sensor inside an incubator or greenhouse while the Arduino stays outside.

Arduino DHT11 Sensor Code

Open the Library Manager, search “DHT sensor library”, and install the one by Adafruit; accept the prompt to install Adafruit Unified Sensor with it. Then upload this sketch and open the Serial Monitor at 9600 baud:

#include "DHT.h"

 

#define DHTPIN 2

#define DHTTYPE DHT11        // change to DHT22 for that sensor

DHT dht(DHTPIN, DHTTYPE);

 

void setup() {

  Serial.begin(9600);

  dht.begin();

}

 

void loop() {

  delay(2000);                              // both sensors need a pause between reads

  float h = dht.readHumidity();

  float t = dht.readTemperature();

  if (isnan(h) || isnan(t)) {

    Serial.println("Read failed - check wiring and DHTTYPE");

    return;

  }

  Serial.print("Temp: "); Serial.print(t); Serial.print(" C   Humidity: ");

  Serial.print(h); Serial.println(" %");

}

Why you get NaN or wrong readings?

  • Reading too fast. Anything under two seconds between reads returns NaN, especially on the DHT22.

  • No pull-up on the bare sensor. Without the 10k resistor the data line floats and reads fail.

  • Wrong DHTTYPE. A DHT22 read as a DHT11 (or the reverse) gives NaN or nonsense values like 255.

  • Heat from the board. A sensor sitting on top of the Arduino's regulator reads 3–4 °C high. Mount it on wires, away from the board.

  • The first reading after power-on often fails. Ignore it and read again.

Projects to build with DHT11

Start with a room monitor on a 16x2 LCD. Add a relay to switch a heater or fan and you have the core of an egg incubator or greenhouse controller – two of the most common DHT projects in Pakistan. Add an SD card module for a week-long log, or a buzzer for a server room that passes 30 °C.

DHT11 Sensor Module Price in Pakistan

The DHT11 sensor module sells for roughly Rs 250–400 in Pakistan; the bare 4-pin sensor for Rs 150–300. The extra buys the pull-up resistor, a power LED and usually three jumper wires, so for a first project the module is worth it. The DHT22 costs two to three times as much – pay it only when accuracy matters. Prices move with the dollar rate, so check the product page for today's price.

Where to buy DHT Sensors in Pakistan?

CircuitHub Pakistan stocks the DHT11 sensor module, the bare DHT11 sensor and the DHT22 alongside the Arduino Uno, 16x2 I2C LCDs, relay modules and SD card modules used in these projects, with fast delivery in Rawalpindi and Islamabad.

Shop DHT11 sensor modules at CircuitHub Pakistan.

Frequently Asked Questions

  1. Which is more accurate, DHT11 or DHT22?

The DHT22, by a wide margin: ±0.5 °C against ±2 °C, and it reads below 0 °C. Buy the DHT22 for anything you will log or control from.

  1. Can I connect two DHT sensors to one Arduino?

Yes. Give each its own data pin and its own DHT object in the sketch, and read them at least two seconds apart.

  1. Why does my DHT11 read 2 °C different from my thermometer?

That is within its ±2 °C rating. Either move to a DHT22 or measure the offset against a trusted thermometer once and subtract it in code.