As a kettle, the remote control read
For a long time I was going to connect an IR receiver (1838B) and an IR transmitter (IR diode 5 mm, 940 nm, an emission angle of about 80 degrees) to Raspberry, to understand how they will work and what can be done with them. And once such a day came.
Having studied the problems, including materials from Habr , I realized that in addition to the IR diode and IR receiver, you also need a transistor and several resistors, a little depressed. It’s easier with the receiver - it came with the kit, but the transistor was not enough for the diode, but nevertheless decided to try, but what if it works? And it turned out ...
Basically, I found all the necessary information in the vast, but in each material some point was missed, and I had to think out something myself. The situation was especially complicated because I was a teapot in programming, so some moments were not easy, so I’ll try for the same ones as I describe everything step by step and as detailed as possible.
So, the IR receiver module is connected to GPIO23, gnd and 3.3V - there are corresponding symbols on it. Between GPIO and 3.3V there is a 10k resistor. LED - through a 1 kΩ resistor to GPIO22 (anode) and gnd (cathode).
Next - install LIRC :
Editing the file / etc / modules:
Add the lines to the file:
Where:
gpio_in_pin = 23 - pin to which the receiver is connected.
gpio_out_pin = 22 - pin for the transmitter.
Editing the file /etc/lirc/hardware.conf:
It should be like this:
Edit the file /boot/config.txt:
Add the line to the file:
Where:
gpio_in_pin = 23 - pin to which the receiver is connected.
gpio_out_pin = 22 - pin for the transmitter.
Restart raspberries:
Stop the lirc daemon:
Check the operation of the receiver with the command:
Now we take any remote control and press the buttons, directing to the receiver. The numbers should run through the screen.
Now the most interesting thing is to record the configuration of your remote control (or several) so that the program matches the IR signal from the remote control with the name of the button and in the future this signal can be used.
To do this, use the irrecord program included with lirc.
Where aa59-00741a is the model of my remote control, you can use any other name. In this example, the configuration file is saved in the home folder.
After starting, you need to follow the prompts on the screen (in English).
When entering button names, it is better to use a list wired into the program.
It turns out the configuration file - in our case with the name aa59-00741a.conf, it will be saved in the home folder. In the resulting file, I added through # comments to understand what the button is.
This action needs to be done for each remote. The configuration file contains an important field - name. This is the name of the device by which lirc will determine which file to take the command from (in my case, Samsung_TV).
The resulting file is copied somewhere. I put in the / etc / lirc / rc folder and added the line to the /etc/lirc/lircd.conf file:
Thus, the lirc configuration file will take information about my remote control from the aa59-00741a.conf file located in the / etc / lirc / rc folder. In my opinion, this is the easiest way to add information about the console configuration to the program settings.
Restart lirc:
Now lirc can use the remote control data for transmission using the transmitter, or for recognizing commands from the remote control and launching any actions in response to raspberry.
To do this, we place the transmitter as close to the device as possible (for verification, then it will be possible to experimentally determine how far it will work) and write a command in the terminal, for example:
where irsend is the program for controlling the transmitter;
SEND_ONCE - attribute of a one-time signal sending;
Samsung_TV - device name from the configuration file (in the name field);
KEY_POWER - the name of the command from the configuration file to be sent.
In this way, the TV can turn on or off. With this command, I turn the TV on or off.
In the terminal, enter the command:
After that, when the buttons of the remote control are pressed, their names from the configuration file will be displayed.
The next step is to control the transmitter through a browser, but I have not yet studied this.
Will be glad to comments.
Having studied the problems, including materials from Habr , I realized that in addition to the IR diode and IR receiver, you also need a transistor and several resistors, a little depressed. It’s easier with the receiver - it came with the kit, but the transistor was not enough for the diode, but nevertheless decided to try, but what if it works? And it turned out ...
Basically, I found all the necessary information in the vast, but in each material some point was missed, and I had to think out something myself. The situation was especially complicated because I was a teapot in programming, so some moments were not easy, so I’ll try for the same ones as I describe everything step by step and as detailed as possible.
So, the IR receiver module is connected to GPIO23, gnd and 3.3V - there are corresponding symbols on it. Between GPIO and 3.3V there is a 10k resistor. LED - through a 1 kΩ resistor to GPIO22 (anode) and gnd (cathode).
Next - install LIRC :
sudo apt-get install lirc
Editing the file / etc / modules:
sudo nano /etc/modules
Add the lines to the file:
lirc_dev
lirc_rpi gpio_in_pin=23 gpio_out_pin=22
Where:
gpio_in_pin = 23 - pin to which the receiver is connected.
gpio_out_pin = 22 - pin for the transmitter.
Editing the file /etc/lirc/hardware.conf:
sudo nano /etc/lirc/hardware.conf
It should be like this:
/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 = ""
################################################# ###############
# /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 = ""
################################################# ###############
Edit the file /boot/config.txt:
sudo nano /boot/config.txt
Add the line to the file:
dtoverlay=lirc-rpi,gpio_in_pin=23,gpio_out_pin=22
Where:
gpio_in_pin = 23 - pin to which the receiver is connected.
gpio_out_pin = 22 - pin for the transmitter.
Restart raspberries:
sudo reboot
Settings are complete and you can now check how everything works.
Checking the IR receiver
Stop the lirc daemon:
sudo /etc/init.d/lirc stop
Check the operation of the receiver with the command:
mode2 -d /dev/lirc0
Now we take any remote control and press the buttons, directing to the receiver. The numbers should run through the screen.
There must be something like this
space 1805
pulse 315
space 122
pulse 215
space 731
pulse 232
space 122
pulse 214
space 1067
pulse 1379
space 114
pulse 210
pulse 315
space 122
pulse 215
space 731
pulse 232
space 122
pulse 214
space 1067
pulse 1379
space 114
pulse 210
Create a remote control image
Now the most interesting thing is to record the configuration of your remote control (or several) so that the program matches the IR signal from the remote control with the name of the button and in the future this signal can be used.
To do this, use the irrecord program included with lirc.
irrecord -d /dev/lirc0 ~/aa59-00741a.conf
Where aa59-00741a is the model of my remote control, you can use any other name. In this example, the configuration file is saved in the home folder.
After starting, you need to follow the prompts on the screen (in English).
Brief instruction in Russian
1) Launched
2) Enter
3) We took the remote control into our hands
4) Enter
5) Press different buttons on the remote control until the program prompts you to enter the name of the button. In this case, each press should lead to the appearance of a point, but no more than 10 points in one click
6) Enter the name of the button to be pressed
7) Press the button
8) And so on, until the button ends
9) Then Enter
2) Enter
3) We took the remote control into our hands
4) Enter
5) Press different buttons on the remote control until the program prompts you to enter the name of the button. In this case, each press should lead to the appearance of a point, but no more than 10 points in one click
6) Enter the name of the button to be pressed
7) Press the button
8) And so on, until the button ends
9) Then Enter
When entering button names, it is better to use a list wired into the program.
Long list of buttons (displayed using irrecord --list-namespace command)
Key_0
KEY_102ND
Key_1
Key_2
Key_3
Key_4
Key_5
Key_6
Key_7
Key_8
Key_9
Key_A
KEY_AB
KEY_ADDRESSBOOK
KEY_AGAIN
KEY_ALTERASE
KEY_ANGLE
Key_Apostrophe
KEY_ARCHIVE
KEY_AUDIO
KEY_AUX
Key_B
Key_Back
Key_Backslash
Key_Backspace
Key_BassBoost
KEY_BATTERY
KEY_BLUE
KEY_BLUETOOTH
KEY_BOOKMARKS
KEY_BREAK
KEY_BRIGHTNESS_CYCLE
KEY_BRIGHTNESSDOWN
KEY_BRIGHTNESSUP
KEY_BRIGHTNESS_ZERO
KEY_BRL_DOT10
KEY_BRL_DOT1
KEY_BRL_DOT2
KEY_BRL_DOT3
KEY_BRL_DOT4
KEY_BRL_DOT5
KEY_BRL_DOT6
KEY_BRL_DOT7
KEY_BRL_DOT8
KEY_BRL_DOT9
Key_C
KEY_CALC
KEY_CALENDAR
KEY_CAMERA
Key_Cancel
Key_CapsLock
KEY_CD
KEY_CHANNEL
KEY_CHANNELDOWN
KEY_CHANNELUP
KEY_CHAT
Key_Clear
KEY_CLOSE
KEY_CLOSECD
KEY_COFFEE
Key_Comma
KEY_COMPOSE
KEY_COMPUTER
KEY_CONFIG
KEY_CONNECT
KEY_CONTEXT_MENU
KEY_COPY
KEY_CUT
KEY_CYCLEWINDOWS
Key_D
KEY_DASHBOARD
KEY_DATABASE
KEY_DEL_EOL
KEY_DEL_EOS
Key_Delete
KEY_DELETEFILE
KEY_DEL_LINE
KEY_DIGITS
KEY_DIRECTION
KEY_DIRECTORY
KEY_DISPLAY_OFF
KEY_DISPLAYTOGGLE
KEY_DOCUMENTS
Key_Dollar
KEY_DOT
KEY_DOWN
KEY_DVD
Key_E
KEY_EDIT
KEY_EDITOR
KEY_EJECTCD
KEY_EJECTCLOSECD
KEY_EMAIL
Key_End
Key_Enter
KEY_EPG
Key_Equal
KEY_ESC
KEY_EURO
KEY_EXIT
Key_F10
Key_F11
Key_F12
Key_F13
Key_F14
Key_F15
Key_F1
Key_F16
Key_F17
Key_F18
Key_F19
Key_F20
Key_F21
Key_F22
Key_F23
Key_F24
Key_F2
Key_F
Key_F3
Key_F4
Key_F5
Key_F6
Key_F7
Key_F8
Key_F9
KEY_FASTFORWARD
Key_Favorites
KEY_FILE
KEY_FINANCE
KEY_FIND
KEY_FIRST
KEY_FN
KEY_FN_1
KEY_FN_2
KEY_FN_B
KEY_FN_D
KEY_FN_E
KEY_FN_ESC
KEY_FN_F
KEY_FN_F10
KEY_FN_F1
KEY_FN_F11
KEY_FN_F12
KEY_FN_F2
KEY_FN_F3
KEY_FN_F4
KEY_FN_F5
KEY_FN_F6
KEY_FN_F7
KEY_FN_F8
KEY_FN_F9
KEY_FN_S
Key_Forward
KEY_FORWARDMAIL
KEY_FRAMEBACK
KEY_FRAMEFORWARD
KEY_FRONT
Key_G
KEY_GAMES
KEY_GOTO
KEY_GRAPHICSEDITOR
KEY_GRAVE
KEY_GREEN
Key_H
KEY_HANGEUL
KEY_HANJA
Key_Help
Key_Henkan
Key_Hiragana
Key_Home
Key_HomePage
KEY_HP
Key_I
KEY_INFO
Key_Insert
KEY_INS_LINE
KEY_ISO
Key_J
Key_K
Key_Katakana
KEY_KATAKANAHIRAGANA
KEY_KBDILLUMDOWN
KEY_KBDILLUMTOGGLE
KEY_KBDILLUMUP
KEY_KEYBOARD
KEY_KP0
KEY_KP1
KEY_KP2
KEY_KP3
KEY_KP4
KEY_KP5
KEY_KP6
KEY_KP7
KEY_KP8
KEY_KP9
KEY_KPASTERISK
KEY_KPCOMMA
KEY_KPDOT
KEY_KPENTER
KEY_KPEQUAL
KEY_KPJPCOMMA
KEY_KPLEFTPAREN
KEY_KPMINUS
KEY_KPPLUS
KEY_KPPLUSMINUS
KEY_KPRIGHTPAREN
KEY_KPSLASH
Key_L
KEY_LANGUAGE
KEY_LAST
KEY_LEFT
KEY_LEFTALT
KEY_LEFTBRACE
KEY_LEFTCTRL
KEY_LEFTMETA
KEY_LEFTSHIFT
KEY_LINEFEED
KEY_LIST
KEY_LOGOFF
Key_M
KEY_MACRO
KEY_MAIL
KEY_MAX
KEY_MEDIA
KEY_MEDIA_REPEAT
KEY_MEMO
Key_Menu
KEY_MESSENGER
KEY_MHP
Key_Minus
KEY_MODE
KEY_MOVE
KEY_MP3
KEY_MSDOS
Key_Muhenkan
KEY_MUTE
Key_N
KEY_NEW
KEY_NEWS
KEY_NEXT
KEY_NEXTSONG
KEY_NUMERIC_0
KEY_NUMERIC_1
KEY_NUMERIC_2
KEY_NUMERIC_3
KEY_NUMERIC_4
KEY_NUMERIC_5
KEY_NUMERIC_6
KEY_NUMERIC_7
KEY_NUMERIC_8
KEY_NUMERIC_9
KEY_NUMERIC_POUND
KEY_NUMERIC_STAR
Key_NumLock
Key_O
KEY_OK
KEY_OPEN
KEY_OPTION
Key_P
Key_PageDown
Key_PageUp
KEY_PASTE
Key_Pause
KEY_PAUSECD
KEY_PC
KEY_PHONE
Key_Play
KEY_PLAYCD
KEY_PLAYER
KEY_PLAYPAUSE
KEY_POWER
KEY_POWER2
KEY_PRESENTATION
KEY_PREVIOUS
KEY_PREVIOUSSONG
Key_Print
KEY_PROG1
KEY_PROG2
KEY_PROG3
KEY_PROG4
KEY_PROGRAM
KEY_PROPS
KEY_PVR
Key_Q
Key_Question
Key_R
KEY_RADIO
KEY_RECORD
KEY_RED
KEY_REDO
Key_Refresh
KEY_REPLY
KEY_RESERVED
KEY_RESTART
KEY_REWIND
KEY_RFKILL
Key_Right
KEY_RIGHTALT
KEY_RIGHTBRACE
KEY_RIGHTCTRL
KEY_RIGHTMETA
KEY_RIGHTSHIFT
KEY_RO
Key_S
KEY_SAT
KEY_SAT2
KEY_SAVE
KEY_SCALE
KEY_SCREEN
KEY_SCROLLDOWN
Key_ScrollLock
KEY_SCROLLUP
Key_Search
Key_Select
Key_Semicolon
KEY_SEND
KEY_SENDFILE
KEY_SETUP
KEY_SHOP
KEY_SHUFFLE
Key_Slash
Key_Sleep
KEY_SLOW
KEY_SOUND
Key_Space
KEY_SPELLCHECK
KEY_SPORT
KEY_SPREADSHEET
Key_Stop
KEY_STOPCD
KEY_SUBTITLE
KEY_SUSPEND
KEY_SWITCHVIDEOMODE
KEY_SYSRQ
key_t
Key_Tab
KEY_TAPE
KEY_TEEN
KEY_TEXT
KEY_TIME
KEY_TITLE
KEY_TUNER
KEY_TV
KEY_TV2
KEY_TWEN
Key_U
KEY_UNDO
Key_unknown
KEY_UP
KEY_UWB
Key_V
KEY_VCR
KEY_VCR2
KEY_VENDOR
KEY_VIDEO
KEY_VIDEO_NEXT
KEY_VIDEOPHONE
KEY_VIDEO_PREV
KEY_VOICEMAIL
Key_VolumeDown
Key_VolumeUp
Key_W
KEY_WAKEUP
KEY_WIMAX
KEY_WLAN
KEY_WORDPROCESSOR
KEY_WWW
Key_X
KEY_XFER
Key_Y
KEY_YELLOW
Key_yen
Key_Z
KEY_ZENKAKUHANKAKU
Key_Zoom
KEY_ZOOMIN
KEY_ZOOMOUT
KEY_ZOOMRESET
BTN_0
BTN_1
BTN_2
BTN_3
BTN_4
BTN_5
BTN_6
BTN_7
BTN_8
BTN_9
BTN_A
BTN_B
BTN_BACK
BTN_BASE
BTN_BASE2
BTN_BASE3
BTN_BASE4
BTN_BASE5
BTN_BASE6
BTN_C
BTN_DEAD
BTN_DIGI
BTN_EXTRA
BTN_FORWARD
BTN_GAMEPAD
BTN_GEAR_DOWN
BTN_GEAR_UP
BTN_JOYSTICK
BTN_LEFT
BTN_MIDDLE
BTN_MISC
BTN_MODE
BTN_MOUSE
BTN_PINKIE
BTN_RIGHT
BTN_SELECT
BTN_SIDE
BTN_START
BTN_STYLUS
BTN_STYLUS2
BTN_TASK
BTN_THUMB
BTN_THUMB2
BTN_THUMBL
BTN_THUMBR
BTN_TL
BTN_TL2
BTN_TOOL_AIRBRUSH
BTN_TOOL_BRUSH
BTN_TOOL_DOUBLETAP
BTN_TOOL_FINGER
BTN_TOOL_LENS
BTN_TOOL_MOUSE
BTN_TOOL_PEN
BTN_TOOL_PENCIL
BTN_TOOL_QUADTAP
BTN_TOOL_RUBBER
BTN_TOOL_TRIPLETAP
BTN_TOP
BTN_TOP2
BTN_TOUCH
BTN_TR
BTN_TR2
BTN_TRIGGER
BTN_TRNX
BTN_NTN
BTN_TRIGH
BTN BTN_TRIGX BTN_NTN BTN_TRIGX BTN_NTN
KEY_102ND
Key_1
Key_2
Key_3
Key_4
Key_5
Key_6
Key_7
Key_8
Key_9
Key_A
KEY_AB
KEY_ADDRESSBOOK
KEY_AGAIN
KEY_ALTERASE
KEY_ANGLE
Key_Apostrophe
KEY_ARCHIVE
KEY_AUDIO
KEY_AUX
Key_B
Key_Back
Key_Backslash
Key_Backspace
Key_BassBoost
KEY_BATTERY
KEY_BLUE
KEY_BLUETOOTH
KEY_BOOKMARKS
KEY_BREAK
KEY_BRIGHTNESS_CYCLE
KEY_BRIGHTNESSDOWN
KEY_BRIGHTNESSUP
KEY_BRIGHTNESS_ZERO
KEY_BRL_DOT10
KEY_BRL_DOT1
KEY_BRL_DOT2
KEY_BRL_DOT3
KEY_BRL_DOT4
KEY_BRL_DOT5
KEY_BRL_DOT6
KEY_BRL_DOT7
KEY_BRL_DOT8
KEY_BRL_DOT9
Key_C
KEY_CALC
KEY_CALENDAR
KEY_CAMERA
Key_Cancel
Key_CapsLock
KEY_CD
KEY_CHANNEL
KEY_CHANNELDOWN
KEY_CHANNELUP
KEY_CHAT
Key_Clear
KEY_CLOSE
KEY_CLOSECD
KEY_COFFEE
Key_Comma
KEY_COMPOSE
KEY_COMPUTER
KEY_CONFIG
KEY_CONNECT
KEY_CONTEXT_MENU
KEY_COPY
KEY_CUT
KEY_CYCLEWINDOWS
Key_D
KEY_DASHBOARD
KEY_DATABASE
KEY_DEL_EOL
KEY_DEL_EOS
Key_Delete
KEY_DELETEFILE
KEY_DEL_LINE
KEY_DIGITS
KEY_DIRECTION
KEY_DIRECTORY
KEY_DISPLAY_OFF
KEY_DISPLAYTOGGLE
KEY_DOCUMENTS
Key_Dollar
KEY_DOT
KEY_DOWN
KEY_DVD
Key_E
KEY_EDIT
KEY_EDITOR
KEY_EJECTCD
KEY_EJECTCLOSECD
KEY_EMAIL
Key_End
Key_Enter
KEY_EPG
Key_Equal
KEY_ESC
KEY_EURO
KEY_EXIT
Key_F10
Key_F11
Key_F12
Key_F13
Key_F14
Key_F15
Key_F1
Key_F16
Key_F17
Key_F18
Key_F19
Key_F20
Key_F21
Key_F22
Key_F23
Key_F24
Key_F2
Key_F
Key_F3
Key_F4
Key_F5
Key_F6
Key_F7
Key_F8
Key_F9
KEY_FASTFORWARD
Key_Favorites
KEY_FILE
KEY_FINANCE
KEY_FIND
KEY_FIRST
KEY_FN
KEY_FN_1
KEY_FN_2
KEY_FN_B
KEY_FN_D
KEY_FN_E
KEY_FN_ESC
KEY_FN_F
KEY_FN_F10
KEY_FN_F1
KEY_FN_F11
KEY_FN_F12
KEY_FN_F2
KEY_FN_F3
KEY_FN_F4
KEY_FN_F5
KEY_FN_F6
KEY_FN_F7
KEY_FN_F8
KEY_FN_F9
KEY_FN_S
Key_Forward
KEY_FORWARDMAIL
KEY_FRAMEBACK
KEY_FRAMEFORWARD
KEY_FRONT
Key_G
KEY_GAMES
KEY_GOTO
KEY_GRAPHICSEDITOR
KEY_GRAVE
KEY_GREEN
Key_H
KEY_HANGEUL
KEY_HANJA
Key_Help
Key_Henkan
Key_Hiragana
Key_Home
Key_HomePage
KEY_HP
Key_I
KEY_INFO
Key_Insert
KEY_INS_LINE
KEY_ISO
Key_J
Key_K
Key_Katakana
KEY_KATAKANAHIRAGANA
KEY_KBDILLUMDOWN
KEY_KBDILLUMTOGGLE
KEY_KBDILLUMUP
KEY_KEYBOARD
KEY_KP0
KEY_KP1
KEY_KP2
KEY_KP3
KEY_KP4
KEY_KP5
KEY_KP6
KEY_KP7
KEY_KP8
KEY_KP9
KEY_KPASTERISK
KEY_KPCOMMA
KEY_KPDOT
KEY_KPENTER
KEY_KPEQUAL
KEY_KPJPCOMMA
KEY_KPLEFTPAREN
KEY_KPMINUS
KEY_KPPLUS
KEY_KPPLUSMINUS
KEY_KPRIGHTPAREN
KEY_KPSLASH
Key_L
KEY_LANGUAGE
KEY_LAST
KEY_LEFT
KEY_LEFTALT
KEY_LEFTBRACE
KEY_LEFTCTRL
KEY_LEFTMETA
KEY_LEFTSHIFT
KEY_LINEFEED
KEY_LIST
KEY_LOGOFF
Key_M
KEY_MACRO
KEY_MAIL
KEY_MAX
KEY_MEDIA
KEY_MEDIA_REPEAT
KEY_MEMO
Key_Menu
KEY_MESSENGER
KEY_MHP
Key_Minus
KEY_MODE
KEY_MOVE
KEY_MP3
KEY_MSDOS
Key_Muhenkan
KEY_MUTE
Key_N
KEY_NEW
KEY_NEWS
KEY_NEXT
KEY_NEXTSONG
KEY_NUMERIC_0
KEY_NUMERIC_1
KEY_NUMERIC_2
KEY_NUMERIC_3
KEY_NUMERIC_4
KEY_NUMERIC_5
KEY_NUMERIC_6
KEY_NUMERIC_7
KEY_NUMERIC_8
KEY_NUMERIC_9
KEY_NUMERIC_POUND
KEY_NUMERIC_STAR
Key_NumLock
Key_O
KEY_OK
KEY_OPEN
KEY_OPTION
Key_P
Key_PageDown
Key_PageUp
KEY_PASTE
Key_Pause
KEY_PAUSECD
KEY_PC
KEY_PHONE
Key_Play
KEY_PLAYCD
KEY_PLAYER
KEY_PLAYPAUSE
KEY_POWER
KEY_POWER2
KEY_PRESENTATION
KEY_PREVIOUS
KEY_PREVIOUSSONG
Key_Print
KEY_PROG1
KEY_PROG2
KEY_PROG3
KEY_PROG4
KEY_PROGRAM
KEY_PROPS
KEY_PVR
Key_Q
Key_Question
Key_R
KEY_RADIO
KEY_RECORD
KEY_RED
KEY_REDO
Key_Refresh
KEY_REPLY
KEY_RESERVED
KEY_RESTART
KEY_REWIND
KEY_RFKILL
Key_Right
KEY_RIGHTALT
KEY_RIGHTBRACE
KEY_RIGHTCTRL
KEY_RIGHTMETA
KEY_RIGHTSHIFT
KEY_RO
Key_S
KEY_SAT
KEY_SAT2
KEY_SAVE
KEY_SCALE
KEY_SCREEN
KEY_SCROLLDOWN
Key_ScrollLock
KEY_SCROLLUP
Key_Search
Key_Select
Key_Semicolon
KEY_SEND
KEY_SENDFILE
KEY_SETUP
KEY_SHOP
KEY_SHUFFLE
Key_Slash
Key_Sleep
KEY_SLOW
KEY_SOUND
Key_Space
KEY_SPELLCHECK
KEY_SPORT
KEY_SPREADSHEET
Key_Stop
KEY_STOPCD
KEY_SUBTITLE
KEY_SUSPEND
KEY_SWITCHVIDEOMODE
KEY_SYSRQ
key_t
Key_Tab
KEY_TAPE
KEY_TEEN
KEY_TEXT
KEY_TIME
KEY_TITLE
KEY_TUNER
KEY_TV
KEY_TV2
KEY_TWEN
Key_U
KEY_UNDO
Key_unknown
KEY_UP
KEY_UWB
Key_V
KEY_VCR
KEY_VCR2
KEY_VENDOR
KEY_VIDEO
KEY_VIDEO_NEXT
KEY_VIDEOPHONE
KEY_VIDEO_PREV
KEY_VOICEMAIL
Key_VolumeDown
Key_VolumeUp
Key_W
KEY_WAKEUP
KEY_WIMAX
KEY_WLAN
KEY_WORDPROCESSOR
KEY_WWW
Key_X
KEY_XFER
Key_Y
KEY_YELLOW
Key_yen
Key_Z
KEY_ZENKAKUHANKAKU
Key_Zoom
KEY_ZOOMIN
KEY_ZOOMOUT
KEY_ZOOMRESET
BTN_0
BTN_1
BTN_2
BTN_3
BTN_4
BTN_5
BTN_6
BTN_7
BTN_8
BTN_9
BTN_A
BTN_B
BTN_BACK
BTN_BASE
BTN_BASE2
BTN_BASE3
BTN_BASE4
BTN_BASE5
BTN_BASE6
BTN_C
BTN_DEAD
BTN_DIGI
BTN_EXTRA
BTN_FORWARD
BTN_GAMEPAD
BTN_GEAR_DOWN
BTN_GEAR_UP
BTN_JOYSTICK
BTN_LEFT
BTN_MIDDLE
BTN_MISC
BTN_MODE
BTN_MOUSE
BTN_PINKIE
BTN_RIGHT
BTN_SELECT
BTN_SIDE
BTN_START
BTN_STYLUS
BTN_STYLUS2
BTN_TASK
BTN_THUMB
BTN_THUMB2
BTN_THUMBL
BTN_THUMBR
BTN_TL
BTN_TL2
BTN_TOOL_AIRBRUSH
BTN_TOOL_BRUSH
BTN_TOOL_DOUBLETAP
BTN_TOOL_FINGER
BTN_TOOL_LENS
BTN_TOOL_MOUSE
BTN_TOOL_PEN
BTN_TOOL_PENCIL
BTN_TOOL_QUADTAP
BTN_TOOL_RUBBER
BTN_TOOL_TRIPLETAP
BTN_TOP
BTN_TOP2
BTN_TOUCH
BTN_TR
BTN_TR2
BTN_TRIGGER
BTN_TRNX
BTN_NTN
BTN_TRIGH
BTN BTN_TRIGX BTN_NTN BTN_TRIGX BTN_NTN
It turns out the configuration file - in our case with the name aa59-00741a.conf, it will be saved in the home folder. In the resulting file, I added through # comments to understand what the button is.
My file aa59-00741a.conf
# Please make this file available to others
# by sending it to
#
# this config file was automatically generated
# using lirc-0.9.0-pre1 (default) on Wed Feb 10 02:11:48 2016
#
# contributed by Malina-shop.ru
#
# brand: Samsung / home / pi / aa59 -00741a.conf.conf
# model no. of remote control: aa59-00741a
# devices being controlled by this remote: Color TV screen
#
begin remote
name Samsung_TV
bits 16
flags SPACE_ENC | CONST_LENGTH
eps 30
aeps 100
header 4565 4509
one 570 1677
zero 570 553
ptrail 570
pre_data_bits 16
pre_data 0xE0E0
gap 108301
toggle_bit_mask 0x0
begin codes
KEY_POWER 0x40BF
KEY_CYCLEWINDOWS 0x807F #SOURCE
KEY_1 0x20DF
KEY_2 0xA05F
KEY_3 0x609F
KEY_4 0x10EF
KEY_5 0x906F
KEY_6 0x50AF
KEY_7 0x30CF
KEY_8 0xB04F
KEY_9 0x708F
KEY_PREVIOUS 0xC837 #PRE-CH
KEY_0 0x8877
KEY_TEXT 0x34CB #TTX/MIX
KEY_MUTE 0xF00F
KEY_CHANNELUP 0x48B7
KEY_CHANNELDOWN 0x08F7
KEY_VOLUMEUP 0xE01F
KEY_VOLUMEDOWN 0xD02F
KEY_LIST 0xD629 #CH LIST
KEY_MEDIA 0x31CE #MEDIA.P
KEY_MENU 0x58A7
KEY_EPG 0xF20D #GUIDE
BTN_TL 0xD22D #TOOLS
KEY_UP 0x06F9
BTN_RIGHT 0x46B9
0xA659 KEY_LEFT
KEY_DOWN 0x8679
KEY_OK 0x16E9 #Enter
BTN_BACK 0x1AE5 #RETURN
KEY_EXIT 0xB44B
Key_A 0x36C9 #red
Key_B 0x28D7 #green
Key_C 0xA857 #YELLOW
Key_D 0x6897 #BLUE
BTN_START 0xFC03 # E-the MANUAL
KEY_SUBTITLE # 0xA45B the AD / SUBT.
KEY_STOP 0x629D
KEY_REWIND 0xA25D
KEY_PLAY 0xE21D
KEY_PAUSE 0x52AD
KEY_FORWARD 0x12ED
KEY_P 0x7C83 # P.SIZE
end codes
end remote
# by sending it to
#
# this config file was automatically generated
# using lirc-0.9.0-pre1 (default) on Wed Feb 10 02:11:48 2016
#
# contributed by Malina-shop.ru
#
# brand: Samsung / home / pi / aa59 -00741a.conf.conf
# model no. of remote control: aa59-00741a
# devices being controlled by this remote: Color TV screen
#
begin remote
name Samsung_TV
bits 16
flags SPACE_ENC | CONST_LENGTH
eps 30
aeps 100
header 4565 4509
one 570 1677
zero 570 553
ptrail 570
pre_data_bits 16
pre_data 0xE0E0
gap 108301
toggle_bit_mask 0x0
begin codes
KEY_POWER 0x40BF
KEY_CYCLEWINDOWS 0x807F #SOURCE
KEY_1 0x20DF
KEY_2 0xA05F
KEY_3 0x609F
KEY_4 0x10EF
KEY_5 0x906F
KEY_6 0x50AF
KEY_7 0x30CF
KEY_8 0xB04F
KEY_9 0x708F
KEY_PREVIOUS 0xC837 #PRE-CH
KEY_0 0x8877
KEY_TEXT 0x34CB #TTX/MIX
KEY_MUTE 0xF00F
KEY_CHANNELUP 0x48B7
KEY_CHANNELDOWN 0x08F7
KEY_VOLUMEUP 0xE01F
KEY_VOLUMEDOWN 0xD02F
KEY_LIST 0xD629 #CH LIST
KEY_MEDIA 0x31CE #MEDIA.P
KEY_MENU 0x58A7
KEY_EPG 0xF20D #GUIDE
BTN_TL 0xD22D #TOOLS
KEY_UP 0x06F9
BTN_RIGHT 0x46B9
0xA659 KEY_LEFT
KEY_DOWN 0x8679
KEY_OK 0x16E9 #Enter
BTN_BACK 0x1AE5 #RETURN
KEY_EXIT 0xB44B
Key_A 0x36C9 #red
Key_B 0x28D7 #green
Key_C 0xA857 #YELLOW
Key_D 0x6897 #BLUE
BTN_START 0xFC03 # E-the MANUAL
KEY_SUBTITLE # 0xA45B the AD / SUBT.
KEY_STOP 0x629D
KEY_REWIND 0xA25D
KEY_PLAY 0xE21D
KEY_PAUSE 0x52AD
KEY_FORWARD 0x12ED
KEY_P 0x7C83 # P.SIZE
end codes
end remote
This action needs to be done for each remote. The configuration file contains an important field - name. This is the name of the device by which lirc will determine which file to take the command from (in my case, Samsung_TV).
The resulting file is copied somewhere. I put in the / etc / lirc / rc folder and added the line to the /etc/lirc/lircd.conf file:
include "/etc/lirc/rc/aa59-00741a.conf"
Thus, the lirc configuration file will take information about my remote control from the aa59-00741a.conf file located in the / etc / lirc / rc folder. In my opinion, this is the easiest way to add information about the console configuration to the program settings.
Restart lirc:
sudo /etc/init.d/lirc restart
Now lirc can use the remote control data for transmission using the transmitter, or for recognizing commands from the remote control and launching any actions in response to raspberry.
Checking the operation of lirc and IR transmitter
To do this, we place the transmitter as close to the device as possible (for verification, then it will be possible to experimentally determine how far it will work) and write a command in the terminal, for example:
irsend SEND_ONCE Samsung_TV KEY_POWER
where irsend is the program for controlling the transmitter;
SEND_ONCE - attribute of a one-time signal sending;
Samsung_TV - device name from the configuration file (in the name field);
KEY_POWER - the name of the command from the configuration file to be sent.
In this way, the TV can turn on or off. With this command, I turn the TV on or off.
Another check of the IR receiver, as well as the correct perception by the lirc of the configuration file
In the terminal, enter the command:
irw
After that, when the buttons of the remote control are pressed, their names from the configuration file will be displayed.
The next step is to control the transmitter through a browser, but I have not yet studied this.
Will be glad to comments.