Skip to content

Alternative to adjust Brightness on RGB matrix #3409

Open

Description

@riffnshred

Hey guys, Sorry if this as been discussed already but I can't find anything using google and search on here.

I've been playing around with the Feather M4 express and an 64x32 RGB matrix. First thing I've been looking for when I started running demos is for a way to reduce the brightness.

I found that you can only turn on or off the LEDs by setting the brightness attribute to 1.0 or 0.0:
https://circuitpython.readthedocs.io/en/5.3.x/shared-bindings/rgbmatrix/RGBMatrix.html

Is there any way I can hack my way to adjust the brightness? On all my other raspberry pi projects where I run an rgb matrix, I set them to half brightness because I feel like looking at it 100% brightness is way too intense.

Thank you so much in advance

Activity

  1. added this to the Long term milestone on Sep 13, 2020
  2. jepler commented on Sep 13, 2020

    @jepler

    You're right that this isn't possible right now. It would need to be added "upstream", so I've filed a bug there: adafruit/Adafruit_Protomatter#19

    Until that feature is added and then made available in Circuitpython, depending on what you're doing, you can

  3. riffnshred commented on Sep 13, 2020

    @riffnshred
    Author

    Sweet, thank you Ill test those out

  4. tejasxo commented on Mar 21, 2022

    @tejasxo

    Any update on this?

  5. ladyada commented on Mar 22, 2022

    @ladyada
    Member

    unlikely to be added any time soon, it is nontrivial

  6. wb8nbs commented on Dec 17, 2023

    @wb8nbs

    Louis Beaudoin has it worked out in the SmartMatrix library. Maybe you could steal his code.
    This works for me 64x64 panel, SmartMatrix, Teensy 3.6
    void setBrightness(uint8_t brightness);

  7. czei commented on Feb 21, 2024

    @czei

    just select different color constants, like 0x7f7f7f or (127,127,127) instead of 0xffffff or WHITE or (255,255,255)

    FYI, this approach doesn't seem to work on the MatrixPortal S3 with CircuitPython. The actual brightness of 0x7f7f7f is exactly the same as 0xffffff. :-(.

    I was hoping this would be a solution, but no dice. I'm getting complaints about the LED being so bright it's hurting people's eyes, so I'm hoping a workaround will show up somehow.

  8. CedarGroveStudios commented on Feb 21, 2024

    @CedarGroveStudios

    I haven’t used the S3 version of the MatrixPortal yet, but suspect that the default color bit depth is set to two bits, just four levels of color brightness, limiting the granularity of intensity.
    When instantiating the display in CircuitPython, the bit depth can be set to 6-bits which increases the brightness granularity — at a price of needing more memory to hold the display buffer.
    If you are using CircuitPython displayio objects, you could apply something like PaletteFader to help. https://github.com/CedarGroveStudios/CircuitPython_PaletteFader It’s in the Community Bundle and can be installed using circup.

  9. no3rdw commented on Feb 21, 2024

    @no3rdw

    So, I have a RGBMatrix brightness workaround... you can even use a brightness control to adjust the brightness values of all text/vectorio shapes and displayed BMP images. I'm defining all color values in HLS instead of Hex, which makes it super simple to change the brightness without changing the color value (just adjust L/level). For BMPs, feed the pixel_shader into a function that converts the integer colors to HSL, then adjusts their level and inserts the new value back into the pixel_shader.

    Relevant code is in this file:
    https://github.com/no3rdw/ledmatrix-effects/blob/main/device.py

    All colors are defined like this: device.hls(.85, .3, 1), and the hsl function in device.py applies the brightness adjustment.
    All BMPs need their shader fed into this function: device.alphaPalette(bmpimage.pixel_shader) - which again applies the brightness adjustment to every indexed color used by the BMP.

    It works well, although if you set the brightness too low... (anything around .2 or lower) colors will start shifting hue.

  10. czei commented on Feb 21, 2024

    @czei

    I haven’t used the S3 version of the MatrixPortal yet, but suspect that the default color bit depth is set to two bits, just four levels of color brightness, limiting the granularity of intensity. When instantiating the display in CircuitPython, the bit depth can be set to 6-bits which increases the brightness granularity — at a price of needing more memory to hold the display buffer. If you are using CircuitPython displayio objects, you could apply something like PaletteFader to help. https://github.com/CedarGroveStudios/CircuitPython_PaletteFader It’s in the Community Bundle and can be installed using circup.

    Yup, that was the problem. After setting the buffer depth to 6-bits adjusting the RGB values by a scale enabled a decent control over brightness. Thanks for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions