“温湿度”的版本间的差异

来自Labplus盛思维基百科
跳转至: 导航搜索
图形化示例
第26行: 第26行:
 
== 使用教程 ==
 
== 使用教程 ==
  
=== Arduino示例 ===
+
=== <font size="3">Arduino示例</font> ===
 
[http://wiki.labplus.cn/index.php?title=文件:SHT20_test.rar 温湿度库下载]
 
[http://wiki.labplus.cn/index.php?title=文件:SHT20_test.rar 温湿度库下载]
 
<pre style="color:blue">
 
<pre style="color:blue">
第56行: 第56行:
 
     delay(1000);
 
     delay(1000);
 
}
 
}
</pre>
 
=== MicroPython示例 ===
 
<pre style="color:blue">
 
//程序功能:利用数码管分别显示温度和湿度的值//
 
from microbit import *
 
 
#@import bluebitDigitCube
 
 
tm1650Init()
 
 
def getTemp():
 
  i2c.write(0x40,bytearray([0xE3]))
 
  sleep(85)
 
  t=i2c.read(0x40,2)
 
  return -46.86+175.72*(t[0]*256+t[1])/65535
 
 
def getHumi():
 
  i2c.write(0x40,bytearray([0xE5]))
 
  sleep(40)
 
  t=i2c.read(0x40,2)
 
  return -6+125*(t[0]*256+t[1])/65536
 
 
 
while True:
 
  tm1650DisplayInt(getTemp())
 
  sleep(3000)
 
  tm1650DisplayInt(getHumi())
 
  sleep(3000)
 
 
</pre>
 
</pre>
  
=== 图形化示例 ===
+
===<font size="3"> 图形化示例</font> ===
 
{|
 
{|
 
|-
 
|-
 
|实物连接如下图:
 
|实物连接如下图:
 
|-
 
|-
|[[文件:温湿度实物连接.png|900px|无框|左]]
+
|[[文件:温湿度实物连接.png|700px|无框|左]]
 
|-
 
|-
 
|程序功能:利用数码管分别显示温度和湿度的值
 
|程序功能:利用数码管分别显示温度和湿度的值

2018年4月26日 (四) 11:40的版本

黑色传感器最终版12.20-28.png

概述

基于SHT20数字温湿度传感器集成IC。用于检测环境温湿度,具有极高的可靠性和长期稳定性。采用I2C通讯方式,操作简便。

技术参数

  • 工作电压:VCC 3.3-5V
  • I2C数字信号输出
  • 温度测量范围:-40~125℃
  • 温度测量精度:±0.3℃
  • 湿度测量范围:0~100%RH
  • 湿度测量精度:±3%RH
  • 模块尺寸:24x46x7.5mm

引脚定义

VCC 电源
SDA I2C数据
SCL I2C时钟
GND

使用教程

Arduino示例

温湿度库下载

//程序功能:读取当前的温湿度值//
#include <Wire.h>
#include "SHT20.h"
SHT20    sht20;
void setup()
{
    Serial.begin(9600);
    Serial.println("SHT20 Example!");
    sht20.initSHT20();                                  // Init SHT20 Sensor
    delay(100);
    sht20.checkSHT20();                                 // Check SHT20 Sensor
}
void loop()
{
    float humd = sht20.readHumidity();                  // Read Humidity
    float temp = sht20.readTemperature();               // Read Temperature
//    Serial.print("Time:");
//    Serial.print(millis());
    Serial.print(" Temperature:");
    Serial.print(temp, 1);
    Serial.print("C");
    Serial.print(" Humidity:");
    Serial.print(humd, 1);
    Serial.print("%");
    Serial.println();
    delay(1000);
}

图形化示例

实物连接如下图:
温湿度实物连接.png
程序功能:利用数码管分别显示温度和湿度的值
温湿度1.png

版本历史记录

Version Date Note [+]新增[-]删除[^]修复
V2.0