Using an optocoupler to control a basic LED driver circuit

Thread Starter

david_m

Joined Oct 8, 2017
7
I'm trying to use a basic LED driver circuit from PCB heaven (http://www.pcbheaven.com/userpages/LED_driving_and_controlling_methods/?topic=worklog&p=2) and I want to control it from a raspberry Pi GPIO (just to switch it on and off, I'm not going to be doing PWM with it). I _think_ the attached circuit should work, but I've not used an opto like this before so a sanity check would be helpful.

Note that the darlington transistor operates in the linear regime, it isn't just being used a switch (so it sops up any excess supply voltage and dumps it as heat - I'll adjust the number of LEDs depending on what the voltage drop across them at 60ish mA turns out to be).

I'm using a PC817, and driving the LED side at about 4mA (3.3V at the GPIO pin, 1.2ish for the LED, leaving about 2V across a 470R resistor). This should be fine for the Pi. My understanding is that this will allow the transistor side of the opto to also pass around 4mA (the current transfer ratio at 4mA is a bit over 100% according to the datasheet I've seen, and I'm assuming that is what that parameter actually means). Given the 4k7 resistor between the 15v supply and the top of the zener, will that be enough to short out the zener and keep the base on the darlington low enough to stop it conducting at all? Does that even make sense?

Also, I'm assuming that running about 4mA through both sides of the opto shouldn't damage it long term?

(I'm aware that the LEDs will be off when the GPIO is on).


opto-isolated-led-driver.gif
 
Last edited by a moderator:

AnalogKid

Joined Aug 1, 2013
11,042
Your assumptions and understanding are correct. A high output from the uC will turn off the LEDs. Note that the transistor base does not have to be pulled all the way down to GND, only low enough for the two base-emitter junctions in series to stop conducting. Still, assuming that the opto will deliver 100% CTR is not a conservative approach. Better to derate that by at least 50% so assure that its output transistor is firmly saturated; 75% would be better, as the CTR slowly but steadily decreases with aging. You can safely increase R8, as the TIP120 needs less than 1 mA of base current for 200 mA of collector current.

What is your calculation for the LED current?

ak
 

Thread Starter

david_m

Joined Oct 8, 2017
7
The pcbheaven calculator says the LED current will be 63mA, but I may push that a bit higher if the LEDs and transistor don't get too warm (by reducing R9 or playing with the zener voltage). I guess I can increase R8 as long as the zener is getting enough current to regulate; I'll bump it to 10k. I could also reduce R7 a bit to increase the current on the input side of the opto but I don't want to stress the pin on the uC.

Thanks very much for you reply.
 

bertus

Joined Apr 5, 2008
22,277
Hello,

What is the voltage drop of the 4 leds?
If the voltage drop is to large, the regulation will fail.

Bertus
 

Thread Starter

david_m

Joined Oct 8, 2017
7
Hello,

What zener do you use?
When the zener current gets below Iz(min), the regulation will fail.

Bertus
Generic DO-35 package 1/2W type, don't appear to have much useful printed on them (eg C3V0 ST - I'm assuming C means 5% and 3V0 is the voltage, no idea what the ST (could be 5T) means). I'll have to experiment with that and see how it goes (if it isn't stable, I'll have to reduce R8 again).
 

Thread Starter

david_m

Joined Oct 8, 2017
7
At the cost of adding another resistor and transistor, I can reduce R8 (increasing the current through the zener which should improve the regulation), increase R7 (reducing the current required from the GPIO), and reduce reliance on the CTR of the opto. Does this make better sense?
opto-isolated-led-driver-2.gif
 
Last edited by a moderator:

AnalogKid

Joined Aug 1, 2013
11,042
The added transistor changes the logic polarity. IMO it is completely unnecessary.

Actually, if you really are ok with changing the logic polarity, you can put the opto output transistor in series with R7 (in your original schematic), and eliminate the static power dissipation in R7 whenever the LEDs are turned off.

ak
 

Thread Starter

david_m

Joined Oct 8, 2017
7
The added transistor changes the logic polarity. IMO it is completely unnecessary.

Actually, if you really are ok with changing the logic polarity, you can put the opto output transistor in series with R7 (in your original schematic), and eliminate the static power dissipation in R7 whenever the LEDs are turned off.

ak
I'm fine with changing the polarity (its just software right :) )

Umm. Do you mean R8? R7 is on the other side of the opto.

Assuming I can get enough current through the opto to keep the zener regulating OK, that would work nicely. I'll have to test that out. Thanks.
 
Top