[vc_row][vc_column][vc_column_text]In this post, we detail the steps to install and configure LIRC software for the infrared shield for Raspberry Pi.
[/vc_column_text][vc_tour][vc_tab title=”LIRC software” tab_id=”1398837092-1-78″][vc_column_text]1. Install LIRC software
Note: LIRC (Linux Infrared remote control) is an open source software package used to transmit and receive the infrared signal under Linux.
$sudo apt-get install lirc
2. Edit the file “modules”, and add configurations. The transmitter connected to pin 17, and receiver connected to pin 18 of Raspberry Pi.
$sudo nano /etc/modules
And append the following two lines to the file “modules”:
lirc_dev lirc_rpi gpio_in_pin=18 gpio_out_pin=17
3. Edit the hardware.conf of LRIC to enable the infrared function:
$sudo nano /etc/lirc/hardware.conf
Modify the following lines:
LIRCD_ARGS=”–uinput –listen” DRIVER=”default” DEVICE=”/dev/lirc0″ MODULES=”lirc_rpi”
4. Restart LIRC:
$sudo /etc/init.d/lirc stop $sudo /etc/init.d/lirc start
Till now, all the LIRC software installation and configuration are finished.[/vc_column_text][/vc_tab][vc_tab title=”Receiving function of LIRC” tab_id=”1398837092-2-73″][vc_column_text]Infrared Receiver:
1. Stop LIRC software:
$sudo /etc/init.d/lirc stop
2. Run the following command:
$mode2 -d /dev/lirc0
3. Use any remote keypad, point to the infrared shield and press any key. If we receive any information like the following, it means that the receiver function is normal.
space 16300
pulse 95
space 28794
pulse 80
space 19395
pulse 83
space 402351
pulse 135
space 7085
pulse 85
space 2903[/vc_column_text][/vc_tab][vc_tab title=”Transmitting function of LIRC” tab_id=”1398837974878-2-2″][vc_column_text]Infrared Transmitter:
1. Stop LIRC:
$sudo /etc/init.d/lirc stop
2. Enter command ‘$irrecord –list-namespace‘. The parameter means to prompt the useable keys.
$irrecord –list-namespace
3. Run the recorder command:
$irrecord -d /dev/lirc0 ~/lircd.conf
4. Please following the instructions of the software. The program will automatically compute the key being pressed and the duration. The results will be saved in ~/lircd.conf.
Note: The following are the common keys:
KEY_VIDEO_PREV
KEY_VIDEO_NEXT
KEY_VOLUMEUP
KEY_VOLUMEDOWN
KEY_POWER
5. Copy the recorded file ~/lircd.conf over the corresponding file under lirc:
#sudo cp ~/lircd.conf /etc/lirc/lircd.conf
6. Restart LIRC:
sudo /etc/init.d/lirc restart
7. Use irsend command to check the usable keys in the recorded file:
irsend LIST /home/pi/lircd.conf “”
You should see
irsend: 000000000000c837 KEY_VOLUMEDOWN
irsend: 00000000000048b7 KEY_VOLUMEUP
irsend: 00000000000008f7 KEY_VIDEO_PREV
irsend: 0000000000008877 KEY_VIDEO_NEXT
8. Now we can use the infrared transmitter to send the prerecorded key.
The sample commands are as follows:
$irsend SEND_ONCE /home/pi/lircd.conf KEY_VIDEO_PREV
$irsend SEND_ONCE /home/pi/lircd.conf KEY_VIDEO_NEXT
$irsend SEND_ONCE /home/pi/lircd.conf KEY_VOLUMEDOWN
$irsend SEND_ONCE /home/pi/lircd.conf KEY_VOLUMEUP
`[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
September 5, 2014 at 4:01 pm
Hi,
when I execute: irsend LIST /home/pi/lircd.conf “”
I receive error:
irsend: could not connect to socket
irsend: No such file or directory
How can I solve this problem?
Thanks in advance.