Insert IR code translator in IR repeater system

Hello,

I'm working on a little project and I'm a little stuck. We have Xfinity at home and are using the existing remote control. However, the volume and mute buttons on the control are controlling the TV but I'd rather have them control our sound system. We also have an IR repeater system. Now I had the idea to make a little 'translator' device to change the codes from the ones the TV responds to, to the ones from the sound system. The device should be plugged-in between the IR receiver and the diverter.

What I accomplished so far. I was able to use the IR receiver and transmitter from the Arduino set and receive, translate and send the code to the repeater. Now I'd like to use the existing IR receiver from the repeater, because it looks nicer and has the confirmation LED already built in. Then I'd like to connect the output directly into the diverter. The receiver is connected via a stereo jack to the system. I connected ground and 5V to the receiver and tried to use the last connector for the signal. It should be the right wiring. At least I'm getting a confirmation from the receiver LED when I send a signal but I don't get any codes in the monitor.

I hope I was able to explain what I'm trying to do. Has anyone tried to do something similar and can give me a hint?

Thank you!

Hi Dwicke,

Just out of the shower and rushing out, but if you draw and post a little picture to highlight your setup I can try to give a look when I get back later and see if I can help.

What you describe sounds easy enough so would guess a solution is in sight.

Hv.

Hi Hiddenvision,

Thank you for your willingness to help. I appreciate that.

Here's a picture of the setup that works:

Now I'd like to use this receiver from the repeater instead of the one from the Arduino set. I connected the Sleeve with ground, the Ring with 5V and the Tip with pin 11. Since the LED in the receiver is giving me a feedback for receiving a signal I assume that's the right wiring. I don't have any documentation about the wiring of the repeater so I googled for the most likely solution.

I'm using the IRremote library to handle and convert the codes and in the first setup it works perfectly. However I'm not getting any code from this receiver.

The final step later after solving this problem would be to get rid of the transmitter LED and connect the output directly to the repeater box. Basically inserting my "code translator" between the receiver and the box.

Here's an image of the receiver box

Thank you again!

Hi Dw,
Well you are right on track, but you know that already.!

This reply will be brief as I am busy side tracked on Harley bikes today so the mind is thinking other things.

But FIRST if you can pop the plastic BAFX receiver apart pic3 then you should be able to see exactly what way the wires go round. That would be best as you do not want to shove 5v up the output line for too long.

But check that the data out pin is what it is . PERHAPS swapping the 5v and the signal wires around.

If I look around later I will no doubt find something similar on the shelfs here to see how that is wired.

But Logically you are doing everything 100%, more so if you have proved the Arduino side of things by using those other boards and show it working. The IR library is pretty great, has worked for everything I have needed for both sending and receiving but you have proved that so do think that side is a problem at all.

You may also find that perhaps the receiver wiring is correct but the data pin is inverted logic, so highs are lows and visa versa , I'm scratching here but worth a thought.

So yer,
check the pinouts to that 3.5mm plug one more time, pop the plastic off the receiver and get sight of the actual receiver diode/module.

Then check to see if the data line is inverted. You know, resting at 5v and banging low on active data or resting at 0volts and spiking to 5v when it sees data If you can find the spec sheet of the IR receiver IC that will make it clear. If inverted you need to invert your receiving logic in the code or reinvert the signal again to be standard to your other working receiver.

Presume you have a multi meter, just probe the data pin press some IR buttons and see it you can the voltage jiggle.

Sorry I know this reply is not a one button fix but as mentioned my head is not in the right place (it will be back after I finish with this bike.) and I truly suspect it will be something simple like the above mentioned rather than a never gonna work thing.

If you can get the little receiver exposed pop up another picture or part number if visible.

I'll be back.!!!!

Hv.

Edit:
Although you don't need it .
Someone doing a similar thing for reference.

Thank you so much, Hv!

I don't have a multi meter (anymore) but will get one this week and check out your suggestions and also take the picture.

I'll keep you posted!

Sorry, that took much longer than planned.

Unfortunately I wasn't able to open the receiver because it is really tiny and the only point of leverage is where the cable goes in and I didn't want to damage the cable/receiver. But I have another extender that I was able to open. Here's how it looks inside:

However I had the same problem with this one. It wasn't receiving any signals. After you pointing me in that direction and some research I decided to give it a try and changed the settings in IRemoteInt.h from

#define MARK 0
#define SPACE 1

to

#define MARK 1
#define SPACE 0

I hope that was the right place to do it. The good news is that I'm now actually getting codes from both receivers but the bad news is that the signals seem to be random. I'm still in the process of finding out if they're really random or not. I read some posts that stated that it might be caused by cheap hardware/LEDs but I'm not sure that's true in this case.

I just wanted to give you an update and thank you for your help. Let me know if you have any experience with random codes. I'll keep on finding out about the randomness.

Thank you again and have a nice weekend!

It could be running at a slightly different frequency.
There is a carrier frequency that the IR pulses are sent over.

It's a long time since I was tinkering with IR.
I forget all the tweaky bits in the libary.
If I remember the debug mode did something useful.
I'll have a quick read on some old code. Refresh the mind..

Looks like the IR may feed that little IC, perhaps just a simple OPAmp just to give a clean data signal at the connector.
Can't see enough to identify any wiring per say, but it should be easy enough to spot true Pos & Neg then the data. and a fourth wire, led perhaps !

There is also the option to enable / disable the different remote decode/encode modules.

I seem to get best results turning off everything except the expected encoding.
And yes in the top of the iRremote.h I see some #if debug define a debug_print.
This was the version I was using.

//******************************************************************************
// IRremote
// Version 2.0.1 June, 2015
// Copyright 2009 Ken Shirriff
// For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
// Edited by Mitra to add new controller SANYO
//
// Interrupt code based on NECIRrcv by Joe Knapp
// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
// Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
//
// JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
// LG added by Darryl Smith (based on the JVC protocol)
// Whynter A/C ARC-110WD added by Francesco Meschia
//******************************************************************************

//------------------------------------------------------------------------------
// Supported IR protocols
// Each protocol you include costs memory and, during decode, costs time
// Disable (set to 0) all the protocols you do not need/want!
//

//------------------------------------------------------------------------------
// Set DEBUG to 1 for lots of lovely debug output
//
#ifndef DEBUG
#define DEBUG  0
#endif
//------------------------------------------------------------------------------
// Debug directives
//
#if DEBUG
# define DBG_PRINT(...)    Serial.print(__VA_ARGS__)
# define DBG_PRINTLN(...)  Serial.println(__VA_ARGS__)
#else
# define DBG_PRINT(...)
# define DBG_PRINTLN(...)
#endif

Hi Hv,

thank you! I deactivated all decode modules but the NEC. It should be NEC codes because they were identified as such when I was working with the standard IR receiver from the Arduino set and I was also able to use sendNec() when forwarding the codes. I also activated the debug mode. Here are a few results from the monitor when pressing the the same button on the remote:

Attempting NEC decode
Testing mark (actual vs desired): 250us vs 9000us: 6800 <= 250 <= 11400?; FAILED
F9C9F1E
Attempting NEC decode
Testing mark (actual vs desired): 450us vs 9000us: 6800 <= 450 <= 11400?; FAILED
F8729E75
Attempting NEC decode
Testing mark (actual vs desired): 100us vs 9000us: 6800 <= 100 <= 11400?; FAILED
F6650069

The same happens when I have the other modules enabled. Just with an attempt on every single one. I tried to find other libraries/sketches to see if I can get different results.

You mentioned that the receiver might be running at a slightly different carrier frequency. I didn't find a setting to change the frequency. Is that even possible or am I on the wrong track here?

Thank you again for your patience and insights!

Hi DW,

Mostly the frequency is done in the library cpp files for the different remote types.
See "ir_nec.cpp"

// Set IR carrier frequency
enableIROut(38);

It is possible that the little 8pin IC on the receiver board is actually something smart.
It could be something that is doing all the IR detection work and simply passing back serial data or stuff in another format into the repeater box. Have you tried to wire the project IR boards to the repeater box.

Without a scope it is hard to what the device maybe doing.
You can try to gather some timing data with a simple sketch to monitor the IR pin and print something.
That way you can spot idle state and perhaps get a feel for any differences the two different receivers are outputting

Something like,

/*
  Modified from State change detection (edge detection) Example

*/

// this constant won't change:
const int  IR_INpin = 11;             // the pin that the IR pin is attached to
const int ledPin = 13;                // the pin that the visible LED is attached to

// Variables will change:
int IRpinState = 0;                   // current state of the IR pin
int last_IRpinState = 0;              // previous state of the IR pin
uint32_t  last_statechangetime = 0;   // Time of last change (millis())
uint32_t  state_duration = 0;         // Time between changes
uint32_t  last_repeattime = 0;         // 
uint32_t  repeat_duration = 0;         // Time between repeats
bool userepeat = false;



////////////////////////////////////////////////
const int REPEATFREQ = 50;
const int SERIALTYPE = 3;
////////////////////////////////////////////////

////////////////////////////////////////////////
void setup() {
//  pinMode(IR_INpin, INPUT_PULLUP);    // initialize the IR Pin as a input:
  pinMode(IR_INpin, INPUT);           // initialize the IR pin as a input:
  pinMode(ledPin, OUTPUT);            // initialize the LED as an output:
  digitalWrite(ledPin, HIGH);    
  
  Serial.begin(115200);               // initialize serial communication:
  if (SERIALTYPE != 3){
    Serial.print("Pin State Tester on pin "); Serial.println(IR_INpin, DEC);
  }
  
  digitalWrite(ledPin, LOW);    
  IRpinState = digitalRead(IR_INpin);
  last_IRpinState = IRpinState;        
  digitalWrite(ledPin, IRpinState);    
  
  last_statechangetime = millis();
  if (SERIALTYPE == 0){Print_HL_Millis();}
  if (SERIALTYPE == 1){Print_LH_Duration();}
  if (SERIALTYPE == 2){Print_Data();}
  if (SERIALTYPE == 3){Print_Plotter();}
}
////////////////////////////////////////////////

////////////////////////////////////////////////
void loop() {  
  IRpinState = digitalRead(IR_INpin);     // read the IR input pin:
  if (IRpinState != last_IRpinState) {    // compare the IR pinState to its previous state    
    state_duration = (millis() - last_statechangetime);
    last_statechangetime = millis();
    last_repeattime = last_statechangetime;
    digitalWrite(ledPin, IRpinState);    
    last_IRpinState = IRpinState;        
    
    if (state_duration >= 1000){  // No changes for over a second.
      if (SERIALTYPE == 0){Serial.println();}
      if (SERIALTYPE == 2){Serial.println();}
    }
    
    if (SERIALTYPE == 0){Print_HL_Millis();}
    if (SERIALTYPE == 1){Print_LH_Duration();}
    if (SERIALTYPE == 2){Print_Data();}
    if (SERIALTYPE == 3){Print_Plotter();}
    
    if (state_duration >= 1000){  // No changes for over a second.
      if (SERIALTYPE == 1){Serial.println();}
    }
    
  } else {
    if ((millis() - last_statechangetime) >= 1000){userepeat = false;}
    if (userepeat){
      repeat_duration = (millis() - last_repeattime);
      if (repeat_duration >= REPEATFREQ){
        last_repeattime = millis();
        if (SERIALTYPE == 2){Print_Data();}
        if (SERIALTYPE == 3){Print_Plotter();}
      }
    }
  }
}
////////////////////////////////////////////////

////////////////////////////////////////////////
void Print_Data(){
  // Just prints "-" or "_"
  if (IRpinState == HIGH) {Serial.print("-");} 
  else {Serial.print("_");}
  userepeat = true;
}
////////////////////////////////////////////////

////////////////////////////////////////////////
void Print_Plotter(){
  // Just a template to use the serial plotter feature in the Arduino IDE.
  // This may need editing to work, quick read of the serial plotter docs will help.
  Serial.println(IRpinState,DEC);
  userepeat = true;
}
////////////////////////////////////////////////

////////////////////////////////////////////////
void Print_HL_Millis(){
  // Shows the current state and the Millis timer
  if (IRpinState == HIGH) {Serial.print("H,");} 
  else {Serial.print("L,");}
  Serial.println(last_statechangetime,DEC);      
  userepeat = false;
}
////////////////////////////////////////////////

////////////////////////////////////////////////
void Print_LH_Duration(){
  // Shows the previous state and it's duration
  if (IRpinState == HIGH) {Serial.print("L,");} 
  else {Serial.print("H,");}
  Serial.println(state_duration,DEC);      
  userepeat = false;
}
////////////////////////////////////////////////

////////////////////////////////////////////////

That's now the weird but also very interesting part.

I bought this specific extender because someone claimed in his review that he could plug in his Harmony controller via cable directly into it without having to use the emitter and receiver in between. The extender seems to be able to handle the signals from different sources.

I was at first postponing to connect my Arduino project to the extender and figure out the incoming part first. But after you mentioned it I tried and am amazed that this setup with the standard receiver actually works.

It might be the case that the receiver somehow "encrypts" the code and the extender is able to handle it? I used your code for the timing data and it printed out zeros and a 1 every time. Not sure if it's even possible to get reliable data from this receiver or if it would be easier to include the standard receiver and led in the little casing and replicate the behaviour (give feedback when ir signal received) with the board.

I have to think about it...

Thank you again for your help I really appreciate it!