Electronic – How to calculate image brightness for use with LED panel

amperagebrightnessledrgb

I am using a 64×64 RGB LED matrix for which I'm preparing some content.
The existing firmware reads RGB888 video files.

I'd like to analyse these files before uploading them, to make sure the overall brightness doesn't go past a threshold to keep the amperage in a happy zone.

So far I'm thinking about getting the maximum brightness based on the average brightness of each video frame.

My question is about calculating brightness in a way that makes sense in terms of electronics (which I'm not very experience with).

What is the best method to calculate the brightness of an RGB888 pixel in relation to amperage used by an RGB LED ?

There are multiple colour spaces that have a luminance channel (YUV,YCrCb,XYZ,Luv,L*a*b*,HLS,HSV), but do any of these make sense to use in terms of how much power an LED will pull ?

Would simply averaging R,G,B values be closer ?

Best Answer

The question you should be asking is not "how bright will the LEDs be" but "what will the duty cycle of the LEDs be", for it's the duty cycle that defines both the brightness and the current draw. Brightness can be a funny thing to work out since what you perceive is not the same as the current used.

You can guestimate a 1:1 relationship between the duty cycle of any one LED's PWM signal and the current drawn (0% duty = off = 0% max current, 50% duty = half on = 50% max current, 100% duty = full on = 100% max current).

So assuming you know how much current each channel of R, G and B consume when full on per LED you can work out what the current draw for a full frame would be.

It is important to keep the three channels separate since the current for each channel may be very different - for instance blue is perceived brighter than red, and may be illuminated with less current to compensate for that.

So for each pixel in the image you take each of R, G and B, and calculate the average intensity of that channel over the whole image. Say it works out as 20% red, 15% green and 45% blue. So overall you would have 20% of the total red current, 15% of the total green current, and 45% of the total blue current.

Say each red and green LED takes 10mA and each blue one takes 5mA (for the sake of simplicity and argument) when fully on. That would be \$10mA \times 64^2\$ for each of red and green, and \$5mA \times 64^2\$ for blue.

Doing the maths that's a total current of 40.96A for each of red and green, and 20.48A for blue.

At 20% average brightness, and thus 20% average duty cycle, that would be 20% of 40.96A, which is 8.192A for red. For green, at 15%, that would be 6.144A and blue, at 45% would be 9.216A. Sum them together and you get 23.552A.

Of course, that's only a rough ball-park figure, and the numbers I have chosen to demonstrate are probably completely and utterly wrong.

Also that is assuming that each LED is a separate entity and controlled individually.

What you may well find though is the display is scanned a line or column or arbitrary block at a time, and only one line is actually illuminated at any one time.

In this situation the current draw at any time is the current draw of the line that is being displayed at that moment. So you would need to find the brightest line, or whatever the MUX unit is, and calculate the current for just that sub-section since that would be the peak draw for your frame.

Say the display scans through a line at a time - that's one line of 64 pixels at once, so you would want to find the average brightness and thus the average current draw (max current per LED * 64 * avergae duty %) for each individual line of your image. You then work out which line has the maximum total current draw and take that as the maximum for your frame.