lisu60 / DFRobot_DHT20

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DFRobot_DHT20

The DHT20 temperature & humidity sensor is the newly upgraded version of the DHT11. The DHT20 features a brand-new ASIC dedicated chip, an improved MEMS semiconductor capacitive humidity sensor element and a standard on-chip temperature element. All sensors are factory calibrated and characterized by low power, high precision & stability, fast response, and strong anti-interference. Moreover, the DHT20 performance parameters of accuracy, power supply voltage, measurement range and response time have been enhanced greatly over the previous generation,making it more cost-effective. Besides that, the DHT20 temperature & humidity sensor employs I2C digital output protocol, which is very suitable for HVAC,automobiles, data loggers, weather stations, home appliances, and other related temperature and humidity detection and controlled areas.

Product Link(链接到英文商城)

SKU:产品名称

Table of Contents

Summary

Provide an Arduino library to get Humidity and Temperature by reading data from dht20.

Installation

To use this library, first download the library file, paste it into the \Arduino\libraries directory, then open the examples folder and run the demo in the folder.

Methods

  /*!
   * @brief Construct the function
   * @param pWire IC bus pointer object and construction device, can both pass or not pass parameters, Wire in default.
   * @param address Chip IIC address, 0x38 in default.
   */
  DFRobot_DHT20(TwoWire *pWire = &Wire, uint8_t address = 0x38);

  /**
   * @brief init function
   * @return Return 0 if initialization succeeds, otherwise return non-zero and error code.
   */
  int begin(void);
    
  /**
   * @brief Get ambient temperature, unit: °C
   * @return ambient temperature, the measurement range is (-40°C ~ 80°C)
   */
  float getTemperature();
    
  /**
   * @brief Get relative humidity, unit: %RH. 
   * @return Relative humidity, the measurement range is (1-100%)
   */
  float getHumidity();

Compatibility

MCU Work Well Work Wrong Untested Remarks
Arduino Uno
Mega2560
Leonardo
ESP32
ESP8266
M0
Micro:bit

History

  • Date 2021-6-25
  • Version V0.1

Credits

Written by fengli(li.feng@dfrobot.com), 2021.7.31 (Welcome to our website)

About

License:MIT License


Languages

Language:C++ 62.8%Language:Python 37.2%