How to Disable Screen Blanking on the Raspberry Pi

Ben
Ben
@benjislab

Screen blanking is a power-saving feature that turns off the display after a period of inactivity. While this is useful for saving energy, there are scenarios where you might want your Raspberry Pi's display to stay always on, such as in kiosks, digital signage, or continuous monitoring setups. This guide will show you how to disable screen blanking on your Raspberry Pi.

Equipment Needed

  • Raspberry Pi with Raspberry Pi OS installed
  • Internet connection
  • Access to the command line

Method 1: Using Raspberry Pi Configuration

The simplest way to disable screen blanking is through the Raspberry Pi Configuration tool.

  1. Open Raspberry Pi Configuration:

If you are using the Raspberry Pi OS with the desktop environment, you can access the configuration tool from the main menu.

  • Go to the main menu.
  • Select Preferences.
  • Click on Raspberry Pi Configuration.
  1. Disable Screen Blanking:
  • Navigate to the Display tab.
  • Find the Screen Blanking option and set it to Disabled.
  • Click OK to save the changes.
  1. Reboot Your Raspberry Pi:
sudo reboot

Method 2: Using the Command Line

If you are using Raspberry Pi OS Lite (without a desktop environment) or prefer using the command line, you can disable screen blanking by editing configuration files.

Step 1: Edit lightdm.conf

  1. Open the lightdm.conf file:
sudo nano /etc/lightdm/lightdm.conf
  1. Add Configuration Settings:

Find the [Seat:*] section and add the following lines:

[Seat:*]
    xserver-command=X -s 0 -dpms
  • -s 0 disables the screen saver.
  • -dpms disables the Display Power Management Signaling (DPMS).
  1. Save and Exit:

Save the file and exit the editor.

Step 2: Edit autostart

  1. Create/Edit the autostart file:

If you are using the LXDE environment, edit the autostart file.

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
  1. Add the Following Lines:

Add the following lines at the end of the file:

@xset s off
    @xset -dpms
    @xset s noblank
  • @xset s off disables the screen saver.
  • @xset -dpms disables the Display Power Management Signaling.
  • @xset s noblank prevents the screen from blanking.
  1. Save and Exit:

Save the file and exit the editor.

Step 3: Reboot Your Raspberry Pi

Apply the changes by rebooting your Raspberry Pi.

sudo reboot

Method 3: Using a Script

For a more automated approach, you can create a script to disable screen blanking and run it at startup.

  1. Create a Script:

Create a new script file named disable-blanking.sh:

nano disable-blanking.sh
  1. Add the Following Commands:
#!/bin/bash
    xset s off
    xset -dpms
    xset s noblank
  1. Make the Script Executable:
chmod +x disable-blanking.sh
  1. Edit rc.local to Run the Script at Startup:

Open the rc.local file:

sudo nano /etc/rc.local

Add the following line before the exit 0 line:

/home/pi/disable-blanking.sh &

Adjust the path to the script as necessary.

  1. Save and Exit:

Save the file and exit the editor.

  1. Reboot Your Raspberry Pi:
sudo reboot

Conclusion

Disabling screen blanking on your Raspberry Pi is essential for applications that require a continuous display, such as kiosks, digital signage, and monitoring systems. Whether you prefer using the Raspberry Pi Configuration tool, editing configuration files, or using a startup script, these methods will help you keep your display always on. By following these steps, you can ensure your Raspberry Pi remains active and visible at all times.