MCU Programable constant Current Source

Status
Not open for further replies.

VictorPS

Member
Hi,

I am designing multiple channel programable constant current source for LED light source of Camera.

From previous help from here,
Possible method is using V to I , a shift register CD4094 output connect to R2R (DAC) generate a V, input to opamp (buffer), and output to MOSFET to control current. ( a lot of component count)

I like to have an alternative solution, can I use LM317?
LM317 can be configure as constant Current mode, but can I control the current by using PIC MCU, i have no idea on how to interface it.

Any idea? or other possible method?

Thank you,
 
hi Victor,
What constant currents levels do you require? also must the current levels be fully variable or would a 'range' of currents be acceptable?
 
Hi ericgibbs,

The current is from range about >0.01A to 0.5A (max), prefer with 8bit resolution, 256 step.

I now is hard to start from 0mA, but start from 10mA will be acceptable.

Kindly suggest any possible alternative method.

Thank you
 
blueroomelectronics said:
That's why PWM is popular for controlling light levels.
PWM is flickering, even with high freq, it may not accept for high speed camera light source.

If can, I will use DMX to control the brightness.
 
VictorPS said:
Hi ericgibbs,

The current is from range about >0.01A to 0.5A (max), prefer with 8bit resolution, 256 step.

I now is hard to start from 0mA, but start from 10mA will be acceptable.

Kindly suggest any possible alternative method.

Thank you

Hi,
I was thinking of this type of constant current source, 255 CC combinations.
refer attached pdf.

If the Vce sat of the ULN transistor is is too high, they could be FETs or power BPTs.


EDIT: A variant of this circuit would be to have a fixed value emitter resistor and drive the Vref from the PWM output of a PIC.
The PWM signal would be filtered/smoothed before controlling the transistor/FET CC.
 
Last edited:
Hi Eric,

Thanks for the drawing and the variant of circuit.
Now I have 3 methods for the design.

The design are base on either R2R DAC, PWM DAC, or resistor switching.

Is it possible that I use shift registor to generate multiple PWM? If I stream fast enough..., also will the programming become complicated?

Choosing Shift register is because it can cascade and expand easily .
The PIC software PWM may have limitted channel and low freq.
 
You could use a digital potentiometer with the LM317?

https://www.electro-tech-online.com/custompdfs/2007/10/21940A.pdf
https://www.electro-tech-online.com/custompdfs/2007/10/22017a.pdf

I *think* its SPI controlled, which means a small micro controller could handle it (software SPI, or hardware with a larger micro). To get the full range form it would just require you to calculate the value of a resistor in series with it.


And if you're really after accuracy.....use a current sense resistor...with an opamp, and an ADC in the microcontroller to get a feedback loop.

But of course, a micro with PWM (through a low pass filter) would do just fine. 8-bit PWM isn't that tricky to do, some PIC's have hardware modules which will do it for you, but for software, its just counting.

I believe the PIC's hardware PWM (CCP module) can run pretty fast...more than fast enough to generate a varying DC voltage with a small low pass filter.

Some more idea's there..

I'm doing this myself, but with 'step range' as in only 3 values of current needed, and I'm using a 12F675 and a logic level MOSFET (with biasing transistor).

Blueteeth
 

This is one way of getting a programable current source from a microcontroller.

R1 = 30khm:
R3 = 10khm:
R2 will have a maximum of 1.66 V across it and you set the maximum LED current by the value of R3.
You can put several LEDs in series, depending on the supply voltage.

You can daisy-chain several LT1257s if you want.

The brightness works the wrong way round, in that 000 to the D/A is full on and FFF is off, but it is linear for current.

You might be able to find a more suitable D/A as the LT1257 is 12 bit, and it needs a high voltage supply to swing to 5V output.

Multiple PWM with a PIC is very difficult, unless they have hardware modules to do it. The problem is that the program can only change one output at a time and if there are several outputs opperating at different times it is difficult to devise code to do it all at the right times. You could do it with multitasking code if you don't mind it not being very accurate.

The circuit that I have suggested will also work with a PWM feeding a smoothing circuit, which then feeds the R1, and the A/D is not needed.
 

The TPIC6595A S/R has a number of useful features.

www.datasheetarchive.com
 
VictorPS said:
Can I use LM317 instead of MIC29152?

Sorry, but no.

That design needs a voltage regulator that controls the feedback pin to 1.2V or so to ground.

The LM317 controls the feedback pin to 1.2V less than the output.
 
hi Victor,

Looking at the constant current range you require for the LED's, how are you planning to connect the LED's to the CC source?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…