As a follow up from my previous post Getting Waveshare TFT working on Raspberry Pi, my display was blanking out (turning off) after a few minutes. While this is preferable to conserve power and to prevent the display from spoiling, it will be necessary for my projects to be able to turn the display on on demand to display the information before turning if off automatically again. To that end, I will be using the following approach to turn the display on demand.

Please note that this command can be put into a script and then executed using GPIO buttons connected to the Raspberry Pi. I will write an entry on that topic at a later date but the command remains the same. It is important to know that the command needs to be run as root and Raspbian Jessie allows sudo usage without password. Otherwise this command needs to be run as user root.

  • Create a file called screen-blanking.sh
  • Enter the following into the file. Replace the number after -blank with any positive number. This number represents how long the screen will be active in minutes.
  • Save and quit the file.
  • Make the file executable using the following command chmod 755 screen-blanking.sh
  • Execute the file to turn the screen on and it will go blank again after the specified minutes.

To view the current screen blank value, type cat cat /sys/module/kernel/parameters/consoleblank which will display how long console blanking is in seconds.