├── ir_to_lwrf-stripboard.fzz ├── images ├── fritzing-schematic.png ├── photo-stripboard.jpg ├── fritzing-stripboard.png ├── photo-enclosure-inside.jpg └── photo-enclosure-finished.jpg ├── generate_mapping_code.rb ├── README.md └── ir_to_lwrf.ino /ir_to_lwrf-stripboard.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/njh/ir_to_lwrf/main/ir_to_lwrf-stripboard.fzz -------------------------------------------------------------------------------- /images/fritzing-schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/njh/ir_to_lwrf/main/images/fritzing-schematic.png -------------------------------------------------------------------------------- /images/photo-stripboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/njh/ir_to_lwrf/main/images/photo-stripboard.jpg -------------------------------------------------------------------------------- /images/fritzing-stripboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/njh/ir_to_lwrf/main/images/fritzing-stripboard.png -------------------------------------------------------------------------------- /images/photo-enclosure-inside.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/njh/ir_to_lwrf/main/images/photo-enclosure-inside.jpg -------------------------------------------------------------------------------- /images/photo-enclosure-finished.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/njh/ir_to_lwrf/main/images/photo-enclosure-finished.jpg -------------------------------------------------------------------------------- /generate_mapping_code.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # LightWave RF Protocol documented here: 4 | # https://wiki.somakeit.org.uk/wiki/LightwaveRF_RF_Protocol 5 | # 6 | 7 | NIBBLES = [0xF6,0xEE,0xED,0xEB,0xDE,0xDD,0xDB,0xBE,0xBD,0xBB,0xB7,0x7E,0x7D,0x7B,0x77,0x6F]; 8 | 9 | mapping = { 10 | '0xC2D0' => 'C0 F0 F3 18 90', 11 | '0xC2D0' => 'C0 F0 F3 18 90', 12 | '0xC038' => '82 F2 F3 18 90', 13 | '0xC084' => '00 01 F3 18 90', 14 | '0xC044' => '00 00 F3 18 90', 15 | '0xC0C4' => '00 11 F3 18 90', 16 | '0xC024' => '00 10 F3 18 90', 17 | '0xC0A4' => '00 21 F3 18 90', 18 | '0xC064' => '00 20 F3 18 90', 19 | '0xC0E4' => '00 31 F3 18 90', 20 | '0xC014' => '00 30 F3 18 90', 21 | } 22 | 23 | def lwrf_encode(bytes) 24 | raw_bytes = [] 25 | bytes.each do |byte| 26 | raw_bytes << NIBBLES[ (byte >> 4) & 0xF ] 27 | raw_bytes << NIBBLES[ (byte >> 0) & 0xF ] 28 | end 29 | return raw_bytes.map{|b| sprintf("\\x%X", b)}.join 30 | end 31 | 32 | mapping.each_pair do |ir, lwrf| 33 | raw_bytes = lwrf_encode(lwrf.split.map{|str| str.hex}) 34 | 35 | puts "case #{ir}:" 36 | puts " lw_send((byte*)\"#{raw_bytes}\");" 37 | puts "break;" 38 | end 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Infrared to LightWave RF relay 2 | ============================== 3 | 4 | 5 | 6 | Stripboard Design 7 | ----------------- 8 | 9 | ![Stripboard design made using Fritzing](https://raw.githubusercontent.com/njh/ir_to_lwrf/master/images/fritzing-stripboard.png) 10 | 11 | 12 | Schematic 13 | --------- 14 | 15 | ![Schematic made using Fritzing](https://raw.githubusercontent.com/njh/ir_to_lwrf/master/images/fritzing-schematic.png) 16 | 17 | 18 | 19 | Button mapping 20 | -------------- 21 | 22 | | JVC Button | JVC Code | LightWave RF Button | LightWave RF Code | 23 | |------------|----------|---------------------|-------------------| 24 | | Power | 0xC2D0 | All Off | C0 F0 F3 18 90 | 25 | | Mute | 0xC038 | Mood | 82 F2 F3 18 90 | 26 | | 1 | 0xC084 | Light 1 On | 00 01 F3 18 90 | 27 | | 2 | 0xC044 | Light 1 Off | 00 00 F3 18 90 | 28 | | 3 | 0xC0C4 | Light 2 On | 00 11 F3 18 90 | 29 | | 4 | 0xC024 | Light 2 Off | 00 10 F3 18 90 | 30 | | 5 | 0xC0A4 | Light 3 On | 00 21 F3 18 90 | 31 | | 6 | 0xC064 | Light 3 Off | 00 20 F3 18 90 | 32 | | 7 | 0xC0E4 | Light 4 On | 00 31 F3 18 90 | 33 | | 8 | 0xC014 | Light 4 Off | 00 30 F3 18 90 | 34 | | 9 | 0xC094 | | | 35 | | 0 | 0xC004 | | | 36 | 37 | 38 | 39 | Atmega 328 Pinout 40 | ----------------- 41 | 42 | | Arduino Pin | AVR Pin | Function | 43 | |-------------|---------|-----------------| 44 | | D0 | D0 | Serial Receive | 45 | | D1 | D1 | Serial Transmit | 46 | | D2 | D2 | | 47 | | D3 | D3 | | 48 | | D4 | D4 | | 49 | | D5 | D5 | Red LED | 50 | | D6 | D6 | | 51 | | D7 | D7 | | 52 | | D8 | B0 | IR Receive | 53 | | D9 | B1 | RF Transmit | 54 | | D10 | B2 | | 55 | | D11 | B3 | | 56 | | D12 | B4 | | 57 | | D13 | B5 | | 58 | | A0 | C0 | | 59 | | A1 | C1 | | 60 | | A2 | C2 | | 61 | | A3 | C3 | | 62 | | A4 | C4 | | 63 | | A5 | C5 | | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /ir_to_lwrf.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * InfraRed to LightwaveRF relay 3 | * Receives remote control commands via InfraRed 4 | * and then transmits commands to LightWave RF 5 | * 6 | * Dependencies: 7 | * IRRemote: https://github.com/shirriff/Arduino-IRremote 8 | * LightwaveRF: https://github.com/lawrie/LightwaveRF/ 9 | * 10 | * Copyright 2015 Nicholas Humfrey 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | 17 | int LW_TX_PIN = 9; 18 | int IR_RECV_PIN = 8; 19 | int LED_PIN = 5; 20 | 21 | IRrecv irrecv(IR_RECV_PIN); 22 | decode_results results; 23 | 24 | void setup() 25 | { 26 | Serial.begin(9600); 27 | lw_tx_setup(LW_TX_PIN); 28 | irrecv.enableIRIn(); 29 | 30 | // Turn on the LED for 1/4 a second 31 | pinMode(LED_PIN, OUTPUT); 32 | digitalWrite(LED_PIN, HIGH); 33 | delay(250); 34 | digitalWrite(LED_PIN, LOW); 35 | 36 | Serial.println("Ready."); 37 | } 38 | 39 | void loop() { 40 | if (irrecv.decode(&results)) { 41 | if (results.decode_type == JVC) { 42 | digitalWrite(LED_PIN, HIGH); 43 | Serial.print("Received: 0x"); 44 | Serial.println(results.value, HEX); 45 | switch(results.value) { 46 | case 0xC2D0: 47 | lw_send((byte*)"\x7D\xF6\x6F\xF6\x6F\xEB\xEE\xBD\xBB\xF6"); 48 | break; 49 | case 0xC038: 50 | lw_send((byte*)"\xBD\xED\x6F\xED\x6F\xEB\xEE\xBD\xBB\xF6"); 51 | break; 52 | case 0xC084: 53 | lw_send((byte*)"\xF6\xF6\xF6\xEE\x6F\xEB\xEE\xBD\xBB\xF6"); 54 | break; 55 | case 0xC044: 56 | lw_send((byte*)"\xF6\xF6\xF6\xF6\x6F\xEB\xEE\xBD\xBB\xF6"); 57 | break; 58 | case 0xC0C4: 59 | lw_send((byte*)"\xF6\xF6\xEE\xEE\x6F\xEB\xEE\xBD\xBB\xF6"); 60 | break; 61 | case 0xC024: 62 | lw_send((byte*)"\xF6\xF6\xEE\xF6\x6F\xEB\xEE\xBD\xBB\xF6"); 63 | break; 64 | case 0xC0A4: 65 | lw_send((byte*)"\xF6\xF6\xED\xEE\x6F\xEB\xEE\xBD\xBB\xF6"); 66 | break; 67 | case 0xC064: 68 | lw_send((byte*)"\xF6\xF6\xED\xF6\x6F\xEB\xEE\xBD\xBB\xF6"); 69 | break; 70 | case 0xC0E4: 71 | lw_send((byte*)"\xF6\xF6\xEB\xEE\x6F\xEB\xEE\xBD\xBB\xF6"); 72 | break; 73 | case 0xC014: 74 | lw_send((byte*)"\xF6\xF6\xEB\xF6\x6F\xEB\xEE\xBD\xBB\xF6"); 75 | break; 76 | } 77 | } 78 | irrecv.resume(); // Receive the next value 79 | } 80 | delay(100); 81 | digitalWrite(LED_PIN, LOW); 82 | } 83 | 84 | --------------------------------------------------------------------------------