IR transmitter not working with Arduino

Hey everyone, I am having a problem with my IR transmitter.

Firstly, I am working on an IR remote control project to turn on some LED strips whenever the surrounding light is below a certain brightness. For this project I am going to use an IR reciever, transmitter, arduino Uno, 100 ohm resistor and a photo resistor. I am currently at the phase where the transmitter has to send out the "turn on code" to the LED strips (this code was collected from the strips remote control, using the receiver).

I know my IR Led is working because if I switch from pin 3 to the 5v pin (with the resistor connected) I can see the light using my phone, but when I connect it to pin 3 it does not flash when the code is sent. Another way I can identify if a code is sent is with the IR receiver, but it also does not receive any signal (it has a red led that flashes when it receives a signal, model:1838)

This is the code below (so far I am just trying to get the transmitter to send the signal)

#include <IRremote.h>

IRsend irsend;

void setup() {
  Serial.begin(9600);
}

void loop() {
  delay(5000);
  //Power//
  irsend.sendNEC(0xFEA857, 32); //Power Code - turn on/off the led strip
  Serial.println("Power");
  delay(5000);
}

Here is the circuit diagram, and my set up

image
image

This is the reciever

I'm fairly new and was having trouble finding an answer on this specific question. If you know anything that can help me I would greatly appreciate it.

Your LED is working, but is it sending an IR wavelength that the receiver is expecting? Data on the LED and on the receiver will tell you that.
Paul

Sorry, I'm not sure I understand. How would I go about fixing the wavelength. As for the LED, I don't remember the technical ID so I don't know how I can check its data sheet.

Also, shouldn't the LED blink regardless? Sorry, I'm just getting into more advanced projects so I'm still a beginner

The wavelength is fixed at the factory based on chemistry and geometry.
Yes, the LED blinks. But at 38000 times per second. Your IR receiver is expecting that.
Paul

Try getting your sender much closer to the receiver. Remote controls typically use a high-power IR LED (sometimes more than one). The Arduino might not be able to drive it hard enough without a transistor amplifier. If it works when very close you can try a transistor.

How did you determine that 0xFEA857 was the right code?

So why not use a basic light level module....??

https://www.ebay.com.au/itm/393287539270?hash=item5b91c39a46:g:biAAAOSwXnxcHeSo&frcectupt=true

I tried getting the transmitter closer to the receiver, but there is still no response (even when touching). I got that code from a tutorial. For my project the actual code is 0xFF02FD, but since I wasn't getting any response I decided to use the code from the YouTube tutorial (just to see if the IR led would blink).

I actually did this project some time ago, but that was very long ago (with the same set up) so I don't know why the LED won't blink (while looking through phone camera or checking with the receiver)

I guess that would be good, but I would at least like to know why this project isn't working. What if I encounter a similar problem with this module? I also have multiple IR LEDs so I don't think they are burnt or anything (I could verify with my phone camera by connecting the LEDs to 5v).

Without a proper circuit diagram, it is difficult to help. Your pretty "Frizzy" picture is of no use to Man nor beast.

What polarity have you connected your IR LED with? Let's see the LED close up, with the internal structure visible.

You can use a conventional LED whilst testing, you will see that flickering if everything is working correctly.

Okay I have taken better pictures, and I have also replaced the IR LED with a regular LED (I checked to make sure it is working). There is no flickering of the LED.

The polarity is correct for this setup. I briefly placed the yellow wire on the 5v pin and the led lit up


image

I tried running the code again and I noticed this is written before the code is uploaded

C:\Users\jake1\Documents\Arduino\IRsend\IRsend.ino: In function 'void loop()':
C:\Users\jake1\Documents\Arduino\IRsend\IRsend.ino:15:30: warning: 'void IRsend::sendNEC(uint32_t, uint8_t)' is deprecated: This old function sends MSB first! Please use sendNEC(aAddress, aCommand, aNumberOfRepeats). [-Wdeprecated-declarations]
   irsend.sendNEC(0xFF02FD, 32); //Power Code
                              ^
In file included from C:\Users\jake1\Documents\Arduino\libraries\IRremote\src/IRremote.h:182:0,
                 from C:\Users\jake1\Documents\Arduino\IRsend\IRsend.ino:2:
C:\Users\jake1\Documents\Arduino\libraries\IRremote\src/IRremoteInt.h:485:10: note: declared here
     void sendNEC(uint32_t aRawData,
          ^~~~~~~

1 Like

Your system consists of 2 parts, a transmitter and a receiver. Both parts have to match for a successful communication. You’ve shown mainly the transmitter. Incidentally, which version of the IR library are you using?
Also the receiver part. Is this also an Arduino? If so, which version of the IR library are you using there? Have you any other way of verifying if the receiver is OK? For example a remote control.

No need for ANY light transmission from the Arduino for this module (#6) to work as it works off ambient light.
That was, I thought, your original requirement.

I was able to fix the problem. Thanks for all the help.

The problem was with the code and after some searching the code below is what got me the results I was looking for.( The IR led transmits the code)

/*
 * SimpleSender.cpp
 *
 *  Demonstrates sending IR codes in standard format with address and command
 *  An extended example for sending can be found as SendDemo.
 *
 *  Copyright (C) 2020-2021  Armin Joachimsmeyer
 *  armin.joachimsmeyer@gmail.com
 *
 *  This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
 *
 *  MIT License
 */
#include <Arduino.h>

/*
 * Define macros for input and output pin etc.
 */
#include "PinDefinitionsAndMore.h"

//#define SEND_PWM_BY_TIMER
//#define USE_NO_SEND_PWM

#include <IRremote.h>
IRsend irsend;
int i = 0;
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));

    /*
     * The IR library setup. That's all!
     */
    IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin

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

void loop() {
   
   if (i == 0){
   
    irsend.sendNEC(0xFF02FD, 32); // this turns on the led strip
    i++;
   }
   else{
    irsend.sendNEC(0xFF1AE5, 32); // this selects the colour red
   }
   

    
   
   }

Hello,

i have the same problem. your code worked but 32bit data is not sending properly.
How can I send 32 bit data? and I can't receive the hex codes I sent. Helpp?

sender code: Arduino mega use. IR Sender sensor connection pin 3.
#include <Arduino.h>

/*

  • Define macros for input and output pin etc.
    */
    #include "PinDefinitionsAndMore.h"

//#define SEND_PWM_BY_TIMER
//#define USE_NO_SEND_PWM

#include <IRremote.h>
IRsend irsend;
int i = 0;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);

Serial.begin(9600);

// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));

/*
 * The IR library setup. That's all!
 */
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin

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

}

void loop() {

if (i == 0){

irsend.sendNEC(0xFFFFAF11, 32); 
delay(100);
i++;

}
else{
irsend.sendNEC(0x111111, 32);
delay(100);
}

receiver code: arduino nano use. IR receveir sensor connection pin 11.

//#define DECODE_NEC
#include <IRremote.h>
int RECV_PIN=11;
int led=10;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn();

}

void loop() {
// put your main code here, to run repeatedly:
if(irrecv.decode(&results)){
Serial.println(results.value,HEX);
Serial.println(results.value,BIN);
delay(100);
//Serial.println(results.value);
Serial.println("******");
irrecv.resume();
}

}

Please start your own thread and repeat your request.

Show us a good schematic of your circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.

Hi,

sender code:

/*
   SimpleSender.cpp

    Demonstrates sending IR codes in standard format with address and command
    An extended example for sending can be found as SendDemo.

    Copyright (C) 2020-2021  Armin Joachimsmeyer
    armin.joachimsmeyer@gmail.com

    This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.

    MIT License
*/
#include <Arduino.h>

/*
   Define macros for input and output pin etc.
*/
#include "PinDefinitionsAndMore.h"

//#define SEND_PWM_BY_TIMER
//#define USE_NO_SEND_PWM

#include <IRremote.h>
IRsend irsend;
int i = 0;
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);

  Serial.begin(9600);

  // Just to know which program is running on my Arduino
  Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));

  /*
     The IR library setup. That's all!
  */
  IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin

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

void loop() {

  if (i == 0) {

    irsend.sendNEC(0xFFFFAF11, 32); // this turns on the led strip
    delay(100);
    i++;
  }
  else {
    irsend.sendNEC(0x111111, 32); // this selects the colour red
    delay(100);
  }
}

receiver code:

//#define DECODE_NEC
#include <IRremote.h>
int RECV_PIN = 11;
int led = 10;
IRrecv irrecv(RECV_PIN);
decode_results results;


void setup() {
  // put your setup code here, to run once:
  pinMode(led, OUTPUT);
  Serial.begin(9600);
  irrecv.enableIRIn();

}

void loop() {
  // put your main code here, to run repeatedly:
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    Serial.println(results.value, BIN);
    delay(100);
    //Serial.println(results.value);
    Serial.println("******");
    irrecv.resume();
  }

Get the Moderator to move your question to a new thread.

Try these sketches:

//Receiver

#include <IRremote.h>

const byte RECV_PIN = 11;
const byte led      = 10;

IRrecv irrecv(RECV_PIN);
decode_results results;

//*******************************************************
void setup()
{
  Serial.begin(9600);

  pinMode(led, OUTPUT);
  
  irrecv.enableIRIn();

} //END of setup()


//*******************************************************
void loop()
{
  if (irrecv.decode(&results))
  {
    Serial.println(results.value, HEX);
    Serial.println(results.value, BIN);
    Serial.println();
    
    //toggle the LED
    digitalWrite(led, !digitalRead(led));
    
    irrecv.resume();
  }
  
} //END of loop()








//Sender

#include <Arduino.h>
#include <IRremote.h>

//               resistor    IR LED  
//[UNO pin #3]----[220R]----[A->|-K]----GND

const byte led      = 13;

IRsend irsend;

//*******************************************************
void setup()
{
  pinMode(13, OUTPUT);
  
} //END of setup()


//*******************************************************
void loop()
{
    irsend.sendNEC(0xFFFFAF11, 32); // this turns on the led strip
    delay(1000);

    //toggle the LED
    digitalWrite(led, !digitalRead(led));

} //END of loop()



not working sender. because may be #include <IRremote.h> version different. ir led light not flashing

Does a previous version work ?

there is version 3.3.0.

the app i want to make;

https://forum.arduino.cc/t/remote-control-with-viessman-air-conditioner-ir/905146