Perhaps you calculated the resistance incorrectly?
What is the voltage drop across the LED?
What is the current requirement of the LED?
If you have the 276-0143 "High-Output 5mm Infrared LED" the answers are 1.2V and 100mA. That would be a problem because the Arduino output can't source 100 mA (40 mA MAX). You would typically use a transistor to switch the high current. Perhaps you could tie three output pins together and draw 33.3 mA from each.
johnwasser:
Perhaps you calculated the resistance incorrectly?
What is the voltage drop across the LED?
What is the current requirement of the LED?
If you have the 276-0143 "High-Output 5mm Infrared LED" the answers are 1.2V and 100mA. That would be a problem because the Arduino output can't source 100 mA (40 mA MAX). You would typically use a transistor to switch the high current. Perhaps you could tie three output pins together and draw 33.3 mA from each.
KE7GKP:
Note that if you don't switch ALL three pins SIMULTANEOUSLY, you run the very serious risk of damaging your Arduino. johnwasser should have also provided the special code it takes to address the port directly (vs. digitalWrite to each pin in turn).
Note that the conventional (because it is SAFE) way of doing this is to use an external transistor as a switch, and a single Arduino output pin. Like this...
Thanks all..
I think I should try to do it using transistor to get 100mA.
Can you guys introduce any sites showing how to do it? I want to follow it step by step.
KE7GKP:
I believe that 100mA is the total package limit for output pins, and prudence would to with the more conservative design using the external transistor switch.
The current limit for Vcc and Gnd pins is 200 mA. The processor draws 12 mA (MAX) which leaves 188 mA for other things, assuming the power supply can provide 200 mA.
Even 20ma in an emitter like that should be sufficient to send a signal 30cm. Are you not getting any signal to your decoder at any distance? Are you pointing the top of the emitter at the decoder?
IR LEDs can be obtained that operate at a number of different wavelengths, you have to make sure that the receiver and transmitter both have a peak response at the same wavelength.
However having said that 30cm is a long way for a 100mA LED and an unamplified detector. I think you are expecting too much.
IR remotes use modulated IR and an amplifier built into the detector to get the distance you see from them.
KE7GKP:
I rescind my warning and apologize to johnwasser. By using separate resistors on each output, he is mitigating the problem of switching the outputs asynchronously. Indeed it forms a crude digital to analog converter where each pin turned on provides a portion of the current.
However I believe that 100mA is the total package limit for output pins, and prudence would to with the more conservative design using the external transistor switch.
The method is as simple as using most any NPN transistor (like 2N2222, etc.) and a base resistor, say ~500 ohms or so. As shown in the third circuit in the illustration.
So in the illustration, R4 is the base resistor (500~1000 ohms), T1 is the NPN switching transistor (2N2222, etc.), R3 is your LED current limiting resistor, and LED4 is your IR LED.
The value of R3 can be calculated conveniently online here: http://led.linear1.org/1led.wiz
The "Source voltage" is whatever you are powering the LED from. You said 5V.
The "Diode forward voltage" you said is 1.28V
The "Diode forward current" you said is 100mA
So if we plug those values into the calculator, it says that R3 should be a 39 ohm resistor, and it needs to be capable of handling 1 Watt.
Note that you can use lower-power resistors in parallel to get the 39 ohms @ 1 Watt.
Thanks all your comments.
I have
IR transmitter: 276-143 High-Output Infrared LED, 1.28V and 100mA
IR detector: PNA4602
In this case, I guess I do not need to use a transistor. Just simply connect (5V)---Ohm--IR LED--GND
Is that true? or I still need to use a transistor?
Now, I have NPN transistors (2N222A 2N3904 2N4401 from radio shack)
The problem is I do not have the resistor(39ohm 1W)..
You must not be modulating (blinking) your LED at 38Khz as required by the PNA4602. That sensor will not give a reading if the LED is steady-on. Without the modulation you might see the PNA4602 giving spurious signals (especially in bright sunlight) but that's a different issue.
While you're getting things worked out I'd suggest using a visible color LED so you can see what's happening. A decently-bright red LED at 20ma should give you a few feet of transmission distance. Once you have the basic programming worked out then you can then jump to the IR led/transistor circuit running at ~100ma.
In this case, I guess I do not need to use a transistor. Just simply connect (5V)---Ohm--IR LED--GND
Is that true? or I still need to use a transistor?
100 mA is still greater then 40 mA which is the largest current you can safely pull form an Arduino output pin.
You can use a 1/2 Watt 100 Ohm resistor to run the LED at 40 mA but that won't be full brightness. To get full brightness you still need some way to switch higher current, such as the NPN transistor.
Just simply connect (5V)---Ohm--IR LED--GND
Is that true? or I still need to use a transistor?
If you don't need to control the LED with an arduino then yes that will work.
However, if you need to modulate the LED or turn it off sometimes then you need a transistor.
Hi guys, I tried to get a better range out of my ir led by controlling it with a mosfet, although it was brighter(fromm looking with a camera) it was not flashing rapidly and it did not turn the tv off, the mosfet was the 2n7000. The light was like a single pulse. Why is this.