2
\$\begingroup\$

I am using a 64x64 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 ?

\$\endgroup\$
3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Wow! That's a very exhaustive answer(+1). I understand most of it. I guess I'm not interested in perceived brightness, but a relationship between the colour and brightness of a pixel in RGB88 format and current draw. The point you made with different current per channel makes sense and it sounds like I shouldn't convert to a different colour space and compute brightness, but keep the r,g,b values and work out the r,g,b values per frame in separation(since each channel can draw different power). I'm not 100% sure I understood the last part about the multiplexer & average brightness per line... \$\endgroup\$ – George Profenza Apr 1 '15 at 14:35
  • \$\begingroup\$ ...does that mean I shouldn't be concerned with the values of all the pixels, but one line at a time ? \$\endgroup\$ – George Profenza Apr 1 '15 at 14:37
  • \$\begingroup\$ It depends on how your display works. If it (as it probably does) only illuminates a small group of pixels at any one time then yes, you only need to be concerned about the image as sections. Think of it like an old TV scanning across the image - only one spot is actually being illuminated, but persistence of vision makes it look like the whole thing is illuminated. With an LED display it may be an entire line that is illuminated at any one time, or part of a line, or a block of pixels - you'd have to check the manual for the display to know. \$\endgroup\$ – Majenko Apr 1 '15 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.