Microcontrollable adjustable and switchable constant current source for driving LED's

Thread Starter

Calltronics

Joined Nov 20, 2020
19
Hi,
I am looking for a suitable solution for driving LED strings with constant current.
As depicted below I need to do some precise timed switching on/off of the LED’s from a microcontroller.
Pretty standard microcontroller (Ti) with DIO, AD and DA.

Could anyone help in pointing me in the best direction for the switchable constant current source circuit solution.
As depicted in the attached diagram?


  • Range = (10mA to 150mA)
  • The microprocessor needs to adjust the constant current to enable a set current dependent on which of the various LED strings are attached.
  • The constant current requires on/off switching from a digital port on Micro, not fast (0.1sec on/off).
Anyone got any good starting suggestions?
1656329864397.png
 
Last edited:

Martin_R

Joined Aug 28, 2019
108
If the micro can output a pulse width signal, it's easy to use a resistor and capacitor to obtain a d.c. value to drive a constant current circuit
 

Thread Starter

Calltronics

Joined Nov 20, 2020
19
If the micro can output a pulse width signal, it's easy to use a resistor and capacitor to obtain a d.c. value to drive a constant current circuit
But the drive current output required for a R/C solution can not be sourced from a micro digital output pin.
 

BobTPH

Joined Jun 5, 2013
5,234
One way to do it is to have the micro control the switching in a buck converter circuit using the A/D to get feedback on the duty cycle.

Bob
 

Thread Starter

Calltronics

Joined Nov 20, 2020
19
One way to do it is to have the micro control the switching in a buck converter circuit using the A/D to get feedback on the duty cycle.

Bob
Yeh Bob, I started thinking on the same lines. But I am not sure of the speed of the closed loop response using a software AD to control the convertor.
I've started looking at digitally controlled resistors to adjust the biasing on a OPAMP. What do you think?
 

BobTPH

Joined Jun 5, 2013
5,234
There are two common ways to implement a buck converter with a micro.

You can use PWM to control the switch and use the A/D to read the current. This will likely be plenty fast for you if the LEDs are just lighting. Maybe more if a problem if you are trying to modulate the LEDs at audio frequencies or higher.

The other method, on a micro with comparators, is the “bang bang” converter. You use the comparator to read the current. You turn the switch on until the current exceeds the set point, then off until it is below. No code loop! This will have very fast response.

Bob
 

ronsimpson

Joined Oct 7, 2019
2,161
suitable solution for driving LED strings with constant current.
Is the purpose to make the LED bright and dim or is the purpose to test the LED?
It is very common to run the LED at 150mA then turn the LED on/off from 10% to 100% at a frequency of about 1khz. Your eye averages the light and see a bright to dim as the duty cycle goes from 100% to 10%.
 

Ian0

Joined Aug 7, 2020
5,510
The other method, on a micro with comparators, is the “bang bang” converter. You use the comparator to read the current. You turn the switch on until the current exceeds the set point, then off until it is below. No code loop! This will have very fast response.

Bob
The only snag is that as you reduce the current, you also reduce the hysteresis, which reduces the time between thresholds. Result is that the frequency is inversely proportional to current: very high at low current.

I would suggest using a fixed constant current supply using a standard buck regulator IC, the dimming via PWM at 200Hz. [edit] seems like @ronsimpson suggested much the same thing whilst I was typing.
 

ApacheKid

Joined Jan 12, 2015
720
Hi,
I am looking for a suitable solution for driving LED strings with constant current.
As depicted below I need to do some precise timed switching on/off of the LED’s from a microcontroller.
Pretty standard microcontroller (Ti) with DIO, AD and DA.

Could anyone help in pointing me in the best direction for the switchable constant current source circuit solution.
As depicted in the attached diagram?


  • Range = (10mA to 150mA)
  • The microprocessor needs to adjust the constant current to enable a set current dependent on which of the various LED strings are attached.
  • The constant current requires on/off switching from a digital port on Micro, not fast (0.1sec on/off).
Anyone got any good starting suggestions?
View attachment 270241
Why? why must the MCU be burdened with the details of driving an LED? What is the objective anyway? Surely you just want an LED to be on or off, yes? what is the point of this constant current idea?
 

Thread Starter

Calltronics

Joined Nov 20, 2020
19
Why? why must the MCU be burdened with the details of driving an LED? What is the objective anyway? Surely you just want an LED to be on or off, yes? what is the point of this constant current idea?
I need varying currents to connect to varying LED strings and LED lights. Same solution just varying confgurations without having to change resistors etc.
Each type of LED string, display and Lamp has a fixed current requirement. The type of LED fitted to each solution is read from an I2C interface seperate from this diagram and part of the configurable LED fixture.
Hence we know what current is required for each connected LED fixture. We just need to configure the current to match through the Microprocessor.
 

Ian0

Joined Aug 7, 2020
5,510
I need varying currents to connect to varying LED strings and LED lights. Same solution just varying confgurations without having to change resistors etc.
Each type of LED string, display and Lamp has a fixed current requirement. The type of LED fitted to each solution is read from an I2C interface seperate from this diagram and part of the configurable LED fixture.
Hence we know what current is required for each connected LED fixture. We just need to configure the current to match through the Microprocessor.
Use an IC such as AL8862
https://www.diodes.com/assets/Datasheets/AL8862.pdf
Then, using your microcontroller‘s DAC, output a voltage to the CTRL pin of the 8862 to set the current.
 

ApacheKid

Joined Jan 12, 2015
720
I need varying currents to connect to varying LED strings and LED lights. Same solution just varying confgurations without having to change resistors etc.
Each type of LED string, display and Lamp has a fixed current requirement. The type of LED fitted to each solution is read from an I2C interface seperate from this diagram and part of the configurable LED fixture.
Hence we know what current is required for each connected LED fixture. We just need to configure the current to match through the Microprocessor.
OK I think I have a better idea of what you're doing now. Is the need to set the current driven by a desire to control brightness or to be able to support a range of different LEDs?

Why not leverage voltage controlled resistors or digital potentiometers? then you can think of this as a simple voltage driven thing not so much constant current...
 
Last edited:

crutschow

Joined Mar 14, 2008
30,103
Below is the LTspice simulation of a PWM controlled constant-current circuit using an op amp and a transistor, shown for a range of PWM duty-cycles.
The output is turned off by stopping the PWM signal (shown at the 200ms simulation point).
The current ripple shouldn't be a problem for the LEDs, but you can add more filtering to reduce it, if desired.

Will that work for you?

1656348247860.png
 
Last edited:
Top