Playing around with some microcontrollers and multiplexed leds i noticed that i always need to fix the colors of each led rgb output softwareside... thats a pain...
Microcontroller's pwm output has an output of 255 different values.
By mixing a color with rgb leds you do some math... i like hsl(hsv in mc's) and convert it to rgb values.
So if i want yellow i need theoretically turn on the red and the green at 100%
nope... it's not yellow...
here the lighness is not considered...the real rgb values should be less than 255 pwm. all set to 255 should return white.
the blue and the green leds are brighter.
in my code i have something like that
i use only 15% of the blue led when mixing the colors.20% of the green one.
The maximum value of pwm used is 38
38 of 255 possible values. A waste!
Those are the resistors i need to properly power the leds.
It looks like the current vs. intensity curve for an LED is fairly linear, so you could start with simply reducing the current for the green and blue elements based the percentages that you have already determined.
In the theoretical (design) world, everything can be predicted mathematically.
In the real world, that's only approximate. Different parts will behave differently even if they are the "same" part. That's due to small differences in manufacturing and materials.
It used to be somewhat of a challenge back in the pre-IC days to do things like differential amplifiers because you'd have to sort through a box of transistors until you found a pair that matched closely enough. Fortunately with IC amps, that's less of a problem, because the transistors fabricated on the same die have virtually identical properties.. However, discrete LEDs vary just as much as discrete transistors do, so if you want extreme precision you have to measure the actual devices being used on a per-circuit basis.
Also please note that "PWM" stands for Pulse Width Modulation, which is not the same thing as current or voltage control. With PWM, the LED turns full on or full off and the apparent differences in brightness as you vary the pulse width are purely psychological - unlike resistence-based lamps there's no heated filament getting brighter and dimmer as voltage is applied and removed. To get true analog dimming, you'd have to use an analog output device and the Arduino can only handle analog as an input unless you attach it to some sort of external DAC hardware.
Overall, it's easier to tune stuff like that in software rather than hardware. And software can be re-tuned for different temperature conditions and to allow for aging components. Trim pots and stuff like that can help with the hardware but the cost is a higher overall parts count.
Sources may include data from the Fakebook Research Foundation with support from Gargle University
The OP's issue was that if the calibration was done in software, that since the green and blue elements were so much brighter than the red, that the effective dynamic range would be reduce to just a few bits, and that calibrating on the analogue side would allow all 8 bits to be each on each colour.
I included the current vs. intensity graph to show that you can treat current vs. brightness as linear when calculating the values to use to white balance the LED elements - it was not intended to be show brightness vs. duty cycle of the PWM (although to the eye, that is fairly linear was well).
Hi..i am a new user here. As per my knowledge with IC amps there is less of a problem, because the transistors fabricated on the same die have virtually identical properties.Discrete LEDs vary just as much as discrete transistors do.