IR Blaster (LIRC)

Posted on Mar 10 2017 - 11:09pm by piddler

In this Infared Blaster setup we will utilize the TSOP4838 IR Receiver to record IR remote codes in order to play back the commands using an IR LED and a BC547 transistor. Then utilizing python we can create a script to automate the transmission of commands, i.e. turning on a TV set and changing the input source automatically.

Components Required:

RPI 3 – https://goo.gl/CdVNoH
4 Amp Power Adapter – https://goo.gl/js4Uc7
16GB Micro SD – https://goo.gl/FDqZal
Miny Breadboard – https://goo.gl/xoNu4w
Resistor Assortment – https://goo.gl/q7FK1y
LED Assortment – https://goo.gl/Z5ri4u
IR LED kit – https://goo.gl/OqIvs7
Jumper Cable Assortment – https://goo.gl/7o34sL
BC547 Transistors – https://goo.gl/ewCMLX
TSOP4838 IR Recievers – https://goo.gl/3wqWdW

SCHEMATIC:

Install LIRC

Edit /etc/modules file

Add to the bottom of file:

Edit /etc/lirc/hardware.conf:

Change it to:

Edit the /boot/config.txt file:

Add this line:

Create /etc/modprobe.d/ir-remote.conf file:

Add this line:

Go ahead and reboot the Pi:

Time to test IR Reciever:

then

then

At this point you should be able to press buttons on your remote and see output similar to this:

(hit “ctrl + c” to exit)

save output to text file for future reference:

——MAPPING REMOTE CODES—–

run

then

*follow prompts to the letter, refer to video for more detailed usage. (instructions can be somewhat confusing on first run-through)

verify /home/pi/lircd.conf created successfully:

(if so continue, if not start over at MAPPING REMOTE CODES section)

copy/overwrite /home/pi/lircd.conf to /etc/lirc/

Restart LIRC:

Double check to see if keys were recorded:

IMPORTANT

Before issuing commands run this:

Test sample command:

CODE:

 

 

 

 

Multiple Devices Update*
In order to control multiple devices such as a TV and sound bar we need to make a few modifications to our setup.

First and foremost we need to create two wiring harnesses so that we can position the IR-LEDS in front of the devices.

Updated SCHEMATIC

Now that the two LEDS are wired up we need to edit the original lircd.conf file and create an new lircd2.conf for the soundbar remote.

Modify the lircd.conf file and change the “brand” and “name” field to something more meaningful such as “TV”.

Should look something like this.

Generate new lircd2.conf for soundbar remote.

Then go through the button mapping process once again.

Change the “brand” and “name” like the above step to new device name such as “SOUNDBAR”

With that finished, we need to append the contents of lircd2.conf to lircd.conf.

Go ahead and reboot.

We need to verify if the changes were successful, so run these commands.

You should now see something like this.

Let’s do a little house cleaning and get rid of lircd2.conf.

Now we can access the TV and SOUNDBAR devices within our python script.