顯示具有 kbro 標籤的文章。 顯示所有文章
顯示具有 kbro 標籤的文章。 顯示所有文章

2016年2月29日 星期一

[Arduino] 完整抓取 凱擘 kbro 遙控器紅外線原碼並發出重新發出以控制機上盒

再次與 kbro 凱擘機上盒遙控器搏鬥:


先講結果, kbro 遙控器發射出來的 IR code 頻率為 38 kHz, 是 XMP protocol  (應該是). IRremote/IRLib 抓取 IR 碼因為 bug 所以中間會斷掉, 沒有辦法抓到完整的碼, 需要將 IR receiver 接到 Arduino 的 interrupt pin 抓才能抓到完整的碼.

如果你不想看以下落落長的過程, 只想用 Arduino IRremote 發射已經抓出來的完整 kbro 凱擘機上盒遙控器碼. 請直接服用以下 sketch:

IRsendKbro.ino : 測試程式, 已寫入所有 kbro raw code, unmark 之後可以測試遙控機上盒.

LfPanasonic2KbroIRtransf.ino: 將 Sony LF-Box1 發出的 Panasonic CATV(1)碼轉為凱擘碼的 IR 轉換器. (請參考這篇)

其實說搏鬥也很可笑, 在台灣應該很多人知道凱擘使用的紅外線碼, 但是網路上能找到的資訊很少, 而且相當分散, 用 Arduino 的 IRremote 或 IRLib (也是基於 IRremote) 都無法解譯 kbro 機上盒遙控器碼, 更無法用Arduino去發射 IR 碼來控制機上盒, 也找不到人有寫這塊.

這次找到時間重新解析 kbro 的 IR 碼, 讓我一個外行人搞懂更多關於 IR 的事情, 就算很蠢走了歪路, 最後結果得到滿意的答案, 還是很開心.

在一年多前寫的一篇 [Arduino] 用 IRrepeater 抓取 kbro 凱擘遙控器的 IR raw code , 當時利用 repeater 程式抓取 kbro 凱擘機上盒遙控器碼, 利用 Arduino 發射 raw code 對應於自己家中的機上盒是可以用的, 但後來發現僅限於我家中那個機上盒, 拿到長輩家比較舊的凱擘機上盒就完全無效. 令人相當苦惱.

抓取紅外線發射頻率

對一個外行人來說, 遇到謎樣的紅外線碼, 首先上網找一下. 以前菜鳥剛弄紅外線時買的紅外線接收器就是光華商場買來就用. 雖然商家有講型號, 並且上網找了 datasheet. 但買了就用從來沒有關心過接收器的真正功能.

從網路上找一下, 發現最基本的就是紅外線接收器有分不同的頻率, 有 36, 38, 40 kHz ... 等等的發射頻率. 最常見的是 38 kHz. 首先我先懷疑到凱擘可能使用的頻率不是常見的頻率:



參考了 CY's Tech Talk 的 1.4.3 IR Receiver Components and Schematics , CY是 IRLib 的作者. 參考 CY 的blog上網買了 TSOP38236 (36 kHz), TSOP38256 (56 kHz) 和  TSMP58000 這幾種. 關於買特定型號的電子零件和光華商場買有不同, 要找到能夠小量買的商家不容易, 起碼以我一個外行人去找不好找. 後來仍是到淘寶找店家買. 可以小量大約十個以內但是運費就省不了. 十個對我來說還是太多了, 但沒辦法.

終於等到這幾種 IR receiver 寄到來抓凱擘遙控碼, 很不幸, 俺運氣沒那麼好. 用 IRremote 或 IRLib 抓出來的 raw code, 用 Arduino 發出來仍舊不能控制凱擘機上盒. 不過用一併買回來的 TSMP58000 搭配 CY 的 IRLib 中的 IRfreq.ino 來抓取遙控碼的頻率:

在 Arduino mini pro 用的 interrupt pin 是 pin 2:

IRfreq.ino 一開始會印出 pin 腳:

測試了幾支不同的遙控器, 可以看到它印出遙控器發出的頻率, (38) 那個就是凱擘遙控器的頻率:

TSMP58000 是 IR learner 而不是 IR receiver. 一般的 IR receiver 的封裝中會帶有 bandpass filter 調諧到特定的頻率, 例如: 36 kHz, 38 kHz:

但是 TSMP58000 則沒有 bandpass filter, 所以會讀取到更原始的 raw code. 根據 CY 的說法是可以用 TSMP58000 去取得 raw code, 但是會需要比一般 IR receiver 更多的記憶體. 所以他只把 TSMP58000 這樣的 IR learner 拿來偵測控制碼的頻率.

問題是, 外行人的我滿心認為一定是 kbro 使用有別於一般 38 kHz 頻率, 例如: 40 kHz, 是我用錯 IR receiver 所以造成抓取 raw code 失敗. 但用 IRfreq.ino 一抓, 可惡的 kbro 白色遙控器發出來的頻率居然是非常標準的 38 kHz, 為此相當沮喪的卡關了一陣子. <=== 事實上得知頻率仍是很重要的事.

查知 kbro 機上盒疑似使用XMP

OK, 卡了幾天關之後, 灰心的我還是上網碰碰運氣, 之前其實就知道網路上的 slingbox 社群有流傳支援 kbro 的設定檔. 但是我都是 download 到 binary 的檔案, 打開當然是編碼過, 人類不懂的二元檔. 卡關那幾天心血來潮就找了它的原始 slingbox 檔來看, 它被發布在著名的 JP1 remotes 網站上. 這個網站是一些 IR 遙控器愛好者分享資訊網站, 其中就有 slingbox 使用的 kbro 凱擘機上盒控制檔:

RMDU Remotemaster source file for the Kbro Hyundai Digital Technology digital set top box (DSTB).
http://www.hifi-remote.com/forums/dload.php?action=file&file_id=8399Kbro Hyundai Digital Technology digital set top box (DSTB) (1).rmdu

上面這個檔案是原始檔(免費註冊登入JP1 remotes 後能取得), 用來產出真正 slingbox 使用的 binary 檔. 原始檔是人類可以看懂的, 可以看到下面的字眼:

Description=Kbro Hyundai Digital Technology digital set top box (DSTB)
Remote.name=Slingbox with UEI RV Chip
Remote.signature=BINRV
DeviceType=Cable
DeviceIndex=1
SetupCode=2010
Protocol=01 6C
Protocol.name=XMP (Slingbox)
Protocol.variantName=JP1Slingbox
ProtocolParms=88 16 null 0 0
FixedData=1B 0F 44 58 1F 00 40
Function.0.name=power
Function.0.hex=0F

可以看到 protocol  是 01 6C, 名稱為XMP, google 一查確實有這樣的 IR protocol, 再查, 發現國外也有 cable TV 公司使用這樣的碼, 而且用 Arduino 去解析並產出 XMP 碼並不成功. 找了數個文章都沒有看到 XMP 和 Arudino IRremote 合作的線索. 但皇天不負苦心人, 找到一個對我很重要的一篇 Arduino forum 的討論: Reading IR signals from Comcast XR2 remote

這篇討論由 robertanthony02 發動, 他也是想用 Arduino parser XMP 不成功. 討論的前兩頁給我幾個以前不知道的線索, 首先, IR receiver 是有對於 XMP 比較建議的型號, 也就是說比較著名ㄧ點的 IR receiver 的型號(通常也會貴一些), 它的 datasheet 是有建議針對哪種 protocol 比較友善的 receiver:

所以依據網路找到的 datasheet 建議我又上網買了 TSOP38338, 這個 IR receiver 被推薦使用在 XMP 上. 買來用用看. 結果到貨後滿心歡喜的用 IRremote 一弄, 當場又囧了, 沒錯! 抓出來的 raw code 居然仍無法使用!

至此, 第二次進入卡關. 又花了幾百塊買 TSOP38338, 重點是沒有得到新的突破, 再次令我沮喪...

AnalysIR 的 Arduino_Record_Long_AirConditioner_Infrared_Signals_10 sketch

所幸天公伯沒有把門堵死, 累積走過的一切仍有收穫, 在 Reading IR signals from Comcast XR2 remote 討論串中, 前兩頁中 robertanthony02 和 AnalysIR 兩人的討論非常重要.

AnalysIR 就是 AnalysIR 這個軟體專案的開發者, AnalysIR 是一個可以搭配數種開發板, 包含 Arduino, 將截獲的 IR code 在 PC 上繪製成圖形, 也就是軟體示波器. 個人非商用版本很便宜, $10 美金約 $300 台幣上下, 和一個硬體示波器的價格比便宜太多了. 如果只是應用在 IR 場合不想花大錢買硬體示波器的話 AnalysIR是滿不錯的選擇.

在討論中, AnalysIR 他提供給 robertanthony02 一個很重要的 sketch 來進行抓取 IR code 的任務. 這個 sketch 叫做 Arduino_Record_Long_AirConditioner_Infrared_Signals_10.txt, 這個 sketch 最早被 AnalysIR 發表在 Air Conditioners: Recording long Infrared Remote control signals with Arduino 這篇文章中.

這時候發生令我振奮的結果, 沒錯! AnalysIR 的 sketch 可以用, 搭配 TSOP38338 抓出來的 raw code 可以控制我手上有的兩個外型不同的凱擘機上盒.

AnalysIR 的 sketch 跳過了 IRremote, 將 IR receiver 接到 interrupt pin 去抓取 raw code. 這個程式本來是用來對付一些冷氣機的遙控器, 因為這些遙控器所發出的 code 特別長, 而 IRremote 的 buffer 有 100 的長度限制, 所以他做了這個 sketch 來抓. 剛好它也繞過了我遇到的問題. 後面分所抓出來的凱擘 IR code, 它的長度是 71 並不是因為太長超過 buffer 無法抓取, 而是發現另一個 IRremote 的問題.

總之, AnalysIR 的 sketch 讓我順利的抓出 kbro 機上盒的 raw code, 我放置在本文後的附錄, 我只抓了用來選台的一些按鍵. 搭配我的 IR translator 和 LF-Box1 使用. 至於其他的按鍵同好們可以用相同的 sketch 抓取. 我測試過不只 TSOP38338 (XMP首選) 可以抓出來, 用光華商場買的 38 kHz IR receiver 也可以抓出來沒問題.

利用抓出來的 raw code, 我修改了做給 Sony LF-Box1 用的 IR code 轉換器, 把它發出的 Panasonic code 轉為 kbro cable box 的 code, 這樣 LF-Box1 可以遙控 kbro box. 程式碼在此: LfPanasonic2KbroIRtransf.ino, 稍有經驗的人應該可以看出程式中的問題來, 在最後一段會說怎麼處理.

我還寫了一個簡單的 sketch, 將所有抓出來的 kbro raw code 都放進去: IRsendKbro.ino, 可以用來測試.

IRremote/IRLib 無法適應 XMP protocol

事實上在找到 AnalysIR 的  sketch 之前, 我花了一些時間 trace IRremote/IRLib 的原始碼. 因為從邏輯上來說 IRremote 雖然沒有支援 XMP protocol, 但是直接從 ISR 抓出來的 raw code 應該要可以使用, 但事實上沒辦法用. 所以 IRremote 中抓 raw code 的算法肯定有問題.

不過我沒有貴鬆鬆的示波器, 也沒買 AnalysIR, 所以沒有對照組可以用來抓 IRremote 的問題. 但是找到 AnalysIR 的 sketch 之後, 分析抓出來的 kbro raw code 就瞭解了一些事情.

首先, AnalysIR 的 sketch 抓出來完整的 raw code 長度為 71, 而我以前用 IRrepeator 抓出來的長度是 17, 很明顯 IRremote 抓出來的長度少了很多. 判斷不是被錯誤過濾掉就是誤判了結束點.

再以抓出來的 channel+ 按鈕為例:

Raw: (71) 224, 892, 224, 2252, 224, 752, 224, 2796, 228, 1292, 232, 1292, 224, 1432, 232, 1836, 228, 14264, 228, 888, 228, 1024, 228, 748, 232, 744, 232, 748, 232, 2512, 236, 744, 224, 752, 228, 15468, 280, 840, 232, 2244, 232, 744, 224, 2792, 228, 1296, 232, 1288, 228, 1432, 228, 1836, 228, 14268, 224, 892, 224, 2112, 224, 1844, 220, 756, 224, 752, 228, 2520, 228, 748, 228, 752, 228

IR LED 亮是 mark, 暗是 space. 它是 mark, space, mark space... 這樣一直排下去, 可以發現其中有抓出特別長的間隔時間, 就是我上面紅色標出來的數字. 以這個數字為間隔可以發現很長的間隔出現之前, 其他的 mark, space 數字一共剛好就是17, 就是我以前抓的長度. 至此可以推斷出來 IRremote 判斷 IR code 結尾是有問題的. 過長的時間間隔會造成 IRremote 的誤判, 誤以為整個 raw code 結束了.

這時候繼續 trace IRremote, 發現了癥結點在 IRremoteInt.h 和 IRremote.cpp (其實也沒幾個檔案):

Arduino-IRremote/IRremote.cpp

Arduino-IRremote/IRremoteInt.h  // Minimum gap between IR transmissions
                                        #define _GAP            5000
                                        #define GAP_TICKS       (_GAP/USECPERTICK)
    Arduino-IRremote/IRremoteInt.h  // microseconds per clock interrupt tick
                                                           #define USECPERTICK    50

可以看到 IRremote 是 state machine 的設計, 以一些研判條件來推進整個 parser process 的 state.

if (irparams.timer > GAP_TICKS) {
        irparams.rcvstate = STATE_STOP;
}

當抓出來的 ir timer 小於 GAP_TICKS 的 ticks 數量, 代表要將 IR receiver 的狀態推進到 STATE_STOP, 而 GAP_TICKS 則是從 _GAP 5000  算出來, 5000 的單位是 microseconds , 這相當小, 是 10 的 -6 次方. 所以是 0.005 秒. 而上面的紅色數字為 14264, 15468 14268, 明顯都大於 5000 這個數字.

所以我刻意加大 _GAP, 加大到 20000, 可以處理一部分上面的 timer gap, 抓出更長一些的 raw code. 可是很奇特的是, 從數字上去計算, 應該比抓出來的數字例如 15468 稍微大一點就可以避免誤判, 但實際測試出來卻不是這樣, _GAP 必須要大上很多才行, 這點我目前也不明白, 應該還有什麼東西拖延到實際的 ticks 數字.

總之 IRremote 的 _GAP 不修改的話, 是肯定會對 XMP protocol 造成結束碼的誤判. 未來如果要想為 IRremote 添加 XMP 支援, 則這個問題不能忽略.

用 PROGMEM 解決 raw code 陣列過大問題

第一個版本 LF-Box1 遙控 kbro box 程式碼: LfPanasonic2KbroIRtransf.ino, 前面有提到出了問題. 由於抓出來的 kbro raw code 很大, 每個按鈕有 71 個 unsigned int (Arduino 上是 2 bytes) 的大小, 實際一用發現當整個 arrary 很大的時候, 會造成 sketch 上載成功但是無法運作. 這個問題大約卡了一天, 後來找到這個文件 Dean Camera's "GCC and the PROGMEM Attribute", 它的說明相當清楚, 問題就是出在實行時期 Arduino 會將使用到的陣列由 ROM 拷貝到 RAM, 如果 array 太大就會把 RAM 塞爆, 造成程式無法執行.

我使用的 Arduino mini pro 內帶 32KB Flash memory (ROM), 2KB SRAM (RAM), SRAM就是執行時期能用的記憶體大小. AVR-GCC在起始的時候會將用到的 array 從用來存放程式的ROM拷貝到 RAM 中執行, 這樣速度會比較快, 但是 array 加上執行時期用掉的其他空間不能大於 2KB.

我們在 upload sketch 到 Arduino 上時, Arduino IDE 上顯示的大小是 32 KB 的 ROM, 而不是執行時期的 RAM, 請注意.

所以我實際遇到的狀況發現陣列存放 12 個 kbro raw code 時 sketch 就無法執行. 細算一下:
    71 * 2 (bytes) = 142 (bytes)
    142 * 12 =  1704 (bytes) <=== 很接近 2KB

若包含其他執行時期的 heap, stack 的消耗, 很容易就把只有 2KB 的 RAM 撐爆. 葉難 的 Arduino:關於記憶體之二三事 文章有佷漂亮的圖片可以參考.

那怎麼避免這樣的狀況呢? 可以利用 PROGMEM 變數屬性告訴 AVR-GCC 將該陣列保留在 ROM 中不要copy到 RAM 中. 而是利用 memory_P 在要用的時候 copy 到我預先在 RAM 中宣告好的 buffer, 再把 IR raw code 發出去. 修正版本在此: LfPanasonic2KbroIRtransf.ino

修正過後原本的靈異現象就不再出現, 而且可以放下更多的 kbro raw code.

最後

終於能夠順利抓出 kbro 凱擘機上盒的遙控碼, 而且用 IRremote 重新播放出去. 雖然 IRremote 沒有辦法 parser XMP protocol, 但總算是可以發出 raw code. 未來若有時間有空閒可以將 XMP 的 parser 添加到 IRremote, 但這時候示波器就很必要了.



附錄:

 kbro 遙控器 Raw data 完整版 (已拿掉第一個 code, 長度為 71):
Caputure by Arduino_Record_Long_AirConditioner_Infrared_Signals_10

CHANNEL UP:
Raw: (71) 224, 892, 224, 2252, 224, 752, 224, 2796, 228, 1292, 232, 1292, 224, 1432, 232, 1836, 228, 14264, 228, 888, 228, 1024, 228, 748, 232, 744, 232, 748, 232, 2512, 236, 744, 224, 752, 228, 15468, 280, 840, 232, 2244, 232, 744, 224, 2792, 228, 1296, 232, 1288, 228, 1432, 228, 1836, 228, 14268, 224, 892, 224, 2112, 224, 1844, 220, 756, 224, 752, 228, 2520, 228, 748, 228, 752, 228

CHANNEL DOWN:
Raw: (71) 224, 892, 232, 2244, 232, 744, 232, 2788, 224, 1296, 228, 1296, 232, 1424, 228, 1840, 224, 14268, 232, 884, 232, 880, 224, 756, 224, 752, 228, 752, 224, 2656, 228, 752, 228, 748, 232, 15464, 232, 884, 232, 2244, 228, 748, 232, 2788, 232, 1288, 228, 1296, 228, 1428, 224, 1844, 232, 14260, 228, 888, 228, 1972, 228, 1840, 224, 752, 228, 748, 228, 2656, 228, 748, 232, 748, 232

POWER
Raw: (71) 228, 892, 224, 2248, 228, 752, 224, 2792, 228, 1296, 232, 1288, 228, 1432, 232, 1832, 228, 14268, 232, 880, 224, 756, 308, 668, 312, 668, 228, 748, 228, 2792, 228, 748, 232, 748, 232, 15420, 224, 896, 232, 2240, 232, 748, 232, 2784, 224, 1300, 228, 1292, 232, 1428, 224, 1840, 224, 14268, 232, 884, 232, 1832, 232, 1836, 224, 752, 228, 752, 228, 2788, 232, 748, 228, 748, 232

ONE 1:
Raw: (71) 232, 888, 232, 2244, 220, 756, 228, 2788, 232, 1292, 224, 1300, 224, 1432, 232, 1836, 224, 14268, 228, 888, 284, 2596, 224, 756, 228, 748, 232, 748, 224, 888, 232, 748, 224, 752, 232, 15412, 228, 888, 232, 2244, 224, 752, 232, 2788, 232, 1288, 228, 1296, 228, 1428, 232, 1836, 224, 14268, 232, 884, 220, 1572, 228, 1840, 228, 752, 220, 756, 228, 884, 224, 756, 228, 748, 232,

TWO 2:
Raw: (71) 232, 888, 232, 2240, 228, 752, 228, 2788, 224, 1300, 228, 1292, 232, 1428, 224, 1840, 232, 14264, 224, 892, 224, 2520, 232, 748, 224, 752, 232, 748, 224, 1024, 228, 752, 220, 756, 228, 15452, 224, 892, 228, 2248, 228, 748, 228, 2792, 228, 1292, 224, 1300, 224, 1432, 232, 1836, 224, 14268, 232, 884, 224, 1436, 224, 1840, 232, 744, 228, 752, 228, 1020, 224, 756, 228, 748, 224

THREE 3:
Raw: (71) 232, 888, 232, 2240, 224, 756, 228, 2788, 232, 1292, 224, 1296, 232, 1428, 224, 1844, 224, 14268, 232, 884, 224, 2384, 232, 748, 224, 752, 228, 752, 304, 1080, 228, 752, 232, 744, 228, 15444, 224, 896, 224, 2248, 232, 748, 224, 2792, 228, 1296, 232, 1288, 224, 1436, 228, 1836, 224, 14272, 228, 884, 224, 1300, 224, 1840, 232, 748, 224, 752, 232, 1156, 224, 752, 312, 664, 224

FOUR 4:
Raw: (71) 224, 896, 224, 2248, 228, 752, 316, 2700, 224, 1300, 228, 1292, 224, 1436, 228, 1840, 228, 14264, 308, 808, 228, 2244, 224, 756, 228, 748, 232, 744, 228, 1296, 232, 748, 224, 752, 316, 15356, 228, 888, 232, 2244, 224, 752, 312, 2708, 232, 1288, 228, 1296, 228, 1432, 224, 1840, 228, 14268, 232, 880, 228, 1160, 228, 1836, 224, 752, 316, 664, 308, 1212, 232, 748, 224, 752, 228

FIVE 5:
Raw: (71) 224, 896, 220, 2252, 228, 752, 228, 2788, 224, 1300, 228, 1292, 224, 1436, 224, 1840, 232, 14264, 224, 892, 228, 2108, 224, 752, 232, 748, 224, 752, 312, 1348, 232, 748, 308, 668, 316, 15360, 228, 892, 228, 2244, 232, 748, 224, 2792, 228, 1296, 232, 1292, 224, 1432, 232, 1836, 224, 14268, 228, 888, 224, 1024, 228, 1840, 232, 744, 228, 752, 232, 1424, 224, 756, 228, 748, 224

SIX 6:
Raw: (71) 224, 892, 224, 2252, 228, 748, 232, 2788, 224, 1296, 232, 1292, 224, 1432, 228, 1840, 232, 14260, 228, 888, 232, 1972, 224, 752, 232, 748, 224, 752, 228, 1568, 220, 756, 228, 752, 220, 15420, 232, 888, 232, 2240, 228, 752, 228, 2788, 224, 1300, 228, 1292, 232, 1428, 224, 1840, 232, 14264, 224, 888, 232, 884, 224, 1844, 228, 748, 232, 744, 228, 1568, 232, 748, 224, 752, 232

SEVEN 7:
Raw: (71) 224, 892, 224, 2252, 228, 748, 224, 2796, 224, 1296, 232, 1292, 228, 1428, 228, 1840, 232, 14264, 224, 888, 232, 1836, 224, 752, 312, 668, 304, 672, 312, 1616, 236, 744, 312, 664, 316, 15344, 224, 892, 224, 2252, 228, 748, 236, 2784, 224, 1296, 232, 1292, 224, 1432, 228, 1840, 220, 14272, 232, 884, 232, 748, 224, 1840, 232, 748, 224, 752, 312, 1616, 224, 756, 228, 752, 220

EIGHT 8:
Raw: (71) 232, 884, 224, 2252, 228, 752, 228, 2788, 224, 1296, 232, 1292, 224, 1432, 228, 1840, 232, 14264, 224, 888, 232, 1700, 224, 752, 228, 752, 304, 672, 312, 1756, 228, 748, 228, 752, 228, 15428, 224, 896, 220, 2252, 228, 752, 228, 2788, 224, 1300, 228, 1292, 224, 1436, 224, 1840, 232, 14264, 224, 888, 232, 2788, 232, 1832, 228, 752, 232, 744, 228, 1840, 228, 748, 308, 620, 344

NINE 9:
Raw: (71) 232, 888, 232, 2240, 224, 756, 228, 2788, 224, 1300, 224, 1296, 232, 1428, 224, 1840, 228, 14268, 224, 888, 228, 1568, 232, 744, 312, 668, 312, 664, 312, 1892, 228, 748, 224, 756, 312, 15384, 232, 888, 228, 2248, 220, 756, 228, 2788, 232, 1292, 224, 1300, 228, 1428, 224, 1844, 224, 14268, 232, 884, 224, 2660, 228, 1836, 232, 744, 228, 752, 316, 1884, 228, 752, 228, 748, 224

ZERO 0:
Raw: (71) 224, 896, 224, 2248, 228, 752, 232, 2784, 228, 1296, 228, 1292, 224, 1436, 228, 1836, 232, 14264, 224, 892, 228, 2788, 236, 744, 228, 748, 232, 748, 224, 752, 232, 748, 224, 752, 232, 15424, 232, 888, 224, 2252, 224, 752, 232, 2784, 228, 1296, 228, 1292, 232, 1428, 224, 1840, 232, 14264, 224, 892, 228, 1700, 224, 1844, 224, 752, 316, 664, 224, 752, 232, 744, 228, 752, 228

OK:
Raw: (107) 228, 888, 232, 2244, 220, 756, 312, 2708, 228, 1292, 224, 1300, 228, 1428, 224, 1844, 228, 14264, 232, 884, 224, 1844, 228, 748, 224, 756, 228, 1020, 232, 1428, 224, 752, 232, 748, 224, 65180, 232, 888, 232, 2244, 220, 756, 228, 2788, 232, 1292, 228, 1292, 232, 1428, 224, 1844, 228, 14264, 232, 884, 224, 752, 232, 1836, 224, 752, 232, 1020, 224, 1436, 224, 752, 232, 744, 228, 16028, 228, 888, 232, 2244, 220, 756, 312, 2704, 224, 1300, 228, 1292, 232, 1428, 224, 1844, 228, 14264, 224, 892, 228, 748, 308, 1760, 224, 752, 232, 1020, 224, 1436, 228, 748, 224, 752, 228

RETURN:
Raw: (71) 224, 896, 220, 2252, 228, 752, 232, 2784, 224, 1300, 228, 1292, 224, 1436, 224, 1840, 232, 14264, 224, 888, 232, 1292, 224, 752, 232, 748, 224, 1028, 224, 1976, 232, 748, 224, 752, 228, 15520, 224, 892, 228, 2248, 228, 748, 228, 2792, 228, 1292, 224, 1300, 228, 1428, 232, 1836, 232, 14260, 232, 884, 224, 2384, 228, 1840, 232, 744, 228, 1024, 232, 1972, 220, 756, 228, 748, 224

i/PINFO:
Raw: (71) 224, 892, 228, 2248, 228, 748, 224, 2796, 224, 1296, 232, 1292, 224, 1432, 228, 1840, 228, 14268, 228, 884, 224, 1164, 228, 748, 224, 756, 224, 1024, 232, 2108, 224, 752, 228, 748, 228, 15464, 224, 896, 224, 2248, 228, 752, 232, 2784, 224, 1300, 280, 1240, 232, 1428, 224, 1840, 228, 14268, 228, 884, 224, 2252, 224, 1840, 232, 748, 224, 1028, 224, 2112, 232, 744, 228, 752, 228

2015年1月24日 星期六

[Arduino] Make a IR translator to translate IR code of Panasonic TV to Kbro TV box

[Arduino] 製作紅外線遙控轉換器 IR translate Panasonic 電漿電視轉 Kbro 凱擘 (Chinese)

Base on last article [Arduino] Use IRrepeator to capture IR raw code of kbro TV box's remote control, the real purpose is make a device to transfer/translate Tivo IR code to be the code of Kbro TV box. Then I just need setup Lotactionfree client to control Tivo, IR translator will transfer Tivo IR code and emit Kbro IR code for controlling Kbro TV box. The same approach is useful to let Sony Locatoinfree remote control any non-supported machines. (Please look at the video record in the end of this article if you want.)

The same situation, I make this device to transfer the IR code of Panasonic remote control to be the Kbro code. Due to my Panasonic TV provides the features of Skype, Youtube and screen size changing, so using the original Panasonic remote control is more convenient to me:


Looks the type of Panasonic remote control is N20AYB:

The IR codes of Panasonic remote control captured by IRrecvDump as following. Due to Arduino IR library could not recognize type of the code, so it prints Unknow type. The length of following raw data are 100, the hash codes are useful to put into program for comparing the received signatures, so I put all raw data in the note of this article:

Channel UP: Unknown encoding: 4DE74847 (32 bits)
Channel DOWN: Unknown encoding: B8781EF (32 bits)
ONE 1: Unknown encoding: F7283C77 (32 bits)
TWO 2: Unknown encoding: 757FB4DF (32 bits)
THREE 3: Unknown encoding: B33B4597 (32 bits)
FOUR 4: Unknown encoding: 3C03E507 (32 bits)
FIVE 5: Unknown encoding: E705551F (32 bits)
SIX 6: Unknown encoding: A4A58EC7 (32 bits)
SEVEN 7: Unknown encoding: E2E45F7F (32 bits)
EIGHT 8: Unknown encoding: 6BACFEEF (32 bits)
NINE 9: Unknown encoding: E88E91F (32 bits)
ZERO 0: Unknown encoding: 7D168BCF (32 bits)
OK: Unknown encoding: BB0ED9E1 (32 bits)
RETURN: Unknown encoding: D28EF217 (32 bits)
POWER: Unknown encoding: F61E2A57 (32 bits)

After Kbro TV box setup by cable company, I need use this specific remote control to watch TV. I really don't like that because I already have 2 remote control, Panasonic TV and Tivo. So my plan is do not use it, put it to drawer.

Due to Arduino IRremote library also could not recognize the code type of the above Kbro remote control, so I need raw data to be the source of emitting IR signature. The same, I list the raw data of Kbro IR codes in the end of this article, the length is 18.

Then is the hardware part, it's fully the same with IR repeater in my laster article:

The architecture is really simple, connect IR LED power pin to D3 of Arduino Pro mini. And, IR receiver data pin connect to D11 pin of Arduino Pro mini.

The components list:

Arduino mini pro, IR LED, IR receiver (PL-IRM0101-3, datasheet), USB male plugUSB. The total cost of components almost $130 NTD (around $4.5 USD):


IR receiver, I bought PL-IRM0101-3, please note different model has different define of 3 pins. Please check appropriate datasheet. There have 3 pins: Vcc, Vout and GND. Connect Vout to D11 of Arduino pro mini:

USB male plug used to connect 5V DC input to Arduino mini pro, connect the power pin on USB male to Vcc pin:

The leading role, Arduino mini pro, 70 NTD (around $2.2 USD). The cost is OK for DIY but still expensive for production:

Arduino pro mini need a USB program upload, take a picture of it:

Connect with upload:

The connection hint of DuPont lines
upload  connect Arduino mini pro
       DTR connect DTR
       RXI  connect TXO
       TXO connect RXI
       VCC connect VCC
       GND connect GND  


After connected by DuPont lines, then using Arduino IDE to complier and upload.

As description in last article, I already tested circuit by breadboard. So I start create use single side matrix board to layout. My design is put IR receiver behind of Arduino, the IR LED put on the side near the IR receive window of Kbro TV box:

The relative position between the USB port of Kbro box and IR window:

Paste a picture of the final position to see the IR LED status:

The layout of welding as following picture:

The left side, welded IR LED, the LED turn toards to IR receive window of Kbro box:

The right side, I welded female pin slot. It give the option to us for removing Arudino mini pro to other purpose:

The end of board, IR receiver is behind Arduino:

The front of Arduino has USB male, it used to get the 5V DC power:

Ya! Done! It's easier than my another project of reform the x61 IR UltraBase dock. Next is testing:

Of course not just hardware, we need upload program:
https://github.com/smallbeetw/arduinosketch/blob/master/Panasonic2KbroIRtrans/Panasonic2KbroIRtrans.ino

The program is easy, we make a mapping table that's used to map Panasonic IR hash code with kbro raw codes. The program compares the IR code that's received by  IR receiver with the Panasonic hash code in mapping table,   then it emits appropriate kbro raw code when found that match.

After a couple of testing, I modified the part of program is delay time, using 30 got the best result.

This is the video record of result:

The same device can used to transfer the Tivo IR code emitted by Locationfree to be Kbro IR code, so don't need worry for any IR codes didn't support by Locationfree. The approach can applied on SlingBox to solve the problem of non-supported IR code because those kind of devices almost supported Tivo IR code. Just need base on Tivo IR code to transfer to the codes that's we want. Then we can continue to use our expensive Locationfree or SlingBox.


2014-12-12 add:
The original program doesn't binding the power button of Kbro remote control with the power button of Panasonic TV. So I need set my Kbro box always power ON, otherwise I will need use Kbro remote control to power on TV box:

The default setting is auto-shutdown after 24 hours didn't control by human:

So I updated the program to binding power button. Due to my TV box put in TV cabinet, there have a distance between IR receive window of TV. It not always synchronous when power on. So I bind the power button of TV box to DTV/TV button on Panasonic remote control. Please check my code.

After power power binding, then I set the auto-shutdown time to 12 hours:

2014-12-20 add:
Today I used simple USB power meter to measure:

The USB slot on Kbro box looks fine to provide 5V output:

The ampere value smaller than the minimum resolution:


2015-01-10 add:
Add some pictures of USB male pin fore reference how to get 5V input to Arduino:




more: [Arduino] 以 nRF24L01+ 和 RF24 library 製作無線電端點



Notes:
Raw data of Panasonic remote control:

Channel UP:
Unknown encoding: 4DE74847 (32 bits)
3450,1750,450,400,450,1300,450,400,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,1300,450,400,450,400,450,450,450,400,450,400,450,450,400,450,450,400,450,450,400,1300,450,450,400,450,450,400,450,450,400,450,450,400,450,400,450,450,450,400,450,400,450,1300,450,400,450,1300,450,1300,400,450,450,400,450,450,400,450,450,1300,400,450,450,1250,450,1300,450,400,450,1300,450,

Channel DOWN:
Unknown encoding: B8781EF (32 bits)
3400,1750,450,400,450,1300,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,400,450,450,400,450,1300,450,400,450,450,400,450,450,400,450,400,450,450,450,400,450,400,450,450,450,1250,450,450,450,400,450,400,450,450,400,450,450,400,450,450,400,450,450,1300,400,450,450,1250,450,450,450,1250,450,1300,450,400,450,450,450,1250,450,450,400,1300,450,450,400,1300,450,1300,450,400,450,1300,450,

ONE 1:
Unknown encoding: F7283C77 (32 bits)
3400,1750,450,450,450,1250,450,450,400,450,450,400,450,450,400,450,450,400,450,400,450,450,450,400,450,400,450,450,450,1250,450,450,450,400,450,400,450,450,450,400,450,400,450,450,400,450,450,400,450,1300,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,1250,450,450,400,450,450,400,450,450,400,450,450,400,450,400,450,1300,450,400,450,450,450,1250,450,

TWO 2:
Unknown encoding: 757FB4DF (32 bits)
3450,1750,400,450,450,1300,400,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,1300,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,400,450,1300,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,400,1300,450,450,400,450,450,400,450,1300,450,400,450,400,450,450,450,1250,450,450,450,400,450,400,450,1300,450,400,450,450,400,1300,450,

THREE 3:
Unknown encoding: B33B4597 (32 bits)
3400,1750,450,450,400,1300,450,450,400,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,1250,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,1300,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,400,1300,450,450,400,450,450,1300,400,450,450,400,450,400,450,450,450,1250,450,450,450,400,450,1300,450,400,450,400,450,1300,450,

FOUR 4:
Unknown encoding: 3C03E507 (32 bits)
3400,1750,450,400,450,1300,450,400,450,450,400,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,1300,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,400,450,450,450,1250,450,450,450,400,450,400,450,450,450,400,450,400,450,450,400,450,450,1300,400,1300,450,450,400,450,450,1250,450,450,450,400,450,400,450,1300,450,1300,450,400,450,400,450,1300,450,400,450,450,400,1300,450,

FIVE 5:
Unknown encoding: E705551F (32 bits)
3400,1750,450,400,450,1300,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,400,450,450,400,450,450,400,1300,450,450,400,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,1300,450,400,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,1250,450,450,450,1250,450,450,450,400,450,400,450,450,450,400,450,1300,400,450,450,1300,400,450,450,400,450,1300,450,

SIX 6:
Unknown encoding: A4A58EC7 (32 bits)
3400,1750,450,400,450,1300,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,400,450,450,400,450,450,400,1300,450,450,400,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,1300,450,400,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,1300,450,400,450,1300,450,400,450,1300,450,400,450,400,450,450,450,1250,450,450,400,1300,450,450,400,1300,450,450,400,450,450,1250,450,

SEVEN 7:
Unknown encoding: E2E45F7F (32 bits)
3400,1750,450,400,450,1300,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,1300,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,1250,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,1300,450,1300,400,450,450,1250,450,450,450,400,450,400,450,450,450,1250,450,1300,450,400,450,1300,450,400,450,450,400,1300,450,

EIGHT 8:
Unknown encoding: 6BACFEEF (32 bits)
3450,1750,400,450,450,1300,400,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,1300,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,400,450,1300,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,1250,450,1300,450,1300,400,450,450,1250,450,450,450,400,450,400,450,1300,450,1300,450,1250,450,450,450,1250,450,450,400,450,450,1300,400,

NINE 9:
Unknown encoding: E88E91F (32 bits)
3400,1750,450,400,450,1300,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,400,450,1300,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,1300,400,450,450,400,450,450,400,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,1300,450,1250,450,450,450,400,450,400,450,450,400,450,450,400,450,1300,450,1300,400,450,450,400,450,1300,450,

ZERO 0:
Unknown encoding: 7D168BCF (32 bits)
3400,1750,450,400,450,1300,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,450,450,400,450,400,450,1300,450,400,450,450,400,450,450,400,450,450,400,450,450,400,450,400,450,450,450,1250,450,450,450,400,450,400,450,450,450,400,450,400,450,450,400,450,450,1300,400,450,450,400,450,1300,450,1300,400,450,450,400,450,400,450,1300,450,400,450,450,450,1250,450,1300,450,400,450,450,400,1300,450,

OK:
Unknown encoding: BB0ED9E1 (32 bits)
Raw (100): -27668 3450 -1750 450 -400 450 -1300 450 -400 450 -400 450 -450 450 -400 450 -400 450 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -1300 450 -400 450 -400 450 -450 450 -400 450 -400 450 -450 450 -400 450 -400 450 -450 400 -1300 450 -450 400 -450 450 -400 450 -400 450 -450 450 -400 450 -400 450 -450 450 -1250 450 -450 450 -400 450 -1300 400 -450 450 -400 450 -1300 450 -400 450 -1300 450 -400 450 -400 450 -1300 450 -400 450 -450 450 -1250 450 -1300 450

RETURN:
Unknown encoding: D28EF217 (32 bits)
Raw (100): -20988 3450 -1700 450 -450 400 -1300 450 -450 400 -450 450 -400 450 -400 450 -450 450 -400 450 -400 450 -450 450 -400 450 -400 450 -450 400 -1300 450 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -1300 450 -400 450 -400 450 -450 450 -400 450 -400 450 -450 400 -450 450 -400 450 -1300 450 -1300 400 -1300 450 -400 450 -1300 450 -1300 450 -400 450 -400 450 -1300 450 -1300 400 -1300 450 -450 400 -1300 450 -1300 450 -400 450 -1300 450

POWER:
Unknown encoding: F61E2A57 (32 bits)
Raw (100): -15610 3400 -1750 450 -450 450 -1250 450 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -450 400 -450 450 -1250 450 -450 450 -400 450 -400 450 -450 400 -450 450 -400 450 -450 400 -450 450 -400 450 -1300 450 -400 450 -450 400 -450 450 -400 450 -400 450 -450 450 -400 450 -400 450 -1300 450 -400 450 -1300 450 -1300 400 -1300 450 -1300 450 -400 450 -400 450 -1300 450 -400 450 -1300 450 -1300 400 -1300 450 -1300 450 -400 450 -1300 450


The Raw data of Kbro remote control (already removed the first number of serial, length is 18-1=17):

Channel up:
250,850,250,1000,250,700,250,750,200,750,250,2450,250,750,200,750,250

Channel Down
250,850,250,850,250,750,200,750,250,700,250,2600,250,750,200,750,250

POWER:
250,850,250,700,250,750,200,750,250,750,200,2750,250,750,200,750,200

ONE 1:
250,850,250,2650,200,750,200,750,250,750,200,900,200,750,200,750,250,

TWO 2:
250,850,250,2450,250,750,200,750,250,700,250,1000,250,750,200,750,200,

THREE 3:
200,900,200,2400,200,750,200,750,250,750,200,1150,200,750,250,750,200,

FOUR 4:
200,900,200,2250,200,750,200,750,250,750,200,1300,200,750,250,700,250,

FIVE 5:
250,850,250,2100,200,750,250,700,250,750,200,1400,250,750,200,750,250,

SIX 6:
250,850,250,1950,200,750,250,750,200,750,200,1600,200,750,200,750,250

SEVEN 7:
200,900,200,1850,200,750,250,750,200,750,200,1700,250,700,250,750,200,

EIGHT 8:
250,850,250,1650,250,750,200,750,250,750,200,1800,250,750,200,750,250,

NINE 9:
200,900,250,1550,200,750,200,750,250,750,200,1950,250,750,200,750,200

ZERO 0:
200,900,200,2800,200,750,200,750,250,750,200,750,200,750,250,750,200

OK:
250,850,250,1800,250,750,200,750,200,1050,200,1450,200,750,200,750,250

RETURN:
250,850,250,1300,200,750,200,750,250,1000,200,2000,200,750,200,750,250

2015年1月13日 星期二

[Arduino] Use IRrepeator to capture IR raw code of kbro TV box's remote control

[Arduino] 用 IRrepeater 抓取 kbro 凱擘遙控器的 IR raw code (Chinese)

Due to Sony Locationfree already stop supported by Sony. My kbro TV box's remote control IR code set didn't in out-of-box IR code set of Locatoinfree, that causes I can not using Locationfree to control TV box. And, the Locationfree LF-BOX1's out-of-box IR code set is also limited, except it doesn't support kbro TV box, some buttons of Tivo's remote control also doesn't work.

So I want using Arduino to make a IR translator. To translate the Tivo IR code that emitted by Locationfree to be the IR code of kbro box. Then Locationree can support any new TV box through this Arduino translator. The same feature is also useful on Slingbox, you don't need worry for how to create the Slingbox bin file for new IR code.

Before making IR translator, grab the IR codes of remote control of Tivo and kbro is the most important preliminary work. This article introduces how to capture IR code by Arduino. The traditional method is using IRrecvDump in IR remote library of Arduino to capture IR codes. But, it doesn't work to kbro's remote control. I will introduce another useful way to grab the IR code, that's using IRreperter program.

First, I still using the most popular program, IRrecvDump to capture code. The following picture is my wire layout of breadboard: I used 3 pin stereo connector to connect to IR receiver. The red wire connected to 5v output pin of Arduino nano, black wire connect to GND pin, white wire connect to digital 11 pin for data input:



More detail: Red wire to 5V, Black wire to GND, White wire to D11

Runing Arduino IDE, select Arduino Nano w/ ATmega328 in "Board" selection:

More detail steps please google, there have bunch of articles introduced that. Please remember copy IRremote library to libraries folder in Sketchbook then Arduino IDE can find it when restart.

Please open IRrecvDump example in IRremote library, compiler and upload to Arduino. Then please launch Serial monitor to watch the IR code that captured. The printing result as following:

Decoded NEC: A10C7807 (32 bits)
Raw (68): -23088 8950 -4450 550 -1650 550 -550 550 -1650 550 -550 550 -550 550 -550 550 -550 550 -1650 550 -550 550 -550 550 -500 600 -500 550 -1650 550 -1650 550 -550 550 -550 550 -550 550 -1650 550 -1650 550 -1650 550 -1600 600 -500 550 -550 550 -550 550 -550 550 -550 550 -550 550 -550 550 -550 550 -1650 550 -1650 550 -1650 550
A10C7807

If program parser IR code type success, it will print out the type like the above NEC words, and follow a hash number of raw code and raw code data. You can using IR type and hash number, or direct using raw code. If it didn't parser out type, you still can using raw code with raw length to emit IR code. Please write down those codes.

When using Raw code, plesae remove the first number. As the above example, -23088 should discarded, please don't paste to your IRsend program. Then please modify all negative number to positive number, the whole length is 68-1. Then you can paste whole raw numbers to IRsend code to be a unsigned int array for testing. As the above example, it will be like:

8950 4450 550 1650 550 550 550 1650 550 550 550 550 550 550 550 550 550 1650 550 550 550 550 550 500 600 500 550 1650 550 1650 550 550 550 550 550 550 550 1650 550 1650 550 1650 550 1600 600 500 550 550 550 550 550 550 550 550 550 550 550 550 550 550 550 1650 550 1650 550 1650 550

Paste those numbers to program to be array, please remember add comma between 2 numbers. The code like this:
https://github.com/smallbeetw/arduinosketch/blob/master/Panasonic2KbroIRtrans/Panasonic2KbroIRtrans.ino#L50

The following are IR coddes of Tivo's Channel up/down button. I do not list raw code because Arduino captured the NEC type has no problem:

TIVO
    Channel up:        NEC: A10C7807 (32 bits)
    Channel down:    NEC: A10CF807 (32 bits)
Remote control of Tivo like this:



After got IR odes, then we cn try to using IR LED to emit IR code for receiving by devices (TV or set-top box). If devices done corresponding action after received IR code, that menas the code is correct. The layout of breadboard is really simple. Just connect the long pin of IR LED to D3, the short pin to GND:




Here is s stupid story of me.  The first time I try IR LED, I direct connect the long pin to 5v ouptut fro Arduino, then LED blasted immediately. That's my first time saw the LED blasted, it's dangerous to my eyes.
As you see in the above picture, I didn't add resistance in long pin because current didn't continue output through D3 pin, so should not like direct connect to 5v pin. But, add resistance is still a better idea for safety

The sofeware of emit IR code is easier than dump, just need jsing IRsendDemo in Arduino IDE. Modify the code type and hash number. Compiler and upload to Arduino, open Serial Monitor and key-in any character to trigger IR code emitting.  Waiting the reopnse of set-top box to verify the code correct.

if you wan to check does IR LED really work. Due to infrared ray could not see by human being. You can using a digital camera to monitor it.

The above steps is the popular way from internet to capture IR code through IRrecvDump. But this way doesn't always work, some remote control's codes are hard to capture by IRrecdump. I don't know why, maybe that has problem in IR remote library. I am not a IR expert, and I am no oscilloscope to check that.

Unfortunately,the remote control of kbro TV box on my hand is this kind of thing:



For grab the IR code of kbro remote control, I spend whole day until 2 am. Finally I find the way to capture IR code more easily. I modified my IR repeater program, add codes for print out IR raw code:
https://github.com/smallbeetw/arduinosketch/blob/master/IRrepeator/IRrepeator.ino

The advantage of this program is like merged IRreceDump and IRsend. That means Arduino grab the raw code then emit immediately through sendRaw() from IR LED. So, I call it IRreperter. This kind of device sale on many store on internet. It's useful to extend the IR receive window on device. e.g. if the IR receive window of TV covered by speaker, or DVD player put in cabinet. Then this device is useful to repeat IR code to other direction or space.

The breadboard layout as following, just put IR receiver and IR LED on the same board:

The simply circuit as following:



The benefit of IRrepeater is for some remote control that Arudino SOMETIME can capture IR code, but the success rate is not too high. Then we can just put button continuously, IRrepeater will emit IR code to set-top box continuously until we saw box response the code. Then we can confirm the code is valid and write it down.

Simply say, when using IRreperter, user can test the raw code immediately. Don't like the IRreceDump, need paste raw code to IRsend program to check, then using IRrecvDump capture again if the code invalid.

Through this way, I captured raw code of the channel up/down button, I will post other keys when I have time. (found the fail rate is really high for grab the code of kbro remote control):

KBRO
  Channel UP:         250,850,250,1000,250,700,250,750,200,750,250,2450,250,750,200,750,250
  Channel DOWN:   250,850,250,850,250,750,200,750,250,700,250,2600,250,750,200,750,250

I used 
sendRaw(sendRawCodes,17,38), and add delay(40). Confirm the above codes are available. Some information from internet say the 38 hz for IR is because this frequency does not use in the nature, it can avoid too many noise.

Except the way to use IRreperter to grab the remote control for SOMETIME work. Some other solutions may worth to try: like some Sony remote control used 40 hz, or Samsung's raw code length sometimes longer then the default size of RAWBUF 100 (Please modify the RAWBUF length define in IR remote library from 100 to 400). And set a longer delay when testing, using 1000 to avoid too fast to emit next code of next cycle. The above are some hints from internet that can try when IRrecDump doesn't work to you.

In this time, I also capture the IR codes of Sony Locationfree LF-Box1's RM-Box1 remote control. This remote control is special and not easy to find on market. So, list the IR codes here for reference:



RM-BOX1
  UP:                    Decoded SONY: 4EB31 (20 bits)
  DOWN:             Decoded SONY: CEB31 (20 bits)
  LEFT:                 Decoded SONY: AEB31 (20 bits)
  RIGHT:               Decoded SONY: 2EB31 (20 bits)
  決定:                  Decoded SONY: 6EB31 (20 bits)
  畫面xxx:             Decoded SONY: 14B31 (20 bits)
  右下:                   Decoded SONY: 34B31 (20 bits)
  左上:                   Decoded SONY: ACB31 (20 bits)
  戾xxx:                  Decoded SONY: 54B31 (20 bits)
  電源:                   Decoded SONY: A8B31 (20 bits)
  入力切換:           Decoded SONY: A4B31 (20 bits)
  畫面表示:           Decoded SONY: 44B31 (20 bits)
  設定:                   Decoded SONY: 4B31 (20 bits)
  XXX電源:           Decoded SONY: A90 (12 bits)
  入力切換(左上): Decoded SONY: A50 (12 bits)
  音量(+):               Decoded SONY: 490 (12 bits)
  音量(-):                Decoded SONY: C90 (12 bits)
  消音:                    Decoded SONY: 290 (12 bits)

more: 
[Arduino] Make a IR translator to translate IR code of Panasonic TV to Kbro TV box