AnaviTechnology / anavi-infrared

16 stars 5 forks source link

LED driver current #7

Open normanr opened 3 years ago

normanr commented 3 years ago

I was trying to figure out what the current through the IR LEDs is, and I think that there might be a missing current limiting resistor (or two).

If I assume that the IR led is being driven at 38kHz at 50% duty, then pulse width is around 13us. The TSAL6400 datasheet indicates that limits would be ~220mA, and maybe ~1.5V? The BC817 has a Vcesat of 0.7V, so that's still ~1.3V (5V - 2*1.5V - 0.7V) unaccounted for. Working backwards ((5V - 0.7V)/2) if the LEDs were driving at 2.15V, that would draw about 900mA, which is also concerning because peak forward current is rated at 200mA (for tp/T=0.5).

Of course LED current should also be limited by the transistor (and it's hFE), but I also get stuck trying to work out what Ic for BC817 would be, because I can't figure out Ib: Vbe is typically 1.2V, but the GPIO will try and drive the pin at 3.3V, so there's approximately 2V unaccounted for there. The default pad drive current is 8mA, but that's not a limit, only a "guarantee" to drive at 3.0V if current is less than configured drive (https://www.raspberrypi.org/documentation/computers/raspberry-pi.html#voltage-specifications). It's not clear what the pad max current is, but the table lists 17mA at 2.3V, so (with an hFE of 40) Ic could be as high as 680mA.

In the worse case maybe the 5V rail is being pulled to ~3.7V while the LED is on, and the power supply is the limit? That would mean max current of ~1A, and maybe nothing on the 3.3V supply cares because 3.7V might still be enough to supply the 3.3V regulator? I don't have a scope to be able to check anything, and I don't think a multimeter will be sufficient because of the low pulse duration (and I don't want to just enable the pin to measure the steady state "on" values, because they're likely to be way over spec).

leon-anavi commented 3 years ago

Hi @normanr,

Yes, probably it makes sense to add current limiting resistor to the schematics. I confirm a multimeter won't be very useful in this case for measurements because of the very fast infrared bursts during data transmission.

Btw the infrared LEDs are 5mm KINGBRIGHT L-53F3BT.

Best regards, Leon

leon-anavi commented 2 years ago

Hi @normanr,

Following your recommendation I have added a 220ohm current limiting resistor for the IR LEDs: https://github.com/AnaviTechnology/anavi-infrared/commit/e47de9f4795c4e42111bb9e3bb92814f7cb4815f

image

image

Best regards, Leon

normanr commented 2 years ago

What current do you get with 220Ω? At a rough guess I think it's less than 10mA.

leon-anavi commented 2 years ago

What current do you get with 220Ω? At a rough guess I think it's less than 10mA.

Honestly, it was late night and I put a template value without looking at the datasheet. So probably it should be 36Ω.

Is my calculation accurate? Am I missing anything?

Thanks, Leon

normanr commented 2 years ago

Yea, I've never sure if it should be max or typical forward voltage. Typical would give (5V - 1.2V 2) / 0.05A = 52Ω. I think you also need to take Vce(sat) of the BC817 into account, so maybe (5V - 1.2V 2 - 0.7V) / 0.05A = 38Ω.

I searched for "5v dual ir led circuit BC817", and these articles seem interesting. I'm not sure that implementing a constant current driver is worth the extra components though. They also seem to use a much smaller resistor (but because they want to drive at around 200mA instead of 50mA, because they're using TSAL LEDs).

Also you need to consider that resistors come in value series, so for something like E6, I guess 47Ω would be the choice. Going too high means that current will be lower and you'll get less luminous intensity, and buyers will complain that they're not as powerful. It's not clear what the effects of going to low are; certainly the v1 boards have zero resistance and seem to be working okay, but I'm not sure why.

You could try using a multi-meter with LEDs on solid 100% of the time, with a resistance starting with at least ~50Ω, and slowly decrease it measuring how the current responds.

Somewhere (I think here) I read that a shorter duty cycle can be advantageous because detectors care more about peak power output and not total power output (which is what the transmitting LED is more limited by). So shorter duty cycle, more current, same total power, but longer transmitting/detecting distance. With the Raspberry Pi I've found that very short duty cycles don't work very well, probably because the pulse isn't generated very cleanly, but I don't remember what the limits were.