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
    Its easy. You have to interface a IR transmitter, that matches with your TV remote and send commands via gpio – askmish Jul 29 '14 at 13:31
  • @askmish I agree with what you said but (as I'm a totally noob regarding hardware connectivity) how to interface the IR transmitter with the raspberry ? (for instance an IR from an unused TV remote but I dont know how to connect the IR to the raspberry, as I said I'm a noob). – Ashbay Jul 29 '14 at 15:27
  • Just leaving this here: http://alexba.in https://github.com/alexbain/lirc_web http://upverter.com/alexbain/f24516375cfae8b9/Open-Source-Universal-Remote – Yet Another User Jul 30 '14 at 03:18

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,541
  • 1
  • 30
  • 37
  • Upvote, this is the kind of hardware I am looking for. Bonus question : Do you know any possiblity to connect a IR from an unused TV remote to the raspberry ? – Ashbay Jul 29 '14 at 15:31
  • @Ashbay short answer: "NO", long answer -- TV remote usually has a microcontroller that scans the remote keypads and sends signals through the IR LED to the TV set. Most likely this microcontroller has no external connectors to be connected anywhere besides keypad and IR LED. – lenik Jul 30 '14 at 12:14
  • @lenik Would this be a potential solution to "program" a satellite receiver? I a consider a project to "remotely" program the receiver for someone else. – user10853 Nov 13 '16 at 19:07
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,307
  • 6
  • 65
  • 104
  • Just a minor correction, CEC was fully fleshed out in the HDMI 1.2a spec. HDMI 2.0 is very new (as of 2015) and primarily focuses on 4K video and enhanced audio capabilities. – zim2411 Jun 23 '15 at 14:03