Hello everyone,
As in last post I posted about how to use LCD in Pi-face CAD.
Now this post covers how to configure and use IR receiver using Pi-Face CAD.
First of all update and upgrade your raspbian using command.
sudo apt-get update
sudo apt-get upgrade
The second step is to install LIRC and to configure it. Enter the following command in terminal.
sudo apt-get install lirc
In the Pi-Face CAD the infrared module is connected to pin 23 of Raspberry GPIO pin. We have to set raspbian to use GPIO pin 23. For that enter the following command.
sudo modprobe lirc_rpi gpio_in_pin=23
Or you can add this to your /etc/modules
lirc_dev
lirc_rpi gpio_pin=23
Change your /etc/lirc/hardware.conf file to
# /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=""
You can test that it is working or not by entering the following command
mode2 –d /dev/lirc0
And press buttons from your remote.
If you get some output like this
space 16300
pulse 95
space 28794
pulse 80
space 19395
pulse 83
space 402351
pulse 135
space 7085
pulse 85
space 2903
That means your IR receiver is working.
Now configure IR module to work with your remote model. For this download your remote code from http://lirc.sourceforge.net/remotes/
Rename the file to lircd.conf and place the file in /etc/lirc/
After this restart your Raspberry Pi to use the work with your remote model.
Now you can test your remote by entering
irw
Press the buttons on your remote and you’ll get pressed buttons values in terminal windows.
Alternatively you can create a small program to use the lirc
sudo nano ~/lircexample
Enter the following in the file and save it.
begin
prog = irexec
button = KEY_1
config = echo "You pressed one"
repeat = 0
end
begin
prog = irexec
button = KEY_2
config = echo "You pressed two"
repeat = 0
end
begin
prog = irexec
button = KEY_3
config = echo "You pressed three"
repeat = 0
end
Make the file executable by entering
sudo chmod +x ~/lircexample
Execute the file by entering following in terminal
./lircexample
Now if you press 1 from remote you’ll get “You pressed one” as output. You can also perform a task by making suitable changes in the file.
This is all how I setup my LIRC using Pi-Face CAD. If you have any problem and query regarding this don’t hesitate to ask. If you have any suggestion’ please comment below.
Regards,