dht-11 sensor

DHT11 SENSOR

SOIL MOISTURE SENSOR

SOIL MOISTURE SENSOR

BUZZER

BUZZER

DHT11 SENSOR

The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed).
₹118.00
SKU
IWP-00036

The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed). Its fairly simple to use, but requires careful timing to grab data. The only real downside of this sensor is you can only get new data from it once every 2 seconds, so when using our library, sensor readings can be up to 2 seconds old.

// sketch for various DHT humidity/temperature sensors
// orginally Written by ladyada, public domain

//code updated by
//https://github.com/iotwebplanet
//for node mcu

//download following 2 library to use DHT11/DHT22 sensor

//https://github.com/adafruit/Adafruit_Sensor.git
//https://github.com/adafruit/DHT-sensor-library.git

#include "DHT.h"

//define pin for Uno or Node MCU we have used D6 on node mcu
#define DHTPIN 12 // what digital pin we're connected to arduino or mcu

// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V/+3V in Controller
// Connect pin 2 of the sensor to whatever your DHTPIN is
// ignore pin 3
// Connect pin 4 (on the right) of the sensor to GROUND

//optional
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor for better response

// Initialize DHT sensor.

DHT dht(DHTPIN, DHTTYPE);

void setup() {
//setup of serial monitor
Serial.begin(9600);
Serial.println("DHTxx test!");

dht.begin();
}

void loop() {
// Wait a few seconds between measurements. dont reduce this time
delay(2000);

// Sensor readings may also be up to 2 seconds
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}

// Compute heat index in Fahrenheit (the default)
float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);

Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" *C ");
Serial.print(f);
Serial.print(" *F\t");
Serial.print("Heat index: ");
Serial.print(hic);
Serial.print(" *C ");
Serial.print(hif);
Serial.println(" *F");
}

More Information
HSN: 85423100
Compatible with Arduino, Raspberry Pi, Node MCU
Write Your Own Review
Only registered users can write reviews. Please Sign in or create an account
We found other products you might like!