I recently built an L-shaped desk for myself. One side for books, the other side for IoT and a 27″ Benq monitor in center. I got this fancy RGB LED strip with remote from some online seller. Cut it down to pieces and soldered wired on corners. Then I fixed the LEDs to the desk and back of my monitor so I have as much diffused light reflecting from walls as possible.

WP_20160730_18_26_01_Pro_LI

Next, I setup my Raspberry to be able to send IR. Then I recorded IR commands that were used by the LED strip IR remote. For this, I used ‘irrecord

$ irrecord -d /dev/lirc0 ~/light


Please enter the name for the next button (press <ENTER> to finish recording)
Key_Play

Now hold down button "Key_Play".
Got it.
Signal length is 67

Please enter the name for the next button (press <ENTER> to finish recording)
Key_Stop

Now hold down button "Key_Stop".
Got it.
Signal length is 67

Lirc irrecord supports only known names for keys which can be discovered with ‘irrecord –list-namespace‘ command.

$ irrecord --list-namespace
KEY_0
KEY_102ND
KEY_1
KEY_2
KEY_3
KEY_4
KEY_5
KEY_6
KEY_7
KEY_8

Once, all the keys are recorded, the output is saved in ~/light.conf. This needs to be merged with /etc/lirc/lircd.conf where I had more remotes.

sudo su 
cat light.conf.conf >> /etc/lirc/lircd.conf

Be sure that each remote configuration be saved in ‘begin remote‘ and ‘end remote‘ section of the file.

begin remote

name desklight
 flags RAW_CODES|CONST_LENGTH
 eps 30
 aeps 100

gap 108363

begin raw_codes

name Key_Play
 9096 4515 602 537 589 529
 611 526 603 540 589 527
 613 528 601 539 590 528
 623 1646 594 1660 571 1682
 617 1658 593 526 626 1649
 591 1660 576 1678 616 1657
 597 1666 560 574 590 526
 615 524 604 535 592 527
 616 523 604 538 589 547
 608 1649 591 1656 574 1682
 618 1658 595 1702 563 1645
 619


...


 end raw_codes

end remote

WP_20160730_18_23_35_Pro_LI

Then, to test, play each command using irsend

irsend SEND_ONCE desklight Key_Play
irsend SEND_ONCE desklight Key_Stop
irsend SEND_ONCE desklight Key_Blue

 

My remote configuration file is attached here as light file, rename extension to .conf

IRrecord can analyze the raw codes and convert them into commands. All you have to do is

irrecord -a /etc/lirc/lircd.conf

After analysis, new IR codes looks like below

begin remote

name DESK_LIGHT
 bits 32
 flags SPACE_ENC|CONST_LENGTH
 eps 30
 aeps 100

header 9134 4491
 one 591 1664
 zero 591 545
 ptrail 613
 gap 108325
 toggle_bit_mask 0x0

begin codes
 KEY_PLAY 0x00F7C03F
 KEY_PAUSE 0x00F740BF
 KEY_DOWN 0x00F7807F
 KEY_UP 0x00F700FF
 KEY_RED 0x00F720DF
 KEY_GREEN 0x00F7A05F
 KEY_BLUE 0x00F7609F
 KEY_YELLOW 0x00F7E01F  #White
 KEY_F1 0x00F710EF
 KEY_F2 0x00F730CF
 KEY_F3 0x00F708F7
 KEY_F4 0x00F728D7
 KEY_F11 0x00F7906F
 KEY_F12 0x00F7B04F
 KEY_F13 0x00F78877
 KEY_F14 0x00F7A857
 KEY_F21 0x00F750AF
 KEY_F22 0x00F7708F
 KEY_F23 0x00F748B7
 KEY_F24 0x00F76897
 KEY_FN_F1 0x00F7D02F  #Flash
 KEY_FN_F2 0x00F7F00F  #Strobe
 KEY_FN_F3 0x00F7C837  #Fade
 KEY_FN_F4 0x00F7E817  #Smooth
end codes

 

Advertisements