Hi,
I've been racking my brains for about two hours now with one problem.
I've successfuly designed/built a simple PIC RGB led controller. Lovely. All nice pretty colours, with just one problem. How can I 'dim' the colour without 'changing' the colour?
For example. Say I have 8-bit resolution for each LED (remember, these are independant of eachother), thats 255 levels per LED, 255^3 total colours available.
If I was to 'dim' the LED by say 20%, I would have to reduce each PWM by 20%, so that they are still in relation to eachother, giving the same colour, but less light output.
Thats fine for dimming slightly, but as the levels reach quite low, we have less to work with. Example 2: 245, 68, 121. Reducing these by 20% is ok. But, for 255, 12, 22 reducing these by 20% is not accurate, because we are dealing with whole numbers. Not only is it complicated in code, but the colour would change as well.
So, apart from somehow digitally controlling the current supply for all LED's (PWM turns them on/off, the current 'dims' them) I've been thinking of PWMing a PWM signal.
That is, the power supply for all the LED's is, say, a 5Khz PWM signal. And the 'colour PWM' is at 200Hz.
Would this work? I mean, essentially the 'colour PWM' controller does the same job, but the PSU PWM controls the brightness of all LEDs proportionally. It wouldn't have to be fantastic resolution, like 4 bits greyscale or something.
I'm unsure of modulating a PWM with another PWM, but I can't see another way, without bringing in some serious analogue (like a current amplifier/limiter). In theory at least, its sound, lowering the
maximum brightness of a PWM'ed LED, whilst keeping the full resolution of the 'colour' PWM controllers.
Any thoughts?
BuriedCode.