Paso 1:
Mando a distancia IR
Hardware
Piezas
- LED infrarrojo: Control remoto TV hogar
- Receptor IR: A3H3 y A3I3
- Transistor NPN: B29X 9014
- 1.5Ω resistencia: 1
- Resistencia de 220Ω: 1
Instalación de la terminal:
- $ sudo apt-get install lirc
Para el arranque tras el arranque (modificar/etc/modules):
- lirc_dev
- lirc_rpi gpio_in_pin = gpio_out_pin 23 = 22
Para prueba solamente:
- sudo modprobe lirc_dev
- sudo modprobe lirc_rpi gpio_in_pin = gpio_out_pin 23 = 22
Modificar /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="" ########################################################
Inicio y parada de lirc
- sudo /etc/init.d/lirc stop
- sudo /etc/init.d/lirc Inicio
Prueba
- sudo /etc/init.d/lirc stop
- Mode2 -d/dev/lirc0
- resultado:
space 16300 pulse 95 space 28794 pulse 80 space 19395 pulse 83 space 402351 pulse 135 space 7085 pulse 85 space 2903
Crear un nuevo mapa remoto
Compruebe la lista de clave nombre $ irrecord--lista de nombres
# 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