DHT12 digital temperature and humidity sensor is a calibration with the digital signal output temperature and humidity sensor, DHT11 upgrade products. It uses a dedicated digital module acquisition technology and semiconductor temperature and humidity sensors to ensure that the product has a high reliability and excellent long-term stability. DHT12 has a single bus and standard I2C two kinds of communication, and single bus communication is fully compatible with DHT11.
Standard single bus interface, the system integration has become simple and quick. With ultra-small size, low power consumption, suitable for a variety of applications. I2C communication using standard communication timing, the user can be directly linked to the I2C communication bus, no additional wiring, easy to use.
Two kinds of communication methods are free to switch, the user is free to choose, easy to use, should be a wide range of areas. Products for the 4-lead, easy to connect, special package can be provided in accordance with user needs.
the application of HVAC, dehumidifiers, testing and testing equipment, consumer goods, automatic control, data loggers, weather stations, home appliances, humidity control, medical and other related humidity detection control.
the product highlights completely interchangeable, low cost, long-term stability, relative humidity and temperature measurement, long signal transmission distance, digital signal output, accurate calibration, low power consumption, standard single bus digital interface, standard I2C bus digital interface , The communication method is free to choose.
In this example we use the https://wiki.wemos.cc/products:d1_mini_shields:dht_shield
Code
https://github.com/wemos/WEMOS_DHT12_Arduino_Library
[codesyntax lang=”cpp”]
#include <WEMOS_DHT12.h> DHT12 dht12; void setup() { Serial.begin(115200); } void loop() { if(dht12.get()==0){ Serial.print("Temperature in Celsius : "); Serial.println(dht12.cTemp); Serial.print("Temperature in Fahrenheit : "); Serial.println(dht12.fTemp); Serial.print("Relative Humidity : "); Serial.println(dht12.humidity); Serial.println(); } delay(1000); }
[/codesyntax]
Output
Open the serial monitor
Temperature in Celsius : 23.60
Temperature in Fahrenheit : 74.48
Relative Humidity : 38.10
Temperature in Celsius : 23.70
Temperature in Fahrenheit : 74.66
Relative Humidity : 38.30
Temperature in Celsius : 24.00
Temperature in Fahrenheit : 75.20
Relative Humidity : 41.80
Temperature in Celsius : 24.20
Temperature in Fahrenheit : 75.56
Relative Humidity : 42.00
Temperature in Celsius : 24.50
Temperature in Fahrenheit : 76.10
Relative Humidity : 43.20