Home » MH ET LIVE ESP32 MINI KIT and DHT Pro shield example

MH ET LIVE ESP32 MINI KIT and DHT Pro shield example

by shedboy71

In this example we connect the DHT22 Single Bus Digital Temperature Humidity Sensor (DHT Pro shield) to our Wemos Mini , you can see this in the picture below which shows the shield

AM2302 output calibrated digital signal. It applys exclusive digital-signal-collecting-technique and humidity sensing technology, assuring its reliability and stability. Its sensing elements is connected with 8-bit single-chip computer. Every sensor of this model is temperature compensated and calibrated in accurate calibration chamber and the calibration-coefficient is saved in type of programme in OTP memory, when the sensor is detecting, it will cite
coefficient from memory.

Small size & low consumption & long transmission distance(100m) enable AM2302 to be suited in all kinds of harsh application occasions. Single-row packaged with four pins, making the connection very convenient

Power's voltage should be 3.3-5.5V DC. When power is supplied to sensor, don't send any instruction to the sensor within one second to pass unstable status. One capacitor valued 100nF can be added between VDD and GND for wave filtering.

Code

There are basic examples , the code below is based on the example from https://github.com/wemos/D1_mini_Examples.git

[cpp]
#include “DHT.h”
#define DHTPIN 16 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)

DHT dht(DHTPIN, DHTTYPE);

void setup()
{
Serial.begin(9600);
Serial.println(“DHTxx test!”);
dht.begin();
}

void loop()
{
// Wait a few seconds between measurements.
delay(5000);

float h = dht.readHumidity();
float t = dht.readTemperature();
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;
}

Serial.print(“Humidity: “);
Serial.print(h);
Serial.print(” %\t”);
Serial.print(“Temperature: “);
Serial.print(t);
Serial.print(” *C “);
Serial.print(f);
Serial.println(” *F”);

}
[/cpp]

 

Output
Open the serial monitor with Ctrl+Shift M or Tools->Serial Monitor, and you should see the values for the humidity in percent as well as the temperature & heat index in Celcius and Fahrenheit.

Humidity: 78.80 % Temperature: 22.10 *C 71.78 *F
Humidity: 82.10 % Temperature: 22.40 *C 72.32 *F
Humidity: 84.10 % Temperature: 22.60 *C 72.68 *F
Humidity: 85.60 % Temperature: 22.80 *C 73.04 *F
Humidity: 87.20 % Temperature: 23.10 *C 73.58 *F
Humidity: 88.90 % Temperature: 23.30 *C 73.94 *F

 

Links

DHT Pro Shield for WeMos D1 mini DHT22 Single-bus digital temperature and humidity sensor module sensor

You may also like

Leave a Comment

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.