Automate the backlight timer on your balenaDash display

We've just updated balenaDash with functionality to enable you to automatically turn the backlight on and off using cron scheduling. Here's how to use it.

A lot of you have been building balenaDash displays since we posted our tutorial a few months ago, and one of the most requested features is to be able to automatically turn the backlight of the display on and off.

Today we've pushed an update to the balenaDash GitHub repo that enables you to do just that.

Step 1: Update your display to the latest version of the code

The first thing to do is update your device to the latest version of the balenaDash application (found on GitHub). This is done in the same way as the code was pushed when you first set the display up; you don't need to download the OS again, nor flash any SD cards, or even go near your display!

The beauty of balenaCloud means we can update the display (or displays!), no matter where they are in the world, from the comfort of our desks.

To update, either download the latest code from GitHub again via the zip file download, or via git pull and then push this to your application using the balena CLI or git push as you did originally. If you need a reminder on how to do this, check back on our original balenaDash setup guide.

Once you've successfully updated your display, you'll see two services now running in the balenaCloud dashboard instead of one:

Step 2: Define the required service variables

Now that your display is up to date, we need to add some variables that tell the system first to enable the backlight timer and then specify the times you'd like to turn it on and off.

Service variables can be added in the balenaCloud dashboard by going to your application and then finding the Service variables option in the left-hand menu as per the screenshot below.

The first is ENABLE_BACKLIGHT_TIMER; to enable the backlight timer it is required that this is set to a value of 1. If you enable the timer and do not specify your own on/off times, the backlight will switch on at 0800 hours and off at 2300 hours by default.

To specify your own on and off times, you can add the variables BACKLIGHT_ON and BACKLIGHT_OFF as shown in the screenshot above. Each of these variables accepts a time in cron format; if you're not familiar with this, I recommend checking out crontab guru which explains everything.

That's it! No longer will your balenaDash display backlight be burning throughout the night. If you have any questions or feedback, or have built your own version of this project, we'd love to see you share your work over in our forums!

comments powered by Disqus
Terms of Service | Privacy Statement | Master agreement | Copyright 2019 Balena | All Rights Reserved