TechSmartSolutions/0-10v-lighting-controller-for-Home-Assistant

PWM Frequency of 24 Channel PWM Board does NOT fit for MeanWell drivers

Opened this issue · 14 comments

Hi !

When I stumbled upon this project, it seemed to be exactly what I need.
.. now I realize the following, stating from the docs/datasheets:

"The TLC5947 is integrated with a 4-Mhz internal oscillator. and the 12-bit GS data include 4095 steps. So the frequency of the 12-bit PWM is 4MHz and the frequency of LED is 4MHz/4095." - this means fixed pwm frequency of 4MHz.

Datasheet MeanWell Driver regarding DIM-function: "◎ Applying additive 10V PWM signal (frequency range 100Hz ~ 3KHz):" - range for pwm = 100Hz up to 3KHz. So its a completely different value-area.

The 24 Channel PWM Board example is titled with "tested" - Do you by chance know for sure, that the 4MHz 10V PWM is actually/indeed interpreted/seen as additive voltage for dimming by the driver ? If so, the 15mA per channel would be sufficient for the 10mA required for additive voltage ...

Also:
I have currently built the circuit - and I am trying to get the 0V-10V range as exact as possible, with a 12V supply on specific channels, while leaving the voltage range on other channels as 0-12V (fans, using the pwm as base for an additional transistor towards "feeding" voltage supply) - what resistor ratings do you suggest ?

Hey I was setting up everything, but when measuring, I got very very strange results. Maybe you really should check if your output is as desired for the different stages with a multimeter...
What would happen if you feed a 4MHz signal, is that the driver sees it as additive voltage dimming.
And yes, during my measurements, it was working in a way, that you could dim via pwm - but just not with reliable exact values, e.g. 50% pwm results in 25% voltage of 12V (4.23V or so), basically behaving like a curve

yes, this is exactly how I set it up. When measuring with a multimeter I did absolutely not get the desired values, when not running at 100% or 0% - do you have a multimeter to check?

I am investigating right now.. What I can definitely confirm already, is that an alternate circuit with the PCA9685 16channel servo pwm driver module works :

I set that up with a pwm frequency of 1kHz and using its pwm output to control a small 2N3904 NPN transistor. PWM out of the module goes to the transistor base with a 1k-ohm base resistor and a load resistor of 10k-ohms between collector and 12V source - the output produces an exakt 1kHz 10V PWM if capped to 83.34% and using 0-84 as base for 100% calculation.

Okay I can confirm this all together now and I have a solution also.

The general idea is great don`t get me wrong. But there is some problems with the setup, I would love to see corrected, because they can cause major issues for people who use it in lots of use cases, because the circuit (just the TLC5947 one !) does not work as expected.
So. What I can confirm is, using your circuit you have a kind of dimming - just not the way you expect it to act, because:

  • this is not pwm dimming, this is dimming via additive voltage. You generate a specific voltage using the pwm signal, that`s also why the pwm frequency "has nothing to do" (very easily spoken) with the pwm frequency of the MeanWell driver.
    For generating a voltage with pwm, the higher freq is better, because it makes the voltage more "smooth" - and you could also add a small cap to improve that further. BUT: This is not PWM dimming. This is dimming via additive voltage.
    Problem:
    With this circuit, the generated voltage does NOT act as expected, regarding the value. For example, you use a 12V supply source, you would assume giving a 80% pwm duty cycle would result in 10V and a 50% duty cycle would result in 6V - but it does NOT. Take a multimeter, set the pwm duty to 50% and measure yourself.
    With my built of this circuit, I used 12.1V supply voltage, 50% duty cycle -> resulted in 1.859V (!!!!!!!). Either there is some bug in the code for the tlc5947 or there is sth wrong with the circuit.

But - that just doesnt matter, as my solution now will be even much better than the "original" circuit here - providing "expected" linear results, not requiring another power supply source apart from a 5V one, that will also power the mcu - and providing REAL pwm, where the power source inside the meanwell driver itself is used and only switched by pwm.
Imagine this the following way : "Inside" the driver is a small 10V V+ and GND and they are left open connected to the DIM+ and DIM- cables. You can now just "put a switch" between them and keep it pressed for 1s, then leave it not pressed for 1s and repeat - with a frequency of 300Hz to 1kHz - thats what the pwm dimming actually means. Why cant you just connect an arduino/esp GPIO-PWM-Pin ? Simply because those cant handle 10V voltage that would run over them when duty cycle is on "on". So in short - all you need is your tlc5947 adafruit module, dont provide a 10V/12V supply voltage at all, just power the module with 5V from 5V supply. This also reduces the complexity of the circuit in a great way, as it allows for a very cheap chinese small 230V to 5V/2A mini supply to be used - and just hooked to the main power of 1 lamp for example - or some other mains used anyhow.
As soon as you have the module running, get 24 logic level transistors, like the ones stated in the following image, I got from a forum post on Arduino forum and 24x 1kOhms resistors. Then just hook each pwm pin (no need for the other resistors and 10V or 12V supply, just connect pwm pin) with one of the resistors to the base and collector to DIM+ and emitter to DIM-.
Then you will also have expected "linear" output.
You could test this also with hooking up the 5V in series with a 10k Ohms resistor to the collector side and GND to emitter, then measure voltage - it will be the percentage of 5V that you set the duty cycle to.

Wawa-Arduino-Forum-MeanWell-PWM-Dim This was taken from a post from Wawa on the arduino-forum towards that topic. Remember : We power the TLC5947 with 5V and it`s PWM pins will therefore run with 5V supply voltage - and therefore we don`t(!) need to take the 3.3V GPIO voltage of the ESP32/ESP8266 into account.

Hope this helps, thanks so much for the in general awesome idea to use this TLC5947 module with home assistant and stuff.
Will post results from my built along with some pictures etc
Regards ...

Thank YOU mate - and - I now found out the keyword here is the gamma_correct setting that you also have in your config - this was the reason for the strange voltages - it defaults to 2.8 and together with inversion results in the mentioned result-voltage-curve if not set. So I can now confirm your circuit works as expected with the gamme correct set. Could you put that to the description for others as important fact to know, together with your conf? Thanks SOOO much. This is actually awesome.
The other stuff is true though - you are applying additive voltage, not pwm, and you could get rid of the 10V/12V power supply allltogether with the module I mentioned, resistor & transistor.
Also, I already managed to implement the "relay-switch-off" and stuff like that - would you mind me mentioning your awesome project, when I put my version up as a "pseudo-fork" here?

Also, maybe just change the description to "Additive voltage dimming" - then you are completely on the technically correct side regarding the description also - could help prevent wrong assumptions for users.

I suggest following info added to the 24 Channel MeanWell - Dimmer setup with the TLC5947 Adafruit module:

  • The Adafruit TLC5947 states to provide a 4MHz PWM frequency, which is not configurable. The TLC5947 chip even has a "random" not configurable frequency in the range between 2.6MHz and 5.1 MHz, that differs between different power-ups. This PWM-frequency is well suited for pwm-voltage generation, as a higher frequency generates a more smooth output voltage - it does not fit the range of 100Hz - 3kHz for PWM-dimming of MeanWell drivers. You will need the extra power supply as shown in the picture. The dimming takes place using "additive voltage 0-10V" method, stated as valid in the dimming-info section of MeanWell drivers. -

As long as the gamma_correct = 1 setting is set correctly, you can provide a 12V supply source and just set the max_power setting to 0.80, resulting in max. 10V with a 100% setting.
Do NOT use this for fans though, as the PWM pin is not able to switch their loads that quick. For that, you will need my setup, with the 6V 16 channel servo control PWM module, 2n222 transistors and resistors, as those transistors can handle load currents up to 700mA - enough for 12V fans (around 0.2A normally). A 2n3904 has max. current of 200mA - that is too much on the edge for my liking.

Sorry for that wall of text, but I though I could leave my findings here, to save time for others.
Best regards =) and thx again for the awesome project. Please put up more info for others, as this is really really great as soon as it works as intended !
Best regards

Hey mate, just as an update in case it is interesting:

First of all - I think I owe you "kind of" an apology - while it is indeed true, that you are using additive voltage dimming with the circuit you created - that additive voltage dimming method is the better / preferable solution compared to pwm dimming directly.
Reason is, that the true pwm dimming is much more prone to longer cable issues. The solution I made with true pwm also works - but is inferior to your solution.
I was able to build my own two prototypes right now, using both the tcl5947 and the pca9685 board together with npn transistor circuits now, and I have PWM, additive Voltage dimming and fan control combined and working, as well as an additional sensor board connectable via i2c (works over long cables also) that will go inside the tent then.
Currently I am building a separate pcb - people could then order a cheap controller board from a pcb manufacturer very cheap, without the hassle of building the whole circuit.

Thanks a lot for your work again, will update as soon as project is rdy for "deployment" :D