声で家電を制御する:その2(赤外線リモコン付きLEDシーリングライト購入編)
目的
声で家電を制御する。ただし安価に。
経過(その1)
OpenHRIとarduino(万能リモコン)を用いて、下記の家電を声で制御できる
ようになった。
※SANYOエアコンのリモコンは通信の解析中…
gnuplotのstepオプションにて描画
今回
リモコン付きのLEDシーリングライト(天井に取り付ける照明器具)を
購入しようと考えています。
そこで、エアコンのように簡単に解析できないリモコンだと困るので、
「即席、持ち出しできる赤外線解析機」をつくりました。
「即席、持ち出しできる赤外線解析機」
見難いですが右上の LCD は下記を示しています。
「Sony」=>「赤外線通信がSony形式」
「481」=>「データコード」
(赤外線のバイナリ信号をHEXコードに直したもの)
※Kenさんの作ったIRemoteライブラリの賜物です。すごい☆
これで、赤外線通信が既知の規格にのっとったものが購入できます。
見るからにアレゲな感じですが、これを持ってヨド○シ店頭で
解析しつつ購入を考えようとしてる自分です。
結線図
これにプラスでDIGITAL10PINに「赤外線リモコン受光モジュール:
PL-IRM-2161-C438」を取り付けました。
(センサのGndと5V電源は当然arduinoを利用)
電源は、USBをつなげる充電器からUSB給電です。
arduinoのプログラム
即席なので誰の参考にもならないかもですが、一応載せます。
// include the library code:
#include
#includeint RECV_PIN = 10;
IRrecv irrecv(RECV_PIN);
decode_results results;// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);void setup() {
// Start the receiver
irrecv.enableIRIn();
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
}void dump(decode_results *results) {
int count = results->rawlen;
lcd.begin(16, 2);
if (results->decode_type == UNKNOWN) {
lcd.print("Unknown encoding: ");
}
else if (results->decode_type == NEC) {
lcd.print("NEC:");
}
else if (results->decode_type == SONY) {
lcd.print("SONY:");
}
else if (results->decode_type == RC5) {
lcd.print("RC5:");
}
else if (results->decode_type == RC6) {
lcd.print("RC6:");
}
else if (results->decode_type == PANASONIC) {
lcd.print("PANASONIC");
}
else if (results->decode_type == JVC) {
lcd.print("JVC: ");
}
lcd.setCursor(0, 1);
lcd.print(results->value, HEX);
}void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume(); // Receive the next value
}
}