Stap 1:
IR afstandsbediening
Hardware
Onderdelen
- Infrarood LED: Home TV afstandsbediening
- IR ontvanger: A3H3 en A3I3
- NPN-Transistor: B29X 9014
- 1.5Ω weerstand: 1
- 220Ω weerstand: 1
Terminal installeren:
- $ sudo apt-get install lirc
Voor start na het opstarten (wijzigen/etc/modules):
- lirc_dev
- lirc_rpi gpio_in_pin = 23 gpio_out_pin = 22
Voor de test alleen:
- sudo modprobe lirc_dev
- sudo modprobe lirc_rpi gpio_in_pin = 23 gpio_out_pin = 22
/Etc/lirc/hardware.conf wijzigen
######################################################## # /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 en Stop lirc
- sudo /etc/init.d/lirc stop
- sudo /etc/init.d/lirc start
Testen
- sudo /etc/init.d/lirc stop
- Mode2 -d/dev/lirc0
- resultaat:
space 16300 pulse 95 space 28794 pulse 80 space 19395 pulse 83 space 402351 pulse 135 space 7085 pulse 85 space 2903
Maak een nieuwe externe kaart
Toets lijst naam $ irrecord--lijst-naamruimte controleren
# 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