1

I've done a lot of Googling but not found anything. What I would like to do is dim the backlighting after a timeout period of no GUI activity and restore the backlight brightness on GUI activity. Rather like a screensaver image appearing but instead dimming the backlighting. I've seen it done but don't know how to implement it without writing something from scratch. Pi 3B+ and Official Touchscreen (New Version) - Any Ideas? Thanks

  • Would something like github.com/timothyhollabaugh/pi-touchscreen-timeout work for you? – Dougie Jan 13 at 20:22
  • Thanks Dougie. It's the sort of thing I need although this turns the backlighting on and off rather than dimming it and its in 'C' - Never written any linux 'C' only Microcontroller 'C' and that was a long long time ago so I'm not saying its impossible but would take me a couple of days I guess to get that doing what I need. It seems so simple really just dim the backlight after 10 minutes of no activity and restore it when there is some input. – jon Eskdale Jan 14 at 0:17
  • It looks like it was developed before the backlight PWM stuff was available - you should be able to hack the code. If I can find time I'll see if I can get that working and change it to do the dimming stuff. – Dougie Jan 14 at 0:46
  • Thanks that would be appreciated and I would think that it could be useful for a lot of people where they need the display on 24/7 but a) want to save power and b) want to extend the life of the backlight – jon Eskdale Jan 14 at 14:25
1

Starting with Pi Touchscreen Timeout I've hacked that code to not just set bl_power to 0 or 1. But to progressively changed the brightness (/sys/class/backlight/rpi_backlight/brightness) from the current value down to zero.

On a touch event the brightness is set back to the initial value.

You can get my code from backlight dimmer on Github.

  • Hi Dougie - Thanks for that - I have it working now Although I have a few issues The installation in the Read.me says git clone github.com/timothyhollabaugh/pi-touchscreen-timeout.git cd pi-touchscreen-timeout Where it should be git clone github.com/DougieLawson/backlight_dimmer.git – jon Eskdale Jan 24 at 11:58
  • and then cd backlight_dimmer/ Also the command sudo setuid ./timeout setuid is not recognised on the Pi so I just did sudo ./timeout 10 event0 instead Also I changed one line of code if (current_brightness > 0) to if (current_brightness > 15) This then means the brightness remains dim which was the aim of this. So the display never goes off completely but is Dim so that it saves power and the life of the backlight. I'll see if I can add this minimum as a parameter to the command line. Many thanks – jon Eskdale Jan 24 at 12:16
  • sudo chmod +s ./timeout – Dougie Jan 24 at 12:33
  • 1
    Thanks - I tried to mark your answer as useful but it won't let me as it says you need a reputation of 15+ will try again another time – jon Eskdale Jan 24 at 13:36
  • Hi Dougie I have it all working now as I wanted where it dims to a specified brightness after a timeout and also done a few other changes. I've created a Github of if <github.com/eskdale/Pi-Touchscreen-Dimmer.git> if you would like to look at it. I would like to share this so anyone else looking for a solution can use it - I notice that you added a copyright in your readme.md. Would like to clarify with you what you want to copyright and if you are OK with my Github. Thanks for your assistance – jon Eskdale Jan 25 at 10:51
1

With the assistance from this Forum, specifically Dougie I have a solution to my original question and this allows the Raspberry Pi Touchscreen to be dimmed (or completely off) gradually after a timeout period to allow a longer life to the backlight and also save power. The brightness is restored on a touch of the screen. This is available and documented here pi-touchscreen-dimmer.git

Hopefully, others will find this useful.

  • You can honor Dougies help by upvoting his answer. – Ingo Jan 26 at 21:24
  • @Ingo Thanks Ingo but I have tried but it won't let me as it says I need a reputation of more than 15 before I can do that – jon Eskdale Jan 27 at 22:53
  • Now you have it ;-) – Ingo Jan 27 at 22:58

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.