1

Here is my very simple IR emitter circuit. OSI5FU5111C-40 is an infrared LED.

enter image description here

I am using the IRremote library from here in this simple sketch,

#include <IRremote.h>
unsigned int raw[100]={... *SOME RAW SIGNAL* ...};
IRsend irsend;

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

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
      Serial.print("Start sending ...");
      irsend.sendRaw(raw, 100, 38); 
      delay(40);
    }
  }
}

The problem is when I send 1 to serial monitor,

it outputs triple Start sending ... and LED emits no signal.

So I test the voltage between PIN3 and GND before and after sending the 1. The voltage stays around 1V3.

Would someone please give me some advice? Thank you!

3
  • 1
    Just add a normal led instead of the ir-led, so you can at least see what is happening. Also note that when transmitting the led is pulsed at 38kHz, so your multimeter will some average voltage, and never the full 5 volt.
    – Gerben
    Jul 10, 2014 at 13:46
  • 1
    In addition to the duty cycle being averaged by a meter, the current drawn is likely enough that the output pin will be noticeably below the supply rail even during the fraction of time it is "on". It should be noted that the LED itself is specified with a typical forward voltage of 1.35v so the anode of the LED will be limited to around that voltage, with the difference from the supply dropped across the resistor and the internal impedance of the ATmega. Jul 10, 2014 at 15:15
  • 1
    You can also detect the IR with a cheap cell phone or digital camera.
    – Ricardo
    Jul 10, 2014 at 17:22

1 Answer 1

0

A few things. As somebody else suggested, try a normal red LED and make sure that works first.

Note that your resistor is allowing too much current through the LED. A high-current LED might tolerate 20 mA (thousandths of an amp.) With a 47 ohm resistor, you're pumping 5/47, or about 106 mA into the LED, which is likely more than 5 times what it is designed to handle. You will quickly burn out your LED. You should use a 270 ohm resistor instead.

Also try just setting pin 3 to an output with this line:

pinMode(3, OUTPUT);

And then manually setting that pin to on:

digitalWrite(3, 1);

If the LED lights up, you know the pin is working correctly. Then use the code you posted with the same setup, and make sure your LED flashes. If THAT works, try putting your IR LED back in the circuit.

7
  • 1
    Bear in mind that ~1.5v is dropped across the LED, so only ~3.5v is going across the resistor. That means the current driving the LED is about 74 mA, which is below the rated maximum of 100 mA specified in the datasheet. Jul 10, 2014 at 23:01
  • 100 mA? Wowzers, that's a high current LED! (You'r right, I forgot to subtract out the voltage drop of the LED).
    – Duncan C
    Jul 10, 2014 at 23:10
  • 2
    IR LEDs usually have a much higher If than visible light LEDs. Not that the pin is actually capable of sourcing that much, of course... Jul 10, 2014 at 23:37
  • @IgnacioVazquez-Abrams - That's a good point -- attempting to draw that much current for any length of time is definitely not a good idea. Jul 10, 2014 at 23:46
  • Thank you for all your comments. This is what I tried, I switched the IR LED to a normal LED, increased the resistor and tested with digitalWrite. It worked fine. Then I switched the sketch program without changing anything in the circuit. The LED failed to work. I tested PIN3 and GND without any circuit attached. The voltage reads 1.6v. Is there any chance the sketch is wrong
    – Znatz
    Jul 12, 2014 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.