Having issue dimming a meanwell driver using PWM

Hi everyone, i've recentloy posted a diagram showing a esp32 connected to a pc817 octocoupler then to an ESP32, @Wawa did correct me about the value of a resistance (100ohm was too low) so i changed the circuit, tried it yesterday with a friend's driver as mine is waterproof so it would be a pain to use for testing (no clips, no nothing) and it lit the LED this time but it would nearly instantly shutdown, we tried a few times, changing the brightness value would lit the LED again but they again shut almost immediatly, so i figured/assumed we triggered one of the protection mecanism of the driver (it has plenty : OVER CURRENT, SHORT CIRCUIT , OVER VOLTAGE , OVER TEMPERATURE)

Im using ESPHOME as the software as indicated in this video with this configuration :

  - platform: ledc
    pin: 23
    frequency: 1220 Hz
    inverted: true
    id: led_pwm
    channel: 0

Here is the new diagram after wawa's advice (thanks)

Here's a picture of the circuit in case i missed something and misrepresented it

the octocoupler's mark is represented by the red dot and the blue and white wire should be connected to DIM+, DIM- on the driver.

Thanks in advance, i hope i can get this to work !

PS: just thought about it but i used the wires showed in the picture to connect to the dim using wire clips, could they have been too thin to witstand the current ?

Thanks, sicknesz.

Remove the opto coupler from the breadboard and replace it with a red LED.
Then see if you can dim the LED.
If that works, then it must be the dimmer. If it doesn't work it must be the code.

Thanks, I will tests this tomorrow.

Have a great one.

Hello again, I don't have a LED to test yet but i measured with a voltmeter the output of the octocoupler and what i got was value ranging from 0v to 3.3v i think that's what's to be expected, or should it goes from 0-10v ?

You didn't give the exact model of the LED driver but typically they work (nominally) 0-10V and they have a built-in pull-up resistor (which should work with the circuit you have).

If I'm right... You should get about 10V across the dimming terminals without the opto-isolator connected, and you should get full-brightness. And if you short those terminals together it should go off.

Can you turn it on & off by writing high & low instead of using PWM?

BTW - The opto-isolator is an inverter so 100% PWM should turn the power supply off.

Multimeters can't reliably measure PWM. As you may know, PWM switches between (about) zero and full voltage so when you vary the PWM you vary the duty-cycle and the average voltage, but it's still switching between zero and maximum. Some meters will give you the average but you can't rely on it.

When you directly dim an LED with PWM it's not really dimming. It's switching quickly on & off and if it's off half of the time it appears to be half-brightness to the eye... Well it will actually appear to be just-slightly dimmed our eyes aren't linear, but the concept is the same. The output of the Mean Well probably is actually dimming (lowering the DC current) even though it's controlled with PWM.

Sorry i forgot to mention it's this model : https://www.meanwell.com/Upload/PDF/HLG-480H/HLG-480H-SPEC.PDF

the model B (IP67 with 3 dimming method)

thanks for those info, i will get some standalone LED to do the tests wawa told me to in very few days, i just thought about using the meter to see if i can figure out why they went off when i tested it but my understanding is so low it wasnt usefull at all :frowning:

Thanks, Sylvain.

I got LED in the mail this morning, tested and it works fine at dimming the LED, it's inverted but it dims the LED properly.

@Wawa what do you by mean by "If that works, then it must be the dimmer."

It's a standard meanwell driver my friends has the AB, i have the B model (both have 3 in 1 dimming 0-10v,PWM signal and resistance) can you explain a bit further please ?

Thanks, Sylvain.

Edit: I just went back to the youtube video where i found the explanaition for this circuit, who found it here (lol the loop is complete :p) and i just saw he added this in the comment section :

Something I need to correct in the video - at [11:33](https://www.youtube.com/watch?v=cEy5go2eZtY&t=693s) I said that it didn't matter which way you plug the dim+ and dim- wires into the output of the optocoupler. This is incorrect.

put the Dim- on the optocoupler emitter pin (with the orientation I have it in the video, it would be the top right pin) and the Dim+ on the collector pin (shown top left in video). So, if it doesn't work quite like you expected, try flipping your dim wires on your opto output!

@Wawa is this correct ? about the Dim(+) Dim(-)

We did not try to inverse the polarity when i tested it on the meanwell, but i had to do it to make the red LED lit when testing this morning, could that have been the culprit all along ?

i wish i could test it right now.

Thanks, Sylvain.

So the problem is not in the ESP32 or in the code.
But we don't know what's inside the dimmer, or how it will react.

I would test the LED driver with a potentiometer of the recommended value.
Or, if you don' t have one, with resistors of a few values in that range.

Did you already try another opto coupler.

Will try another optocoupler tonite and report back.

Hey, i have a good news (well at least for me) it works :partying_face: ! Thanks alot @Wawa and @DVDdoug for helping me with this. :handshake:

changing the polarity seems to have done the trick, i'm just wondering now just how safe is it to use when fully replacing the manual potientiometer. :thinking:

PS: First thing i'll do to make it futur proof is change the super thin wire and use some 18 gauge to go from the breadboard to the dim wire.

Thanks, Sylvain

I don't know if the DIM terminals of Meanwell LED drivers are 100% safe to touch (using a pot),
therefore I recommended an opto coupler (isolating with light) between ESP and DIM pins.

Thin wires for the opto coupler is ok. Only small currents are involved there.

Yes, i've looked up octocoupler isolation and learned that they isolate using light as you just mentionned so i guess it's perfectly safe to use as replacement of the pot.

Thanks for the help it means alot to me.


This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.