Installing LIRC on Raspberry PI 2B Running Raspbian

Posted by:

Preamble

Here’s what you need to do in order to get LIRC working properly on Raspbian:

  1. Make sure you are running the version of Raspbian which has the LIRC modules included
  2. Install lirc from apt-get
  3. Add a couple of entries into the /etc/modules file
  4. Use dmesg to ensure the Lirc settings have loaded properly
  5. Run a system command to ensure the the device is reading the signals from the remote control
  6. Run an lirc program to record the IR commands from the remote control
  7. Test the IR commands are being properly interpreted by the final setup.

Here’s the steps in detail:

Upgrading Raspbian

type `apt-get upgrade`

Install lirc from apt-get

type `apt-get install lirc`

Here’s the output from that:

Reading package lists… Done Building dependency tree Reading state information… Done Suggested packages: lirc-x setserial ir-keytable The following NEW packages will be installed: lirc 0 upgraded, 1 newly installed, 0 to remove and 354 not upgraded. Need to get 562 kB of archives. After this operation, 1,784 kB of additional disk space will be used. Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main lirc armhf 0.9.0~pre1-1 Fetched 562 kB in 2min 7s (4,404 B/s) Selecting previously unselected package lirc. (Reading database … 103145 files and directories currently installed.) Unpacking lirc (from …/lirc_0.9.0~pre1-1_armhf.deb) … Processing triggers for man-db … Setting up lirc (0.9.0~pre1-1) … No valid /etc/lirc/lircd.conf has been found.. Remote control support has been disabled.. Reconfigure LIRC or manually replace /etc/lirc/lircd.conf to enable..

Modify the /etc/modules file

I added the following lines to /etc/modules

lirc_dev lirc_rpi gpio_in_pin=18 gpio_out_pin=25

Also changed the file /etc/lirc/hardware.conf

************************************************########

LIRCD_ARGS=”–uinput”

LOAD_MODULES=true

DRIVER=”default”

DEVICE=”/dev/lirc0″ MODULES=”lirc_rpi”

LIRCD_CONF=”” LIRCMD_CONF=”” ########################################################

Now restart lircd so it picks up these changes:

sudo /etc/init.d/lirc stop sudo /etc/init.d/lirc start

## Check dmesg

It should look something like this:

lirc_dev: IR Remote Control driver registered, major 248 lirc_rpi: module is from the staging directory, the quality is unknown, you have been warned. lirc_rpi lirc_rpi.0: lirc_dev: driver lirc_rpi registered at minor = 0 lirc_rpi: driver registered! lirc_rpi: auto-detected active low receiver on GPIO pin 18 input: lircd as /devices/virtual/input/input0

Initial test

Type the following:

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

Point a remote control at your IR receiver and press some buttons. You should see something like this:

space 16300 pulse 95 space 28794 pulse 80 space 19395 pulse 83 space 402351 pulse 135 space 7085 pulse 85 space 2903

Recording IR commands

Be sure to run `irrecord –list-namespace` to see the valid names before you begin.

Here were the commands that I ran to generate a remote configuration file:

sudo /etc/init.d/lirc stop

irrecord -d /dev/lirc0 ~/lircd.conf

sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf

sudo cp ~/lircd.conf /etc/lirc/lircd.conf

sudo /etc/init.d/lirc start

Testing the final setup.

type `irw` to detect the commands

example output:

0000000000000002 00 KEY_DOWN /home/james/lircd.conf 0000000000000002 01 KEY_DOWN /home/james/lircd.conf 0000000000000002 02 KEY_DOWN /home/james/lircd.conf 0000000000000002 03 KEY_DOWN /home/james/lircd.conf 0000000000000001 00 KEY_CHANNELUP /home/james/lircd.conf 0000000000000001 01 KEY_CHANNELUP /home/james/lircd.conf 0000000000000001 02 KEY_CHANNELUP /home/james/lircd.conf 0000000000000001 03 KEY_CHANNELUP /home/james/lircd.conf 0000000000000003 00 KEY_POWER /home/james/lircd.conf 0000000000000003 01 KEY_POWER /home/james/lircd.conf 0000000000000003 02 KEY_POWER /home/james/lircd.conf

Playing back

Resources

Setting up a web-application

Install Node Js

Setting up lirc_web

<a href="http://192.168.1.xx%3A3000%7B/php">http://192.168.1.xx:3000{/php</a>]} </p></div></div></div><div id="outline-container-org076a07f" class="outline-2"><h2 id="org076a07f">Running Lirc_web With Nginx and Upstart</h2><div class="outline-text-2" id="text-org076a07f"><p> `To accomplish this will take three steps: </p><ol class="org-ol"><li>Configure the hostname for the RaspberryPi</li><li>Install and configure Upstart</li><li>Install and configure NGINX</li></ol></div><div id="outline-container-org9f1f308" class="outline-3"><h3 id="org9f1f308">Configure the hostname for the RaspberryPi and Auto Start with System</h3><div class="outline-text-3" id="text-org9f1f308">[crayon-673f06d2aa76c677103222  language="sh" title="" ]sudo apt-get install upstart# You will be asked to type 'Yes, do as I say!'# You may see an error about initctl being unable to connect, which will be fixed after a reboot# Reboot the RaspberryPisudo shutdown -r now

{php}/etc/init/open-source-universal-remote.conf[/crayon]

After creating the Upstart script, you should be able to start the lirc_web project by running:

Install and Configure Upstart and NGINX

Upstart configuration

and create the config file in /etc/init/open-source-universal-remote.conf:

After creating the Upstart script, you should be able to start the lirc_web project by running:

You can verify everything works by opening http://universalremote.local:3000

NGINX

You should see a “Welcome to nginx!” web page when you access {php}http://universalremote.local{/php} in your web browser.

Notes

problems: http://archlinuxarm.org/forum/viewtopic.php?f=57&t=8851 locate downgrade version: http://tech.enekochan.com/en/2014/03/08/upgradedowngrade-to-a-specific-firmware-kernel-version-with-rpi-update-in-raspbian/

installation in Arch linux: http://bofhsolutions.blogspot.com/2014/12/raspberry-pi-lirc-arch-linux.html

tan@archipi ~$ sudo cat /sys/kernel/debug/gpio GPIOs 0-53, platform/3f200000.gpio, pinctrl-bcm2835: gpio-35 (? ) in hi gpio-47 (? ) out lo

Another version of lirc-web: https://github.com/jdavisonc/rasparmony

0

Add a Comment