Based on arduino dht11 temperature and humidity sensor

Introduction to DHT11 Temperature and Humidity Sensor

The DHT11 is a temperature and humidity sensor with a calibrated digital signal output. Its precision humidity +-5%RH, temperature +-2 °C, range humidity 20-90% RH, temperature 0~50 °C.

The DHT11 digital temperature and humidity sensor is a temperature and humidity composite sensor with a calibrated digital signal output. It uses dedicated digital module acquisition technology and temperature and humidity sensing technology to ensure high reliability and excellent long-term stability. The sensor consists of a resistive wet sensor and an NTC temperature sensor connected to a high performance 8-bit microcontroller. Therefore, the product has the advantages of excellent quality, ultra-fast response, strong anti-interference ability and high cost performance. Each DHT11 sensor is calibrated in an extremely accurate humidity calibration chamber. The calibration coefficients are stored in the OTP memory as a program, and these calibration coefficients are called internally during the processing of the detection signal. The single-wire serial interface makes system integration easy and fast. Its ultra-small size and low power consumption make it the best choice for demanding applications in this type of application. The product is a 4-pin single-row pin package for easy connection.

DHT11 temperature and humidity sensor electrical characteristics
Based on arduino dht11 temperature and humidity sensor
Temperature and humidity sensor DHT11 package form and interface description

It is recommended to use 5K pull-up resistor when the length of the cable is shorter than 20 meters. Use a suitable pull-up resistor according to the actual situation when it is more than 20 meters (if the integrated module is purchased, the pull resistor is added to the module, please ignore the following) Of course, if you want to streamline the circuit, the STC enhanced MCU's built-in push-pull output function is an option, which is equivalent to an external 2k pull-up resistor, but you need to pay attention to the current of the microcontroller when designing the circuit. It is recommended not to exceed 55mA, that is, the current flowing from the MCU-VCC does not exceed 55mA, the current flowing from the MCU-GND does not exceed 55mA, and the overall inflow and outflow currents do not exceed 55mA. The package size and typical application circuit diagram are as shown below.

Based on arduino dht11 temperature and humidity sensor

Typical application circuit of DHT11 temperature and humidity sensor
Based on arduino dht11 temperature and humidity sensor
DHT11 temperature and humidity sensor timing chart
Based on arduino dht11 temperature and humidity sensor
DHT11 temperature and humidity sensor connection diagram
Based on arduino dht11 temperature and humidity sensor

As shown in the figure, connect the positive terminal of DHT11 to the 5V power supply interface, the negative terminal to GND, and the middle data interface to pin 2.

Code

#include 《dht11.h》

Dht11 DHT11;

#define DHT11PIN 2

Void setup(){

Serial.begin(9600);

}

Void loop(){

Serial.println("/n");

Int chk = DHT11.read(DHT11PIN);

Serial.print("Read sensor: ”);

Switch (chk)

{

Case DHTLIB_OK:

Serial.println("OK");

Break;

Case DHTLIB_ERROR_CHECKSUM:

Serial.println("Checksum error");

Break;

Case DHTLIB_ERROR_TIMEOUT:

Serial.println("TIme out error");

Break;

Default:

Serial.println("Unknown error");

Break;

}

Serial.print("Humidity (%): ”);

Serial.println((float)DHT11.humidity, 2);

Serial.print("Temperature (oC): ");

Serial.println((float)DHT11.temperature, 2);

Delay(2000);

Precautions

1, the code quoted #include "dht11.h", this is the library file to operate DHT11, with it, you can easily operate our temperature and humidity sensor. But the steps to reference this library file are:

(1) Find and download the library file on the Internet, including a header file and a .cpp file.

(2) Click on the menu in the Arduino IDE: Programs - Import Library - add library, then select the folder where you want to store the library files.

(3) Quote #include "dht11.h" in the code so that it can be used.

2, #define DHT11PIN 2, indicating that the name of the defined pin 2 is DHT11PIN, note that there is no semicolon after this definition statement.

Principle analysis

In the hardware programming process, when you get a device, you must first understand his pin definition. This will tell you how to connect this thing. In one is to look at his timing diagram. After reading the timing diagram, you will know the master. How to write code from the data acquisition process between devices, such as how to start, how to shake hands, how to collect real data and so on.

In our experiment, the timing diagram for DHT11 looks like this:

Based on arduino dht11 temperature and humidity sensor

The technology zone low-cost development system is now in the peak of the IoT expectation expansion. Intel Cyclone 10 LP FPGA evaluation board circuit diagram and PCB assembly drawing using 32-bit MCU series to design an embedded or X86 industrial control board for the new non-magnetic water meter On, the CAN port is indispensable! Software and hardware integration solution with MSP432 host microcontroller

Privacy Screen Protector

The ultra-thin precision cutting of the Anti-Peep Screen Protector means that you can enjoy a perfect touch screen experience without allowing anything on the screen to be peeped. Whether you place your phone horizontally or vertically, Privacy Screen Protector can protect your personal Information and sensitive information are protected from harm by strangers. People around you cannot see the contents of your phone, so your details are safe.

The use of soft TPU material can really cover the entire screen.

With self-healing function, it can automatically repair bubbles and scratches within 24 hours.

The 0.14mm Ultra-Thin Protective Film can maintain the sensitivity of the touch screen to accurately respond to your touch.

The oleophobic and waterproof coating prevents fingerprints, oil stains and other substances from adhering to it and keeps the screen clean.

If you want to know more about Privacy Screen Protector products, please click Product Details to view the parameters, models, pictures, prices and other information about Privacy Screen Protector products.

Whether you are a group or an individual, we will try our best to provide you with accurate and comprehensive information about Privacy Screen Protector!

Anti-Spy Hydrogel Screen Protector, Privacy Protection Film, Protection Film, Privacy Film, Privacy Screen Protective Film, Soft Film

Shenzhen Jianjiantong Technology Co., Ltd. , https://www.hydrogelprotectivefilm.com