*温湿度センサ HDC1000 [#sf191586]
#ref(s_ondo.png)
-Texas Instrumentsの高精度14ビット温度湿度センサ
-I2C通信により温湿度を取得可能
--温度測定レンジ:-20 ℃から+85 ℃ ±0.2 ℃
--相対湿度レンジ:0 %~100%(無結露状態) ±3%
--通信:I2C(最大クロック 400 kHz)
--電源:3~5 V
-取扱説明書
#ref(AE-HDC1000.pdf)
-データシート
#ref(hdc1000.pdf)
*Arduinoとの接続 [#h8157571]
-温湿度センサとArduinoを以下のように接続する。
|Pin|距離センサ信号名|Arduino|備考|
|1|+V|5V||
|2|SDA|アナログ入力(A4)|A4はI2C通信のSDA信号線として使用可能です|
|3|SCL|アナログ入力(A5)|A5はI2C通信のSCL信号線として使用可能です|
|4|RDY|||
|5|GND|GND||
~
#ref(ondo-setsuzoku.png)
*サンプルコード [#u9abbd32]
-「ファイル」→「スケッチの例」→「HDC1000」→「HDCtester」
/*
・Texas Instrumentsの高精度14ビット温度湿度センサ HDC1000 のサンプルプログラムです。
・下記で配布されているDC1000の通信ライブラリを使用しています。
http://www.geocities.jp/zattouka/GarageHouse/micon/Arduino/Humidity/Humidity.htm
・1秒ごとに温湿度を測定し、シリアルモニタに出力します。
・マイコンボードに書き込み後、「ツール」→「シリアルモニタ」を起動してください。
・Arduinoとの接続
1 +V 5V
2 SDA アナログ入力(A4)
3 SCL アナログ入力(A5)
4 RDY
5 GND GND
*/
#include <Wire.h>
#include "HDC.h"
#define HDC1000_ADRS 0x40 // HDC1000のI2Cアドレス
HDC hdc(HDC1000_ID, HDC1000_ADRS); // HDC1000ライブラリを生成する
void setup()
{
int ans;
Serial.begin(9600); // シリアルモニターを開始
Wire.begin(); // I2C通信を開始
delay(3000); // 3S待機
ans = hdc.Init(); // HDC1000の初期化
if (ans != 0) {
Serial.print("HDC Initialization abnormal ans=");
Serial.println(ans);
} else Serial.println("HDC Initialization normal !!");
}
void loop()
{
int ans;
ans = hdc.Read();// HDC1000から湿度と温度を読み取る(Humi/Temp変数に格納)
if (ans == 0) {
Serial.print("TEMP / HUMI = ");
Serial.print(Temp);
Serial.print("'C / ");
Serial.print(Humi);
Serial.println("%");
} else {
Serial.print("Failed to read from HDC ans=");
Serial.println(ans) ;
}
delay(1000);
}
*実行例 [#j8ebb11b]
#ref(ondo-serial.png)
*参考資料 [#i4fd88bc]
-[[湿度センサー(HDC1000/AM2302)を動作させて見ます>http://www.geocities.jp/zattouka/GarageHouse/micon/Arduino/Humidity/Humidity.htm]]
-[[Arduinoで温湿度計 >http://s2jp.com/2015/04/arduino-thermo-hygrometer/]]
-[[温湿度センサモジュールの実験>http://garretlab.web.fc2.com/arduino/lab/temperature_and_humidity_sensor/index.html]]
-[[Arduino + 温度湿度センサHDC1000>http://shirotsuku.sakura.ne.jp/blog/?p=812]]
----
&size(12){Total:&counter(total); / Today:&counter(today); / Yesterday:&counter(yesterday);};