@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.