Skip to content

mdennis281/rpi-auto-dimmer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

57 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”† Raspberry Pi Auto-Dimmer

The convenient alternative to screen blanking - automatically dims your Raspberry Pi touchscreen when idle, keeping it visible but power-efficient.

Note: This tool is designed for displays connected via ribbon cable (like the official Pi touchscreen). It may not work with HDMI displays.

Requirements

  • Ribbon-cable connected display (HDMI wont work)
  • X11 Display protocol (Wayland wont work)

โœจ Features

โœ… What this DOES do:

  • Automatic dimming of your Raspberry Pi's screen, controlled by last input (touch, mouse, keyboard)
  • Improves power efficiency and LCD life compared to an always-on display
  • Allows you to set the brightness percentage for both "active" and "inactive" states

โŒ What this DOES NOT do:

  • Give you a way to control / change screen brightness on the fly
  • Force the PI from going into sleep/blank mode (though this is configurable in other ways)

๐ŸŽฌ Demo

rpi-auto-dimmer-v2.mp4

Watch the auto-dimmer in action - idle timeout is set to 2s for demo purposes


๐Ÿš€ Quick Start

Install

curl -sSL https://raw.githubusercontent.com/mdennis281/rpi-auto-dimmer/refs/heads/main/install.sh | bash

Configure

sudo /opt/rpi-auto-dimmer/config.sh

Update

curl -sSL https://raw.githubusercontent.com/mdennis281/rpi-auto-dimmer/refs/heads/main/update.sh | bash

Uninstall

curl -sSL https://raw.githubusercontent.com/mdennis281/rpi-auto-dimmer/refs/heads/main/uninstall.sh | bash

๐Ÿ“‹ What Gets Installed

The installer automatically handles:

  • System packages: python3, python3-pip, python3-venv, xprintidle
  • Python dependencies: rpi_backlight for display control
  • Service setup: Creates and enables systemd service for automatic startup
  • Permissions: Configures user access to GPIO and backlight controls
  • Configuration: Sets up sensible defaults (customizable later)

โš™๏ธ Configuration

Default Settings

  • Idle brightness: 5% (nearly off but visible)
  • Active brightness: 100% (full brightness)
  • Dim delay: 30 seconds of inactivity

Customize Settings

sudo /opt/rpi-auto-dimmer/config.sh

The interactive configuration script will guide you through customizing:

  • Brightness levels for idle and active states
  • Delay before dimming kicks in
  • Update frequency for activity checking

๐ŸŽฎ Service Management

Basic Commands

# Check status
sudo systemctl status rpi-auto-dimmer

# Start service
sudo systemctl start rpi-auto-dimmer

# Stop service
sudo systemctl stop rpi-auto-dimmer

# Restart service
sudo systemctl restart rpi-auto-dimmer

# View logs
sudo journalctl -u rpi-auto-dimmer -f

Service Details

  • Service name: rpi-auto-dimmer
  • Installation path: /opt/rpi-auto-dimmer/
  • Configuration file: /opt/rpi-auto-dimmer/config.ini
  • Runs as: Current user with hardware access permissions
  • Auto-start: Enabled on boot

๐Ÿ”ง Dependencies

Hardware Requirements

  • Raspberry Pi (any model with display output)
  • Official Raspberry Pi 7" Touchscreen Display (or compatible)
  • Raspberry Pi OS with desktop environment

๐Ÿ› Troubleshooting

Common Issues

Service won't start?

# Check service status
sudo systemctl status rpi-auto-dimmer

# Check logs for errors
sudo journalctl -u rpi-auto-dimmer -n 50

Permission errors?

# Ensure user is in correct groups
groups $USER  # Should include 'gpio' and 'video'

# If not, run the installer again
curl -sSL https://raw.githubusercontent.com/mdennis281/rpi-auto-dimmer/refs/heads/main/install.sh | bash

Screen not dimming?

  • Check if xprintidle is working: xprintidle (should return a number)
  • Verify display is supported: Check /sys/class/backlight/ for available controls
  • Review configuration: /opt/rpi-auto-dimmer/config.ini

Still having issues? Open an issue with:

  • Service logs: sudo journalctl -u rpi-auto-dimmer -n 100
  • System info: uname -a and cat /proc/device-tree/model

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

  • Thanks to the rpi_backlight project for making display control simple
  • Built for the awesome Raspberry Pi community ๐Ÿฅง

โญ Star this repo if it helped you save power and extend your Pi display's life!

Made with โค๏ธ for Raspberry Pi enthusiasts

About

Automated backlight dimming for the official Raspberry Pi screen

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors