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

来自Labplus盛思维基百科
跳转至: 导航搜索
技术参数
使用教程
 
(未显示3个用户的21个中间版本)
第1行: 第1行:
 +
[[文件:黑色传感器最终版12.20-28.png|350px|thumb|右]]
 
== 概述 ==
 
== 概述 ==
 
基于SHT20数字温湿度传感器集成IC。用于检测环境温湿度,具有极高的可靠性和长期稳定性。采用I2C通讯方式,操作简便。
 
基于SHT20数字温湿度传感器集成IC。用于检测环境温湿度,具有极高的可靠性和长期稳定性。采用I2C通讯方式,操作简便。
  
 
== 技术参数 ==
 
== 技术参数 ==
* 工作电压:3.3V~5V
+
* 工作电压:VCC 3.3-5V
 
* I2C数字信号输出
 
* I2C数字信号输出
 
* 温度测量范围:-40~125℃
 
* 温度测量范围:-40~125℃
第24行: 第25行:
  
 
== 使用教程 ==
 
== 使用教程 ==
=== 连接示意图 ===
+
=== <font size="3">掌控板及mPython编程</font> ===
=== Arduino示例 ===
+
 
=== MicroPython示例 ===
 
 
<pre style="color:blue">
 
<pre style="color:blue">
from microbit import *
+
#程序功能:用掌控板OLED显示屏显示温湿度传感器测量的温度和湿度值。
 +
</pre>
 +
{|
 +
|-
 +
| [[文件:温湿度接线图.png |800px|居中|无框]]
 +
|-
 +
|style="text-align:center"|连接示意图
 +
|}
 +
<br/>
  
def Distance():
+
{|
     i2c.write(0x0b, bytearray([1]))
+
|-
     sleep(2)
+
| [[文件:温湿度mPython编程.png |900px|居中|无框]]
     temp=i2c.read(0x0b,2)
+
|-
     distanceCM=(temp[0]+temp[1]*256)/10
+
|style="text-align:center"|图形化及mPython代码
     return distanceCM
+
|}
 +
<br/>
 +
<br/>
 +
=== <font size="3">Arduino示例</font> ===
 +
[http://wiki.labplus.cn/index.php?title=文件:SHT20_test.rar 温湿度库下载]
 +
<pre style="color:blue">
 +
//程序功能:读取当前的温湿度值//
 +
#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);
 +
}
 +
</pre>
  
# test code
+
===<font size="3"> Bluebit主控</font> ===
while True:
+
{|
    print(Distance())
+
|-
    sleep(100)
+
|实物连接如下图:
 +
|-
 +
|[[文件:温湿度实物连接.png|700px|无框|左]]
 +
|-
 +
|程序功能:利用数码管分别显示温度和湿度的值
 +
|-
 +
|[[文件:温湿度1.png|900px|无框|左]]
 +
|}
  
</pre>
+
== 版本历史记录 ==
  
=== 图形化示例 ===
+
{|  border="1" cellspacing="0" align="left" cellpadding="0" width="60%" style="text-align:center;"
 +
|- style="text-align:center;background-color:#6fa8dc;color:#fffff;"
 +
!width="10%"|Version !!width="15%"| Date !! Note  <small>[+]新增[-]删除[^]修复</small>
 +
|-
 +
| V2.0 || || style="text-align:left"|
 +
|}

2020年4月16日 (四) 14:26的最新版本

黑色传感器最终版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

使用教程

掌控板及mPython编程

#程序功能:用掌控板OLED显示屏显示温湿度传感器测量的温度和湿度值。
温湿度接线图.png
连接示意图


温湿度mPython编程.png
图形化及mPython代码



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);
}

Bluebit主控

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

版本历史记录

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