Arduino遙控大金(daikin)冷氣 (1)

Arduino 遙控大金冷氣

今年夏天實在太熱了,剛好正在試Arduino,心想到是不是可以用Arduino + 紅外線來遙控家中的大金冷氣,如果成功後,再配上網路模組就能實現遠端控制,這也能算是個IoT吧?

準備工作

  • Arduino 目前只試過UNO、Leonardo這兩款
  • Arduino UNO/Leonardo、ESP8266、Ameba、STM32Duino F1
  • IR LED 需要的是發射端
  • Arduino_IRremote_Daikin 這是適用於Arduino的Library,整合修改後的IRremote與自制的IRdaikin
  • Arduino_DY_IRDaikin 這是適用於Arduino的Library,整合IRremote宣告PWM內容與自制的DYIRDaikin
  • 具備Arduino程式修改與上傳動作的能力

連接紅外線

將紅外線發射LED接至Arduino,如下面的示意圖:

Arduino遙控大金(daikin)冷氣 (1) - 連接紅外線

紅外線LED的接地接至GND,另一端接至接腳3,如果您是Leonardo請接接腳2,這樣就完成電路連接非常簡單,但建議你可以將紅外線LED線延長,之後完成紅外線LED要與冷氣紅外線接收做個對準的動作會比較方便。

依照上圖的電路連接紅外線LED與NPN電晶體,NPN電路具有電流放大的功能,讓紅外線LED亮度可以達到最亮的程度讓搖控的範圍較大一點。

下載 Arduino_DY_IRDaikin

請到Github下載Arduino_DY_IRDaikin,這是將許多資訊整合後的版本給大金冷氣使用:

Arduino遙控大金(daikin)冷氣 (1) - 下載 Arduino_DY_IRDaikin

下載並解開後,將目錄名稱修成Arduino_DY_IRDaikin之後開啟Arduino程式,並且:

Arduino遙控大金(daikin)冷氣 (1) - 下載 Arduino_DY_IRDaikin

選擇加入.ZIP程式庫(Add Library...)來加入新的Library,選擇剛下載好的`Arduino_DY_Daikin-master.zip如下圖:

Arduino遙控大金(daikin)冷氣 (1) - 下載 Arduino_DY_IRDaikin

加入成功後就能看到~以目錄~名稱為Arduino_DY_IRDaikin的Library已經加入:

Arduino遙控大金(daikin)冷氣 (1) - 下載 Arduino_DY_IRDaikin

開啟範例程式

Library已經有一個範例可以測試,所以開啟Arduino程式並且開啟範例PowerOnOff:

Arduino遙控大金(daikin)冷氣 (1) - 開啟範例程式

接下來就會開啟一個視窗並且會看到範例程式的內容:

Arduino遙控大金(daikin)冷氣 (1) - 開啟範例程式

按下上傳(Upload)鍵上傳就完成基本動作。 首先解說一下範例程式,程式載入至Arduino開發版時,你開啟Arduino內建的Serial Monitor後,傳送New line(\n、Enter)就能傳送開、關的遙控訊息至大金冷氣,此時你要確認一下大金冷氣是不是會有這樣的動作(發射正確、接收也正確時,大金冷氣會嗶嗶2聲),並且Serial Monitor也會看到訊息:

Arduino遙控大金(daikin)冷氣 (1) - 開啟範例程式

Arduino_DY_IRDaikin Library

最基本的遙控函數如下:

 on();
 setSwing_off();
 setMode(1);
 setFan(4);//FAN speed to MAX
 setTemp(25);
 //----everything is ok and to execute send command-----
 sendCommand();

函數設計成當你所有的參數都設定完成時,再執行sendCommand()才會將資料轉成紅外線訊號出去,使用時必需要先在setup()中自行設定一組預設值,像上面的範例一樣,之後就能在loop()根據你的方式去變更,但一定要記住一點,你都變更完成時,一定要執行sendCommand(),否則紅外線訊號是不會發送的。

結語

Arduino 與紅外線在使上非常容易,也有現成的IRremote的Library能使用,但較難的是你要如何去解出遙控器的編碼這才是重點,這次的大金冷氣使用的方式較特別,當你每按一個遙控器按鍵時,它是將整個遙控機按鍵的控制資料全都送至紅外線,與一般的電視遙控器不同,電視遙控器每按一個鍵只送出那個按鍵的編碼,對觀察遙控器編碼比較單純,但大金遙控器使用的方式卻不同。

有了上面基本的基礎後,可以試著自行增加網路模組來完成網路控制的項目,現接段Danny已經有完成並測試約二個月左右,當你人不在家時,在回家前就能用手機先將冷氣開啟,回到家後就能享受涼快感,這也是不錯的DIY成就感。

參考資料

更新日誌

日期 內容
2017/04/26 更新內容以符合新版的Library
2014/08/27 初版

關鍵字

  • 大金 Arduino 搖控
  • 大金冷氣 搖控
  • 大金 紅外線

關於作者

已發表 274 篇文章

留言 53

  1. Arduino 使用 SCT013 量電流 - 可丁丹尼@一路往前走2.0

    […] 如果不清楚Library怎麼下載及安裝可以參考Arduino遙控大金(daikin)冷氣中的下載Arduino_IRremote_Daikin說明。 […]

  2. Fong Kwok Fai

    Which model do you in use of this experiment of DaiKin? the serial monitor where execute on or off command. but Daikin A/C no response !or IR sender is not work

    1. Fong Kwok Fai

      Hi, it 's work since the ir emitter is not pin to sensor of air conditioning, hi how about daikin BRC remote control series IR emiiter, do you research it?

      1. i don't research it.i just use general ir emiter.

        1. Fong Kwok Fai

          Please consider if I do sponser

          1. is general ir emiter and BRC remote control serial IR emiter different? please tell me more detial what do you want to do? thx

          2. Fong Kwok Fai

            I want to use Arduino UNO and ethernet shield remote control office 4 Daikin Air conditioning one arc three brc by internet or smartphone. I have tried hack IR program get some data but the signal is played daikin A/C no response, please help, my deadline is two weeks

          3. mail: danny (a) 35g.tw can you take your BRC remote control picutre or serial? maybe IR signal protocol is different.

          4. Fong Kwok Fai

            What is your email address ? I send microsecond on off for your elaboration

          5. danny (at) 35g.tw

          6. Fong Kwok Fai

            ARC and BRC series IR remote control data is sent to your email moreover IR hack program and play signal is enclosed for your review

          7. Marcos Hemann

            Hi Fong. Please may you send to me too? marcos @ mhemann.com.br

          8. Fong Kwok Fai

            Hi, sorry for the late reply, will you give me your plan in this matter?

          9. Marcos Hemann

            I will use this codes in a equipament that read pronto IR codes, soo i need IR codes of ARC433 in HEX Pronto Format. If you dont have in Pronto format, send me, if possible, in other format that i will convert it. thank you.

          10. Fong Kwok Fai

            Here is both ARC and BRC remote control sample is succesfully developed and tested. please contact me stanleyfong@gmail.com, I help you to develop your project. Which country are you stayed?

          11. Fong Kwok Fai

            stanleyfong2012@gmail.com sorry for typing mistake

  3. Fong Kwok Fai

    Is problem in IR emitter, please give me specification

  4. Fong Kwok Fai

    I checked your program, use camera see IR transmitter, but it is so week IR light, please tell me your IR transmitter model no., many thanks or any advise.

    1. IR light maybe so week,i have not another Circuit to Enhance. IR transmitter link wire need short.

      IR transmitter frequency is 38khz

  5. IR light maybe so week,i have not another Circuit to Enhance. IR transmitter link wire need short. IR transmitter frequency is 38khz

  6. Fong Kwok Fai

    Please tell me your Daikin Air conditioning model, is yours wall mount invertor, VRV or Split type ? I tried to transmit cassette type no response, please help

    1. Split type Air condition , can your check your daikin remote model? this is imprtant!

  7. 您好,我想請問有關使用arduino 裝上紅外線接收器,接收"大金遙控器"的紅外線碼。發現每次,按同一個遙控器按鈕,收到的紅外線碼都不一樣(如下圖所示),每按一次都會收到六行代碼,下圖是我按了四次同一個鍵所收到的代碼。請問您知道問題出在哪裡嗎? 還是有更好的方法您建議我解決呢? 謝謝您!!!

    1. 大金搖控器編碼方式不適合使用"學習"方式copy 紅外線訊號

      1. 請問你上面所提供的程式,是不是可以直接讓我發送紅外線給大金冷氣。我今天有按照步驟執行上列敘述程式,但是紅外線發射器沒有輸出訊號(我用手機相機螢幕確認)。不知道問題出在哪邊~

        我用Serial Monitor 輸入turn off 但紅外線發射器沒有反應。

      2. 所以按照上面程式的流程執行,可以順利開啟大金的任一台冷氣嗎? 為什麼可以省去複雜編碼的部分呢?

        1. 因為我在程式的library中加入處理的程式

          1. 是不是可以請您教我,如果要設定冷氣溫度為18度,那我的 loop 內容要如何寫。我是初學者,希望您能提供許多撰寫範例,感謝您~~!!

          2. 一開始有預設值,所以你設定完溫度後要記得設定電源狀態: daikin_on();//開啟 或

          3. 謝謝您~我有試成功了,相當的開心。 謝謝您的幫忙和解說。

          4. 恭禧你成功了!

          5. 目前library使用上蠻穩定的,所以後面我會追加一篇使用方式。

  8. Arduino遙控大金(daikin)冷氣 (2) - 可丁丹尼@一路往前走2.0

    […] 前篇Arduino遙控大金(daikin)冷氣 (1)提到使用Arduino配合Arduino_IRremote_DaikinLibrary讓Ardino能夠控制大金冷氣讓它關啟或關閉及設定一些功能,距上篇到現在約一年左右,使用下來蠻有心得的,適逢夏季來臨,想必許多Maker可能也會想要嘗試一下,所以接下來會再說明清楚一點如何使用它。 […]

  9. Please teach me how do i change the pin number from Arduino?

    1. it use pwm pin to generate 38Khz wave, it can't change the pin number. only one pin for every type of arduino.

      1. Thank you for the reply! my room has more than 1 air-conditioner..do you know of any way I can get past this?

        1. maybe you can use arudino gpio to swith output path or use two arduino board. i even try two boards communication by nRF24L01 IC, one is master ,other is slave

          1. Okay thank you so much! I'll try on that!

  10. Arduino、Webduino 和自走車 « 碧華國小資訊中心

    […] Arduino遙控大金(daikin)冷氣 (1) […]

  11. 你好: 謝謝您的範例,很實用。我用UNO成功實作一次,把 5V 改接 3.3V也可正常運作。 問題是,改用 pro mini 3.3v 8M Hz 時, 可成功上傳 code, 在 Serial Monitor 也可下指令和看到 Execute Command! 訊息,但冷氣機卻沒反應,請問需要修正什麼呢?

    1. 自問自答, 原來是因為紅外線 LED 距離冷氣太遠, 放近一點就可以了.

      1. 我對電路不是很熟,尤其是紅外線,目前還不知如何處理紅外線距離問題,所以無法像大金搖控器隨便用就能正確的控制。

      2. 再自問自答,參考 http://swf.com.tw/?p=359 (自製主動式紅外線遙控發射器) 的電路,似乎有增加遙控的距離。(是錯覺嗎?)

  12. 您好: 請問在 IRDakin.cpp/.h 裏的 IRDaikinRecv irrecv, 以及多個 daikin_getXXX() 函數的用途是? 是用來取得冷氣上目前的設定資料嗎? 是不是需要用紅外線接收元件來接收資料?

    1. 不是,函數庫中會使用一組暫存資料,該系列函數為取得暫存資料內容

      1. 再請問, 我的大金是冷暖氣機, 要怎麼設定為暖氣功能?

        1. 我的環境並沒有冷暖氣機型,如果您願意協助測試的話,請下載此branch:https://github.com/danny-source/Arduino_IRremote_Daikin/tree/heat ,setMode(3) 為暖器執行參數,請再試後試看

          1. 似乎可以了, 謝謝!

  13. Shao Kuan-Chieh

    Hi,

    PowerOnOff的範例line 4: #define DYIRDAIKIN_SOFT_IR的註解需拿掉否則無法正常執行。我的環境是Arduino Yun。

    1. Shao Kuan-Chieh

      應該說pin port會沒有定義,紅外線LED不會發射訊號。Message是正常的。

      1. 謝謝您的回報,請您提取最後版本應該有修正

  14. Cristian Paixão

    i'll wondering, you have a list of they air conditioner have been successfully with your Library?

    I'm sorry for my bad english, i'm from brazil, so...

    Regards and congratulations for your awsome work.

    1. this remote control is ARC serials ,it can control it. but you need care your ir remote that power more.

發表留言

Email 不會公開,只用於回覆通知。

第一次留言需經審核,之後會直接顯示。