Simulate TV Remote Button Press using IR Transmitter

Hi All,

I have Arduino UNO board and another board with IR Transmitter circuit on it.
The IR Transmitter board is connect on PIN# 3 with +, D & GND pin.
Simply I want to simulate Number 1, 2 & 3 pressed from DirecTV remote control using IR Transmitter.

I used below code but it is not working for me:

#include <IRremote.h>

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

    Serial.begin(115200);

    // Just to know which program is running on my Arduino
    Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
    Serial.print(F("Ready to send IR signals at pin "));
    Serial.println(IR_SEND_PIN);

    /*
     * The IR library setup. That's all!
     * The Output pin is board specific and fixed at IR_SEND_PIN.
     * see https://github.com/Arduino-IRremote/Arduino-IRremote#hardware-specifications
     */
    IrSender.begin(true); // Enable feedback LED,
}

/*
 * Set up the data to be sent.
 * For most protocols, the data is build up with a constant 8 (or 16 byte) address
 * and a variable 8 bit command.
 * There are exceptions like Sony and Denon, which have 5 bit address.
 */
uint16_t sAddress = 0x0102;
uint8_t sCommand = 0x34;
uint8_t sRepeats = 0;

void loop() {
    /*
     * Print current send values
     */
    Serial.println();
    Serial.print(F("Send now: address=0x"));
    Serial.print(sAddress, HEX);
    Serial.print(F(" command=0x"));
    Serial.print(sCommand, HEX);
    Serial.print(F(" repeats="));
    Serial.print(sRepeats);
    Serial.println();

    Serial.println(F("Send NEC with 16 bit address"));

    // Results for the first loop to: Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 (32 bits)
    IrSender.sendNEC(sAddress, sCommand, sRepeats);

    /*
     * If you cannot avoid to send a raw value directly like e.g. 0xCB340102 you must use sendNECRaw()
     */
//    Serial.println(F("Send NECRaw 0xCB340102"));
//    IrSender.sendNECRaw(0xCB340102, sRepeats);

    /*
     * Increment send values
     * Also increment address just for demonstration, which normally makes no sense
     */
    sAddress += 0x0101;
    sCommand += 0x11;
    sRepeats++;
    // clip repeats at 4
    if (sRepeats > 4) {
        sRepeats = 4;
    }

    delay(5000);  // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal
}

If any of the forum member can guide me what sort of Command need to send to simulate Button #1, #2 & #3 pressed from the DirecTV Remote control using my IR Transmitter connected with Arduino UNO it would be really helpful.

Thanks in advance! :smiley:

How do you know it is not working? Is the transmitter turning on and off, this can be checked with your cell phone camera. Include a schematic, something does not appear correct.

Hi Gilshultz,

Thanks for your help and I solved the issue... ???

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