In the last experiment, I recorded RGB strip remote commands with LIRC and played them. Taking a step further, I tried to miniaturize my remote controller to ATTiny85 processor. Digispark is my favorite development board for this.

I used Arduino-IRRemote library. It default uses Pin 3 for transmitter. However, pin 3 on Digispark is not a PWM, also Pin 3 and Pin 4 are used by USB programmer so I made change to library and used Pin 1 in IRremoteInt.h [line 283] so I can upload code without disassembling again.

...
# define TIMER_PWM_PIN 14 // MightyCore
#else
# define TIMER_PWM_PIN 1 //3 // Arduino Duemilanove, Diecimila, LilyPad, etc
#endif // ATmega48, ATmega88, ATmega168, ATmega328

Previously, I had translated remote raw codes using irrecord analyze (-a) switch

$irrecord -a rgb.conf

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
 ...

With IRrecvDumpV2 example code, I also confirmed that the encoding used is NEC.

Code to upload to Digispark

#include <IRremote.h> 

IRsend irsend; 

void setup() 
{
}

void loop() 
{
  irsend.sendNEC(0x00F7C03F, 32); //On
  delay(1000); 
  irsend.sendNEC(0x00F740BF, 32); //Off
  delay(1000); 
}

I programmed and plugged the Digispark to a Power-bank. It is now controlling my desk lights! On-Off-On-Off

WP_20160731_21_02_21_Rich_LI

I spent all day trying to decode signals from this remote, my tv remote and the STB. STB remote encoding is the only one left to crack… Hope to crack it soon!

Commands for reference

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
          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
          KEY_FN_F2                0x00F7F00F
          KEY_FN_F3                0x00F7C837
          KEY_FN_F4                0x00F7E817
      end codes

end remote
Advertisements