Maker Pro
Maker Pro

Regulating brightness of a high power LED via PWM on a Raspberry Pi

para

Nov 2, 2019
2
Joined
Nov 2, 2019
Messages
2
Hi,

I did my best using the search and google to find an answer to my problem, but unfortunately, I didn't succeed. If I might have missed something, I am sorry! I am no electronics specialist and would be happy to get some advice.
I am a biochemist and intend to selectively cleave a photocleavable bond at 365 nm (UVA) in a biological context, which is why I want to limit the radiation dose to a minimum. Exposure might require mixing of the solution, which is why I want to be able to regulate the brightness of the light source and don't want to apply a single highly intense pulse.
I bought a 10W high power LED that emits light at 365 nm (If = 900 mA, Vf=9-11V) and a CC source (LED driver) that provides constant 900 mA (input: 100-240V AC, output: 6-10V DC).
My aim is to switch the LED and regulate its brightness via PWM on a raspberry pi.
I noticed that the following thread deals with something similar, but without PWM and some links and attachments are not working anymore:
https://www.electronicspoint.com/fo...g-high-power-leds-with-a-raspberry-pi.272994/

For testing, I build the circuit with a blue low power LED, an NPN transistor, 5V power supply from the RaspberryPi and controlled the LED brightness via a GPIO PWM signal on the base of the transistor:
pi_circuit.png
This works perfectly fine!

Now I would like to replace the low power LED with the high power LED. For testing and safety reasons I purchased an equivalent 10W (3x3 matrix COB) LED that emits white light (If = 900 mA, Vf=9-11V).

I ordered a Darlington BD681G NPN transistor and originally intended to build the following circuit:
pi_circuit_HP_not_good.png

Now, I am wondering what the CC source will do when I don't allow it to output any current ...
As far as I understood, the circuit at the end of chapter 3 (https://www.electronicspoint.com/forums/resources/got-a-question-about-driving-leds.5/)
current2-png.12783

should contain a solution for switching the LED on and off, but it is not suitable for fast switching... (?)

I am pretty much stuck and don't know how to go on without testing it and risking to blow up the Pi, the PS, the transistor, or the LED ...
How would you do this?

Another question: Would it be better to use an optocoupler to isolate the Raspberry Pi's circuit from the CC source? However, I have read that optocouplers can't operate at high frequencies such as 100Hz.

Thank you!
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Now, I am wondering what the CC source will do when I don't allow it to output any current ...
Probably nothing will happen. A LED driver should be able to cope with an open output.

the circuit at the end of chapter 3 (https://www.electronicspoint.com/forums/resources/got-a-question-about-driving-leds.5/)
should contain a solution for switching the LED on and off, but it is not suitable for fast switching... (?)
Why should it not be able to switch fast? The answer depends mainly on what you consider "fast". A few 100 Hz are no problem.
This circuit from our resource, however, is a constant current circuit (current is limited by the feedback via Q2). You do not need this feedback as the current is controlled by the LED driver. A simple on/off switch as used in your 2nd diagram is enough.
Alternatively you control the current by the circuit as shown and use a fixed voltage source - not an LED driver (current source)

I am pretty much stuck and don't know how to go on without testing it and risking to blow up the Pi, the PS, the transistor, or the LED ..
There is almost no risk to the PI or the PS. The transistor or the LED may suffer when wired incorrectly, but that is a risk that you will finally have to take.
Would it be better to use an optocoupler to isolate the Raspberry Pi's circuit from the CC source? However, I have read that optocouplers can't operate at high frequencies such as 100Hz.
An optocoupler would further reduce the risk to the PI, but it will require a mor elaborate scheme to control the switching transistor. It is imho not necessary.
Switching speed is no issue at all. optocouplers can operate in the MHz range, depending of the type. 100 Hz is no issue at all.
 

Alec_t

Jul 7, 2015
3,587
Joined
Jul 7, 2015
Messages
3,587
Welcome to EP!
Now, I am wondering what the CC source will do when I don't allow it to output any current .
Good question. Your CC source probably already uses PWM to control the current, so additional external PWM might conflict with that. But as Harald suggests, that is unlikey with a reputable LED driver.
Hopefully your CC source has some way of setting the current to something a tad lower than 900mA, as that is uncomfortably close to over-driving the LED. It is not good practice to drive components at their rated maximum if you want them to have a long and happy life.
 

Bluejets

Oct 5, 2014
6,901
Joined
Oct 5, 2014
Messages
6,901
I build similar units for an eye specialist using an array of leds set for cc via a simple 317 regulator @ their rated output or just a tad below. (17.6 mA)
Cure is controlled via selectable binary weighted dip switches for timing. Complete system is Arduino promini monitored with current and timing displayed on a 0.96" OLED.
All fits in a 60 x50 mm box, no need for massive raspberry pi.
 

para

Nov 2, 2019
2
Joined
Nov 2, 2019
Messages
2
Thanks for your opinions!!

I tested it.
I ordered a few BD681G NPN transistors, but unfortunately, they haven't arrived yet. Thus, I used a LOGIC N-Channel MOSFET (FQP30N06L) and tested the circuit with a low power LED and a resistor with a constant voltage source. This worked without problems.

Then I tested the circuit with the high power LED and the constant current LED driver and the LED started flashing wildly, but nothing blew up.
So my second diagram didn't work, at least not with a MOSFET.

So, I probably have to build the current source myself.
 
Top