davelook
Published © GPL3+

TV Remote for Speakers - IR Translator

Use your TV's IR remote to control the volume and mute of separate speakers without using the speaker's remote.

IntermediateShowcase (no instructions)7,856
TV Remote for Speakers - IR Translator

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
IR (Infrared) Receiver Sensor - TSOP38238
×1
Super-bright 5mm IR LED - 940nm
×1
Blue LED
×1
USB Pigtail
×1
Resistor 220 ohm
Resistor 220 ohm
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

IR translator schematic

Code

TV IR remote to Speaker IR remote code translator

Arduino
recieve 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.
#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
  }
}

TV IR Remote translator

Arduino
#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
  }
}

Credits

davelook

davelook

0 projects • 4 followers

Comments