Controlling LED illumination

Hello Everyone!

My knowledge of electronics is very basic so please bare with me. What I am wanting to do is to very precisely control the illumination of a set of LEDs.

I would like to be able to control the LEDs over a 4 log until range of illumination (ie be able to control the range of brightness from 0-1000) however I would only require access to about 256 steps equally spread out across this range.

Also I would like the LEDs to be pulsating as they do this.
How dim can LEDs go before they completely go off?

The project I am working on is a medical device known as a dark adaptometer for a university dissertation which measures the rate at which a person's eyes adapt to the dark by progressively making a pulsating light dimmer and dimmer.

Would pulse width modulation by an arduino board be able to control LEDs so precisely?
Also would anyone have any recommendations as to which LEDs I should use?

I hope this makes sense! Thanks for taking the time to read this. I would really appreciate any advice on what the best way to go about this task cheaply is.

Standard PWM can be used to control brightness, range is 0 to 255.
PWM range can be extended, see

and

Dimness of LED is controlled by on-time of the LED, and how much current flows during that on-time. You can have narrower and narrower on-time with varying current amounts, or just leave it full on and reduce the current.

How big is the "set of LEDs"? How many colors? If one color, what range within that color?
If you look here you can get an idea of the variety of LEDs available for just 1 mounting style:
http://www.superbrightleds.com/cat/through-hole/

Hi, do you have a calibrated meter to measure the light output?
I'd say that you will need more than 256 steps of PWM to get your 256 levels as the output of an LED is not linear with PWM input.
Check the specifiaction of the LEDs you use, current vs light output.

Tom.... :slight_smile:

theboilerman:
How dim can LEDs go before they completely go off?

Basically, as dim as you want. It occurs to me however that whilst it is generally held that the eye's response to brief flashes is simply the integral of the power contained in the flash, this may not be the case for very short (low duty cycle) flashes, and it is possible this may not give you the correct result.

theboilerman:
The project I am working on is a medical device known as a dark adaptometer for a university dissertation which measures the rate at which a person's eyes adapt to the dark by progressively making a pulsating light dimmer and dimmer.

Would pulse width modulation by an arduino board be able to control LEDs so precisely?

Yes, of course, but not using the hardware 8-bit PWM. You need at least 16 bit precision for such a wide range.

theboilerman:
Also would anyone have any recommendations as to which LEDs I should use?

Not really. You have not specified whether you want to use a narrow or broad field, or whether colour is important.

I was thinking last night, that brightness could be controlled by just turning off Some of the set of LEDs as well. If all are under a diffuser so individual LEDs are not seen, then perhaps 256 level PWM enhanced with turning off 1/4, 1/2, 3/4 of the LEDs for example can provide additional levels of control.

Thanks a lot for your replies everyone, they are genuinely appreciated.

CrossRoads:
Standard PWM can be used to control brightness, range is 0 to 255.
PWM range can be extended, see
http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM
and
Gammon Forum : Electronics : Microprocessors : Timers and counters

Dimness of LED is controlled by on-time of the LED, and how much current flows during that on-time. You can have narrower and narrower on-time with varying current amounts, or just leave it full on and reduce the current.

How big is the "set of LEDs"? How many colors? If one color, what range within that color?
If you look here you can get an idea of the variety of LEDs available for just 1 mounting style:
Through Hole - Component LEDs - More LED Lighting | Super Bright LEDs

I wouldn't actually need a set of LEDs.

I would need 1 green LED and 1 red LED however they would never both be running at the same time. I'm unsure as to the range of wavelengths at the moment, I still need to research this.

TomGeorge:
Hi, do you have a calibrated meter to measure the light output?
I'd say that you will need more than 256 steps of PWM to get your 256 levels as the output of an LED is not linear with PWM input.
Check the specifiaction of the LEDs you use, current vs light output.

Tom.... :slight_smile:

Yeah I should have access to the university departments calibrated meter to measure the light output. Hmmm I see what you're saying- this project is getting more confusing and complicated haha.

Paul__B:

theboilerman:
How dim can LEDs go before they completely go off?

Basically, as dim as you want. It occurs to me however that whilst it is generally held that the eye's response to brief flashes is simply the integral of the power contained in the flash, this may not be the case for very short (low duty cycle) flashes, and it is possible this may not give you the correct result.

theboilerman:
The project I am working on is a medical device known as a dark adaptometer for a university dissertation which measures the rate at which a person's eyes adapt to the dark by progressively making a pulsating light dimmer and dimmer.

Would pulse width modulation by an arduino board be able to control LEDs so precisely?

Yes, of course, but not using the hardware 8-bit PWM. You need at least 16 bit precision for such a wide range.

theboilerman:
Also would anyone have any recommendations as to which LEDs I should use?

Not really. You have not specified whether you want to use a narrow or broad field, or whether colour is important.

Ahh okay, how would I go about getting the 16bit precision? (sorry if these questions seem silly, this is quite a steep learning curve for me).

I would require one green and one red led which would both run independently of each other ie I would either be using one led or the other to perform a complete analysis on a person's rate of dark adaptation. The LED would be sat behind a diffuser in my project so I'm thinking I'd need a broadfield design? If broadfield means how the light is diffused?

CrossRoads:
I was thinking last night, that brightness could be controlled by just turning off Some of the set of LEDs as well. If all are under a diffuser so individual LEDs are not seen, then perhaps 256 level PWM enhanced with turning off 1/4, 1/2, 3/4 of the LEDs for example can provide additional levels of control.

I was kind of thinking something along the same lines but I think for my project this would possibly scientifically act as confounding factor to the results as the surface area and spread of light would be slightly different when an LED is turned off.

Just one LED of each color, you could easily "roll your own" PWM for that.

int pwmLevel = 500; // call this 50%, 0.5mS
byte RedLED = 2;
byte GreenLED = 3;
byte colorChoice = 1; // 1 = red, 0 = green

void loop(){
// add code to change level via pot reading, serial interface, button presses, whatever,
// and whether Red or Green is on

if (colorChoice == 1){
digitalWrite (RedLED, HIGH);
delayMicroseconds (pwmLevel);
digitalWrite (RedLED, LOW);
delayMicroseconds (1000-pwmLevel);
}
else{
digitalWrite (GreenLED, HIGH);
delayMicroseconds (pwmLevel);
digitalWrite (GreenLED, LOW);
delayMicroseconds (1000-pwmLevel);
}

} // end loop

Then you can fine tune the brightness as you want.
delayMicroseconds works down to 3-4, the for-loop adds ~ another 12, so shortest on-time can be ~16microseconds. You'll have to experiment with the LEDs you use to see what time can actually be seen as on, and what ontimes equate to brightnesses for the 256 points correspond to your log 4 scale points.
Maybe 0.5mS on & off isn't the midpoint brightness wise for example. Maybe the range for pwmLevel needs to be portions of something bigger than 1000, say its 10000:
Level Ontime (uS)
0 0
1 50
2 75
3 100
4 150
5 200
:
:
253 8000
254 9000
255 10000

Then you put those levels in an array, enter the 0-255 from the serial port, and have the on/off times pulled from the array.