Skip to content

nickGermi/monitor-brightness-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monitor-brightness-manager

Maintenance made-with-python Windows Donate

Automatically adjust monitor brightness based on ambient light on a Windows PC or laptop using inexpensive hardware that you'll be building yourself!

  • No coding or programming skills required
  • No soldering
  • Plug-n-play hardware

Hardware you'll need to get

It would be a good idea to search for above items and buy from a local supplier if applicable in your region.

hardware screenshot

Software requirements

After installing Python and C++ Build Tools, you'll need to install following Python libraries

  • screen_brightness_control
  • setuptools
  • hidapi
  • adafruit-blinka
  • adafruit_tsl2591
To install above libraries in command prompt execute following commands:
pip3 install --upgrade screen_brightness_control
pip3 install --upgrade setuptools
pip3 install --upgrade hidapi
pip3 install --upgrade adafruit-blinka
pip3 install --upgrade adafruit_tsl2591

Download monitor-brightness-manager script

A simple way to get the script is to right click on following link and select Save Link As

Configuration

Download and save monitor_brightness_manager.py file if you haven't done yet and edit it in a notepad or editor of your choice editing following as you see fit and save the file:

config = {
    "BLINKA_MCP2221": "1",
    "BLINKA_MCP2221_RESET_DELAY": "-1",
    "lux_range": {
        range(0, 25, 1): 10,
        range(25, 50, 1): 20,
        range(50, 100, 1): 30,
        range(100, 150, 1): 40,
        range(150, 200, 1): 50,
        range(200, 250, 1): 60,
        range(250, 300, 1): 70,
        range(300, 350, 1): 80,
        range(350, 400, 1): 90,
        range(400, 5500, 1): 100
    },
    "average_lux_count": 10,
    "display_id": 0
}
  • BLINKA_MCP2221 needs to be 1, this is required by BLINKA library
  • BLINKA_MCP2221_RESET_DELAY value should be -1 for Windows 11, you can try 0.5 or higher if getting errors
  • lux_range this is where you can configure what brightness should your monitor use based on what ambient light condition, values are: (lux_start, lux_end, increament_by): brightness. For example, first one defines for ambient light value (lux) between 0 and 25, set brightness to 10%.
  • average_lux_count is amount of seconds to hold lux values before taking average of, if your monitor's brightness is changing too slow or too rapidly, adjust this value. Lower value will cause brightness to change more rapidly, higher value will make it slower.
  • display_id is your monitor's ID, primary monitor is 0 and it is set by default

Usage

After downloading and saving the monitor_brightness_manager.py file, to run the script, in command prompt enter:

python monitor_brightness_manager.py
If you've saved the file in C:\ drive, you'll need to execute the command as:
python C:\monitor_brightness_manager.py

Demo

demo gif

Troubleshooting, additional references & information

License

MIT License