目录
- 一、简介
- 二、使用前准备
- 三、 测试方法
- 四、实验现象
- 五、总结
原文链接:https://www.yourcee.com/newsinfo/2929581.html
一、简介
HDC具有集成温度传感器的数字湿度传感器,相对湿度精度为±2%,温度精度为±0.2℃,采用IIC接口通信,睡眠模式下电流可达100nA,稳定性极佳。
名称 | 描述 |
---|---|
VCC | 电源2.7~5.5V |
GND | 接地 |
SCL | IIC串行时钟线/串行时钟线/SPI串行时钟端口 |
SDA | IIC串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/串行数据线/SPI串行数据输入 |
二、使用前准备
CJMCU-1080 高精度 温湿度 传感器 HDC1080 湿度 温度模块 | 1个 |
---|---|
原装 uno r3开发板 编程 Atmega328P AVR 8位单片机 | 1个 |
USB2.0打印机数据线高速方口连接转接线 A公对B公 | 1条 |
杜邦线 | 若干 |
三、 测试方法
用USB2.0打印机数据线高速方口连接转接线A公 uno r3开发板 编程 Atmega328P AVR 8位单片机连接在一起。 uno r3开发板 编程 Atmega328P AVR 8位单片机和HDC如下图所示 5V —— VCC GND —— GND SCL —— A5 SDA —— A4 安装Arduino IDE,打开ArduinoIDE,点击项目然后点击加载库,搜索库管理器HDC1080点击安装,如下图所示 点击【文件】,点击【示例】,再点击【ClesedCube HDC1080】和【hdc1080demo】,最后点击上传,如下图所示 代码如下
/************************************************************************************** This is example for ClosedCube HDC1080 Humidity and Temperature Sensor breakout booard Initial Date: 13-May-2016 Hardware connections for Arduino Uno: VDD to 3.3V DC SCL to A5 SDA to A4 GND to common groud Written by AA for ClosedCube MIT License **************************************************************************************/ #include <Wire.h> #include "ClosedCube_HDC1080.h" ClosedCube_HDC1080 hdc1080; void setup() {
Serial.begin(9600); Serial.println("ClosedCube HDC1080 Arduino Test"); hdc1080.begin(0x40); Serial.print("Manufacturer ID=0x"); Serial.println(hdc1080.readManufacturerId(), HEX); // 0x5449 ID of Texas Instruments
Serial.print("Device ID=0x");
Serial.println(hdc1080.readDeviceId(), HEX); // 0x1050 ID of the device
}
void loop()
{
Serial.print("T=");
Serial.print(hdc1080.readTemperature());
Serial.print("C, RH=");
Serial.print(hdc1080.readHumidity());
Serial.println("%");
delay(300);
}
四、实验现象
程序下载进去之后,显示温度28℃,湿度63%RH。
五、总结
波特率要选择正确,否则不会有有读数显示出来的。