read

To get my infrared receiver working with my Raspberry Pi I followed the great instructions provided here.

First we need to wire up our IR sensor.

ir sensor

You can find a description of the pins here.

  • Pin 1 is the output so we wire this to a visible LED and resistor
  • Pin 2 is ground
  • Pin 3 is VCC, connect to 3.3V

And then we need to set up LIRC (Linux Infrared Remote Control)

sudo apt-get install lirc

And then add this to your /etc/modules file:

lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=22

Now modify /etc/lirc/hardware.conf

To match the contents shown below (more details available here and here)

########################################################
# /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=""
########################################################

And reboot your Pi.

You can now test that you’ve wired everything up correctly by typing:

sudo /etc/init.d/lirc stop
mode2 -d /dev/lirc0

When you point a remote control at your receiver you should see:

space 3020711
pulse 9126
space 4512
pulse 582
space 559
pulse 553
space 590
pulse 581
space 593
pulse 534
space 548
pulse 586
space 579
pulse 542
space 556
pulse 614
space 533
pulse 551
space 589
pulse 590
...

You can now create or download a lirc config file for your remote. To do this I followed the instructions in the lined blog.

# Stop lirc to free up /dev/lirc0
sudo /etc/init.d/lirc stop

# Create a new remote control configuration file (using /dev/lirc0) and save the output to ~/lircd.conf
irrecord -d /dev/lirc0 ~/lircd.conf

# Make a backup of the original lircd.conf file
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf

# Copy over your new configuration file
sudo cp ~/lircd.conf /etc/lirc/lircd.conf

# Start up lirc again
sudo /etc/init.d/lirc start

You can test that things are working by doing:

irw

Why not subscribe to my mailing list - I'll send out regular emails with new content (don't worry I won't spam you!)

* indicates required
Blog Logo

Chris Greening


Published

Image

Chris Greening

Blogging about random stuff

Back to Overview