Basic web frame question

I’m having a hard time finding references online to answer my questions. I am just starting with balenaCloud and am trying just a basic web frame. I’ve got the URL coming up on my Pi, and that works great. Is there an environment variable I can set for screen blank timeout. I don’t want to have the display on all that time.
Related to that, is there a way to have a screensaver of some sort?

1 Like

I wrote the same question 14 days ago

Regards , Joachim

The only way is at the moment this solution on terminal

echo 1 > /sys/class/backlight/rpi_backlight/bl_power

Hey @joachim and @sterling,

You could create a second container that does that, using the code that @joachim posted, turning the screen on/off on a interval configurable from the device variables. What do you have in mind to turn on the backlight/display again?

Another option would be to run a code that would set a different WPE_URL variable on different times, this way you can control which page to show at different times.

I was hoping to just blank the screen after a fixed amount of time the system is idle. I don’t suppose there is a way to do that?

@sterling, you can do this on the website side, but it depends on your application.
You can use Javascript turn the website blank, or if you run a node application, you can change the WPE_URL from there as well.

Hi @dansku ,

Another option would be to run a code that would set a different WPE_URL variable on different times, this way you can control which page to show at different times.

I’m really a newbie … Would you have a little details on how to get this done? Perhaps some code examples on how to display two different website at 2 different times would be greatly appreciated …

thanks,

Hi @Alexmol,

We are putting together a sample project for this example, so stay tuned!

Thanks for using balena!

Hi guys, I put together a simple example for turning the backlight on and off via cron.

It’s pushed to this branch: https://github.com/balena-io-projects/balena-dash/tree/multicontainer. You’ll need to uncomment the cron lines in scheduler/Dockerfile and adjust them to fit your needs.

Edit: see updated post below vv

This can be expanded to trigger a script that users the balena API to change the WPE_URL on a schedule; I’ll make an example for this next.

Hi again guys, as an update to my previous post we’ve updated the master branch of the project with the functionality to turn the backlight on and off automatically now.

You’ll just need to configure a few service variables for the new scheduler service just added.

ENABLE_BACKLIGHT_TIMER=1
BACKLIGHT_ON=0 8 * * *
BACKLIGHT_OFF=0 23 * * *

The BACKLIGHT_ON and BACKLIGHT_OFF variables accept standard cron syntax; I recommend taking a look at https://crontab.guru if you’re not familiar.

Otherwise have fun!

Something is wrong with your URL, here are the correct URL.

Thanks @chrisys for provide this scripts.

Best regards Joachim

1 Like

I tried to play with the following config.txt setting: consoleblank, by seeting it in BALENA_HOST_CONFIG_consoleblank =10, but without success.
Also, if I

cat /sys/module/kernel/parameters/consoleblank

I always get 0 and can’t set it from the console to test. Is there a way to make this work and let the frame behave like a screensaver?

Hi,
can you give us a little more context on your environment ?
You seem to be refering to:


But I am not aware of a variable BALENA_HOST_CONFIG_consoleblank in config.txt and if you are running the device on balenaOS I would need to investigate if we actually support the referenced kernel parameter variable.
Regards
Thomas

Indeed, thats the link. I’m running balenaOS with the Dash example, which is working fine.

And it is also available in the config.txt of raspbian, so I thought that every config setting like lcd_rotate could be set by putting a prefix BALENA_HOST_CONFIG in front of it to have it changed in the config.txt.

Hi @cazzeken. When you ask whether there is a way to “let the frame behave like a screensaver”, what do you mean exactly? I am a bit confused because I understand that the consoleblank parameter you mentioned applies in the absence of a GUI _(“if you are using the Raspberry Pi solely on the console (no GUI)”), but the web frame app uses a GUI. If you are looking for a way to turn off the screen on a timer in the context of the web frame app, check chrisys’ post above (link) about the ENABLE_BACKLIGHT_TIMER variable. Hope this helps!

I would like to use it as a dashboard for my home automation system. If I don’t touch the dashboard, I would like the screen to go blank (backlight off) after a while and when I touch the screen again to change something, the screen should brighten up again so I can use the dashboard.
This is not exactly turn of the screen on a predefined timer with cron and put it up again. This is more dynamically, just like a screensaver.
I was playing with the consoleblank because the GUI doesn’t run on X or wayland, so I thought the console window could do the trick.

Hi @cazzeken I guess it would be possible to have a routine that checks the touch input events and puts the screen off if no events are detected after a given amount of time, and then turn it on again at the next event. Afaik the official rpi screen linux driver provides a standard backlight interface at /sys/class/backlight/rpi_backlight so you could do echo 0 > /sys/class/backlight/rpi_backlight/bl_power to turn it off and echo 1 > /sys/class/backlight/rpi_backlight/bl_power to turn it on. I think in order for this interface to be available, you need to load the rpi-backlight overlay in your config.txt

Hi @curcuz,
I successfully activated the rpi-backlight overlay with BALENA_HOST_CONFIG_dtoverlay “rpi-backlight” and can switch the backlight on/off with the /sys/class/backlight/rpi_backlight from the terminal window. Now find a way to do it automagically :slight_smile: .
I found a script to do it here https://github.com/timothyhollabaugh/pi-touchscreen-timeout, but am not sure what would be the best way to implement it. In a separate service container? I’m not sure if I have the needed skills for that :slight_smile: .
Or is there another easier way to do this?

Hi @cazzeken,
You should be able to replace the scheduler's code in the balena-dash repo with the code from the pi-touchscreen-timeout repo and have it working after pointing your dockerfile to the start script of pi-touchscreen-timeout.
All in all, that repo is finding out all /dev/input devices and then is actively monitoring them for user input. It is still achieving to turn the display on/off by using the /sys/class/backlight/rpi_backlight/bl_power, similarly to how it is implemented in balena-dash.
If you want to fine tune it for your needs, but find C a bit awkward, you can use a /dev/input library on the programming language of your choice. For example if you prefer nodejs over C you can use the input-event node module to listen for touch events.

Kind regards,
Thodoris