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.5v - 1.2v = 3.8v 3.8v / 0.0333 A = 114+ Ohms (Use 120 ohms)So:Arduino pin2---- 120 Ohm ---\Arduino pin3---- 120 Ohm --- |Arduino pin4---- 120 Ohm ----+--- (+) IR LED (-) ----- GND on Arduino..Turn all three on and you should get close to 100 mA through the LED.
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...
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.
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.wizThe "Source voltage" is whatever you are powering the LED from. You said 5V.The "Diode forward voltage" you said is 1.28VThe "Diode forward current" you said is 100mASo 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.
I haveIR transmitter: 276-143 High-Output Infrared LED, 1.28V and 100mAAccording to the calculator (http://led.linear1.org/1led.wiz), I need 39 ohms and 1W.In this case, I guess I do not need to use a transistor. Just simply connect (5V)---Ohm--IR LED--GNDIs that true? or I still need to use a transistor?
Just simply connect (5V)---Ohm--IR LED--GNDIs that true? or I still need to use a transistor?