Putting Raspberry Pi Monitor to Sleep (DPMS)

Fix for a longstanding Raspberry Pi annoyance: Getting the monitor into powersave mode after a period of idle time - turning off the backlight.

Here's a quick tweak that seems to work fine on native HDMI and VGA (via adapter*) monitors. Hopefully helpful to others.

Background: I've played with Linux Power Management commands, utilities, screen savers and such in attempts to get Pi's to turn off (standby) monitors when idle. I recently hit upon a couple of Raspberry Pi config option that seems to do the trick - not really sure when/where it appeared, but it does switch off the HDMI when Display Power Management (DPMS) is triggered, as opposed to simply blanking the screen. Works on Raspbian Stretch & Buster and recently on RaspOS


Fall 2021 Update: Rescued from http://ventures.tpedersen.net/projects/puttingraspberrypimonitortosleepdpms.

In spite of a recent Buster Update ... I STILL manually adjust /boot/config.txt & /boot/cmdline.txt to get HDMI into standby mode. Works on RPI 4 too!


Oct 2018 Step-by-step (Original Post)

The fix involves editing a couple of key configuration files - as always remember to make a backup copies before type-o'ing in these files!
Use sudo to edit files in boot partition *and* be careful!

  1. Edit /boot/config.txt (RPi's main System Config File)

      • Add the following line to force HDMI output to switched off when DPMS is triggered. This config option was not explicitly defined in my Raspbian (Stretch) config.txt - apparently defaults to 0/off.


I added this line below hdmi_mode in config.txt, but it probably doesn't matter.

See complete details in https://www.raspberrypi.org/documentation/configuration/config-txt/video.md. There are some notes/considerations.

  1. Make sure Screen Savers are installed/configured to take advantage of hdmi_blanking.

    1. For Console Mode (no Desktop UI) set console blanking ...

      • Check current setting of consoleblank kernel parameter, it sets the inactivity time. It defaults to zero (returns 0)

$ cat /sys/module/kernel/parameters/consoleblank


      • Edit (sudo) /boot/cmdline.txt to set time in seconds to turn off monitor when Pi is in console mode.
        Carefully add the
        string "consoleblank=<numsec>" to /boot/cmdline.txt - MUST be a single line text file like this:

$ cat /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 consoleblank=300 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

    1. For Desktop GUI set Display Power Management (DPMS) via screensaver or power manager applications - you may need to install these.

sudo apt-get install xscreensaver

sudo apt-get install xfce4-power-manager

See RPI Screensaver doc @ https://www.raspberrypi.org/documentation/configuration/screensaver.md for complete details.

    1. Reboot and check your work!

As they say in IT - Works for me! Hope it works for others too.


Couple of random notes: