Turning an iMX6 board into a perfect mediacenter certainly requires to be able to interact thanks to an IR remote command.
Some of you may think it is a thing of the past and a nice remote application on a smartphone is the way to go but I may be quite old school as I still think that a plain old remote is very useful.
If your TV and your board support CEC, then your TV remote can be the right candidate. Unfortunately, as I pointed in a previous article, only a few products (utilite being the only one I have successfully tested so far) wire correctly the CEC signal.
If you are unlucky with CEC, a IR receiver may be very welcome. Here again there are no many imx6 boards/products which have such a feature. As far as I know solidrun cuboxi products/boards are the only one.
So when a user, Rene vand den Braken, sent to me a way to add this feature thanks to a very cheap component 2 months ago, I though it is worth sharing this with all of you. (I am ashamed for being so long to write this article).
The wandboard will be used here but the same kind of hack can be done on any imx6 board with VCC/GND and a GPIO available on headers with minor modifications.
At last, it is worth mentioning that the initial driver/idea comes from Aron Robert Szabo and his work on RaspberryPi and that even if this hack works fine at least for Rene and I, you decide to realize it under your own responsibility and we will not be responsible if you damage your board…
At hardware level, we use a Vishay TSOP4838. It is a very affordable component : I have been able to order 5 pieces for 2.6$ (shipment included) on ebay.
You can read the whole datasheet but here is what you need to know :
The TSOP has 3 pins :
1 = OUT, 2 = GND, 3 = Vs
For our example, we will connect the TSOP on the JP4 header
And we will connect :
- TSOP 2 to JP4 pin 19
- TSOP 3 to JP4 pin 1
- TSOP 1 to JP4 pin 18
Here is how it looks like on my own wandboard
Changes are required in the kernel (they will be included in my next image of course).
First the GPIO has to be freed from the generic GPIO framework to be usable for our needs. For now, the used pin is hardcoded and you will have to change this by yourself if you decide to use another GPIO.
Then, a dedicated lirc driver (lirc_wand.c) is required : This driver has been provided by René (as a derivative work from Aron lirc_rpi.c driver).
All the required changes are available in this commit
This new kernel driver will behave as a lirc_serial driver and the standard userspace lirc tools will be usable after loading it by :
Maybe I can summarize how to start quickly with lirc user tools :
irrecord -n -d /dev/lirc0 myremote.conf
will enable to create a new configuration file for your remote.
You can launch lircd that way :
lircd -d /dev/lirc0 /path/to/myremote.conf
And, at last, you can test the correct behavior by launching
and pressing buttons on your remote
Many LIRC tutorials will give you further details…
That’s it ! Now, you can have fun with your IR remotes.
All this work can easily be adapted for another imx6 board…