INFRARED

PINOUT / WIRING


SOFTWARE CONFIGURATION

Python Blinking LED Script

#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(22, GPIO.OUT)
while True:
    GPIO.output(22, True)
    time.sleep(1)
    GPIO.output(22, False)
    time.sleep(1)

LIRC

Install LIRC

sudo apt-get install lirc

Enable and configure the lirc_rpi kernel module.

sudo nano /etc/modules

Add the lines below to the file

Useless!

lirc_dev
lirc_rpi gpio_out_pin=22

gpio_out_pin parameter points to the pin controlling the IR LED

Edit '/etc/lirc/hardware.conf', and add

LIRCD_ARGS="--uinput"
LOAD_MODULES=true
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
LIRCD_CONF=""
LIRCMD_CONF=""

/boot/config.txt

dtoverlay=gpio-ir,gpio_pin=18
dtoverlay=gpio-ir-tx,gpio_pin=22

/etc/lirc/lirc_options.conf

driver          = default 
device          = /dev/lirc0

Reboot

sudo reboot

LIRC SEND COMMANDS

Put the remotes you want to use in /etc/lirc/lircd.conf.d/.

CONF WITH RAW (PRONTO?) CODES

begin remote
 
   name  MY_REMOTE
   flags RAW_CODES
   eps            30
   aeps          100
 
   frequency    38000
# note ensure the modulation frequency above correctly matches your remote, default is set to 38kHz
# you can also try other common frequencies (36000,40000,56000) if you are unsure
 
       begin raw_codes
 
           name MY_TEST
...<<PUT THE RAW CODE HERE >>...  
 
    end raw_codes
end remote

PRONTO TO LIRC CONF FILE

$ pronto2lirc

Input format: KEY_NAME:HEX_VALUE HEX_VALUE HEX_VALUE…

PIGPIO

wget https://github.com/joan2937/pigpio/archive/master.zip
unzip master.zip
cd pigpio-master
make
sudo make install

If the Python part of the install fails it may be because you need the setup tools.

sudo apt install python-setuptools python3-setuptools

To start the pigpio daemon

sudo pigpiod

To stop the pigpio daemon

sudo killall pigpiod

github

git clone https://github.com/joan2937/pigpio

Raspbian (raspberrypi.org image)

sudo apt-get update
sudo apt-get install pigpio python-pigpio python3-pigpio

This may not be the most recent version. You can check the version with the command pigpiod -v.