Клонируем пульт на Android

«Умная» техника давно перестала быть чем-то дорогим или редким. Для комфортного использования интеллектуальных устройств разработчики предлагают специальные пульты, которые, в свою очередь, имеют ряд недостатков. Если у вас дома несколько устройств с ПДУ, наверняка вы не раз пытались переключить каналы в телевизоре дистанционкой от сплит-системы. Опять же, сами пульты — штука зачастую непрочная… Мой пульт от акустики Dialog J-101 совсем развалился и как обладатель телефона с IR портом возникло желание клонировать этот пульт на Android. После нескольких дней поиска кодов пульта и ‘курение’ мануалов вот, что вышло…

1. Снимать сигналы с пульта будем через микрофонный вход звуковой карты компьютера, для этого припаяем 3.5 audio jack прямо к выводам ИК диода, полярность значения не имеет, подадим питание на пульт…

2. Необходимо настроить вход микрофона на максимальную громкость и усиление сигнала

3. Снимать и детально анализировать сигнал — (модуляция, временные характеристики, особенности кодирования, коды повтора…) будем при помощи программы RCExplorer

Программа определила что пульт работает по NEC протоколу, читаем документацию разбираем сигнал…

4. Согласно принятому сигналу запишем нашу последовательность импульсов, на примере кнопки Power

             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560     560     560    1700     560    1700
              560    1700     560    1700     560    1700
              560    1700     560    1700     560    1700
              560

5. Создадим конфиг файл в формате winlirc

begin remote
 
  name  dialog_winlirc.conf
  flags RAW_CODES|CONST_LENGTH
  eps            30
  aeps          100
 
  gap          108041
 
      begin raw_codes
 
          name Power
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560     560     560    1700     560    1700
              560    1700     560    1700     560    1700
              560    1700     560    1700     560    1700
              560
 
          name Mute
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560    1700     560     560     560     560
              560     560     560     560     560     560
              560     560     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560    1700
              560
 
          name Reset
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560     560     560    1700     560     560
              560     560     560     560     560     560
              560     560     560    1700     560    1700
              560     560     560    1700     560    1700
              560    1700     560    1700     560    1700
              560
 
          name Balance-L
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560    1700
              560     560     560    1700     560     560
              560     560     560     560     560     560
              560     560     560     560     560    1700
              560     560     560    1700     560    1700
              560    1700     560    1700     560    1700
              560
 
          name Balance-R
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560    1700     560    1700     560     560
              560     560     560     560     560     560
              560     560     560    1700     560     560
              560     560     560    1700     560    1700
              560    1700     560    1700     560    1700
              560
 
          name 5.1CH-IN
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560     560     560     560     560    1700
              560     560     560     560     560     560
              560     560     560    1700     560    1700
              560    1700     560     560     560    1700
              560    1700     560    1700     560    1700
              560
 
          name 2.1CH
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560    1700
              560     560     560     560     560    1700
              560     560     560     560     560     560
              560     560     560     560     560    1700
              560    1700     560     560     560    1700
              560    1700     560    1700     560    1700
              560
 
          name Vol+
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560    1700     560     560     560    1700
              560     560     560     560     560     560
              560     560     560    1700     560     560
              560    1700     560     560     560    1700
              560    1700     560    1700     250    1700
              560
 
          name Vol-
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560     560     560     560     560     560
              560     560     560    1700     560     560
              560     560     560     560     560    1700
              560    1700     560    1700     560    1700
              560
 
          name Stereo
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560     560     560    1700     560    1700
              560     560     560     560     560     560
              560     560     560    1700     560    1700
              560     560     560     560     560    1700
              560    1700     560    1700     560    1700
              560
 
          name 5.1CH
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560    1700
              560     560     560    1700     560    1700
              560     560     560     560     560     560
              560     560     560     560     560    1700
              560     560     560     560     560    1700
              560    1700     560    1700     560    1700
              560
 
          name Sub+
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560     560     560     560     560     560
              560    1700     560     560     560     560
              560     560     560    1700     560    1700
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560
 
          name Sub-
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560     560     560    1700     560     560
              560    1700     560     560     560     560
              560     560     560    1700     560    1700
              560     560     560    1700     560     560
              560    1700     560    1700     560    1700
              560
 
          name Cen+
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560    1700
              560     560     560     560     560     560
              560    1700     560     560     560     560
              560     560     560     560     560    1700
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560
 
          name Cen-
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560    1700
              560     560     560    1700     560     560
              560    1700     560     560     560     560
              560     560     560     560     560    1700
              560     560     560    1700     560     560
              560    1700     560    1700     560    1700
              560
 
          name Sur+
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              560    1700     560     560     560     560
              560    1700     560     560     560     560
              560     560     560    1700     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560
 
          name Sur-
             9000    4560     560     560     560     560
              560     560     560     560     560     560
              560     560     560     560     560     560
              560    1700     560    1700     560     560
              560    1700     560    1700     560    1700
              560    1700     560    1700     560     560
              520    1700     560    1700     560     560
              560    1700     560     560     560     560
              560     560     560    1700     560     560
              560     560     560    1700     560     560
              560    1700     560    1700     560    1700
              560
 
      end raw_codes
 
end remote

6. Конвертируем winlirc конфиг в amsr для андроид по ссылке https://www.anymote.io/convert/lirc2amsr.php

{"name":"Dialog","all_codes":[{"function":"Power","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,65,21,65,21,65,21,65,21,65,21,65,21,1557,"},{"function":"Mute","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,65,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,65,21,1557,"},{"function":"Reset","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,21,21,65,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,1557,"},{"function":"Balance-L","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,65,21,21,21,65,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,1557,"},{"function":"Balance-R","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,65,21,65,21,21,21,21,21,21,21,21,21,21,21,65,21,21,21,21,21,65,21,65,21,65,21,65,21,65,21,1557,"},{"function":"5.1CH-IN","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,21,21,21,21,65,21,21,21,21,21,21,21,21,21,65,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,1557,"},{"function":"2.1CH","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,65,21,21,21,21,21,65,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,1557,"},{"function":"Vol+","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,65,21,21,21,65,21,21,21,21,21,21,21,21,21,65,21,21,21,65,21,21,21,65,21,65,21,65,10,65,21,1569,"},{"function":"Vol-","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,65,21,65,21,65,21,21,21,21,21,21,21,21,21,65,21,21,21,21,21,21,21,65,21,65,21,65,21,65,21,1557,"},{"function":"Stereo","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,21,21,65,21,65,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,21,21,65,21,65,21,65,21,65,21,1557,"},{"function":"5.1CH","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,65,21,21,21,65,21,65,21,21,21,21,21,21,21,21,21,21,21,65,21,21,21,21,21,65,21,65,21,65,21,65,21,1557,"},{"function":"Sub+","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,21,21,21,21,21,21,65,21,21,21,21,21,21,21,65,21,65,21,65,21,65,21,21,21,65,21,65,21,65,21,1557,"},{"function":"Sub-","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,21,21,65,21,21,21,65,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,21,21,65,21,65,21,65,21,1557,"},{"function":"Cen+","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,65,21,21,21,21,21,21,21,65,21,21,21,21,21,21,21,21,21,65,21,65,21,65,21,21,21,65,21,65,21,65,21,1557,"},{"function":"Cen-","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,65,21,21,21,65,21,21,21,65,21,21,21,21,21,21,21,21,21,65,21,21,21,65,21,21,21,65,21,65,21,65,21,1557,"},{"function":"Sur+","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,21,65,21,21,21,21,21,65,21,21,21,21,21,21,21,65,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,1557,"},{"function":"Sur-","code1":"38028,342,173,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,65,21,65,21,21,21,65,21,65,21,65,21,65,21,65,21,21,20,65,21,65,21,21,21,65,21,21,21,21,21,21,21,65,21,21,21,21,21,65,21,21,21,65,21,65,21,65,21,1559,"}]}

7. Установим на Android программу Smart IR Remote — AnyMote и импортируем полученный файл, настроим интерфейс пульта. Вот и все, все работает!

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *