“温湿度”的版本间的差异
来自Labplus盛思维基百科
Tangliufeng(讨论 | 贡献) (→MicroPython示例) |
(→使用教程) |
||
(未显示3个用户的20个中间版本) | |||
第1行: | 第1行: | ||
+ | [[文件:黑色传感器最终版12.20-28.png|350px|thumb|右]] | ||
== 概述 == | == 概述 == | ||
基于SHT20数字温湿度传感器集成IC。用于检测环境温湿度,具有极高的可靠性和长期稳定性。采用I2C通讯方式,操作简便。 | 基于SHT20数字温湿度传感器集成IC。用于检测环境温湿度,具有极高的可靠性和长期稳定性。采用I2C通讯方式,操作简便。 | ||
== 技术参数 == | == 技术参数 == | ||
− | * | + | * 工作电压:VCC 3.3-5V |
* I2C数字信号输出 | * I2C数字信号输出 | ||
* 温度测量范围:-40~125℃ | * 温度测量范围:-40~125℃ | ||
第24行: | 第25行: | ||
== 使用教程 == | == 使用教程 == | ||
− | === | + | === <font size="3">掌控板及mPython编程</font> === |
− | + | ||
− | |||
<pre style="color:blue"> | <pre style="color:blue"> | ||
− | + | #程序功能:用掌控板OLED显示屏显示温湿度传感器测量的温度和湿度值。 | |
+ | </pre> | ||
+ | {| | ||
+ | |- | ||
+ | | [[文件:温湿度接线图.png |800px|居中|无框]] | ||
+ | |- | ||
+ | |style="text-align:center"|连接示意图 | ||
+ | |} | ||
+ | <br/> | ||
− | + | {| | |
− | + | |- | |
− | + | | [[文件:温湿度mPython编程.png |900px|居中|无框]] | |
− | + | |- | |
− | + | |style="text-align:center"|图形化及mPython代码 | |
− | + | |} | |
− | + | <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" | |
− | print( | + | SHT20 sht20; |
− | print( | + | 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> | </pre> | ||
− | === | + | ===<font size="3"> Bluebit主控</font> === |
+ | {| | ||
+ | |- | ||
+ | |实物连接如下图: | ||
+ | |- | ||
+ | |[[文件:温湿度实物连接.png|700px|无框|左]] | ||
+ | |- | ||
+ | |程序功能:利用数码管分别显示温度和湿度的值 | ||
+ | |- | ||
+ | |[[文件:温湿度1.png|900px|无框|左]] | ||
+ | |} | ||
+ | |||
+ | == 版本历史记录 == | ||
+ | |||
+ | {| 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的最新版本
概述
基于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显示屏显示温湿度传感器测量的温度和湿度值。
连接示意图 |
图形化及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主控
实物连接如下图: |
程序功能:利用数码管分别显示温度和湿度的值 |
版本历史记录
Version | Date | Note [+]新增[-]删除[^]修复 |
---|---|---|
V2.0 |