Skip to content

libbymiller/lirc-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lirc example

The idea here is to control a chromium webpage via a simple remote control (the usecase I am using it for is full-screen TV-like prototypes). More information is in this blog post: https://planb.nicecupoftea.org/2016/12/23/lirc-on-a-raspberry-pi-for-a-silver-apple-remote/

What you need to do

  • Gather hardware
  • Image an SD card for the Pi
  • Install pre-requisites and this repo
  • Make it all run on boot

Hardware

You will need

With the pi switched off, attach the IR receiver as shown:

i.e. in this gpio diagram: https://www.raspberrypi.org/documentation/usage/gpio-plus-and-raspi2/

  • GPIO 18 ir (1)
  • ground to centre leg (2)
  • 3.3V to ir power (3)

Image a Micro SD card

Download a full Jessie, not lite or NOOBS. I'm asumming 2016-09-23 release and a Pi3. This is on a Mac.

(N is a number, usually 2 for me)

diskutil list
diskutil unmountDisk /dev/diskN
sudo dd bs=1m if=~/Downloads/2016-09-23-raspbian-jessie.img of=/dev/rdiskN

While the SD card is still in your main machine, in config enable lirc module

sudo pico /Volumes/boot/config.txt

Uncomment this to enable the lirc-rpi module

dtoverlay=lirc-rpi

Depending on your version of Jessie, you may need to enable ssh (again before ejecting)

touch /Volumes/boot/ssh

Install prerequisites

Login to the pi

sudo apt-get install lirc #needed ??
sudo apt-get install xdotool

get this repo

git clone [email protected]:bbc/lirc-example.git

if you want to record your own remote

irrecord -d /dev/lirc0 my-remote.lircd

or use the one provided (for an appleTV 2nd gen - silver remote)

sudo cp lirc-example/lirc/my-remote.lircd /etc/lirc/lircd.conf

cp lirc-example/lirc/lircrc > /home/pi/.lircrc
cp -r lirc-example/lirc/keycommands /home/pi/

Autostart Chromium and LIRCD and a tiny server

pico ~/.config/lxsession/LXDE-pi/autostart

make the contents of that file run chromium fullscreen on startup:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi

@xset s off
@xset -dpms
@xset s noblank

@/usr/bin/chromium-browser --kiosk --disable-infobars --disable-session-crashed-bubble --no-first-run http://localhost:3000

Make the server and irexec run on boot by adding to rc.local

sudo pico /etc/rc.local

add before exit 0

cd /home/pi/lirc-example/server && /usr/bin/python -m SimpleHTTPServer 3000 &

(sleep 3;
sudo -u pi irexec -d
)&

Reboot

It should boot into the tiny python server and you should be able to see the javascript keycodes displayed by clicking the remote.

Links

lirc

xdotool

irexec

About

Example LIRC on a Pi with full-screen Chromium and a silver AppleTV remote

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published