How To Keep Your Raspberry Pi Screen On


I ran into a situation where I had my Raspberry Pi plugged into a monitor but not a keyboard. What I quickly discovered was that the screen would turn off after a few minutes and I didn’t have a way to wake it up. Here’s the solution that I found to this problem.

How can you keep a Raspberry Pi screen on? In Raspbian the easiest way is to install xscreensaver and disable the screen saver from ever happening. Without a GUI, you can set consoleblank=0 in /boot/cmdline.txt.

Keeping The Screen On In Raspbian

Preventing the screen from going blank on your Raspberry Pi is quite easy in Raspbian. The first step is to install xscreensaver. This can by done by entering the following into the command line:

$ sudo apt-get install xscreensaver

This may take a few minutes to install. Raspberry Pi doesn’t have a default screen saver manager so this tool will give you the options you need to change the default settings.

Once xscreensaver is installed, you should be able to find it under the preferences section in the main menu. From here you can choose to change the length of time before the screen saver turns on or disable it completely.

Keeping The Screen On In Console

When not running Raspbian, it can be a little trickier to keep the screen of your Raspberry Pi on. The different OS settings and versions of Raspberry Pi’s have slightly different ways to handle the screen saver. The most consistent way I could find to disable the screen saver was to edit the consoleblank value.

To see what the current length of time your Raspberry Pi screen is active, you can type cat /sys/module/kernel/parameters/consoleblank into the console. the value of consoleblank is the number of seconds between inactivity and when the screen will turn off.

To update the consoleblank value, you will need to edit it in the kernel. This can be done by opening the cmdline.txt file with:

sudo nano /boot/cmdline.txt

Next, you will need to set consoleblank to zero, or whatever length of time in seconds that you want the screen to remain on. To set the screen to remain on indefinitely, add consoleblank=0 to the file.

Now after rebooting your Raspberry Pi, your screen should stay on indefinitely.

How To Lock A Raspberry Pi Screen

Now that we know how to keep your Raspberry Pi’s screen on, what if you want it to turn off and be password protected if left alone for an amount of time?

Do do this, we again are going to rely on xscreensaver. If you haven’t already, install it following the instructions above. After it is installed, open it up and set your Blank After time and make sure that Lock Screen After is checked. Then all you need to do is reboot your Pi and the settings will have taken effect.

Related Questions

How To Hide The Mouse Pointer

This can be done using Unclutter. Simply install unclutter, set it to run on startup, and set the idle time to 0. Start by installing unclutter:
sudo apt-get install unclutter
Then, edit the autostart LXDE file by typing:
nano ~/.config/lxsession/LXDE-pi/autostart
and add this line to the file:
@unclutter -idle 0

How To Turn Off The Screen

If you want the screen or monitor to go completely dark instead of just displaying a black screen, you can edit the HDMI Blanking setting. To do this edit /boot/config.txt and set HDMI Blanking=1.

Recent Posts