SHT20 I2C 防水型温湿传感器

概述

SHT20 I2C防水型温湿传感器,采用新一代Sensirion湿度和温度传感器,配有4代CMOSens®芯片。除了配有电容式相对湿度传感器和能隙温度传感器外,该芯片还包含一个放大器、A/D转换器、OTP内存和数字处理单元,可精确测量周边环境温度和空气相对湿度。相对于上一代SHT1x和SHT7x系列,SHT20具有更好的可靠性和更出色的长期稳定性。 传感器采用双防水技术,内部对电路板进行灌封处理,并且采用特殊灌封材料,对测量值无任何干扰;外壳使用PE防水透气材料,允许水分子进入,阻隔水滴渗入,即使带着电长期浸泡在水中也不会损坏传感器,捞出晾干后,即可正常采集数据。 传感器内部带有10k上拉电阻和0.1uf滤波电容,可直接配合Arduino等微控制器使用。推荐配合Gravity: 4Pin传感器转接板一起使用,免去接线烦恼,使用将会变得非常方便。

技术规格

引脚说明

SEN0227TH.jpg

标号 颜色 名称 功能描述
1 红色 电源正 电源正
2 绿色 电源负 电源负
3 黑色(蓝色) SDA 数据
4 白色(黄色) SCL 时钟

连接示意图

使用教程

点击下载库文件SHT20 库文件如何安装库?

/*!
 * @file  getHumidityAndTemperature.ino
 * @brief  DFRobot's SHT20 Humidity And Temperature Sensor Module
 * @details  This example demonstrates how to read the user registers to display resolution and other settings.
 * @n  Uses the SHT20 library to display the current humidity and temperature.
 * @n  Open serial monitor at 9600 baud to see readings.
 * @n  Errors 998 if not sensor is detected. Error 999 if CRC is bad.
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @license  The MIT License (MIT)
 * @author  [Zhangjiawei](jiawei.zhang@dfrobot.com)
 * @maintainer  [qsjhyy](yihuan.huang@dfrobot.com)
 * @version  V1.0
 * @date  2021-12-03
 * @url  https://github.com/DFRobot/DFRobot_SHT20
 */
#include "DFRobot_SHT20.h"

/**
 * Hardware Connections:
 * -VCC = 3.3V
 * -GND = GND
 * -SDA = A4 (use inline 330 ohm resistor if your board is 5V)
 * -SCL = A5 (use inline 330 ohm resistor if your board is 5V)
 */
DFRobot_SHT20 sht20(&Wire, SHT20_I2C_ADDR);

void setup()
{
  Serial.begin(115200);

  // Init SHT20 Sensor
  sht20.initSHT20();
  delay(100);
  Serial.println("Sensor init finish!");

  /**
   * Check the current status information of SHT20
   * Status information: End of battery, Heater enabled, Disable OTP reload
   * Check result: yes, no
   */
  sht20.checkSHT20();
}

void loop()
{
  /**
   * Read the measured data of air humidity
   * Return the measured air humidity data of float type, unit: %
   */
  float humd = sht20.readHumidity();

  /**
   * Read the measured temp data
   * Return the measured temp data of float type, unit: C
   */
  float temp = sht20.readTemperature();

  Serial.print("Time:");
  Serial.print(millis());   // Get the system time from Arduino
  Serial.print(" Temperature:");
  Serial.print(temp, 1);   // Only print one decimal place
  Serial.print("C");
  Serial.print(" Humidity:");
  Serial.print(humd, 1);   // Only print one decimal place
  Serial.print("%");
  Serial.println();

  delay(1000);
}

程序结果
Fig2:演示结果.png

常见问题

问: 这个传感器可以测量土壤湿度吗?
答: 土壤湿度的定义是取1公斤土样,彻底烘干,减少的重量(水的重量)与1公斤的比值成为土壤湿度。空气相对湿度的定义是当前温度下的绝对湿度与当前温度下的饱和湿度的百分比。综上土壤湿度跟空气湿度不是一个概念,也不是一个数量级,土壤湿度10%时土壤中空气的湿度已经100%了。注意:长期埋在土壤里是不会损坏的,即使带电再水里煮也不会损坏,当面对湿度稍大的土壤,土壤中空气湿度会长期是100%,测量就失去了意义。

更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖。

更多

DFshopping_car1.png DFRobot商城购买链接