Dimmable HLG driver Optocoupler or Transistor, does it matter? (and other questions)

Relic79

Well-Known Member
Hi All,

I do not know a lot about electronics, just enough to tinker with Raspberry Pi's and Arduino's and make the odd circuit work.
I'm very interested in trying to control the dimming feature on the HLG-480-C2100B driver I have and see that it takes a PWM signal.

I found this written on an Arduino forum:

"Connect DIM- (white) to Arduino ground.

Small NPN transistor (e.g. BC547).
emitter to ground.
collector to DIM+ (blue)
1k resistor between base and one of Arduino's PWM outputs.


Write 0-255 to the PWM pin for 100-0% dimming."

Then that member posts a follow up:

"With a BC183, you must share Arduino ground with DIM(-).

If you have an opto coupler, I would use that instead of the BC183.
The opto creates an extra layer of safety, because grounds of the two devices are NOT shared."


1) In this scenario, which device is the opto-coupler protecting? The Meanwell?, The Arduino?, or Both from one another? (If it isn't a multi-page explanation, how does not sharing a ground accomplish this?)

2) What are the dangers if I proceed using a transistor rather then an opto-coupler? (I don't care much about the arduino or raspberry pi, but don't want to fry my brand new Meanwell driver).

3) Considering how well Meanwell drivers seem to be engineered and regarded, how likely are those dangers to actually occur?

4) If the answer is that in all cases I should use an opto-coupler. I still only have a transistor in my pocket and an urge tinker right now! Would a transistor work well enough for a testbench/proof of concept? Or am I just gonna let the smoke out?

5) My understanding from the arduino forum post above is that the dimmer is inverted. This should mean if the light powers on with no PWM signal present, it would turn on at 100%. Could I hook both a potentiometer AND apply PWM at the same time? My reasoning would be that the POT would set a MAX intensity for the light should PWM fail, and then I can use PWM to further dim through automation. My reason for this would be to protect any plants not yet ready for 100% intensity in case the PWM signal fails.

6) I'd like to confirm that the dimming circuit on the meanwell can't control on/off, only dim, and that if I want to use automation to turn it on and off, it would be using a relay on the actual input power source?

Thanks for sharing your knowledge whomever might answer this!
 

SBBCal

Well-Known Member
Are you talking about adding just a dimmer to the driver? You lost me in your story. image.jpgimage.jpg
 

Relic79

Well-Known Member
Are you talking about adding just a dimmer to the driver? You lost me in your story. View attachment 4723349View attachment 4723359
I have it connected with a pot like those right now.

I am researching how to control it from a micro controller by using the option to control dimming via 10V PWM.

To do that I need to use a NPN Transistor, or Optocoupler to connect the dimmer contacts on the HLG driver to my Raspberry PI or Arduino.

It is so I can dim it remotely, and dim it via schedule via automation. Mostly just for the hell of it because it is something to do!
 

SBBCal

Well-Known Member
Well yeah, connect the driver wire to Potentiometers/resistor. Those in the pic. Choose Ohm accordingly to driver output.
 

Relic79

Well-Known Member
Well yeah, connect the driver wire to Potentiometers/resistor. Those in the pic. Choose Ohm accordingly to driver output.
I have it connected with a pot like those right now.
I don't want the pot, it is already connected and working. I am removing it so I can use the Pulse WIdth Modulation option (PWM). From the datasheet on the driver:
MeanwellPWM.png


I believe I can connect an NPN transistor's collector and emmitter across the dim + and -, and send a PWM signal into the base of the transistor from a microcontroller's PWM output to control the dimming of the light.

This will eventually allow me to see if there is any benefit to turning on my lamp slowly in the morning via automation rather than blasting the middle of my canopy with over 1,000 PPFD from darkness.

If nothing comes of it, at least I will be able to dim my light from my phone.

Yes, this is fun to me! I like to try things just to see if I can.

Also, I know I could have asked on an electronics and home automation forum, but I thought there might be some of those type on these boards as well, and I'd rather keep this here!
 

SBBCal

Well-Known Member
I only know the basics, my bad in the confusion. I'm sure someone will have an answer on here for you. Try searching the forums
 

Relic79

Well-Known Member
I only know the basics, my bad in the confusion. I'm sure someone will have an answer on here for you. Try searching the forums
No worries. I did search and saw a few people that sounded like they might now, I might @ mention them if this gets no traction.
I think I know some of the answers, but I'm gun-shy to fry the driver, microcontroller, or both.
 

lazaah

Well-Known Member
Take a look at @shimbobs suggestion in my fan thread, same idea and hardware required

 

Relic79

Well-Known Member
Take a look at @shimbobs suggestion in my fan thread, same idea and hardware required

Thanks, I actually read that thread, just not closely enough.

I'm now wondering which wires are which on the AC infinity. I'm going to try figure it out with a multimeter.

I mentioned @shimbob in the other thread. I'm mostly just lacking confidence in myself to figure out the correct wires on the fan.

I'm going to see if I can pickup a couple optocouplers at my local electronics shop today if I can.

Thanks!
 

Mak'er Grow

Well-Known Member
Now this is just a guess...early in the am as well...so I may not be exact...lol
Transistor if it goes bad will short, or can, which connects 2 or 3 points in to a short...so depending on voltages used a higher voltage could go into a lower causing a circuit to blow.
Where when an optocoupler is used it makes a 1 way barrier...isolates voltages from one another...safer.
In the end an optocoupler 'protects' the Arduino/Ras Pi from the switching power...if a short should occur.
 

Relic79

Well-Known Member
Now this is just a guess...early in the am as well...so I may not be exact...lol
Transistor if it goes bad will short, or can, which connects 2 or 3 points in to a short...so depending on voltages used a higher voltage could go into a lower causing a circuit to blow.
Where when an optocoupler is used it makes a 1 way barrier...isolates voltages from one another...safer.
In the end an optocoupler 'protects' the Arduino/Ras Pi from the switching power...if a short should occur.
I think this is the optocoupler @shimbob used but am not certain how it would interface.

I'm thinking PWM signal from microcontroller to in1, dim+ from meanwell to HV, and dim- on meanwell to out1. Any thoughts?
 

Attachments

Mak'er Grow

Well-Known Member
I think this is the optocoupler @shimbob used but am not certain how it would interface.

I'm thinking PWM signal from microcontroller to in1, dim+ from meanwell to HV, and dim- on meanwell to out1. Any thoughts?
Now I'm not exactly sure, but think it works where the 2 x In pins are connected to the 2 x Out pins when the HV or HVG & GND are turned "ON" from the Arduino/Pi which then connects the 2x In and Out...turns on the fan/motor. (Like a DPST relay) Then the HV/HVG pulse length(s) determines how fast it goes by turning power on and off quickly.
Thats the basics of how it works I think...lol
 

Mak'er Grow

Well-Known Member
I'm just getting my circulating fans and light fans to be controlled by my Arduino setup now...I'm wiring up some 12 VDC supplies and some PC fans that are SSR controlled from the Arduino...so mine will work on Temp/Humidity and turn on/off when it should from the readings...hoping...lol
But if I get some time in the next day or so I'll see if I can test a few things out and figure a simple controller. :P
 

Attikus112

Well-Known Member
I think this is the optocoupler @shimbob used but am not certain how it would interface.

I'm thinking PWM signal from microcontroller to in1, dim+ from meanwell to HV, and dim- on meanwell to out1. Any thoughts?
Assuming this is the same board you're looking at I would say you connect 10V supply positive to HV and 10V supply ground to HVG. You're meanwell dim+ connects to Out1 and dim- to HVG, and the microcontroller output to In1 and Gnd. Alternativly, if you wanted to avoid having an additional power supply (10 supply in this case), you could look into a digital rheostat or potentiometer.


1603589877758.png1603589894067.png
1603589957779.png
 

Relic79

Well-Known Member
Assuming this is the same board you're looking at I would say you connect 10V supply positive to HV and 10V supply ground to HVG. You're meanwell dim+ connects to Out1 and dim- to HVG, and the microcontroller output to In1 and Gnd. Alternativly, if you wanted to avoid having an additional power supply (10 supply in this case), you could look into a digital rheostat or potentiometer.

my understanding is that the dim+/- contacts supply 10v and I just need an additive pwn signal to be applied.

i believe if I used a transistor, something as simple as this would work. Where the pwn signal from the microcontroller is driving the base of the transistor and the dim contacts supply their own 10v.

A5lVo.png
I am also told it would be a good idea to use a optocoupler to isolate the low and high voltages.

If we assume the above circuit works, any idea how the sparkfun optocoupler might be used instead of the transistor?

The schematics linked for the sparkfun board get beyond my understanding.

I believe since this is a 2 channel coupler I could think of HV as the collector, out1 as the emitter, and in1 as the base, so dim + to HV, dim - to out1 and gpio to in1? Does that sound right?
 

Attikus112

Well-Known Member
my understanding is that the dim+/- contacts supply 10v and I just need an additive pwn signal to be applied.

i believe if I used a transistor, something as simple as this would work. Where the pwn signal from the microcontroller is driving the base of the transistor and the dim contacts supply their own 10v.

View attachment 4724331
I am also told it would be a good idea to use a optocoupler to isolate the low and high voltages.

If we assume the above circuit works, any idea how the sparkfun optocoupler might be used instead of the transistor?

The schematics linked for the sparkfun board get beyond my understanding.

I believe since this is a 2 channel coupler I could think of HV as the collector, out1 as the emitter, and in1 as the base, so dim + to HV, dim - to out1 and gpio to in1? Does that sound right?
I could easily be misinterpreting the meanwell datasheet. I was working with a LPF-60D-54 which has a similar 3 in 1 dimmer scheme but I interpreted the pwm requirement "Applying additive 10V PWM signal (frequency range 100Hz ~ 3KHz)" as it needed a 10v PWM signal. I know applying a 10v PWM works but it seems like it might be an overly complex solution. From a post on the arduino forum (maybe the one you were referring to) it seems like you can just short dim+ to dim- like you were suggesting. The opto breakout might be more complex than needed might only need an opto, but it seems cheap enough to try and find out.

Edit:
I could be wrong but i think you would connect dim+ to HV (or out1 to bypass the resistor) and dim- to HVG. It looks like dim- is the ground for the transistors and load side of the opto couple. Your trying to pull dim+ to ground, it sounds like it outputs 10v by default. On the micro side the gpio goes to in1 and micro ground to gnd.

 
Last edited:

shimbob

Well-Known Member
87 (1).jpg87.jpg

Without the remote, the ac infinity fans do need a separate line 10V from somewhere as it is the remotes that generate the 10V.
I happen to have another 0-10v fan that does output 10V in the fan itself, not the remote. So that's my source of 10V.

More coming...
 

shimbob

Well-Known Member
Oh wait, I had it wrong. With my S4, the fan body itself does produce 10V and that goes to the remote to get PMW'd. I have another fan for which I needed a source of 10V to pwm, so I use it from the S4. I'm aware the T fans don't make their own 10V, it comes from the remote?

So above is inside my S4 fan. Brown is +10V to the optoisio's HIN pin, solid blue is the output of top optoiso going back to the fan's PWM in pin. stripblue ground.
There's another fan on the 2nd channel of the top optoiso, and I' dimming a driver on one channel of the second optoiso. I'd like to use the unused channel to control some AC heating elements, bought some thyristors for that future project.
 
Top