Raspberry Pi‎ > ‎SANKI Device‎ > ‎

IR Remote

IR Remote

Hardware

 
 


Parts


Infrared LED: Home TV remote
IR Receiver: A3H3 and A3I3
NPN Transistor: B29X 9014
1.5Ω Resistor: 1
220Ω Resistor: 1



Terminal

Install : 
  • $ sudo apt-get install lirc

For start after boot (Modify /etc/modules):
  • lirc_dev
  • lirc_rpi gpio_in_pin=23 gpio_out_pin=22
For test only:
  • sudo modprobe lirc_dev
  • sudo modprobe lirc_rpi gpio_in_pin=23 gpio_out_pin=22
Modify /etc/lirc/hardware.conf
########################################################
# /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=""
########################################################
Start and Stop lirc
  • sudo /etc/init.d/lirc stop
  • sudo /etc/init.d/lirc start
Testing 
  • sudo /etc/init.d/lirc stop
  • mode2 -d /dev/lirc0
result :
space 16300
pulse 95
space 28794
pulse 80
space 19395
pulse 83
space 402351
pulse 135
space 7085
pulse 85
space 2903
Create a new remote map 

Check Key List name $ irrecord --list-namespace
# Stop lircd so /dev/lirc0 is not in use
sudo /etc/init.d/lirc stop

# Create a new remote control configuration file (using /dev/lirc0) and save the output to ~/lircd.conf
irrecord -d /dev/lirc0 ~/lircd.conf

# Edit ~/lircd.conf and add edit the name of the controlled device
nano ~/lircd.conf

# Make a backup of the original lircd.conf file
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf

# Copy over your new configuration file
sudo cp ~/lircd.conf /etc/lirc/lircd.conf

# Start up lirc again
sudo /etc/init.d/lirc start
TEST
# List all of the commands that LIRC knows for 'samsung_tv'
irsend LIST samsung_tv ""

# Send the KEY_POWER command once
irsend SEND_ONCE samsung_tv KEY_POWER

# Send the KEY_VOLUMEDOWN command once
irsend SEND_ONCE samsung_tv KEY_VOLUMEDOWN

# Send the KEY_VOLUMEDOWN command 10 times lowering the volume for 10 units at once
irsend --count=10 samsung_tv KEY_VOLUMEDOWN

Reference