Mobile devices actively control their display brightness by adjusting to ambient light levels.
For a desktop setting there are (expensive) monitors that have integrated ambient light sensors.
Even cheap monitors can be controlled via DDC from any operating system.
This project combines a microcontroller based USB HID ambient light sensor with python based DDC control on Windows.
Ambient Light ☀️/🪟/☁️/💡
↓ ↓ ↓
[ Light Sensor (1250 lux) ]
↓ USB ↓
[ PC / autoBright ]
↓ DDC/CI ↓
[ Monitor (72%) 🖥️ ]
For Linux there is also a well documented project with the same approach: xythobuz/AutoBrightness
To adjuist the monitor brightness main.py uses:
- Windows Sensor API (LightSensor) for lux input via
winsdk - Windows DXVA2 DDC/CI APIs for monitor brightness output via
ctypes - a system tray icon with manual offset controls via
pystray
Further development/integration:
- add the USB HID light sensor function to TwinkleTray or similar software.
Dependencies for main.py:
- python 3.12
- winsdk
- pystray
- Pillow
Install required packages:
pip install pystray pillow winsdk
Win+R, shell:startup, create shortcut with python3.12.exe "path\to\autoBright\main.py" (if path variables are set correctly)
Reading ambient brightness is done with an USB-C ATtiny85 and a I2C BH1750 (GY-302/GY-30) brightness sensor. See MatejKocourek/spark-als. The folder housing includes a 3D printable enclosure.
