[Solved] Unable to control tv/receiver with ir.

Hi all,
I am doing a little project with an arduino uno as a smart home controller over network.

I thought it would be nice to be able to control my tv and av receiver with an IR led.

I had no problem setting up sheriff IRremote library and started recording ir signals with an tsop38238 reciever.

Then I hooked up my ir led TSHG5410 850nm to pin 3 with an 200 ohm resistor. This work nicely sending encoded signals to the ir receiver and it decoded it with the correct protocol and signal but it wont control any of my devices. Then I tried sending a raw signal but that didn't seem to work either.

I googled the ir codes for my devices and it seems that i am receiving correctly because they where correct.
It's an old Sony receiver and a swedish tv using rc5 protocol.
It seems that I am missing something somewhere and I am in great need of tips.

Heres my current send code:
I have tried multiple different approaches but it shouldn't be harder then this...

#include <IRremote.h>

IRsend IrSender;

int button = 7;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(button, INPUT);
  Serial.begin(9600);

  Serial.print(F("Ready to send IR signals at pin "));
  Serial.println(IR_SEND_PIN);
}

void loop() {
  //receiver
  //0xEA976CDE //VOL UP
  //0xD3FADDD //VOL DOWN
  //0x481 //VOL UP
  //0xC81 //VOL DOWN
  //Projector
  //0x52A2DA24 VOL UP
  //0x9C7C29E0 VOL DOWN
  //tv
  //0x50,0x850//volume up//rc5
  //0x51,0x851//volume down//rc5
  //0xE99DB8FE, 0x97C75832 turn off, Raw data
  if (!digitalRead(button)) {
    unsigned long tData = 0x851;

    //IrSender.sendSony(tData, i, 12);
    //IrSender.sendRaw(tData, i, 38);
    IrSender.sendRC5(tData, 12);

    Serial.print(F(" :send 0x"));
    Serial.println(tData, HEX);
  }

  delay(1000);
}

receive code:

#include <IRremote.h>

int IR_RECEIVE_PIN = 5;
//0xEA976CDE VOL UP
//0xD3FADDD VOL DOWN
IRrecv IrReceiver(IR_RECEIVE_PIN);


void setup() {
    pinMode(LED_BUILTIN, OUTPUT);

    Serial.begin(9600);

    IrReceiver.enableIRIn();  // Start the receiver
    IrReceiver.blink13(true); // Enable feedback LED

    Serial.print(F("Ready to receive IR signals at pin "));
    Serial.println(IR_RECEIVE_PIN);
}

void loop() {
    if (IrReceiver.decode()) {
        IrReceiver.printResultShort(&Serial);
        Serial.println();

        IrReceiver.resume(); // Receive the next value
    }
    delay(100);
}

thanks

Is the remote protocol you need to use only RC5 (IrSender.sendRC5(tData, 12)), what do you get when running the IRrecvDump?

Usually you need to repeat the IR code at least 3 times to get the equipment to act on it
I use the send format like this...

irsend.send((decode_type_t)ir_type, ir_code, ir_bits, ir_repeat);

as you can specify the repeat count.

Thank you Riva!
The trick was just to send it 3 times...
It wasn't harder then that... I seemed to missed that detail somewhere.

Yes, its a crude error-correction measure - if the IR comms is flaky multiple repeats all read different
and get ignored. With IR this can happen when the signal is washed out with bright sunlight or the
remote is too far away and noise corrupts the signal.

Mh I think if got an similar problem.
Do you use "Repeats 3" to send it 3 times?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.