Author Topic: LED accurate light output driver  (Read 3536 times)

0 Members and 1 Guest are viewing this topic.

Offline swat3dTopic starter

  • Contributor
  • Posts: 27
LED accurate light output driver
« on: April 26, 2016, 05:09:43 pm »
Hi,

I am working on a project which requires the lumens output by several LEDs to be accurately controlled using a micro controller. It needs to stay in a budget since i'll have to control a bunch of them.

The initial idea was use a pwm signal with an rc low pass filter to the non inverting input of an opamp. The output controlls a mosfet and the inverting input is connected to a shunt resistor. I was able to stabilize the circuit, it works very well and it's cheaper than a DAC or a dedicated LED driver.

The problem is that since the micro controller is powered from a regular 7805, the output voltage can vary quite a bit and so does the PWM peak to peak, therefore i can't create a calibration curve of current/lumens.

In order to solve the problem, i have another opamp buffering a reading from the shunt resistor and the output goes to the ADC of the micro controller.
The idea here is to set the pwm, read the voltage on the shunt resistor with the ADC and adjust the pwm to match the desired value, making it independent of input voltage variations.

However in order to make accurate readings with the ADC, i need a precise voltage reference. I was able to use a voltage reference and calibrate the ADC to within 0.5% error which is good enough so the circuit works well so far.

But that got me thinking, shouldn't i just power the micro controller from the voltage reference, to ensure a precise pwm voltage in the first place? That way i can just eliminate the ADC reading part completely right? So, that would be my first question.

The voltage reference that i have and most of them, output very little current, but i came across the circuit that i attach to this post many times. They use a pnp transistor to drive higher current loads.
I'm having a hard time understanding the circuit though so i was hoping someone could expand a little. That would be my second question.

http://cds.linear.com/docs/en/application-note/an82f.pdf (Page 5, Current Hungry Loads)
http://www.silabs.com/Support%20Documents/TechnicalDocs/TS6001.pdf (Page 10, Boosting the TS6001’s Output Current Drive
http://waltjung.org/PDFs/Getting_the_Most_from_IC_Voltage_References.pdf (Page 20, Current boosted 50ma, 3 terminal reference)

Thanks a lot in advance for sharing your wisdom!


 

Offline michaeliv

  • Frequent Contributor
  • **
  • Posts: 260
Re: LED accurate light output driver
« Reply #1 on: April 26, 2016, 05:45:13 pm »
#1: I would probably still go the ADC route, since powering from a stable supply is more unpredictable -- a stable voltage at the input does not necessarily mean a stable voltage at the PWM output and a scalable PWM signal.

#2: Talking about:  Voltage_Ref_Circuit_02.JPG

The voltage reference will try to maintain 2.5v on it's output by sinking or sourcing current.
Let's say you have a 2.5R load resistor on the output which at 2.5V will conduct 1A.
The voltage reference will try to supply 1A to the load, as it does so, the current limiting resistor R1 will kick into effect.
So in it's effort to supply 1A, the reference tried to source 1A through the input, but the current limiting resistor didn't allow it to do that and dropped the input voltage to the reference.
As the input voltage to the reference decreases, the transistor gets turned on, and starts conducting. Now, the transistor starts supplying current to the resistor.
As the transistor conducts more % of the 1A required through the load, the reference will need to supply less and less of the current.
This will hit an equilibrium at some point.

NOTE: this is just a way of understanding the circuit, it doesn't mean that what I typed above actually happens in time.
« Last Edit: April 26, 2016, 05:49:01 pm by michaeliv »
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: LED accurate light output driver
« Reply #2 on: April 26, 2016, 06:53:48 pm »
Just a thought, but PSOC has onchip reference of .1%, and OpAmps and DAC and
a bunch of other stuff. 8051 or ARM based core, even has fabric than can be pro-
grammed for custom logic, USB, DSP, COMM.........


http://www.cypress.com/file/140796/download


Attached, the UDB array has many preconfigured components that each use part of
the array, come with prewritten APIs, f() calls, that make programming and use of the
component.

Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline edavid

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: us
Re: LED accurate light output driver
« Reply #3 on: April 26, 2016, 07:09:25 pm »
The problem is that since the micro controller is powered from a regular 7805, the output voltage can vary quite a bit and so does the PWM peak to peak, therefore i can't create a calibration curve of current/lumens.

What does "quite a bit" mean to you?

If you look at the 7805 typical line and load regulation, it's much better than the accuracy of your calibration curve will be.

If you don't like the worst case numbers, use an LM317 instead.

Or, if you insist on precision PWM outputs, run the PWM through a CD4050 that's powered by a regular voltage reference.
 

Offline swat3dTopic starter

  • Contributor
  • Posts: 27
Re: LED accurate light output driver
« Reply #4 on: April 26, 2016, 10:07:10 pm »
@Dana
Thanks a lot for the information! I'm trying to keep it to through hole components so i can manually solder them. I'm also trying to use an Atmel328P or any other model of the same family since is what i am familiar with and i'm on a timeline to deliver this. I have in mind getting into ARM next so your info is very helpful.

@edavid
The 7805 line and load regulation are 100mV so 200mV worst case which is bad.
The LM317 is much better but still, .07% for line and 1.5% for load. With an input of 9V and output of 5V we are talking 81mV worst case if i am correct.
The voltage reference that i'm using (a cheap one) MCP1541 has:
Line regulation: 350uV/V of Vdrop, so (5-4.096) * 0.00035 = 0.00032V
Load regulation: 1.3mV/mA of VOut/IOut which i'm not sure how to read :)

If i am not going to use the opamp/ADC part of the circuit ideally i'd aim at precision pwm output. If i'm going to use the opamp/ADC part, then i'm just aiming at stability over temperature, line and load regulation, since i can read the value through the ADC and compensate for errors by changing the duty cycle.

The idea is:
On one side i need the curve of current/lumens. I can apply a sequence of known currents to the LED and capture the output lumens.
On the other side i need to calibrate the ADC so the readings are as accurate as possible. Calculate the curve and compensate for gain and offset.

Once i know that, i can tell the micro, give me 10% of the max output lumens. Using the current/lumens curve i know i have to apply x current to the LED.

Next, i need to know what duty cycle is required to produce that current through the led. I can guesstimate it initially, assuming a pwm input voltage of 5V, then read the the voltage on the shunt resistor from the ADC and correct it until it matches.

Since i will be constantly compensating based on the ADC readings, really the accuracy of the pwm voltage input isn't that big of a deal.
What i was hoping for is, since i am already using a voltage reference for the ADC, if i can use that same precision voltage reference to power the micro controller, then there is no need to read from the ADC and compensate, since the input voltage will be constant. I can then just create a calibration curve for the PWM output itself and map vout/duty cycle.

Does that make sense?

Thanks.



 

Offline edavid

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: us
Re: LED accurate light output driver
« Reply #5 on: April 26, 2016, 10:10:29 pm »
On one side i need the curve of current/lumens. I can apply a sequence of known currents to the LED and capture the output lumens.

But how accurate will that curve be?  5%?  10%?  Worse?
 

Offline swat3dTopic starter

  • Contributor
  • Posts: 27
Re: LED accurate light output driver
« Reply #6 on: April 26, 2016, 10:37:57 pm »
As accurate as I want it to be,right? I could make it into a lookup table with as many entries as memory you want to spend and interpolate the missing values. Right?
 

Offline edavid

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: us
Re: LED accurate light output driver
« Reply #7 on: April 26, 2016, 10:42:03 pm »
As accurate as I want it to be,right? I could make it into a lookup table with as many entries as memory you want to spend and interpolate the missing values. Right?

No, you can't make the lumen measurements very accurately, and LED output varies with temperature and aging.

(Are you going to calibrate each individual LED you use?  If not, that's a huge error.)
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: LED accurate light output driver
« Reply #8 on: April 26, 2016, 10:58:34 pm »
Understand time pressure.

For future reference they have this for thru hole and easy proto -


http://www.cypress.com/documentation/development-kitsboards/cy8ckit-059-psoc-5lp-prototyping-kit-onboard-programmer-and





Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline michaeliv

  • Frequent Contributor
  • **
  • Posts: 260
Re: LED accurate light output driver
« Reply #9 on: April 26, 2016, 11:07:09 pm »
For future reference they have this for thru hole and easy proto -
http://www.cypress.com/documentation/development-kitsboards/cy8ckit-059-psoc-5lp-prototyping-kit-onboard-programmer-and
Regards, Dana.

DigiKey cost of completely assembled board in qty 1: $10
DigiKey cost for just the chips on the board in qty 1: $30
DigiKey cost for just the chips on the board in qty 1000: $19

 :-/O :scared:
« Last Edit: April 26, 2016, 11:09:58 pm by michaeliv »
 

Offline swat3dTopic starter

  • Contributor
  • Posts: 27
Re: LED accurate light output driver
« Reply #10 on: April 26, 2016, 11:22:03 pm »
@Danadak
That's awesome, I'll pickup one of those after this project for sure.

@edavid
Yeah I don't have the data to know the precision of the light measurement yet. I was actually planing on taking pictures of a chrome ball reflecting all the lights in HDR format and automating the calibration curve generation for all LEDs. It will depend then on the sensitivity of the ccd I believe.

Aside from that. Going with the voltage reference as the power source would allow me to ditch a voltage regulator in exchange for a pnp. But potentially involves more bench work to calculate the resistors needed.

Anyone care to explain the formulas to compute the necessary resistor values, etc.?

Thanks!
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: LED accurate light output driver
« Reply #11 on: April 26, 2016, 11:52:01 pm »
@michaeliv, there are two processors on the board, final designs only need
one. The other is used for debug / programming during development.

Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline michaeliv

  • Frequent Contributor
  • **
  • Posts: 260
Re: LED accurate light output driver
« Reply #12 on: April 27, 2016, 01:27:14 am »
@michaeliv, there are two processors on the board, final designs only need
one. The other is used for debug / programming during development.

Regards, Dana.
Yes, but that doesn't explain why the fully assembled board costs 3.5 times less than it's components.
Said another way, If I needed 2 of those chips I could either order them directly for $30 or buy the board for $10 and desolder the chips.
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: LED accurate light output driver
« Reply #13 on: April 27, 2016, 12:10:52 pm »
I would posit price of board is at manufacturer cost to encourage new
designs. It does have the highest ended chip on it, and for sure you
could desolder the chips and move them .........but that has its own
issues. Then there is always the PSOC 4 family and it board, Pioneer
Board, and the PSOC 4 family is low cost. That part is ~ $ 2.20.



Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline swat3dTopic starter

  • Contributor
  • Posts: 27
Re: LED accurate light output driver
« Reply #14 on: April 27, 2016, 12:53:19 pm »
So I tried the vref+transistor circuit yesterday and worked perfectly. However the atmega328p when powered from 4.096v only outputs about 3.2v in the pwm unfortunately. It still works I just need to tune the gain in the opamp.

Thanks all.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf