I am using three Meanwell LDD-600L LED drivers (datasheet) to control brightness/color of a 50 Watts (total) RGB LED. This driver has a PWM input which I draw low with a PC817 opto isolator. Everything works fine in principle, but there is a little flaw:

When the internal phototransistor of the PC817 turns on, its output voltage changes to low lightning fast (500ns). When I turn the PC817 off, I have to use a voltage divider acting on the 30 V supply voltage in order to get around the 5V specified PWM voltage. This actually causes PWM input voltage to rise with a capacitor charge curve. The time constant of the exponential curve is 10us, so my conclusion is that the driver has an input capacitance of about 450 pF (given the 22k resistor from the voltage divider).

Since I want to control the driver with 16 bit PWM at ~305 Hz (i.e. a counter frequency of 20 MHz), the smallest pulse width that can be set inside the controller is 50ns. Of course I will not even get the electrical pulse width close to this (turning the phototransistor off already takes 500 ns), but being limited by the 10 us is a little too lousy for my taste.

Is there any other possible (economic) solution for a lower impedance pull-up of the PWM input capacitance than with a voltage divider?

Of course I don't want to use smaller resistors because they already get noticeably warm (+10 degrees) and I want the circuit to have as high efficiency as possible. The datasheet of the driver also specifies a maximum of 8V on the PWM input (if my interpretation is right), so pulling up directly to 30 V is probably not an option.

By the way: the whole circuit is built on a breadboard. I have not checked yet if the capacitance comes from the breadbord. I don't hope so.-

Problem circuit

Edit: Tony's solution of connecting the digital IO's to the PWM with a resistor directly and dropping the optos actually works. Seems I have been a little to cautious with respect to EMI cause by the 5V/30V interface.

Solution circuit


2 Answers 2


Design Specs

  1. As your TV and computer monitor only have 8 bit intensity control per channel, I think your 16 bit control spec is a overly optimistic for optics.

  2. I suggest 10 bit or 0.1% is adequate ~ 60 dB range and 12 bit is presuming too much.

  3. 1% is often adequate for lighting control and 1% of 1kHz PWM max = 10 us although they do not indicate the resolution limit but this matches your present result width .

Calc. Errors

  1. The Thevenin equiv. R of 22k/3.9K is not 22k but rather 3.3k for a logic "1" which suggests a much higher Cin if Cin=T/R and T is measured for a 0 to 64% asymptote.


  1. Consider open bin Rank (top row on spec p4) 2.5~30 mA.out / 5mA.in = equiv to hFE= 0.5 to 6 (CTR)

  2. This if Vf= 1.2 and AVR=5V+50 ohm then If = (5-1.2)V/(220+50)Ω = 14mA so worst case CTR=50% = 7mA out.

  3. I am assuming you got open rank(bin) : Verify

  4. PWM spec = : DIM ~ -Vin >2.6 ~ 5.5VDC or open circuit
    therefore the Vin threshold is ~ 50% of 2.6V = 1.3V
    (just like TTL and 74HCT ) as expected and as I assumed. Verify

  5. Change R10,11,12 to 5V/7mA = 720 Ω pullup to 5V for 7mA sink and expected rise time ~ 720 /3.3k *10us est. = 2.2us rise time.

  6. "0" Power= 5V*7mA ( 35 mW out) + 1.3 V *14mA (=18mW) * 50% duty cycle = 27mW avg vs 200 mW total rated Abs max. ( << 50% of abs. max is good rule of thumb)

  7. If you need less than 1us, you may consider reducing 720 Ω pullup to 5V

The PWM does have EMI filters which may be partly caused by load capacitance. If you need a faster rise time experiment with emitter follower method instead of 720 pull up on collector try 330 Ω to emitter follower to gnd for 0 to 4V non-inv. output.


  1. Get rid of opto isolators use 50R series to match driver impedance to reduce EMI and ringing from apparent Cin load.

p.s. use a log User Experience (UX) interface for dim control with 12 bit resolution.

p.p.s. breadboard crosstalk is more likely 10 nH/cm for wires and 2 pF/cm if twisted pairs and less if not.

  • \$\begingroup\$ 1-3) 10 bits means that the smallest brighness is 1/1024'th of 50 Watts which is still pretty bright (call me a light sensitive person ;-) Of Course nobody can perceive the the difference between 1024/1024 and 1023/1024, but that's another story. So 16 bits was the tribute I wanted to pay to the logarithmic sensitivity curve of the eye. \$\endgroup\$
    – oliver
    Dec 7, 2019 at 19:23
  • \$\begingroup\$ 4) I am afraid I don't get your argument. If the capacitance is in the discharged state, the voltage at 22k is 30V, so the current and hence the charge rate of the capacitance is determined by the 22k resistor, at least during the first few nanoseconds, right? \$\endgroup\$
    – oliver
    Dec 7, 2019 at 19:28
  • \$\begingroup\$ 5-7) as I said, the transistor in on-state is not the problem, it is fast. The problem arises while the phototransistor is off \$\endgroup\$
    – oliver
    Dec 7, 2019 at 19:34
  • 1
    \$\begingroup\$ yes .. drive PWM direct without optos for best results or maybe 50 ohm series R for noise reduction with matched impedance for RF then you can achieve 10 to 12 bit resolution \$\endgroup\$ Dec 7, 2019 at 19:51
  • 1
    \$\begingroup\$ I have experimented a little bit with a direct connection and one with different series resistors. It works muuuch better. Without series resistor the rise/fall time is 20 ns. With 50 Ohms it is still not much different from 20ns. But already with 160 Ohms the edge time increases to 50ns, which would still be nominally okay, but the problem is that maximum amplitude for the shortest possible PWM peak then becomes well below 4V. So I decided to play it safe and take 50 Ohms. Now I have 16 bits precision. Well done, Tony! \$\endgroup\$
    – oliver
    Dec 8, 2019 at 14:03

Your question is more of a red herring; it's most valuable to know how to effectively drive your LED power supplies' PWM dimming input from your microcontroller. You state that the maximum input on the PWM pin is 8 V, so I assume you're using the 300-700 mA model that has a high logic level of 3.5 - 8 V. It also looks like you're just using a 5 V regulator for your logic supply.

Some alternatives to the slow optocouplers:

  • Directly drive from your microcontroller if you're using 5 V IO. Series resistors 10-50 ohm to slow down the digital signal edges slightly and provide current limiting are good practice. Ensure you have a good common ground between the microcontroller and the -VIN of the LED drivers.
  • Use a level translator or digital isolator to assure signal integrity, particularly if your microcontroller is actually at a lower IO voltage or in a different power domain. Something like the SI8035 provides a fairly low cost, 3-5V compatibility on both sides, and isolation. In low quantities, level translators end up being similarly priced and with additional complexity. Either option is additional cost, but might be cheaper than 3x optocouplers.
  • \$\begingroup\$ The reason why I used optocouplers is that I read a forum question somewhere from somebody who had the suspicion that he fried his MCU by directly connecting the logic lines to the PWM input of said driver. I am not so much worried about frying an ATmega1284 for ~5€ immediately but rather the assembly failing later because it is out of spec (unfortunately the spec of the driver is not so verbose about the PWM input). Although this is a private project, I'd hate to pick up the threads in half a year or so. But as you and Tony Stewart seem to recommend the direct connection, I will try that. \$\endgroup\$
    – oliver
    Dec 8, 2019 at 7:39
  • \$\begingroup\$ The digital isolator is an interesting solution, never heard of a radio transmission inside a single chip. I will definitely keep that in mind, but for the moment it looks a little over-engineered for my case. As to the level translators, I don't clearly see how they could help me, because I am already at 5V with my MCU. Did you mean they are just another way of galvanic decoupling? \$\endgroup\$
    – oliver
    Dec 8, 2019 at 7:45
  • 1
    \$\begingroup\$ @oliver The level translators would give you some separation of drive. If you're worried about EMI, consider putting a few extra pF of capacitor on the data line. If you're worried about spikes, consider putting a 5 V ESD protection diode on the LED driver side of the PWM line. \$\endgroup\$ Dec 8, 2019 at 19:52
  • \$\begingroup\$ The EMI concern mainly comes from the fact that I am also using a IR receiver, which has already proven its sensitivity to interference from the PWM power switching (see my last question on SE). At the moment I have been able to keep EMI away from the IR Rx by an extra RC filter on the power supply. I hope that if it works on the breadboard, it will work even better on the PCB. \$\endgroup\$
    – oliver
    Dec 9, 2019 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.