17

I would like to control my TV using a Raspberry Pi. I would like my Raspberry Pi to act like a TV remote controller.

What kind of hardware do I need to make it? Do I need something like IR emitter, and if so, where to buy such hardware? …or does the Raspberry Pi already have an IR transmitter and I didn't know?

I have already Google'd my question but the topics I found speak about how to control the Raspberry Pi with Infrared which it's not what I want. I want the opposite: I want my Raspberry Pi to control my TV using IR. I also found we can control the TV thanks to HDMI cable (if TV is compatible) but this unfortunately not convenient to me.

Here is a schema that explain how see the thing. My question is about step 2:

Schema

grg
  • 113
  • 6
Ashbay
  • 373
  • 1
  • 2
  • 9

2 Answers2

10

I have tried this one, it connects into the USB port, can record and play back the IR codes, supported by LiRC. I have even tried to plug it into my Android phone and it works there as well.

lenik
  • 11,533
  • 2
  • 32
  • 37
10

As an alternative to Infrared, you could use HDMI, if your TV has HDMI 2.0, it will support some kind of CEC (Consumer Electronics Control) implemenatation

Each TV brand calls this something else, like Panasonic Viera Link. But it all uses the same standard just some TV's implement more, some less but the basics should be there. Like turn TV on or off, navigate channels, etc.

cec-o-matic is a useful tool to try and help you decode message that the array of HDMI devices are sending across the CEC network. Remember that you can also control the Pi form the TV via a remote, but that can also be an AMP, Blu Ray Play, etc. It is uni directional.

You would need to build CEC-CLIENT so you first need a few dependencies

apt-get install build-essential autoconf liblockdev1-dev libudev-dev git libtool pkg-config

Then get it from GIT and build

git clone git://github.com/Pulse-Eight/libcec.git
cd libcec
./bootstrap
./configure --with-rpi-include-path=/opt/vc/include --with-rpi-lib-path=/opt/vc/lib --enable-rpi
make
make install
ldconfig

You can then check if the CEC device is working properly on the Pi by using this console command

cec-client -l

Here are a few more commands to get you going

  • Scan the CEC bus, and report all devices:
    • echo "scan" | cec-client -s -d 1
  • Check the power status of the TV (device 0):
    • echo "pow 0" | cec-client -s -d 1
  • Turn the TV on:
    • echo "on 0" | cec-client -s -d 1
  • Turn the TV off:
    • echo "standby 0" | cec-client -s -d 1

It might be a bit difficult to work out all the commands at first but it is a very robust way to control devices connected via HDMI.

Most tutoritals show how to control the Pi via the TV, like XBMC does. Basically you use your TV remote to navigate the menu on the XBMC. But you can do it other way too.

I hope this helps somebody in the future as an alternative to Infradead.

Piotr Kula
  • 17,336
  • 6
  • 66
  • 105