Hardware components | ||||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
Hand tools and fabrication machines | ||||||
| ||||||
|
The code allows you to use your TV's IR remote control Vol Up, Vol Down, and Mute buttons to control speakers that come with their own IR remote. It's a pain to keep 2 remotes at hand.
I used hot glue to mount the Nano between the grill and speaker.
The blue led and IR Rcvr face the user, while the IR Led faces backward towards the speakers' IR remote sensor.
Space was tight, and you can see from picture I used creative soldering to place the components. I used a USB cable plugged into a USB port on the TV to power the board, and with one end removed, I soldered the Black (GND) and Red (+5VDC) USB wires directly to the 5V & GND inputs of the Nano.
TV IR remote to Speaker IR remote code translator
Arduinorecieve IR codes from TV IR remote control, send code for speaker system
You will first need to gather the IR codes for your TV's remote and your speaker system remote. See "IR Remote" tutorials elsewhere for how to do this. The below is for LG Magic Remote and EDIFIER R1280DB speakers.
You will first need to gather the IR codes for your TV's remote and your speaker system remote. See "IR Remote" tutorials elsewhere for how to do this. The below is for LG Magic Remote and EDIFIER R1280DB speakers.
#include <IRLibSendBase.h>
#include <IRLibDecodeBase.h> // First include the decode base
#include <IRLib_P01_NEC.h>
#include <IRLibCombo.h>
#include <IRLibRecv.h>
IRdecodeNEC myDecoder; // Now declare an instance of that decoder.
IRsend mySender; //pin 3 is set aas IR LED transmitter output by IRLibSendBase.h
IRrecv myReceiver(2); //pin number for the receiver
void setup() {
myReceiver.enableIRIn(); //Start the receiver
pinMode(4, OUTPUT); //BLUE LED CONNECTED TO PIN 4
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void loop() {
digitalWrite(4, LOW);
if (myReceiver.getResults()) {
if (myDecoder.decode()) {
switch (myDecoder.value) {
case 0xFF827D: mySender.send(NEC, 0x8E7906F, 0); //if rcv TV VOL UP, send SPKR VOL UP
delay(25);
digitalWrite(4, HIGH); // 1st BLUE LED BLINK
delay(200);
digitalWrite(4, LOW);
delay(25);
mySender.send(NEC, 0x8E7906F, 0); //resend SPKR VOL UP
delay(25);
digitalWrite(4, HIGH); // 2nd BLUE LED BLINK (2 BLINKS FOR VOL UP)
delay(200);
digitalWrite(4, LOW);
break;
case 0xFFA25D: mySender.send(NEC, 0x8E730CF, 0); //if rcv TV VOL DOWN, send SPKR VOL DOWN
delay(25);
digitalWrite(4, HIGH); // 1 BLUE BLINK FOR VOL DOWN
delay(200);
digitalWrite(4, LOW);
delay(25);
mySender.send(NEC, 0x8E730CF, 0); //resend SPKR VOL DOWN
delay(25);
mySender.send(NEC, 0x8E730CF, 0); //resend SPKR VOL DOWN
delay(25);
break;
case 0xFF12ED: mySender.send(NEC, 0x8E700FF, 0); //if rcv TV MUTE, send SPKR MUTE
delay(25);
digitalWrite(4, HIGH); // LONG BLUE BLINK FOR MUTE ACKNOWLEDGED
delay(800);
break;
}
}
delay(200);
digitalWrite(4, LOW);
myReceiver.enableIRIn(); //Re-enable rcvr after sending
}
}
#include <IRLibSendBase.h>
#include <IRLibDecodeBase.h> // First include the decode base
#include <IRLib_P01_NEC.h>
#include <IRLibCombo.h>
#include <IRLibRecv.h>
IRdecodeNEC myDecoder; // Now declare an instance of that decoder.
IRsend mySender; // Pin 3 set as IR LED by IRLibSendBase.h
IRrecv myReceiver(2); // Pin 2 is IR receiver
void setup() {
myReceiver.enableIRIn(); //Start the receiver
pinMode(4, OUTPUT); // Pin 4 is BLUE LED for visual confirmation of "IR command sent"
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void loop() {
digitalWrite(4, LOW);
if (myReceiver.getResults()) {
if (myDecoder.decode()) {
switch (myDecoder.value) {
case 0xFF827D: mySender.send(NEC, 0x8E7906F, 0); //if rcv TV VOL UP, send SPKR VOL UP
delay(25);
digitalWrite(4, HIGH); // 1st BLUE LED BLINK
delay(200);
digitalWrite(4, LOW);
delay(25);
mySender.send(NEC, 0x8E7906F, 0); //resend SPKR VOL UP
delay(25);
digitalWrite(4, HIGH); // 2nd BLUE LED BLINK (2 BLINKS FOR VOL UP)
delay(200);
digitalWrite(4, LOW);
break;
case 0xFFA25D: mySender.send(NEC, 0x8E730CF, 0); //if rcv TV VOL DOWN, send SPKR VOL DOWN
delay(25);
digitalWrite(4, HIGH); // SINGLE BLUE BLINK FOR VOL DOWN
delay(200);
digitalWrite(4, LOW);
delay(25);
mySender.send(NEC, 0x8E730CF, 0); //resend SPKR VOL DOWN
delay(25);
mySender.send(NEC, 0x8E730CF, 0); //resend SPKR VOL DOWN
delay(25);
break;
case 0xFF12ED: mySender.send(NEC, 0x8E700FF, 0); //if rcv TV MUTE, send SPKR MUTE
delay(25);
digitalWrite(4, HIGH); // LONG BLUE BLINK FOR MUTE ACKNOWLEDGED
delay(800);
break;
}
}
delay(200);
digitalWrite(4, LOW);
myReceiver.enableIRIn(); //Re-enable rcvr after sending
}
}
Comments