g33kyg1rl
Posts: 6
Joined: Sun Apr 19, 2015 5:02 am

How to get an GPIO IR remote to work on Pi 2

Mon Apr 20, 2015 5:46 am

My MCE remote (that I use with IR receiver) isn't working on my Pi 2, although it worked with my B+. Upon each start up, I get a CEC updated notification, although my crappy Element off-brand TV doesn't support CEC as far as I know. Does anyone know how I can get my remote to work with the Pi2?

(EDIT!!!!) Brain fart!! Just realized I had to wipe the SD card to use it on the Pi 2...don't know where my head was there for a bit. Oh, yes I do...In Fibro Fog! My question should be....can anyone point me in the direction of a tutorial on how to set up a GPIO remote? The simpler the better. THANKS!

chateau
Posts: 4
Joined: Tue Feb 17, 2015 12:36 am

Re: How to get an GPIO IR remote to work on Pi 2

Mon Apr 20, 2015 2:34 pm

I have a GPIO IR remote working on my PI 2 running OpenELEC 5.0.8 as I recall.

I am using an Ortec VRC-1100 (actually a Logitech 300 remote set as a VRC-1100). The following file locations apply to OpenELEC so if you use another the locations may be different.

I used an IR Receiver I had lying around that probably came off of an HDMI Switch. It had a stereo plug on it which I cut off. I connected the RED wire to GPIO Header Pin 2 (5 volts since it would not work on GPIO Header Pin 1 3.3 volts), Black Wire to GPIO Header Pin 6 (GND) and White Wire to GPIO Header Pin 12 (which is GPIO Input 18 as I recall). NOTE. I also purchased an IR Receiver from Amazon that worked with my VRC-1100 remote and I was able to connect the RED Wire to GPIO Pin 1 (3.3 volts) for it. Link http://www.amazon.com/Infrared-Receiver ... r+receiver

After you have your IR Receiver connected, use Putty to ssh into your PI 2 and use nano editor to add a line to /flash/config.txt

mount -o remount,rw /flash
nano /flash/config.txt

scroll down to the end of config.txt and add

# added to enable lircd used with gpio IR Receivers
dtoverlay=lirc-rpi

# NOTE the above entry should be all you need but if if not add the following but remove the # at beginning
# dtoverlay=lirc-rpi,gpio_in_pin=18

write the data to config.txt and exit nano editor

mount -o remount,ro /flash
reboot

and continue as follows

You will need to either create or find a ' lircd.conf ' file for your particular remote (or remotes). There are lircd.conf files available at this link http://lirc-remotes.sourceforge.net/remotes-table.html or http://lirc.sourceforge.net/remotes/ and you may or may not find yours there.

You can also use Putty to ssh into your PI 2 and use ' irrecord ' command to create a lircd.conf file using your remote. It is tricky to get going and understand how to use but does have on screen instructions as you go.

I never could get it to create lircd.conf for my VRC-1100 until I used a VRC-1100.conf file I found somewhere at one of the above links as a ' template ' (but it did not have keys 0 - 9 defined and other keys I needed ) and then was able to record my remote keys into my own vrc-1100.conf file for later use.

To use a ' template ' , use Putty to ssh in to your PI 2 and do the following (I used the vrc-1100.conf file I had found at one of the above links which I had placed in /storage/.kodi/userdata/vrc-1100.conf and yours may be different)

killall lircd
irrecord /storage/.kodi/userdata/vrc-1100.conf

which will create a new file in /storage/.kodi/userdata/vrc-1100.conf.conf

Note: it adds .conf to the new file name and does not change the original template file.

Only new keys (buttons) that you have defined will be in this new file. Once you have all your keys defined and finish with irrecord, you can then rename your new file to lircd.conf and place it in /storage/.config/lircd.conf

You will need to modify the remote name in lircd.conf once it is created.

The first few lines of my lircd.conf looked like this
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.1-git(default) on Sat Apr 11 10:36:41 2015
#
# contributed by
#
# brand: ORTEK
# model no. of remote control: VRC-1100
# devices being controlled by this remote:
#

begin remote

name VRC-1100
After a reboot, you can see if your remote is working at this point by using Putty to ssh into your PI 2 and typing

irw

and if things are working you will see the remote's keys being recognized and displayed on screen.

You will now need ' Lircdmap.xml ' (Note: the capital ' L ') to be placed in /storage/.kodi/userdata/Lircdmap.xml

and ' remote.xml ' to be placed in /storage/.kodi/userdata/keymaps/remote.xml

You can find the system default ' Lircdmap.xml ' at /usr/share/kodi/system/Lircdmap.xml and ' remote.xml ' at /usr/share/kodi/system/keymaps/remote.xml. Both are read only so copy them to the locations I have shown above and then modify them as needed for your remote. It is my understanding the system will use your Lircdmap.xml and remote.xml files instead of the defalts.

In my case (and probably yours) the name of my remote had to be "devinput" in Lircdmap.xml to get things working. I also added <altname>VRC-1100</altname> just below but never did prove it was actually needed. The first few lines of my Lircdmap.xml looked like this
<lircmap>
<remote device="devinput">
<altname>VRC-1100</altname>
Good luck, it can be done.

g33kyg1rl
Posts: 6
Joined: Sun Apr 19, 2015 5:02 am

Re: How to get an GPIO IR remote to work on Pi 2

Tue Apr 21, 2015 9:38 pm

I tried to get as far as logging into an SSH with Putty and it timed out. I think I give up. I'm gonna buy a USB remote I think. There needs to be a person who offers this as a paid remote service.

chateau
Posts: 4
Joined: Tue Feb 17, 2015 12:36 am

Re: How to get an GPIO IR remote to work on Pi 2

Tue Apr 21, 2015 11:06 pm

I tried to get as far as logging into an SSH with Putty and it timed out.
If it timed out you probably had the wrong IP Address of your Raspberry. If you are not sure of the IP Address, can you login to your router and see what devices are connected? If your router supports it you can also give your Raspberry a ' fixed IP Address ' by using it's MAC Address.

Not sure what system you are running but OpenELEC username and password are

root
openelec

g33kyg1rl
Posts: 6
Joined: Sun Apr 19, 2015 5:02 am

Re: How to get an GPIO IR remote to work on Pi 2

Mon Apr 27, 2015 12:13 am

I thought I would post an update. I went as far as getting in with Putty, kept getting confused (I do computer repairs, not programming), so I said screw it and bought a USB remote instead. I don't have the patience for this. I will just sell my GPIO receiver and remote with my B+ when I get around to doing that.

cotofana_J
Posts: 1
Joined: Tue Dec 20, 2016 11:57 am

Re: How to get an GPIO IR remote to work on Pi 2

Tue Dec 20, 2016 12:05 pm

Hello,

I also have a configuration like this and it is working.
However, there is a small issue that is bothering me. I use my tv also for other activities which do not use the Raspberry Pi as source (Terrestrial TV, other sources, etc). Therefore, anytime I change the input of the TV to anything else than KODI, the RPI will still receive the IR commands from the remote. In this case it is possible to do some damage in the RPI menu without even knowing.

Do you know if there is any possibility to detect (from the RPI) if the device connected (TV) is displaying the image received from the RPI HDMI (if RPI HDMI is the active source on the TV)? I'm thinking of creating a script which will deactivate the IR remote input when RPI is not used.

Return to “Media centres”