opto-isolate PWM for high current LEDs

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: opto-isolate PWM for high current LEDs

Post by zener »

I should have been more clear on my Beta comment. It is not that PNP transistors have any particular Beta compared to NPN. What I should have said is that power transistors that can do an amp or more typically have lowish Betas. Darlingtons are an exception of course. Mainly I wanted to clarify that you were intending to use a bipolar there and not a fet, since the base/gate resistor would be different in either case.

As for opto's, they are not NPN or PNP really (except in the case when the base is bonded out.) In a 4 pin opto, the output is isolated so it doesn't know if it is sinking or sourcing. You could argue that internally it is one or the other but it really doesn't matter in the 4 pin device. The main output spec to look at is the current, which is spec'd at 50 mA on the LTV-817. The power spec relates to the power dissipated in the opto output not the load. Presumably most of the voltage is dropped across the load and there is only a small voltage across the opto output itself. You should be fine at 20mA.

There is an Arduino library for a custom PWM with variable frequency which I have used. However it seemed to have some resource conflicts (timers) with some other libraries so you may or may not have issues depending on what else you are doing.

User avatar
eforman
 
Posts: 46
Joined: Mon Aug 10, 2009 5:20 pm

Re: opto-isolate PWM for high current LEDs

Post by eforman »

Cool that's what I thought. I was just unsure about the following from the LTV-8x7 datasheet (http://www.dema.net/pdf/liteon/LTV-8x7.pdf) -

p. 9: Collector current maximum: 30mA - cutting it close; max on p.8 says 50mA, should be okay either way, but which is it?

Collector-Emitter Voltage maximum: 35V - okay
Emitter-Collector Voltage maximum: 6V - not okay if high-side switching 12V?

Collector Power Dissipation: 150mW - not okay if switching relay coil 240mW? (12V @ 20mA)

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: opto-isolate PWM for high current LEDs

Post by zener »

1) The collector current max spec you reference is shown under the transfer characteristics section. What it is really saying is that if the "If" is 5mA (the test conditions stated) and the max CTR is 600% then (do the math) the max collector current will be 30mA. It is not saying you cannot exceed 30mA.

2) Veco is the reverse voltage spec. You won't be doing that (barring inductive flyback I suppose).

3) Again they are talking about the power dissipated IN THE OPTOCOUPLER. Not in your load. The voltage drop across the the opto (Vceon) will be very low. The power dissipated in the opto will be 20mW or something like that.

User avatar
eforman
 
Posts: 46
Joined: Mon Aug 10, 2009 5:20 pm

Re: opto-isolate PWM for high current LEDs

Post by eforman »

Got it. Very helpful, I appreciate it. I'll post back when I build and test the circuit.

User avatar
eforman
 
Posts: 46
Joined: Mon Aug 10, 2009 5:20 pm

Re: opto-isolate PWM for high current LEDs

Post by eforman »

Report back - the circuit works, I used an opto-SSR for motor direction control since it requires no external diodes (although I put them in any way), here is the updated schematic - https://www.dropbox.com/s/bjepprtwiymtv ... atic-4.jpg. However there are three problems:

1. When the motor switches direction rapidly (say, eight times in 4 seconds), the MOSFET driving LEDs is destroyed (it stays on permanently), even with diodes across relay coil and across motor power+ground. It seems even though the SSR requires no diodes, the MOSFET *gate* still does. Apparently I should be using two additional diodes, a (30V?) clamping TVS diode, and a zener diode for the gate. Does that sound correct, and what specs or part #s should I be looking for?

2. When PWMing the 1 watt LED, fading is impossible as it turns on very abruptly - even the lowest signal (analogWrite(led, 1) produces considerable brightness. I'm aware of the human eye brightness scale and am using a lookup table to compensate for that. Maybe this is just how it is, unless I use a 12 or 16 bit PWM driver chip.

3. The 5W resistor gets extremely hot when LED on full strength. I am now using only one LED and a 27 ohm 5W resistor and it also gets burning hot. This might just be the deal with that much power dissipation, the resistor package is huge so maybe it can handle it, but I'm worried about heat building up in my waterproof enclosure.

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: opto-isolate PWM for high current LEDs

Post by zener »

Hmmmmm. I will take a stab at all this but I am a bit confused.

You say that the SSR does not require diodes. What does that mean?

You say the motor reverses, but how the schematic is drawn it cannot. It will just turn on and off.

You mention a mosfet driving LED. Are you talking about the IR LED inside the SSR? I find it hard to believe you could kill that. What SSR are you using?

Is there a diode across the relay coil? It is grayed out.

Will a 5W resistor get hot when dissipating 3W? YES. Could this be a problem? YES. Using all 3 LED's in series will help. But the LED's themselves will get hot also. I assume you have some kind of heat sink for those.

Something sounds wrong with your PWM response. With 0 out you should not have any light. With minimum duty cycle out you should have minimal light. I don't recall what the duty cycle min is for analog out. A scope would be very handy to see what you have there. I suppose a DMM could give some idea if your analog out is working correctly.

User avatar
eforman
 
Posts: 46
Joined: Mon Aug 10, 2009 5:20 pm

Re: opto-isolate PWM for high current LEDs

Post by eforman »

The SSR is optically isolated - from the datasheet - "Because the input is solid state there is no need for snubbers or 'catch' diodes to suppress the inductive flyback transient voltage normally associated with EMR coils."

The motor does reverse, that was a little mistake on one line of the schematic - thanks.

The MOSFET that froze on is the IRLB8721 driving the LEDs.

Yes there is a rectifier 1N4001 diode across the motor but initially not the relay coil which is why it was greyed out (I thought the opto-SSR made it unnec.); I have added it in now. There are currently no additional diodes across MOSFET gate or LEDs. I'm trying to figure out which or all of these diodes are necessary.

Yes I have a heatsink on the LED. The 5W resistor is currently dissipating only one 1 watt LED, which I believe means 3.3W dissipation with 12V @ 350mA. Eventually it might drive three 1 watt LEDs in series (as you suggested), which would dissipate 1.0W. Should I have chosen a higher wattage resistor if I stay with one LED? If so, I'll just use two in parallel for the time being.

PWM of 0 does produce no light. A PWM of 1 (on a scale of 0-255) produces dimmer light than full on but still drastically brighter than off. And the light does ramp up and down slightly as value changes from 1 to 255. It's just the very drastic difference from 0 to 1 that looks bad. Arduino PWM duty cycle at 1 should be 0.39% (1/256). Arduino (pseudo-) analog out is 490hz. I don't have a scope. With a multimeter analogWrite(pin, 0) measures 1.3mV (not quite 0 but close), and analogWrite(pin, 1) measures 19.3mV (as it should, very close to 1/256 * 5V) - so that looks fine. I'll check the voltage coming out of the opto-transistor and then the MOSFET in a bit.
Last edited by eforman on Sun Jun 29, 2014 8:52 pm, edited 1 time in total.

User avatar
eforman
 
Posts: 46
Joined: Mon Aug 10, 2009 5:20 pm

Re: opto-isolate PWM for high current LEDs

Post by eforman »

The motor relay circuit is part of a car antenna (even though this project has nothing to do with cars, it's an art installation), and has an internal limit switch so it turns on and off when it reaches its upper and lower limits. I had left that out of the schematic for simplicity because that part is working. I just drew it in now for the sake of thoroughness - https://www.dropbox.com/s/bjepprtwiymtv ... atic-4.jpg

User avatar
eforman
 
Posts: 46
Joined: Mon Aug 10, 2009 5:20 pm

Re: opto-isolate PWM for high current LEDs

Post by eforman »

Update: I tested other points with multimeter. This is what I found:

Code: Select all

Multimeter voltage test results:

PWM out (0-255):        0        1        63       127      191       255
Duty cycle %:           0       0.4       25        50       75       100      %

----------------------------------------------------------------------------

Arduino pin (5V)      0.001    0.019     1.15     2.32      3.49      4.65      V

Opto emitter (12V)    0.003    2.54      5.41     8.29     10.83     11.89      V

MOSFET gate  (12V)    0.003    2.53      5.41     8.28     10.82     11.89      V

MOSFET drain (12V)    9.89     6.41      4.00     1.52      0.005     0.005     V
So the PWM output is as expected, and I confirmed the LED fades properly by hooking up the MOSFET directly to the PWM output with no isolation.

The opto emitter is definitely not doing what I expected. At 0.4% duty cycle (1/255) it's already outputting 2.54V (of 12V), where it should be 0.05V - assuming a linear relationship which is probably naive of me.

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: opto-isolate PWM for high current LEDs

Post by zener »

Change R2 to something around 5K and see if that helps.

User avatar
eforman
 
Posts: 46
Joined: Mon Aug 10, 2009 5:20 pm

Re: opto-isolate PWM for high current LEDs

Post by eforman »

Zener, I never followed up on this - I ended updue to time constraints I ended up opto-isolating only the motor with the opto-SSR, getting rid of the PWM speed control, and keeping the high power LEDs on the same circuit as the Arduino (using that MOSFET). This is working fine so I never figured out the issue but maybe one day I'll go back to it.

I just wanted to thank you for all the help.

- Eric

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”