Connect with us

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

Discussion in 'Microcontrollers, Programming and IoT' started by para, Nov 3, 2019.

  1. para

    para

    2
    0
    Nov 2, 2019
    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/)
    [​IMG]
    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!
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    9,376
    1,907
    Nov 17, 2011
    Probably nothing will happen. A LED driver should be able to cope with an open output.

    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)

    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.
    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.
     
  3. Alec_t

    Alec_t

    2,693
    712
    Jul 7, 2015
    Welcome to EP!
    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.
     
  4. Bluejets

    Bluejets

    3,519
    714
    Oct 5, 2014
    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.
     
  5. para

    para

    2
    0
    Nov 2, 2019
    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.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-