IR remote using ESP8266 to power down AV devices



  • In domoticz I have a switch all off, what powers down all lights and heating with some delays to prevent issues due to trafic overload.

    Now I wanted to also power down my TV, Radio, DVD, ITV receiver and WD life TV when all lights go off.
    In case we leave home or go to sleep at night and we forgot to power down something.

    I started using a normal arduino nano with the IRremote.h and mysensor 1.6 beta to make the ESP8266 a gateway and IO module all in one.

    Sending the IR codes for sony was easy, Sony IR library knows power toggle/on/off, so I don't need to know the state, to switch de devices off.
    But my Motorola vip1853 and WD live TV only know power toggle, so current state needs to be know to power the device only off and not on.

    Motorola vip1853 / KPN ITV
    alt text
    The IR code was an issue, since the signal is 56khz instead of the normal 40khz, a normal raw decoder/receiver did not provide me a repeatable raw IR code to send to the unit... actually every time I got a different code that was not making any sense at all!
    I found that in LIRC this code is named canalsatld, but that is not known in the IR lib in adruino....
    I used IrScrutinizer to generate raw code for ITV, store this in a file and copied that into my sketch... and the power toggle worked!

    • USB 5V is always active when the unit has power, so cannot be used to detect on/off state
    • Service is always running so Ping or Arp cannot be used to detect on/off state
    • Unit is under warrenty to signal cannot be tabed of the power LED (green=on red=off)
    • Scart signals are all availble, sync signal on is different from sync signal off, in oder to power on other devices

    Scart
    alt text

    • Pin 19 used as video sync output
    • This signal was used historically to switch on the TV by external devices like VCR or DVD
    • Off state=1.18V and on stated=1.4V (DC voltage)
    • Sync signal is modulated and to real DC
    • When measuring the frequency of the signal you know if the device is on or off
    • Comparing the frequency to a reference (somewhere half way between on and off state) can translate this to a digital on/off state

    to check if the device is on through the scart plug I use this circuit:
    alt text

    Power supply
    since both units have a free USB port, I use this to get my 5V, power the ESP8266 and power the IR leds

    IR leds
    the unit currently has 2 * 3.5mm mono jacks that can both power 2 IR led's, with + in the tip and - on the frame end
    the IR leds I use have more then enough power to hide them in a corner of the cabinet out of site from the living, but insite for the devices.

    WD live TV
    alt text
    Next is the WD live TV unit, there’s a very simple API for sending simulated commands from the remote control – it involves POSTing a little JSON fragment to a CGI script on the box. You can observe the protocol simply by using the web based remote provided by the built-in web UI.
    w is to power toggle the unit and can be done from the command line
    curl -s -d '{"remote":"w"}' -v http://your.wdtv.ip/cgi-bin/toServerValue.cgi

    multiple people have projects on this, like
    http://blog.dixo.net/category/wdtv/
    http://wdlxtv.com/

    but from the api, i cannot figure out the current state of the unit (power on or off)
    the service is always runing so arp-scan and ping don't work

    since the unit has no scart plug, I need to figure out from HDMI pin 19 likely if the device is on or off
    that is my next project...

    Mysensor gateway
    when the mysensor gateway receives a message to switch one of the devices, it will allways send the sony signals to power devices off, because that cannot hurt. next it checks if the ITV unit is on, if so it will send the power toggle signal, if the unit is off, nothing will be send.
    Same is done for the WD live TV unit, if it is off nothing happens if it is on, the power toggle will be send.
    Next to that the is a test switch that will send all signals if pushed, just to check my code and the sketch checks the stateus of the units every 30 minutes and forwards that data to the server, in case the connection failed when a device changes state.

    All is processed in the sketch below
    http://home.kpn.nl/fwiegers1995/code/GatewayESP8266_IR_remote_demo.ino
    an issue was found with the transfer from a arduino nano to the ESP8266, the send sony signals did not work anymore so the code has to be send in raw format...
    I looked into fixing the IRremoteESP8266.h library, got a long way but got distracted and later decided to just send the code in raw

    The result:
    from a breadboard
    alt text
    to a small box with all fitted inside
    alt text
    only the box was not heigh enough to have the ESP-12 in a normal header on be baord
    alt text
    alt text
    alt text


Log in to reply
 

Suggested Topics

  • 8
  • 1
  • 1
  • 3
  • 44
  • 90

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts