journal of recreational computer science

home

Get the Apple A1156 IR remote to work with LibreELEC on a Raspberry Pi

22 Jul 2018

Got a remote like this one?

Apple Remote

First, you’ll need an IR receiver.

Get a Vishay TSOP38438 or a similar. The important parameters are: operating voltage (3.3v), and carrier frequency (38kHz). Your receiver looks more or less like this:

20180722-ir-receiver-38khz.jpg

Pins are numbered from 1 to 3 starting from the left with the lens facing up. Connect pin 1 to GPIO18 (pin 12) on the Raspberry Pi, pin 2 to any GND/ground pin (6, 9, 14, 20, 25, 30, 34, 39 on the Raspberry Pi), and pin 3 to any 3.3V pin (1 or 17 on the Raspberry Pi).

Enable the gpio-ir driver

Add the following to the end of your /flash/config.txt file:

dtoverlay=gpio-ir

Assign the correct keymap

The linux kernel reads flashes from the IR remote and needs to translate them into events readable by Kodi.

Paste the following into the following file - /storage/.config/rc_keymaps/a1156:

# table a1156, type: NEC
0x87eeda0a KEY_UP
0x87eeda0c KEY_DOWN
0x87eeda05 KEY_ENTER
0x87eeda06 KEY_RIGHT
0x87eeda09 KEY_LEFT
0x87eeda03 KEY_ESC

Set up the keymap to be loaded as default by pasting the following into /storage/.config/rc_maps.cfg:

* * a1156

Reboot your Pi

Your kodi instance, once loaded should now respond to your Mac remote.

Troubleshooting: Is my remote sending signals?

Grab your smartphone and turn on your camera. Then point the camera at the IR LED in the remote and press a button. You should see flashes - if not, your remote probably doesn’t work.

Troubleshooting: Does my IR receiver work?

Log into your Raspberry Pi and run ir-ctl -r and press some buttons on the remote. If you see a bunch of output like this, your remote is picked up by the IR receiver:

pulse 561
space 605
pulse 542
space 627
pulse 564
space 607
pulse 560
space 606
pulse 561
space 608
pulse 563
space 607
pulse 538
space 1756
pulse 569
space 601
pulse 562
comments powered by Disqus