Setting up PiFace Control And Display to use a remote

Before using an IR remote with PiFace CAD you must first install and setup Linux infrared Remote Control.

Automatic Install

There is a script to do this automatically. Open a Terminal and type wget https://raw.github.com/piface/pifacecad/master/bin/setup_pifacecad_lirc.sh
chmod +x setup_pifacecad_lirc.sh
sudo ./setup_pifacecad_lirc.sh
Reboot your Raspberry Pi and skip to the next step, Customising for Your Remote Control

Manual Install

  • Alternatively, to install Linux infrared Remote Control manually, open a Terminal and enter
    sudo apt-get install lirc

  • The latest version of Raspbian should contain the lirc_rpi kernel module. It allows you to specify which GPIO pin the Infrared Receiver is attached to. On PiFace CAD, the Infrared Receiver is connected to GPIO pin 23. To load the module, type
    sudo modprobe lirc_rpi gpio_in_pin=23

  • We will now test that lirc works.
    First run pidof lirc to see if the lirc processes are running.
    If this returns a number, you must kill that process with the command
    sudo kill process_number
    replacing process_number with the number returned by the previous command

  • Now run lirc with the following command
    mode2 -d /dev/lirc0

  • After pressing some buttons on your remote while pointing it at the IR receiver on PiFace CAD, a series of pulse/space lengths will be printed on your Terminal. Great your Infrared is working. Press ctrl c to quit this.

  • To make sure that the module is loaded each time you boot, we need to add some lines to the file/etc/modules , so open it with sudo in your favourite text editor, eg
    sudo leafpad /etc/modules
    Add these lines
    lirc_dev
    lirc_rpi gpio_in_pin=23

  • To set up your Pi to receive IR data from PiFace CAD, first backup the previous Linux Infrared Remote Control configuration with
    cp /etc/lirc/hardware.conf hardware.conf.backup

  • Now edit the configuration file using your text editor
    sudo leafpad /etc/lirc/hardware.conf

    Change it to the following
    # /etc/lirc/hardware.conf
    #
    # Arguments which will be used when launching lircd
    LIRCD_ARGS="--uinput"

    #Don't start lircmd even if there seems to be a good config file
    #START_LIRCMD=false

    #Don't start irexec, even if a good config file seems to exist.
    #START_IREXEC=false

    #Try to load appropriate kernel modules
    LOAD_MODULES=true

    # Run "lircd --driver=help" for a list of supported drivers.
    DRIVER="default"
    # usually /dev/lirc0 is the correct setting for systems using udev
    DEVICE="/dev/lirc0"
    MODULES="lirc_rpi"

    # Default configuration files for your hardware if any
    LIRCD_CONF=""
    LIRCMD_CONF=""

  • Save the file, reboot your Pi sudo reboot and log back in.

  • Now follow the next step to customise for your exact remote control handset