Difference between revisions of "Raspberry Pi 4 - Screen Blanking manually via command line 2023"

From ETCwiki
Jump to navigationJump to search
Line 1: Line 1:
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 do what I wanted.
+
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)
  
 
'''Enable screen blanking on rpi4 so screen will automatically sleep after a while'''
 
'''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
 
  export DISPLAY=:0; xset +dpms; xset s blank; xset s off; xset dpms force on
  
'''Disable screen blanking so screen is always on'''
+
'''Disable screen blanking on rpi 4 so screen is always on'''
 
  export DISPLAY=:0;xset s noblank; xset s off; xset -dpms
 
  export DISPLAY=:0;xset s noblank; xset s off; xset -dpms
  
==Description of xset settings on raspberry pi==
+
==Description of xset screen blanking commands on raspberry pi==
 
* xset s noblank
 
* xset s noblank
 
** Sets the screen to not blank
 
** Sets the screen to not blank
Line 18: Line 20:
 
* xset dpms force on
 
* xset dpms force on
 
** (not sure) I think this is +dpms but also forces the monitor to turn 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.
  
 
==Troubleshooting==
 
==Troubleshooting==
Allow 15 minutes with each setting to see if it's what you want. export DISPLAY=:0 is only needed if you run it via crontab or SSH. There may be other things that blank your screen, like system settings in MATE or other DE's, so look there too.
+
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.
 +
 
 +
==External Links==
 +
[https://pimylifeup.com/raspberry-pi-disable-screen-blanking/|Screen Blanking - this helped me a ton]
 +
[https://www.geeks3d.com/hacklab/20160108/how-to-disable-the-blank-screen-on-raspberry-pi-raspbian/|Disable screen blanking - includes with auto-start]
  
  
 
[[Category:Raspberry Pi]]
 
[[Category:Raspberry Pi]]

Revision as of 18:51, 18 January 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)

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.

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.

External Links

Blanking - this helped me a ton screen blanking - includes with auto-start