Varying LED brightness

Hellmark

New Member
I'm relatively new to electronics (stuck with software development for years, and starting to migrate over), and one of my first useful projects is going to be a LED backlit sign. The sign will have at least 3 banks of LEDs (haven't decided yet entirely, because there was a trick I was thinking about that would use split the one section into a few more banks). I was thinking about using a 08M, or more likely a 14m (because it has more outputs, and thus would allow me to do the aforementioned trick), with the outputs to a darlington driver (most likely an 8 channel ULN2803) so I could effectively drive the various banks without taxing the picaxe too much. The issue I'm coming up with is that the LEDs I was able to get of each color (Red, white and blue), are all different brightnesses. The red is 4000mcd, the blue is 5000mcd, and the white is 13000mcd. The white and blues are both 3.2 forward volts, with 20 mA. The red ones are 2volts and 18mA. Each color will be in its own bank. What I want to do, is have the picaxe control the brightnesses, so that I could have the various LEDs appear to be approximately the same brightness (more important on the red and blue, but I do want to tone the whites down). I could do that with various components in a permanent fashion, but was wanting to be able to fade the LEDs.

What would your recommendations be?
 

Jeremy Leach

Senior Member
Bit of a tricky one I'd say. PWM signals to the LEDs would be best, and then vary the duty cycle of the signal to fade the LEDs. The picaxes can generate PWM signals that run in the background so your code can get on with other stuff. However an 08M only has one PWM output. Could use 3 * 08Ms and another 'master' 08M - but it seems a lot of effort.

There is a very slim possibility that you migh be able to use one 08M and generate three PWM outputs in code - but I doubt if the frequency would be high enough (even setting the clock at m8 with setfreq command) and there would be flicker. Plus there would be the problem of handling the control signal to fade the LEDs ate the same time as generating the PWM signals in code.
 

Hellmark

New Member
Yeah, thats why I was at a bit of a loss as to what to do. Was kinda hoping that someone knew of something else to interface with the picaxes (think I remember something about some I2C compatible chips that did PWM). Or even if need be, another type of IC that can support multiple PWMs (although would prefer not to, since don't want to have to get another programming cablefor this one project)

I know the 28x and 40x can handle 2 PWM signals, but they're quite a bit more expensive, and still one PWM short of what I would want atleast.
 

BCJKiwi

Senior Member
mcd in not always the best guide to balancing colours as the eye perceives colours differently. Set up a few series strings in each colour and get a fix on what looks like equivalent brightness.

08M has one pwm port. 14M, 28X1 etc have both pwmout and hpwm. hpwm is primarily intended for motor driving but uses a separate timer from pwmout. So pwmout and hpwm in single mode give two independent pwm systems. All four hpwm ports share the same timing. So you could get by with a 2 chip solution.

Alternatively there is the pulsout approach;
http://www.picaxeforum.co.uk/showthread.php?t=9747
For this to work well there needs to be very little else happening in the chip or there will still flickering so may also be a 2 chip solution.

pwmout can drive a logic level MOSFET directly - just needs careful selection (potential heating issues), or you could parallel up ports on the ULN2803A and even piggy back a number of ULN2803As to get capacity. Just remember that the ULN2803A outputs sink to a common ground. Heat dissapation may be an issue. I think there are high current versions available as well.

Or, as indicated, there are purpose made LED driver chips some of which include pwm but this is usually only a 16 step pwm designed for brightness control on display panels. They also seem rather complicated to set up.

How many LEDs are in the array?
 

Hellmark

New Member
I've not set out and done the math yet on the layout, but probably will be between 100-150 LEDs between all of the colors.

I know that the brightness scale isn't always equal when talking different colors, and from what I've seen the red and blue should be comparable, but the whites are definitely going to be brighter than what I want.
 

BeanieBots

Moderator
The important thing is that it looks right.
I'd start by experimenting with one of each colour.
Take the LED with the lowest mcd value and drive it via a resistor from the voltage you intend to use at close to it's maximum current rating. This will then benchmark the maximum (balanced) level you can achieve.
Then set up the other LEDs similarly and adjust the brightness to match by changing their resistor values. You now have a setup which will give a balanced output at maximum brightness.
It is reasonable to assume that from now on the brightness of each colour will fade equally for any reduction in PWM duty. Not quite true but should be quite close and the eye's response to lightlevels is logrithmic which will help level out any discrepancies.

Using 3 off 08Ms will probably be just as easy/cheap as using any "dedicated" chip for the purpose. (assuming that you can find such a thing anyway).
 

Andrew Cowan

Senior Member
That chip does look good. However:
-The device drives up to 150 mA per channel means you will need a driver (FET?)
-Can you solder a QFN package? You can get free samples from Allegro's site
-By defult it PWMs at 800KHz. You will have a hard time driving FETs at that speed. You can provide your own PWM clock, though, and I thing you would need to do this. This could be a -PWM pin on a PIC, or a 555 timer.
-32 bit FIFO serial control shouldn't be too hard to control.

A
 

Attachments

avcottle

New Member
LED Brightness

Can you not just play about with resistor values on the brighter LEDs and limit the current to them making them the same brightness as the others?
 
Top