Raspberry Pi 4 - Screen Blanking manually via command line 2023
This is how to disable screen blanking on Raspberry Pi in 2023. This would go in a crontab or can be manually run via the command line. I wanted my rpi screen to power off at night, then be on all day. Most guides seemed confusing, and raspi-config didn't seem to actually do screen blanking for some reason. This was my solution.
- Tested on Raspberry Pi 4 (Jan 18, 2023)
Contents
Disable and Enable Screen Blanking on RPi 4
Enable screen blanking on rpi4 so screen will automatically sleep after a while
export DISPLAY=:0; xset +dpms; xset s blank; xset s off; xset dpms force on
Disable screen blanking on rpi 4 so screen is always on
export DISPLAY=:0;xset s noblank; xset s off; xset -dpms
Description of xset screen blanking commands on raspberry pi
- xset s noblank
- Sets the screen to not blank
- xset s off
- Sets the screensaver off (if applicable)
- xset -dpms
- Turns off Display Power Management (dpms won't trigger the screen to sleep)
- xset +dpms
- This forces Display Power Management to kick in and sleep the monitor after a while
- xset dpms force on
- (not sure) I think this is +dpms but also forces the monitor to turn on.
Auto start
This command does not persist reboots. To run on every boot, create a script and add it to your startup items in your GUI. Or add to crontab -e on startup. Or make a systemd startup script. rc.local may even work if you're lazy.
Disable RPi screen blanking in console
This section is for an older Pi, I haven't tested on Pi 4
If your screen goes black during command line after 30 minutes or so, you have screen blanking enabled most likely. If you want to turn it off:
Edit the file /etc/kbd/config Change these lines:
BLANK_TIME=0 BLANK_DPMS=off POWERDOWN_TIME=0
Troubleshooting
Allow 15 minutes with each setting to see if the screen goes/doesn't go blank in the way you want. There may be other things that blank your screen, like system settings in MATE or other DE's, so look there too.
- Disable screen blanking in raspi-config
- Disable screensaver app, and in settings uncheck DPMS
- Check system settings (MATE or Lubuntu power settings etc)
- export DISPLAY=:0 is only needed if you run it via crontab or SSH.