3

Hi raspberry PI geeks!

I install Raspbian OS, and connected HDMI monitor to one of micro hdmi ports on raspberry pi 4.

Question - how to change brightness of a screen?

I try xrandr: 1) See 2 hdmi:

pi@raspberrypi:~ $ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 7680 x 7680
HDMI-1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      60.00* 
   800x600       60.32    56.25  
   848x480       60.00  
   640x480       59.94  
HDMI-2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm
   1920x1080     60.00*+  60.00    50.00    59.94  
   1680x1050     59.88  
   1400x1050     59.95  
   1600x900      60.00  
   1280x1024     60.02  
   1440x900      59.90  
   1280x800      59.91  
   1152x864      59.97  
   1280x720      60.00    60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       60.00    60.00    59.94    59.94  
   640x480       60.00    59.94    59.94  

2) Try:

xrandr --output HDMI-2 --brightness 0.1
xrandr --output HDMI-1 --brightness 0.1

Doesn't work Also I tried xbacklight, but it doesn't see external monitor:

pi@raspberrypi:~ $ xbacklight -get
No outputs have backlight property

Also checked : ls /sys/class/backlight/ , but the folder is empty. Note: I want to change brightness, no matter how - through gui/command line. Is it possible? Thanks!

3
  • Not all HDMI displays support this, I think. You have to configure them manually.
    – goldilocks
    Commented Sep 6, 2019 at 13:39
  • @goldilocks ok, so.. how to configure it manually?(without touchibg real buttons on monitor) Commented Sep 7, 2019 at 17:02
  • 1
    Manually == touching real buttons on monitor.
    – goldilocks
    Commented Sep 7, 2019 at 17:22

4 Answers 4

4

If your display supports DDC, you could be able to adjust the brightness using corresponding tools such as ddccontrol

/sys/class/backlight/ is typically used with built-in screens, where the actual backlight control mechanism is known.

xrandr/xbacklight are purely software-based and cannot alter the backlight brightness, except for OLED screens where displaying darker colors is the way brightness is controlled, since there's no backlight.

4
  • Hi, thanks for feedback! It supports it (lg.com/ru/monitors/lg-22EA63V-ips-monitors) Commented Sep 6, 2019 at 18:12
  • 1
    But I cannot use it with this tool too [code]pi@raspberrypi:~ $ ddccontrol -p Probing for available monitors Detected monitors : No monitor supporting DDC/CI available. If your graphics card need it, please check all the required kernel modules are loaded (i2c-dev, and your framebuffer driver). [/code] Commented Sep 6, 2019 at 18:13
  • Well, that's your answer then: according to the RPi software, your monitor doesn't support changing brightness via HDMI. Commented Sep 8, 2019 at 8:31
  • 1
    ok thanks for detailed explanation! Commented Sep 9, 2019 at 7:54
1

Thanks to Dmitry Grigoryev for pointing the way in his answer. I had been looking for a solution for some time and this is one of the search results I kept hitting, so I thought to share the solution I found here so others could use it.

If your monitor supports DDC you can use ddcutil which has an entire page for Raspberry Pi. The short summary (AKA "worked for me on Pi4 latest Raspbian Buster and fresh Bullseye"):

sudo apt install ddcutil

You can probably run ddcutil detect here and get something back so you know you're on the right track but I needed to also replace fkms with kms in /boot/config.txt on Buster, not Bullseye and reboot:

sudo sed -i "s/dtoverlay=vc4-fkms-v3d/dtoverlay=vc4-kms-v3d/" /boot/config.txt

(to undo this just reverse fkms and kms in the above command)

Then after rebooting (Buster) you can see more information and get the correct bus IDs using:

ddcutil detect

For each device you need the number after /dev/i2c-<THIS NUMBER> Then you can see what is (technically) available using:

ddcutil getvcp known --bus <THAT NUMBER>

The VCP code hex is what you want - specifically the two characters after the x. For brightness it might be something like:

VCP code 0x10 (Brightness): current value = 63, max value = 100

You then have everything you need to dim your screen. Assuming <THAT NUMBER> is 20 the command to set brightness (0x10) to 50% would be:

ddcutil setvcp 10 50 --bus 20

IMPORTANT: monitor settings are generally stored in a way similar to an sd-card (e.g., EEPROM). They have limited numbers of writes. Worst case scenario is probably 100k writes, so if you write every thirty minutes you have about six years. In general I wouldn't recommend writing more often than that and turning any automation off at night (+3 years) or when you're not using the machine. Again, worst case scenario, but definitely something to be aware of.

Note: many of the VCP codes did not work or not work as expected for me. Sometimes it expects exact numbers even though it has a range. Sometimes the values need to be converted to decimal. One of my monitors requires multiples of 10 for brightness. 70 will work and 71 will not. This is a lack in monitor manufacturers and not the software.

The above is a quick-and-dirty intro, based on ddcutil docs, man ddcutil, and a helpful page here:

https://www.thedigitalpictureframe.com/control-your-monitor-settings-via-software-on-your-raspberry-pi-4/

The ddcutil capabilities command in that tutorial did not offer me helpful information, so don't give up based upon what you see there.

0

https://github.com/lordamit/Brightness/tree/master

This work for me, I use it with my laptop screen.

3
  • Welcome to Raspberry Pi! Please take the tour and visit the helpcenter to see how things work here.
    – Ghanima
    Commented Feb 26, 2022 at 19:42
  • Welcome to Raspberry Pi! In keeping with our policy regarding informationless link-only answers, if this post is not edited to contain information that can stand as an answer, however minimal, in 48 hours it will be converted to Community Wiki to simplify having it corrected by the community.
    – Ghanima
    Commented Feb 26, 2022 at 19:42
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Chenmunka
    Commented Feb 26, 2022 at 22:23
-1

xrandr --output VGA-0 --brightness 0.5

2
  • 1
    Does this work for HDMI monitors? If not, then you really didn't address the question. Commented Jan 31, 2021 at 16:18
  • 1
    @ElliotAlderson -- if that is your real name ;) -- yes it does (or should, or could). The output label ("VGA-0") is just a label. That said, there's nothing to indicate that to the OP. Of course, that doesn't matter much since it is clear in the question that the OP already tried this. So a bad answer but not quite that bad...
    – goldilocks
    Commented Feb 1, 2021 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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