MagicMirror² v2.14.0 is available! For more information about this release, check out this topic.

how to adjust brightness based on time on RPi3?

  • I want to adjust brightness to 100% during day time and 20% at night, how could I do that with RPi3?

  • Module Developer

    For official 7" LCD Screen, echo 32 > /sys/class/backlight/rpi_backlight/brightness will work.
    For common monitors, as far as I know, debian has xbacklightbut I’m not sure it will work on RPI also.

  • @sean

    pi@raspberrypi:~/MagicMirror/config $ xbacklight
    RANDR Query Version returned error -1

    no, doesn’t work in RPi3

  • @lkthomas take a look at MMM=ModuleScheduler. It contains a method for dimming modules.

    Once installed, adding something like this should to your config.js should work

            module: 'MMM-ModuleScheduler',
            config: {
                // SHOW ALL MODULES AT FULL BRIGHTNESS AT 06:00 AND DIM THEM TO 20% AT 22:00
                global_schedule: {from: '0 6 * * *', to: '0 22 * * *', dimLevel: '20' },

  • @ianperrin just tested, dimlevel at 20 and 80 also show black screen

  • @lkthomas okay, a couple of things to check

    1. Have you installed the module and its dependencies as per the instructions
    2. Did you restart MM after installing and changing the config.js file.

    With the config above place at the end of modules section you should see the following lines in the log.

    MMM-ModuleScheduler is removing all scheduled jobs
    MMM-ModuleScheduler received CREATE_GLOBAL_SCHEDULE
    MMM-ModuleScheduler is creating a global schedule for all modules using "0 6 * * *" and "0 22 * * *" with dim level 20
    MMM-ModuleScheduler has created the global schedule for all modules
    MMM-ModuleScheduler will next show all modules at Sun Jan 13 2019 06:00:00 GMT+0000 (UTC)
    MMM-ModuleScheduler will next dim all modules at Sat Jan 12 2019 22:00:00 GMT+0000 (UTC)

    Whilst testing, you could use the following config to toggle the brightness more frequently (i.e. every two minutes):

                module: 'MMM-ModuleScheduler',
                config: {
                    global_schedule: {from: '0-59/4 * * * *', to: '2-59/4 * * * *', dimLevel: '20' },

    Let us know how you get on.

  • all good! thanks, I missed the dependencies installation section.

Log in to reply