Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] PWM for Led driver dimming #262

Closed
leoneo opened this issue Jun 28, 2017 · 131 comments
Closed

[Suggestion] PWM for Led driver dimming #262

leoneo opened this issue Jun 28, 2017 · 131 comments

Comments

@leoneo
Copy link

leoneo commented Jun 28, 2017

Hello Kyle,

I would like to control the brightness of 3 led strips (red, blue, white) in the time.
For example function 1 : day 1 = 10%; day 2 = 15%; day 3 = 20 % ... day 15 to day 30 = 100%
function 2 : sunrise start at 6:30AM with 0% to 100% in 30min / sunset start at 8:30PM with 100% to 0% in 30min.

There are led drivers dimmable with 0-10Vc PWM input and with a 0-5V 0-10V PWM Converter Module it is theoretically possible with the Raspberry Pi to control the brightness.
https://raspberrypi.stackexchange.com/questions/298/can-i-use-the-gpio-for-pulse-width-modulation-pwm
http://www.meanwell.com/productPdf.aspx?i=300
http://www.uctronics.com/0-5v-0-10v-to-0-100-voltage-to-pwm-converter-module.html

Please can you add a PWM output function in Mycodo ?

Thanks
Leo

@kizniche
Copy link
Owner

Good suggestion, How do you envision it being integrated into Mycodo? That is, what is your desired use? Such as x% at 8am, y% at 10am, etc.; response from sensors (conditional- if light sensor is x, set LED output to y, some sort of integration into the relay menu so relay actuation can somehow change brightness/color, or other?

@leoneo
Copy link
Author

leoneo commented Jun 30, 2017

I use mycodo for the cultivation of microalgae. In the first stage the culture has a low density and requires little light. Excessive brightness inhibits growth. As cell density increases the luminous intensity must be increased. Then from day to day the luminous power increases. When cell density is at its maximum, microalgae are stressed with maximum intensity to make a red pigment.

I need a function that gradually increases the brightness during the first 15 days.

For an outdoor culture to have the ability to compensate for the loss of brightness by a cloud would be really very interesting to have a stable, climate-independent production.

I would like to use mycodo to a marine aquarium. For the coral it takes a function of sunrise and sunset every day.
(And the cherry on the cake would be the simulation of the lunar cycle.)

The PWM output function can be integrated in the relay menu.

@kizniche
Copy link
Owner

kizniche commented Jun 30, 2017

Here is what I currently think would work best for the 15 day cycle:

  1. Create a method that gradually increases over the span of 15 days.
  2. Modify the timers to accept a method as an input and a [special] relay as an output. This special relay will be a PWM relay.
  3. When the timer is started, it will output according to the method.

For the sunrise/set, moon phase I could add a new type of controller that can calculate the sunrise/set and lunar phase for a given set of coordinates (and optional time offset to have a complete configuration), where there can be PWM output based on sunrise, midday, sunset, then switch to PWM for moon phase during night period. There could also be actions that can be taken at sunrise or sunset (or periods surrounding those using a time offset, such as "2 hours before sunrise" or "20 minutes after sunset", activate relay x to ON, set relay y PWM to 70% duty cycle, etc.)

@leoneo
Copy link
Author

leoneo commented Jun 30, 2017

That will be great ;)

Do not forget the function of modifying the brightness of the LEDs according to the ambient brightness to maintain a constant luminosity in real time.

There is a lot of work.

@kizniche
Copy link
Owner

How are the LEDs duty cycle changed?

@leoneo
Copy link
Author

leoneo commented Jun 30, 2017 via email

@kizniche
Copy link
Owner

I was asking how is the hardware (LEDs) modulated by the software. And what software or code is used for that? I need a starting point as I don't have any hardware for LED PWM control.

@leoneo
Copy link
Author

leoneo commented Jun 30, 2017 via email

@leoneo
Copy link
Author

leoneo commented Jul 1, 2017

driver datasheet : Applying additive 10V PWM signal (frequency range 100Hz ~ 3KH)

you can test mycodo with 1 led and 1 resistor like that :
https://circuitdigest.com/microcontroller-projects/raspberry-pi-pwm-tutorial

@wangine
Copy link

wangine commented Jul 16, 2017

@kizniche Is the same thing i ask you last year if you can integrate a PWM output function in PID control . Can be 2 main forms of controll PID output (relays and PWM). Relays can do a good job for normal control ,but for fast changes below 1 second , relays just simply cant. I can handle with C but unfortunately my programming skills in Phyton and Flask are very low. (I'm hardware engineer) , software are just a passion.
Here's a simple function for a PWM software (for processors without harware PWM module like Raspberry ) http://www.ccsinfo.com/forum/viewtopic.php?t=54585 .
Also the same function can be used in alternating power sources (~) not only on linear power sources (+-) like @leoneo need .

@kizniche
Copy link
Owner

kizniche commented Jul 16, 2017

The RPI.GPIO module has PWM and I think it would be somewhat easy to add it as a PID output (as the other use mentioned in this thread appears more difficult), now that I have a bit more experience with Python and the framework is more logical and accessible. What would be any additional PID options or changes needed to use PWM as an output? I'd assume I would essentially need to convert the PID output to a percentage, for use in defining the duty cycle. Any other suggestions would be appreciated, as I rarely work with PWM and don't currently have any devices that use it (though I can test the operation with my oscilloscope).

@wangine
Copy link

wangine commented Jul 16, 2017

Yes Kyle , now i see, Pi is the same, software PWM (not hardware) and i assume can be selected as output any RPI pin. That would be great. Here is a tricky part. If controll is in one dirrection (raise or lower , usualy the temp) PWM output will be as percentage 0 - 100% and if the controll need to be in both dirrection can be in two ways :
1 : (the best one) with two RPI output pins , one for lower and one for raise . Raise between 0 - 100% and lower between 0 -100% . independently. Thats method is more easy to set the hardware without to much knowledge
2 : (need a complex hardware , specialy for alternating power source) . with one RPI pin . In that case raise will be between 50 - 100% and lower will be between 0 - 50% percentage.
So the PID interface will be without the relays radio buttons , also without durrations max and min.
We will need a 3 fields (radio buttons):
1: Field to select which method will use (relay or PWM)
2: Field to select the based PWM frequency (between 1Hz and 400kHz will be enoth for all aplications)
3: Field to specify the desired RPI pin (or pins in case of both dirrections).

@wangine
Copy link

wangine commented Jul 16, 2017

@kizniche Also i can made a schematic for each one of the metods (2 pins or single RPI pin) and for the two power sources (alternating and countinuous ). You can fit into the help page after you finish.
Also the advantage of PWM PID modulation control are double.
1: (example for temperature control ) The heat source dont need to be double as necesarry like in relay modulation type, because 100% duty cycle mean the heat will be turned on completly on entire period .
2: The 30% or more of the power source will be saved with PWM controll. Relays controll give a hudge lost in electromagnetic energy when is turned on. Also the delay is big.

@kizniche
Copy link
Owner

Sounds great. I can understand the 0-100% PID for a single relays (one 0-100% up, one 0- - 100 down), or just up or just down. However, I'm not fully understanding the other method you suggest. Schematics and descriptions would help. Thanks. I'm out right now, but plan to do some research when I get home later.

@wangine
Copy link

wangine commented Jul 16, 2017

We can use the solid state relays instead of classic coil relay. That for heat sources load . Actualy is not to much difference between techniques of relays use. Classic relay can modulate in on and off (they can"t open or close only 30% or 66%) and solid state relays can work with PWM modulation . Thats mean if the power source wil be 120v AC , and relay is comanded with 50% duty cycle at 1kHz based frequency , the heat source will get 60v AC .
Some tips about how they work http://www.idc-online.com/technical_references/pdfs/electrical_engineering/The_Solid_State_Relay_Static_Relay_Overview.pdf
and here some relays i"ve used long time ago on my old regulation system with dsPIC and PWM output controller
http://www.farnell.com/datasheets/1754070.pdf?_ga=2.34697575.719620540.1500236779-1343759042.1500236779

@Ryobidelacroix
Copy link

What about a PWM IC? I found two examples. They can be controlled by either I2C or SPI.

https://www.adafruit.com/product/815

https://www.adafruit.com/product/1429

@wangine
Copy link

wangine commented Jul 17, 2017

@Ryobidelacroix That's IC are specialised only for LED PWM , If the code will be made like @kizniche suggestion http://raspi.tv/2013/rpi-gpio-0-5-2a-now-has-software-pwm-how-to-use-it the aplication will be general purpose , not only for LED. The native RPi pin"s can be used on any application.

@Ryobidelacroix
Copy link

Ah, even better!

@kizniche
Copy link
Owner

I completed about 75% of the PWM implementation last night, including the web interface and the PWM controller. Last is to test the operation and enable it as a new PID option. Then we can get into more complex uses.

@wangine
Copy link

wangine commented Jul 18, 2017

I made a simple swap PWM code to simulate the output of PID on RPi . Schematics are for AC and DC load.
Unfortunately my PC cant handle with record screen of 720p and ISIS simulate in real time, but is enough to someone understand. When you will finish i will test and made the schematic for any type on configuration (AC, DC , inductive , resistive load. ... )
https://www.youtube.com/watch?v=RPcaKuM9QoE

kizniche added a commit that referenced this issue Jul 18, 2017
@kizniche
Copy link
Owner

kizniche commented Jul 18, 2017

I pushed the latest commit for what appears to be a working implementation of PWM. I say appears because everything responds as though it's working but I haven't actually tested the pin output. I'll check with my oscilloscope tomorrow. There may very well be issues with this PWM_support branch, as I haven't tested if current relay/PID functionality has been affected.

This commit only brings in the ability to add and configure a PWM output on the output's page (previously "relay" page), and turn on/off PWM. PID output will come next once I confirm there is indeed a PWM being output and normal relay/PID functionality hasn't been broken.

kizniche added a commit that referenced this issue Jul 18, 2017
@wangine
Copy link

wangine commented Jul 18, 2017

Ok. I put here some pictures with basical principle (the best and cheap way) . You are free to put in help page if you want.
Simulate the AC resistive load with PWM and 1% dyty cycle
pwm 1 duty
Simulate the AC resistive load with PWM and 50% dyty cycle
pwm 50 duty
Simulate the AC resistive load with PWM and 99% dyty cycle
pwm 99 duty
This is a basic principle , not a full point schematic, just to users to get the ideea how it works. Is the best way to controll the AC (most used) loads with PWM. It"s work with bipolar, MOSFET and IGBT transistors as well. Can controll any resistive load with less than 40% inductive .

@kizniche
Copy link
Owner

Great! I'll add them to the manual. I've never really used PWM besides simple uses with microcontrollers, so this is all relatively new to me.

@wangine
Copy link

wangine commented Jul 18, 2017

Is just the principle , if you have a osciloscope is easy to fully understand how it's works and the hudge advantage than relays. With PID and PWM , dont stress the relays , the loads . Is almost linear . After you will finish the PWM code , i will upload the full real schematics (ISIS can't simulate the complex hardware, to much math for him), but only after i will test on my rPI . I use that for years on my old dsPIC MCU"s before discover your software.

@kizniche
Copy link
Owner

That last commit should have all parts of the system working with PWM, including PID output. I have my oscilloscope with me so I can test when I get home.

@wangine
Copy link

wangine commented Jul 18, 2017

Ok. The first complete schematics with bipolar transistors, to controll with PWM and isolated output .
The normal circuit in phase with PWM , the most stable with bipolar transistor
pwm 50 duty bipolar isolated no inverting phase
And inverted phase than PWM ,
pwm 50 duty bipolar isolated 1
Are tested only on resistive loads . Not on motors (fully inductive)

@wangine
Copy link

wangine commented Jul 23, 2017

Is strange . I let be tested and when i wake up , Mycodo still running but i can't acces the webserver . Also SSH dont working. I try on differents PC. Seems was orking on PRi web interface itself. I look in logs , no daemon logs, but some lines on HTTP log.

[Sun Jul 23 06:25:14.049833 2017] [ssl:warn] [pid 1514:tid 1995751424] AH01909: 127.0.1.1:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jul 23 06:25:14.050737 2017] [wsgi:warn] [pid 1514:tid 1995751424] mod_wsgi: Compiled for Python/2.7.8.
[Sun Jul 23 06:25:14.050779 2017] [wsgi:warn] [pid 1514:tid 1995751424] mod_wsgi: Runtime using Python/2.7.9.
[Sun Jul 23 06:25:14.052281 2017] [mpm_event:notice] [pid 1514:tid 1995751424] AH00489: Apache/2.4.10 (Raspbian) OpenSSL/1.0.1t mod_wsgi/4.3.0 Python/2.7.9 configured -- resuming normal operations
[Sun Jul 23 06:25:14.052380 2017] [core:notice] [pid 1514:tid 1995751424] AH00094: Command line: '/usr/sbin/apache2'

that was before to restart

[Sun Jul 23 14:44:36.832078 2017] [mpm_event:notice] [pid 1514:tid 1995751424] AH00491: caught SIGTERM, shutting down
[Sun Jul 23 14:44:49.578115 2017] [ssl:warn] [pid 838:tid 1996300288] AH01909: 127.0.0.1:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jul 23 14:44:49.655309 2017] [ssl:warn] [pid 842:tid 1996300288] AH01909: 127.0.0.1:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jul 23 14:44:49.708948 2017] [wsgi:warn] [pid 842:tid 1996300288] mod_wsgi: Compiled for Python/2.7.8.
[Sun Jul 23 14:44:49.709042 2017] [wsgi:warn] [pid 842:tid 1996300288] mod_wsgi: Runtime using Python/2.7.9.
[Sun Jul 23 14:44:49.713878 2017] [mpm_event:notice] [pid 842:tid 1996300288] AH00489: Apache/2.4.10 (Raspbian) OpenSSL/1.0.1t mod_wsgi/4.3.0 Python/2.7.9 configured -- resuming normal operations
[Sun Jul 23 14:44:49.714010 2017] [core:notice] [pid 842:tid 1996300288] AH00094: Command line: '/usr/sbin/apache2'

And that after i restart.
Also i notice a error on influxDB , but seems are ok , just a delay start (i think);

2017-07-23 14:45:37,431 - mycodo - INFO - Anonymous statistics disabled
2017-07-23 14:45:37,698 - mycodo.output - INFO - PWM 1 setup on pin 16
2017-07-23 14:45:37,699 - mycodo.output - INFO - Relay 2 setup on pin 12 and turned OFF (OFF=LOW)
2017-07-23 14:45:37,701 - mycodo.output - INFO - Output controller activated in 100.1 ms
2017-07-23 14:45:37,701 - mycodo - INFO - All activated timer controllers started
2017-07-23 14:45:37,905 - mycodo.sensor_1 - INFO - Activated in 158.9 ms
2017-07-23 14:45:37,907 - mycodo - INFO - All activated sensor controllers started
2017-07-23 14:45:38,179 - mycodo.pid_1 - INFO - Activated in 227.1 ms
2017-07-23 14:45:38,282 - mycodo - INFO - All activated PID controllers started
2017-07-23 14:45:38,283 - mycodo - INFO - All activated LCD controllers started
2017-07-23 14:45:38,284 - mycodo - INFO - Mycodo daemon v5.0.49 started in 1.144 seconds
2017-07-23 14:45:38,296 - mycodo - INFO - 41.888 MB ram in use
2017-07-23 14:46:02,321 - mycodo.influxdb - ERROR - No measurement available in the past 60 seconds.
2017-07-23 14:46:02,321 - mycodo.pid_1 - WARNING - No data returned from influxdb

The influxDB was downgraded , as you suggest.

@kizniche
Copy link
Owner

I just noticed that influxdb 1.3.1 was released 3 days ago (without updating their changelog for me to notice). I just upgraded and it appears to be working. I used the following to upgrade:

wget https://dl.influxdata.com/influxdb/releases/influxdb_1.3.1_armhf.deb
sudo dpkg -i influxdb_1.3.1_armhf.deb
sudo service influxdb restart
rm -rf influxdb_1.3.1_armhf.deb

@hamster007
Copy link

Hello,
This is an awesome feature, Just a quick question.
Will this control a extraction fan PWM with little to no adjustment?
Thanks in advance.

@kizniche
Copy link
Owner

kizniche commented Aug 25, 2017

I'm not sure what that is. Currently, only PIDs can output a PWM signal. If your device can accept a 3.3-volt PWM from 0% to 100% duty cycle, it will work out of the box. Otherwise you'll need to adjust your hardware accordingly.

@hamster007
Copy link

Its a standard 12v 4wire computer fan. Wiring: 12v, ground, tachometer, PWM.
The Idea is to be able to utilise the PWM output from mycodo to control temperatures without turning relays on/off every few seconds. This will give better temp control as well as lowering power draw due to constant running state or off if below temp theshold

@zsole2
Copy link
Contributor

zsole2 commented Aug 25, 2017

I have followed this development too, for the exact same purpose, i.e. for controlling fans.
The problem is that there is a minimum voltage that is needed for the fan to turn on, in my experience it is about 4-5 V for a 12 V fan, thereby affecting the duty cycle range. This would only require a small modification to the code, though... I still have a DIY picture frame running based on the setup described at http://www.raspberrypi.org/forums/viewtopic.php?f=35&t=62438, if that is helpful.

@pukkita
Copy link

pukkita commented Oct 20, 2017

Ok. The first complete schematics with bipolar transistors, to controll with PWM and isolated output .
The normal circuit in phase with PWM , the most stable with bipolar transistor
pwm 50 duty bipolar isolated no inverting phase
And inverted phase than PWM ,
pwm 50 duty bipolar isolated 1
Are tested only on resistive loads . Not on motors (fully inductive)

Will this work with fans? Would be great to be able to PWM drive an inline AC fan (RVK125A) for extraction!

@kizniche
Copy link
Owner

kizniche commented Nov 7, 2017

v5.3.4 released today includes the ability to create timers that output a PWM signal based on a method. Just make sure your method stays between 0 and 100 (%), and select it in a PWM Timer to use it.

@pukkita
Copy link

pukkita commented Nov 12, 2017

Regarding PWM commanding AC inductive motors (Fans), according to RVK it can be done using stepless thyristors:

The fans can be speed-controlled via a stepless thyristor or a 5-step transformer.

Reference:

@Theoi-Meteoroi
Copy link
Contributor

Lets just say - controlling large motors is out of scope I think. Indeed, many things can be done with proper signal conditioning and isolation from the big, bad motor. The problem is that as you try to scale the solution (engineer to reality) you figure out you started from the wrong perspective. Tiny 3.3v digital signals need optoisolators at a minimum and the power stage is a challenge to get done well. At that point you couldn't care less about what wiggles the control signal. I would try to find an engineered solution that takes a 3.3v control signal first then consider building my own if that option isn't feasable if I want to integrate with Mycodo. There is only so much of the effort that Kyle can sustain, I think.

@victorhooi
Copy link

Not sure if I should post here, or start a new issue.

However, the original comment talked about dimming some Meanwell LED drivers, which required 0-10V for the PWM.

I have the same use-case (Meanwell LED dimming using PWM) - Raspberry Pi's do 0-5V for PWM, right?

What are you all using to convert that to 0-10V PWM?

The post did mention some converter, however, the link there is dead.

@leoneo
Copy link
Author

leoneo commented Sep 5, 2022

@kizniche
Copy link
Owner

kizniche commented Sep 5, 2022

There have been a few discussions about generating 10 VDC PWM signals, but these same hardware solutions can also do 5 VDC.

https://forum.radicaldiy.com/t/schematic-using-pwm-to-generate-a-0-10v-control-signal/1098

https://forum.radicaldiy.com/t/can-i-control-the-speed-of-motors-and-fans-with-a-pwm-signal/65

@victorhooi
Copy link

@leoneo Thanks for the link - but just to clarify - that is a digital potentiometer board, right? Not for converting a 5V PWM to 10V PWM? Is the idea that we use this for one of the other non-PWM Meanwell dimming modes?

@kizniche Cool - thank you for that as well. The second link, which then links to a OSHPark PCB seems like exactly what I want.

Sorry if these are basic questions - but my electronics knowledge is fairly basic.

But to confirm, I can just:

  1. Order this board from OSHPARK
  2. Solder on the resisters and 2 x transistors
  3. Connect the PWM and GND on left to the Raspberry Pi (I'm not too clear on the connectivity here)
  4. Connect the two pins on the right to the two dimming pins on a Meanwell driver.

And then it should just work as-is to dim Meanwell drivers via PWM, right? Do you know if anybody has tried or confirmed this circuit with Meanwell drivers?

@victorhooi
Copy link

@kizniche I've just ordered a few of your board from OSHPark =).

Sorry to bother you - but just to confirm - this should just work with the Meanwell 0-10V dimmers, right?

Is there anything special I need to adapt your board for this use-case?

@kizniche
Copy link
Owner

kizniche commented Sep 21, 2022

Connect the PWM and GND on left to the Raspberry Pi

Correct

Connect the two pins on the right to the two dimming pins on a Meanwell driver.

On the right side of the board, you will connect 5 VDC (instead of 10 VDC), ground, and the 5 VDC PWM signal will be generated on the PWM pin.

Devices are either controlled by a 0 to some voltage signal OR a PWM signal, not both. This will generate a PWM signal at whater input voltage you use, either 5 VDC or 10 VDC.

@victorhooi
Copy link

I just received the PCB's today =) - yay!

PXL_20221005_115547111

As far as I can tell, the Meanwell PWM LED dimming mode needs a 10V PWM signal:

The one part I still don't get is the right-hand side connectivity 😕.

@kizniche You mention an input voltage - does this mean I need to supply a 10V voltage to the board, on the right hand side connectors somewhere, for it to convert the Raspberry Pi 5V PWM to a 10V PWM signal?

Ugh, if so, that could be a problem. Where do people normally get this, if they just use a Raspberry Pi?

@kizniche
Copy link
Owner

kizniche commented Oct 5, 2022

If using a Pi, you're not converting from 5 VDC. GPIO pins output 3.3 VDC.

Usually the device can provide the higher DC voltage. For instance, my Terrabloom and AC Infinity fans that can be speed controlled via 10 VDC PWM have 10 VDC as one of the wires of the control wire bundle (GND, 10 VDC, PWM signal in).

You could use the 5 VDC of the Pi if you don't want to use an external power source.

@victorhooi
Copy link

Thanks so much for your help so far =).

You're right, Raspberry Pi PWM output is 3.3V, not 5V (I think Arduino is 5V?)

I've checked - the Meanwell LED dimmers don't appear to supply 10VDC anywhere for me to tap into.

Ah - so you're thinking of taking 5VDC from pin 2 or 4 on the Raspberry Pi, right? I'd need to connect 5V and GND from the Raspberry Pi to the 10V and GND pins on the right-side of the board, correct?

But that means my resulting PWM output will be 0-5V, right? There's no way to get that to 10V?

@kizniche
Copy link
Owner

kizniche commented Oct 5, 2022

I'd need to connect 5V and GND from the Raspberry Pi to the 10V and GND pins on the right-side of the board, correct?

GND is common across all GND points on the board, so it doesn't matter where you connect it.

But that means my resulting PWM output will be 0-5V, right? There's no way to get that to 10V?

Like I mentioned previously, you can either produce a varying voltage signal, e.g. 0 - 10 volts (other boards), or a PWM signal (this board). You cannot do both. PWM signals are one single, static voltage. There are no drivers that I know of that require a varied voltage PWM signal, it's just not a thing.

@victorhooi
Copy link

Got it - really appreciate the explanation.

So double-checking the Meanwell spec sheet again, it seems I just need a 10V PWM signal (100Hz to 3KHz).

Is there any way of getting that 10V PWM using just this board, and a Raspberry Pi, without a separate 10V power supply? Or is that an impossible ask?

@kizniche
Copy link
Owner

kizniche commented Oct 5, 2022

Not that I know of. If the device doesn't give you 10 VDC already, you're going to need an external power supply, which should be between $5 and $10. You can get one with the lowest current rating, since this application uses a negligible mount of current. You can also use that single 10 VDC power source for multiple PWM boards.

@victorhooi
Copy link

I did do some research before, and came across one thread which seems to offer a solution using just the Raspberry Pi and no separate supply - I confess I don't quite understand all of the details yet:

which references this earlier Reddit thread:

The challenge in your case is figuring out how to make the Raspberry Pi 5V output signal talk to the Meanwell which is expecting 10V. When using the 10V PWM method, the Meanwell actually provides its own 10V signal (via the blue wire labelled DIM+), so the good news is you don't need an external 10V power source.

What you can do is use an NPN transistor as a switch to convert the Raspberry Pi 5V PWM signal into a 10V PWM signal. Since PWM is, in essence, just a rapid switching between on and off states, the transistor approach will allow you to "convert" the 5V PWM to a 10V PWM signal. Whatever duty cycle is set by your Pi at 5V will be used as an input signal into the Meanwell HLG at 10V, which will then interpret the signal for dimming as specified in the datasheet.

So there's a 10V differential across the Meanwell DIM+ and DIM- pins.

Is there some way to connect that to your circuit board? =)

@kizniche
Copy link
Owner

kizniche commented Oct 6, 2022

the Meanwell LED dimmers don't appear to supply 10VDC anywhere for me to tap into

So there is 10 VDC? You've verified by measuring the voltage?

Also, from the datasheet: "Please DO NOT connect "DIM-" to "-V"", so it may cause an issue if you connect to ground. I'm not 100% sure how your circuit will respond with the PWM board.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants