IR remote

InfraRed remote support


lirc provides support to interact with the lircd service. This is a linux only driver.


lircd MUST be configured via TWO files: /etc/lirc/hardware.conf and /etc/lirc/lircd.conf.

See for more details about daemon configuration.


This file contains the interaction between the lircd process and the kernel driver, if any. This is the link between the physical signal and decoding pulses.


This file contains all the known IR codes for the remotes you plan to use and convert into key codes. This means you need to “train” lircd with the remotes you plan to use.

Keys are listed at


Here’s a quick recipe to train a remote:

# Detect your remote
irrecord -a -d /var/run/lirc/lircd ~/lircd.conf
# Grep for key names you found to find the remote in the remotes library
grep -R '<hex value>' /usr/share/lirc/remotes/
# Listen and send command to the server
nc -U /var/run/lirc/lircd
# List all valid key names
irrecord -l
grep -hoER '(BTN|KEY)_\w+' /usr/share/lirc/remotes | sort | uniq | less


Please see Raspberry Pi IR specific documentation for details on how to set it up.


A good device is the VS1838. Then you need device driver for hardware accelerated signal decoding, that lircd will then leverage to decode the keypresses. Some boards come with one IR device directly on it.


Purpose: display IR remote keys.

This example uses lirc ( This assumes you installed lirc and configured it. See devices/lirc for more information.

package main

import (


func main() {
    // Load all the drivers:
    if _, err := host.Init(); err != nil {

    // Open a handle to lircd:
    conn, err := lirc.New()
    if err != nil {

    // Open a channel to receive IR messages and print them out as they are
    // received, skipping repeated messages:
    for msg := range conn.Channel() {
        if !msg.Repeat {
            fmt.Printf("%12s from %12s\n", msg.Key, msg.RemoteType)


The periph authors do not endorse any specific seller. These are only provided for your convenience.