Thank you for your donation!

Touchscreen life
Interesting to read the comments on the Rpi forums about touchscreen back-light lifetime....... 20000 Hours confirmed on the official page...(about 2.3 years if left on all the time)

I have changed the brightness setting in the MoOde system config from the default 255 to 100 and not noticed other than a minor dimming so happy with that...

When I first read the specs I heard the Bladerunner  'Tears in rain' monologue... Smile

I would be interested to know if the MoOde 'blank screen' option actually switches off the backlight as some posts on the Rpi forums say is configurable in software or if it just blanks the output ??? 

Anyone have details on this ?

I don't use a 'real' Pi touchscreen, but a different (smaller and cheaper) one from China. It lacks some features, but both the image quality and the touch are very good. When the screensaver kicks in, the backlight remains on. This particular screen has a switch on the back to turn on/off the backlight. So if I could somehow get a spare gpio pin to go high or low when the screen goes blank, I can switch the backlight with the help of a single transistor or FET. 
Does anybody know what command is issued to make the screen go blank? Or what to do to make an unused GPIO pin change state on screen blank? (When I say an 'unused pin' it's because I use a I2C Dac but that leaves enough pins free to use.)
After a lot of googling and adding a lot of pieces together I solved the problem for my situation. 
In stead of relying on the built-in screensaver I installed 'xprintidle'. This is a utility that keeps track of how long (in milliseconds) no interaction has taken place with the system. So when the screen is not touched for, let's say, ten seconds, xprintidle will return 10000. Then I wrote a shell script that loops and checks if the value from xprintidle is bigger than a preset value. If it is, a relay (that replaces the switch on the back of the screen's PCB) is triggered by a GPIO pin and the backlight from the screen is turned off. If its not, the relay will be off and the backlight on (I use the NO contact on the relay so the backlight will be on if something is wrong with the relay). I then set this script to start running at boot and voila, a home baked screen- backlight-saver for my touchscreen. 
For now I don't blank the screen in the script, although that should not be too difficult. But since that function is already available in Moode, simply setting that value a bit higher than the trigger value in the script will blank the screen (even though you wont see that anymore since the backlight is off).

Here is my script, mostly stolen from various websites. I'm not a programmer so this is most likely not the best code ever written. Most important flaw: there is no error checking at all. So if anything goes wrong the the script will either hang or continue doing the wrong thing, either way the Pi may crash. Maybe somebody with more experience in this field can help here.
Also I don't know how heavy the load on the CPU is, shouldn't be much but I have not been able to test this while playing some music yet. Hopefully I'll know more about that tomorrow. 


#We start with 'defining' the display. Without this xprintidle will give an error.
export DISPLAY=:0

#To use a GPIO pin for the relay we have to first define it.
#I use pin GPIO24 because it is not in use by my DAC. Other DAC's might use this pin so check before use.
echo "24" >/sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio24/direction

# Wanted trigger timeout in milliseconds.

#Bool to keep track of on or off

#Since the script is executed at startup, I wait a bit so other processes can start.
#can be left out, but you might not see the GUI screen come up before the backlight is turned off...
sleep 10

#loop forever
while true
   if [ $idle -ge $IDLE_TIME ]; then
       if ! $triggered; then

           #Make GPIO 24 high so the backlight will turn off
           echo "1" > /sys/class/gpio/gpio24/value
       #Make GPIO 24 low so the backlight will turn on again
       echo "0" > /sys/class/gpio/gpio24/value


#Pause the script for one second, this reduces the load. One second is fast enough for the screen to
#come back on without feeling it does not react to touch.
sleep 1


I named the script, left it in /home/pi so when you add this line to etc/rc.local:

sudo sh /home/pi/ & > /home/pi/startLog.txt 2>&1

the script will start to run on startup. It will keep a logfile, but since there is no error checking in the script I doubt if that will be helpful at all.

PS: Since I don't have an 'official' RPI touchscreen I don't know if it can be applied there too. BTW, my TV goes black and turns the backlight off when no signal is present. Putting/uncommenting "Since I don't have an 'official' RPI touchscreen I don't know if it can be applied there too. BTW, my TV goes black and turns the backlight off when no signal is present. Putting/uncommenting 'hdmi_blanking=1' in '/boot/config.text' does that trick...

Forum Jump: