(SKU:SEN060008)AM2320 I2C IIC数字湿度传感器

来自YwRobot Studio Wiki
YWrobot CYB讨论 | 贡献2016年5月24日 (二) 09:50的版本 样例代码

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索
AM2320

简介

电容式温湿度传感器模块AM2320是一款含有己校准数字信号输出的温湿度复合型传感器。采用专用的温湿度采集技术,确保产品具有极高的可靠性与卓越的长期稳定性。传感器包括一个电容式感湿元件和一个高精度集成测温元件,并与一个高性能微处理器相连接。该产品具有品质卓越、超快响应、抗干扰能力强、性价比极高等优点。 电容式温湿度传感器模块AM2320通信方式采用单总线、标准I2C两种通信方式。标准单总线接口,使系统集成变得简易快捷。超小的体积、极低的功耗,信号传输距离可达20米以上,使其成为各类应用甚至最为苛刻的应用场合的选择。I2C通信方式采用标准的通信时序,用户可直接挂在I2C通信总线上,无需额外布线,使用简单。两种通信方式都采用直接输出经温度补偿后的湿度、温度及校验CRC等数字信息,用户无需对数字输出进行二次计算,也无需要对湿度进行温度补偿,便可得到准确的温湿度信息。


              技术参数:
              测量范围:温度:-40…+80℃  湿度:0…99.9%RH
              精度(25℃环境下) 温室:±0.5℃  湿度:±3%RH(10…90%RH)
              分辨率: 温度:0.1℃(0.1℉) 湿度:0.1%RH
              衰减值:温度:<0.1℃/年  湿度:<1%RH/年
              响应时间:  温度:5s   湿度:5s  1/e(63%)
              工作温度范围:-40…+80℃
              外壳材料:PC塑料



产品参数

  • 尺寸:26.7*21mm
  • 固定孔:3mm
  • 孔位:15mm
  • 电压:3.3V、5V
  • 端口:I2C
  • 温度范围:-40-50℃ ±0.5℃
  • 湿度范围:0-99.9%RH ±3%RH
  • 平台:Arduino、单片机、ARM、树莓派


使用教程

AM2320LINE.jpg

样例代码

#include "U8glib.h"
#include <Wire.h> 
#include <AM2320.h>
AM2320 th;

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);
//U8GLIB_NHD_C12864 u8g(8, 7, 6, 5, 4);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, RS = 9, RST = 8

static unsigned char logo_bits[] U8G_PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x3C,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x3C,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x78,0x3C,0x00,0x00,0x00,0xC0,0xDD,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x78,0x3C,0x00,0x00,0x00,0xE0,0x9C,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x3C,0x3C,0x3C,0x00,0xEF,0xFF,0xE0,0xBE,0xE3,0xFF,0x81,0x7F,0xF8,0x0F,0x00,
0x00,0x3C,0x1E,0x3C,0x00,0xEF,0xFF,0x61,0x3E,0xE3,0xFF,0xC3,0xFF,0xF8,0x1F,0x00,
0x00,0x78,0x1E,0x3C,0x00,0xEF,0xFF,0x31,0x7F,0xC3,0xFF,0xE7,0xFF,0xF9,0x1F,0x00,
0x00,0x00,0x00,0x3C,0x1E,0x0F,0xC0,0x39,0x7F,0x06,0x80,0xE7,0xE1,0x01,0x00,0x00,
0x00,0x00,0x00,0x3C,0x1E,0x0F,0xE0,0xB9,0x7F,0x0E,0xFE,0xF7,0xC0,0xC3,0x01,0x00,
0x00,0xE0,0x07,0x3C,0x1E,0x8F,0xFB,0xB9,0x7F,0x0E,0xFF,0xF3,0xC0,0xC3,0x01,0x00,
0x00,0xC0,0x03,0x3C,0x1E,0x8F,0xFB,0x30,0x77,0x06,0xFF,0xF3,0xC0,0xC3,0x01,0x00,
0x00,0xC0,0x03,0x3C,0x1E,0x8F,0x7B,0x60,0x37,0x03,0xFF,0xF7,0xC0,0xC3,0x01,0x00,
0x00,0xC0,0x03,0x3C,0x80,0x8F,0xF3,0x60,0x94,0x03,0x80,0xF7,0xE1,0xC3,0x01,0x00,
0x00,0xC0,0x03,0xFC,0xF3,0x87,0xE3,0xE1,0xC1,0x03,0xFE,0xE7,0xFF,0xC1,0x01,0x00,
0x00,0xC0,0x03,0xF8,0xFF,0x87,0xE3,0xC1,0xFF,0x01,0xFF,0xC3,0xFF,0xC0,0x01,0x00,
0x00,0xC0,0x03,0xF0,0xFF,0x81,0xC3,0x03,0x3E,0x00,0xFF,0x83,0x7F,0xC0,0x01,0x00,
0x00,0xC0,0x03,0x80,0x7F,0x80,0x83,0x07,0x1C,0x00,0xFF,0x00,0x1E,0xC0,0x01,0x00,
};

static unsigned char u8g_logo1_bits[] U8G_PROGMEM = {
  0x00,         // 00000000 
  0x02,         // 00000010
  0x05,         // 00000101
  0x02,         // 00000010
  0x00,         // 00000000 
  0x00,         // 00000000
  0x00,         // 00000000 
  0x00,         // 00000000
  0x00,         // 00000000 
  0x00,         // 00000000 
  0x00,         // 00000000 
  0x00,         // 00000000 
};

void setup(void) {

 // u8g.setRot180();
  u8g.setFont(u8g_font_6x12); //u8g.setFont(u8g_font_osb18);
  u8g.setFontRefHeightText();
  u8g.setFontPosTop(); 
  Serial.begin(9600);           // 初始化串口
}

void loop(void) {
 
  u8g.firstPage();  
  do {
    u8g.drawXBMP( 0, 44, 128, 20, logo_bits);
    u8g.drawStr(0, 0, "AMS2320 Testing...");
    u8g.drawStr(0, 14, "Temperature:");
    u8g.drawXBMP( 108, 14, 8, 12, u8g_logo1_bits);
    u8g.drawStr(112, 14, "C");
    u8g.drawStr(0, 24, "Humidity:");
    u8g.drawStr(112, 24, "%");
    u8g.setPrintPos(76, 14);
    u8g.print(th.getTemperature());
    u8g.setPrintPos(76, 24);
    u8g.print(th.getHumidity());
   } while( u8g.nextPage() );
  delay(1000);
  Serial.println("AMS2320 Testing...");                  
   Serial.print("Temperature:");
    Serial.print(th.getTemperature());
    Serial.println("C");
    Serial.print("Humidity:");                  
   Serial.print(th.getHumidity());
    Serial.println("%");
    Serial.println("Testing..END");
    Serial.println("Testing..END");
    Serial.println("Testing..END");
}


更多

[YWRobot产品资料下载]

购买 YWRobot商城购买链接