Questions about infrared LEDs for remotes - Page 1
Forum section: electronics / projects

author: Peabody
author_rank: Super Contributor
timestamp: September 16, 2019, 03:04:14 am
content: I've built my own Android version of the IR remote for Roku devices, but with a bit different functionality. It's working, but the IR seems a bit more flaky than a real Roku remote, and the Roku remote is brighter on my phone's camera.I borrowed the LED from an old universal remote, so I want to assume it's 940nM but don't know for sure. My Arduino is currently powered by a regulated 3.3V, A GPIO pin drives an NPN transistor, which in turn provides collector current from the 3.3V supply through a 33R resistor to the LED, with the emitter at ground. The base resistor is 2.2K. The voltage drop of the LED is 1.2V, and it's kinda blue. The Roku remote is powered by two AAAs.So I'm getting more than 60ma through my remote's LED, which if the relative brightness thing is meaningful, makes me wonder how much more current the Roku remote LED could be getting. But specifically I have these questions:1. Is there any reason to believe that the Roku IR system uses anything other than 940nM or anything other than 38K? Rokus seem to work fine with universal learning remotes, which I would think all use 940nM LEDs.2. Is there any reasonable way to determine whether an LED is 940nM or 850nM?3. Do IR LEDs come in high-efficiency super-bright versions like red LEDs do? What spec would tell you that an IR LED is one of those? Does anybody have a favorite that's very "bright" on very few milliamps?In case it matters, and it might, the Arduino is 3.3V, 8MHz, and the IRremote library is driving the LED, I think this library was originally written for 16MHz, and I'm not completely sure the shift to 8MHz, which it appears to do ok, is actually being done correctly. When the battery holder for it arrives, I plan to run this on a single 18650 with no regulator.Thanks for any words of wisdom.

author: oPossum
author_rank: Super Contributor
timestamp: September 16, 2019, 03:44:48 am
content: Roku is 38 kHz. Your LED current is lower than what is usually used in remotes. Use the unregulated supply and current of 500 mA to 1A. A darlington config will be required. IR LEDs do vary in efficiency and also beam width. Vishay makes some excellent IR LEDs in the TSAL6000 and TSAL7000 series. 940/950 nm is the right wavelength for consumer IR.

author: Peabody
author_rank: Super Contributor
timestamp: September 16, 2019, 02:31:20 pm
content: Quote from: oPossum on September 16, 2019, 03:44:48 amThanks very much for the information. But I'm confused about the current needed. The Roku remote and all the others I've seen are powered by two alkaline cells, so, essentially 3V. To get 1A of current through an LED with a voltage drop of 1.2V, the resistor would be 1.8R. Or even at 500mA, it would be 3.6R. Is that right? Or do the designers rely on internal battery resistance and not even bother to use a resistor for the LED?Anyway, I will look at the Vishay LEDs. Thanks very much for that lead.

author: oPossum
author_rank: Super Contributor
timestamp: September 16, 2019, 05:19:35 pm
content: A typical remote will have a resistor of a few ohms. Sometimes less than an ohm. I usually just rely on the internal resistance of AA batteries and the PN2222A to limit current to about 1A.

author: Peabody
author_rank: Super Contributor
timestamp: September 16, 2019, 05:32:10 pm
content: Ok, this makes sense now.I looked at the Vishay LEDs, and the intensity rating for the TSAL6100 is twice that of the 6200, which in turn is twice that of the 6400, all at 100mA, and all at the same price. Is there a reason why I wouldn't pick the 6100? It seems you simply get more IR output per mA, and it's hard to see how that could be bad. Is there a tradeoff I'm missing here?I'll be using an 18650 to power this. So I think I will include a resistor. Also because these TSALs are rated at 100mA, 200ma peak.I found an old MPSA13 Darlington in the junque box. Rated at 500mA, wich would work with the Vishay LEDs, but not if I really need 1A.A question about your circuit. If you put the LED in the path from Vcc to both PN2222s, instead of in the path to only the second one. would that also work, and eliminate the need for the 47R resistor. If I use the MPSA13, it would have to be done that way.

author: james_s
author_rank: Super Contributor
timestamp: September 16, 2019, 05:35:11 pm
content: I haven't looked at the datasheets but check the beam angle. Often really high intensity LEDs have a very narrow beam.

author: oPossum
author_rank: Super Contributor
timestamp: September 16, 2019, 05:50:02 pm
content: A proper darlington configuration will have higher Vcethan the circuit I posted. Not a problem when using a 18650 that will provide a solid 3 volts or more. You will need a current limiting resistor because an 18650 has very low internal resistance. Figure 3 in the TSAL datasheet shows max current you can use for pulsed applications like remote control. James is correct about the beam angle.

author: oPossum
author_rank: Super Contributor
timestamp: September 16, 2019, 05:51:28 pm
content: Pulled apart a random remote and found a 1 ohm resistor. Was surprised to see the high current switching transistor integrated in to the chip.

author: Peabody
author_rank: Super Contributor
timestamp: September 16, 2019, 06:02:37 pm
content: Quote from: oPossum on September 16, 2019, 05:50:02 pmYes, the 6100 beam angle is 20 degrees, whereas the 6200 is 34 degrees. So both produce the same output, but one is more spread out than the other. But the question is what beam angle do I need? Is 20 degrees enough? Seems like it would be. What's normally used in remotes?I see that your circuit would continue to work even as two alkalines get very low. On the other hand, any current flowing through that 47R resistor is "wasted" in that it doesn't flow through the LED. I'm not sure which effect wins in terms of battery life.

author: oPossum
author_rank: Super Contributor
timestamp: September 18, 2019, 03:36:06 am
content: Remotes typically have a narrow beam. Probably 20 to 30 degrees.Without the 47 ohm resistor all of the voltage drop would be Vceof the first transistor. The resistor was placed there rather then in the base circuit to allow for more LEDs to be driven by more PN2222A.

author: Peabody
author_rank: Super Contributor
timestamp: September 22, 2019, 07:22:25 pm
content: My completed remote works, kinda, but the IR isn't getting through as well as it should, and some commands are missed at the receiver. And when I look at the transmitting remote in my camera's live view, I barely see anything, whereas the original Roku remote LED is plainly visible. So I'm not putting out enough IR. Attached is the circuit I'm using, which includes a Darlington. The LED itself is a mystery because I took it from an old remote, which worked fine in its day.The 22Ω resistor may still be way too high, but I have a question about the use of a Darlington here. It seems to me that while current needed from the I/O port to drive the LED is smaller with a Darlington than with a regular NPN, the total current actually flowing through the LED is less with the Darlingto than with the NPN, provided the NPN's gain is enough to fully saturate it from base current provided by the port. The reason is that the Darlington has a saturation voltage of one junction drop - call it 0.6V, and the NPN is close to zero volts.If the power supply is 4.2V, and the LED voltage drop is 1.2V, then I should get 109mA through the LED with the Darlington, but 136 mA with the NPN - something like a 2N2222A. with good gain. I have more base current than with the Darlington, but still well within the output of the port pin, and I don't dissipate power in the Darlington.So in cases where the I/O current is sufficient to drive an NPN, wouldn't the NPN be the better choice? If I/O current isn't enough, maybe something like oPossum's Darlington-like configuration of two NPNs would still be better than a Darlington. I don't know. Maybe if you reduce the value of the resistor to get the same current, you've just moved some resistance from the resistor into the Darlingon's effective resistance, and you're no worse off other than some of the heat is generated in the Darlington instead of in the resistor.oPossum's circuit:https://www.eevblog.com/forum/projects/questions-about-infrared-leds-for-remotes/?action=dlattach;attach=836991;image

author: Benta
author_rank: Super Contributor
timestamp: September 22, 2019, 07:59:45 pm
content: Do it like this. Simple and reliable and with constant current drive for the IR LED. Use two standard small-signal diodes like 1N4148. It even works with different supply voltages or varying battery voltage.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 22, 2019, 08:23:03 pm
content: It is not the very best way to set the current via the base current, but this is still better than a small series resistor at the collector side with a varying supply. For up to 500 mA-1 A one can get away with a normal transistor (e.g. BC635, BD139 or similar) and set the base current accordingly. So the base resistor may have to go down to some 330 Ohms or the like. The right values depends on the transistor gain and can vary a little.The way with the resistor at the emitter is a valid option, but it looses extra voltage and the supply might be tight:some 1.5 V for the LED (at 1 A), 1-1.5 V from at a Darlington and only some 3.2 V for an rather empty cell. With weak batteries or thin cables the buffer cap should be reasonably low ESR. IT may take way more then 220 µF.For good efficiency the PWM ratio in the 38 kHz modulation should be less than 50%, more like 20-35%. The last bit around 50% has near zero efficiency. If nothing else help, one can consider 2 IR LEDs.Some remotes have quite small opening angles and one may have to really point well to the sensor. With large TVs this means knowing where the sensor actually is.

author: Benta
author_rank: Super Contributor
timestamp: September 22, 2019, 08:46:12 pm
content: Kleinstein, it's unclear to me what you are replying to. If it's this:"Do it like this. Simple and reliable and with constant current drive for the IR LED. Use two standard small-signal diodes like 1N4148. It even works with different supply voltages or varying battery voltage."Then I have the following comments:1: the BC327-40 is NOT a darlington and has a minimum current gain of 250.2: it can handle up to 800 mA.3: the VCE is negligible, being less than the variation in IRLED forward voltage.4: the emitter resistor drops 0.65...0.7 V, leaving around 2.5 V for the IRLED: plenty.5: PWM is completely irrelevant, the 38 kHz modulation pattern is the defining factor.6: 1 A is completely over the top for IRLED current, which is why I suggest around 100 mA. It can be altered easily by changing the emitter resistor (and, if necessary, the base resistor as well). Less current might work just as well, a practical experiment is necessary.

author: oPossum
author_rank: Super Contributor
timestamp: September 22, 2019, 09:16:30 pm
content: Quote from: Peabody on September 22, 2019, 07:22:25 pmYou can go lower on the 22 ohm, much lower. You are correct about the vcelosses with a darlington. That is why I connect the collector of the first transistor to the supply rather than the collector of the second transistor.

author: oPossum
author_rank: Super Contributor
timestamp: September 22, 2019, 09:18:04 pm
content: Quote from: Benta on September 22, 2019, 08:46:12 pmIt isn't for a pulsed application like this.

author: Benta
author_rank: Super Contributor
timestamp: September 22, 2019, 09:31:41 pm
content: Quote from: oPossum on September 16, 2019, 05:19:35 pmAfter this example of brilliance, nothing more needs to be said...

author: Peabody
author_rank: Super Contributor
timestamp: September 23, 2019, 12:46:58 am
content: Benta, I think I understand your circuit, but I'm confused by your statement that Vce is negligible. I'm not sure how you meant that, but if the voltage at the emitter is 0.7V and the LED voltage drop is 1.2V, then the CE voltage has to be 1.4V, and the transistor is acting like a 14Ω resistor, which also makes it the hot spot in the chain.But I understand the advantage of keeping the LED current constant as the battery voltage drops.

author: Benta
author_rank: Super Contributor
timestamp: September 23, 2019, 03:25:24 pm
content: Yes, the phrasing was perhaps a little unclear.Your voltage calculation is quite correct. What I meant to say was, that the collector-emitter voltage automatically adjusts to the IRLED forward voltage. With a low Vce you are able to use LEDs with a higher forward voltage, or you can tolerate battery voltage drop to a higher degree. I hope this makes sense,

author: Kleinstein
author_rank: Super Contributor
timestamp: September 23, 2019, 04:44:19 pm
content: For pulsed operation like in a remote 100 mA pulse current is not much and would result in low power, low range. So some 500 mA is well possible as it would be only with a low PWM ratio: some 30% at 38 kHz for a few ms at most followed by a little longer off. 1 A may actually be on the upper limit. The remarks on the PWM ratio are independent of the drive circuit - just a point that may be overlooked and it makes clear that it is a low PWM ratio that allows high peak current.The BC327 is a PNP, the correct NPN brother is BC337. At low current the gain is 250 - at high current like 500 mA it is much lower. The low VCE spec is for a rather high base current, like IC/10. At 500 mA and with 10 mA base drive, expect some 0.3 V for VCE. At 5 mA base current it may be in the 1 V region.This can still work with a 3.2 V supply. However the resistor to the driving side needs to be much smaller to get 10 mA of base drive. So more like 150 Ohms.

author: Benta
author_rank: Super Contributor
timestamp: September 23, 2019, 05:05:48 pm
content: Damn! Of course it's BC337-40, not BC327. My bad...Concerning the hfe discussion: you're presuming that the transistor is working as a hard switched device. That's not the case. In my quickly sketched circuit it is operating in it's linear region, which means the high hfe is applicable. At 100 mA collector current it's 250 min.

author: iMo
author_rank: Super Contributor
timestamp: September 23, 2019, 05:18:51 pm
content: A sim..

author: Benta
author_rank: Super Contributor
timestamp: September 23, 2019, 06:20:00 pm
content: @imo:Looks nice. Could you do a sim with 1.8k as base resistor, please?

author: iMo
author_rank: Super Contributor
timestamp: September 23, 2019, 07:19:30 pm
content: 1k8 base resistor.

author: Benta
author_rank: Super Contributor
timestamp: September 23, 2019, 08:33:51 pm
content: @imo: Thank you very much, very helpful.The second plot shows that the circuit still works perfectly, but at reduced current: ~64 mA instead of ~100 mA.Why? The 1N4148 datasheet gives the answer: at low forward currents (<1 mA), VFis down to 0.5...0.55 V. This explains the lower collector current =IRLED current.Solution: an even lower power diode.The curvy collector voltage is due to the fact, that the simulation LED is not suited for high currents and the chip heats up. Substituting the correct IRLED should solve the issue.

author: Peabody
author_rank: Super Contributor
timestamp: September 23, 2019, 10:41:05 pm
content: Thanks very much for all this info. It's really useful.But I'm afraid I have a more fundamental problem, and it involves the LED driver output on pin 3 of the Arduino produced by the library. Just to make sure it was ok, I put my DSO150 scope on it, and found that it's not ok. Some of the positive-going pulses are very weak, and sometimes they are missing entirely. I tried it with the SendRaw example that comes with the IRremote.h library, and got the same thing. And the bad pulses don't happen at the same place each time. I'm actually kinda surprised it works with the Roku puck at all, but I guess most of the time it's close enough.I don't look forward to going through his code to figure out what's wrong. Since most of the bits are sent correctly, and the errors occur at different places each time, my guess is the problems result from the Timer 0 interrupt for millis(). He doesn't ever call millis(), but he does call micros() many places. So it may not be possible to turn off the Timer 0 interrupt. And of course I could be wrong about that being the problem. I guess it could even be a problem with my scope, but I think that's not likely at these speeds.I've had bad luck with Arduino libraries. Anyway, does anyone know of another IRsend library that I could try? It's just plain old NEC format, and I have the raw data that's sent.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 24, 2019, 05:59:11 am
content: The slow rise of the collector voltage is not a thermal effect - LTspice very likely does not include a thermal model. The cause is more that the IR diode goes high impedance once the current is very low and this the discharge of capacitance gets very slow. So nothing to worry about.For more diode current in the circuit, one could use a smaller emitter resistor and the smaller base resistor. The Arduino should be OK delivering some 10 mA.Weak (low amplitude) pulses look odd - this would be more like a hardware problem, maybe not having the IO pins defined as output and thus using the pull ups only.

author: Peabody
author_rank: Super Contributor
timestamp: September 24, 2019, 02:17:50 pm
content: Quote from: Kleinstein on September 24, 2019, 05:59:11 amI flashed a Nano with the SendRaw example, which just sends one command, but I had nothing connected to the output pin except the scope. And I still get the same result. The output is the output of the 38K PWM setup on Timer2, so it must be active in both directions. Looking at the code, the PWM is continuous, but its output is gated to pin 3 only during the ON time, and pin 3 is LOW otherwise. That should be pretty simple, and it works most of the time, but the ON periods are not always right - too short, or don't happen at all. I'm going to see if I can write a delay function based on the number of carrier cycles, and turn off the Timer0 millis() interrupt while sending. Here's his code for the delay:Code:// Custom delay function that circumvents Arduino's delayMicroseconds limitvoid IRsend::custom_delay_usec(unsigned long uSecs) {if (uSecs > 4) {unsigned long start = micros();unsigned long endMicros = start + uSecs - 4;if (endMicros < start) { // Check if overflowwhile ( micros() > start ) {} // wait until overflow}while ( micros() < endMicros ) {} // normal wait}//else {// __asm__("nop\n\t"); // must have or compiler optimizes out//}}#endif // SENDING_SUPPORTEDMy scope is a little kit scope, so I guess it's possible it's just not reading pin 3 correctly. But it does fine reading the output of the remote with an IR phototransistor, so it if can keep up with that, it should be able to keep up with pin3 since the two should be identical. So I assume what it's showing me is what's happening.

author: Peabody
author_rank: Super Contributor
timestamp: September 24, 2019, 06:32:25 pm
content: Attached is a scope screen capture showing the output of a Roku IR remote's BACK button as captured with an IR phototransistor. It's normal NEC format with a value of 0x57436699. Below that are two examples of what the library puts out on pin 3 of a Nano for the same command. In theory, all three should be the same. Anyway, I don't want to worry about driving the IR LED until I'm sure the driver pin is behaving correctly. No point in using lots of current to send the wrong command. Unless the pin 3 captures are some kind of scope artifact, they look pretty ragged to me.

author: Benta
author_rank: Super Contributor
timestamp: September 24, 2019, 07:09:03 pm
content: You need a better 'scope.There's no way a digital output from a microcontroller will output anything other than high or low. Well, it could be three-state of course, but that makes absolutely no sense, as it wouldn't change from pulse to pulse.

author: Peabody
author_rank: Super Contributor
timestamp: September 24, 2019, 08:53:13 pm
content: Maybe so. But then "high" isn't actually high, but rather just the 38K carrier being on. The scope did fine reading the IR input which was not demodulated first. Anyway, I've posted on the Arduino forum asking if someone with a real scope could do the same test. That would settle the question.

author: mikerj
author_rank: Super Contributor
timestamp: September 24, 2019, 10:32:31 pm
content: Quote from: Peabody on September 22, 2019, 07:22:25 pmNot all IR LEDs have the same peak wavelength, if the LED you found is not matched to the receiver (which most always include an IR filter) then range will be greatly reduced.

author: Peabody
author_rank: Super Contributor
timestamp: September 25, 2019, 03:44:49 am
content: A guy on the Arduino forum did the same test, and the output was perfect on his scope. Then I did a bit-banged version of the command, once with the carrier on during the high pulses, and again with the output a solid high during those pulses. The latter show perfectly on my scope, but the carrier version looks messed up. So apparently the problem is indeed my scope. The carrier is throwing it off.So now I can get back to working on the LED drive.

author: Peabody
author_rank: Super Contributor
timestamp: September 25, 2019, 06:51:32 pm
content: I ended up, for now, with a 10Ω resistor for the IR LED, and a Darlington with a 2.2K base resistor. That's noticeably brighter when viewed in my camera, and seems to work fine in practice with both the Roku and the TV. I have a 220µFd cap on the power rail, but I'm not sure that's even needed. The power supply is an 18650 with no regulator, and I think it provides current pretty readily for the LED pulses. I don't see any variation in Vcc as the pulses are sent. The final project is here:https://github.com/gbhug5a/Roku-Sling-IR-Channel-Number-Remote-for-Arduino

author: tooki
author_rank: Super Contributor
timestamp: September 26, 2019, 08:28:17 pm
content: Quote from: Peabody on September 25, 2019, 03:44:49 amMake sure you’re not using an averaging mode. Also, using holdoff might help.