BlueWave Studio forum
  • Login
  • Register
  • Login Register
    Login
    Username:
    Password:
  • Home
  • Help
  • View Today's Post
  • More
    • BlueWave Studio
    • Shop
User Links
  • Login
  • Register
  • Login Register
    Login
    Username:
    Password:

    Quick Links Home Help View Today's Post
    More
    • BlueWave Studio
    • Shop
    BlueWave Studio forum OpenAuto Pro User interface Day/Night Brightness Control

    Day/Night Brightness Control
    jimOAP
    Offline

    Junior Member

    Posts: 1
    Threads: 1
    Joined: May 2021
    Reputation: 0
    #1
    08-01-2021, 08:55 PM
    Hi all, I've combed through the config file and documentation on here, and can't find an existing answer to my query.

    I'm looking for a way to set a screen brightness value for each Day and Night modes, so that when switching between the two the screen brightness changes along with the UI colours & background image.
    When in night mode I'd like my screen brightness at its lowest value, and when in day mode have it at the brightest value.

    Is this possible? If not I'd like to suggest it as a new feature.


    Thanks,
    Phil
    Daniel_BlueWave
    Offline

    BlueWave Team member

    Posts: 1,213
    Threads: 45
    Joined: Jul 2019
    Reputation: 53
    #2
    08-02-2021, 01:27 PM
    You can start from here: https://www.bluewavestudio.io/community/...p?tid=2042&pid=11925#pid11925
    Akshunhiro
    Offline

    Junior Member

    Posts: 17
    Threads: 1
    Joined: Jan 2022
    Reputation: 0
    #3
    01-05-2022, 03:50 AM
    I couldn't find anything for brightness control in the linked config thread. I mainly wanted to see whether brightness and night mode can be triggered from the same GPIO so when the headlights turn on both dark mode will be enabled AND the screen brightness will drop so a set level.
    Daniel_BlueWave
    Offline

    BlueWave Team member

    Posts: 1,213
    Threads: 45
    Joined: Jul 2019
    Reputation: 53
    #4
    01-05-2022, 02:34 PM (This post was last modified: 01-05-2022, 02:35 PM by Daniel_BlueWave.)
    Check section [Day][Night]
    765GHF
    Offline

    Member

    Posts: 54
    Threads: 9
    Joined: Jun 2019
    Reputation: 6
    #5
    01-06-2022, 02:02 PM (This post was last modified: 01-06-2022, 02:03 PM by 765GHF.)
    (08-01-2021, 08:55 PM)jimOAP Wrote: Hi all, I've combed through the config file and documentation on here, and can't find an existing answer to my query.

    I'm looking for a way to set a screen brightness value for each Day and Night modes, so that when switching between the two the screen brightness changes along with the UI colours & background image.
    When in night mode I'd like my screen brightness at its lowest value, and when in day mode have it at the brightest value.

    Is this possible? If not I'd like to suggest it as a new feature.


    Thanks,
    Phil

    If you are willing to install a TSL2561 light sensor then you can use an external script to control both the switching of day / night mode and screen brightness.

    Example script mentioned in this post https://bluewavestudio.io/community/show...p?tid=2398 actual script located here - https://github.com/Grawa/brisensor/blob/...iSensor.py
    wkl3968
    Offline

    Member

    Posts: 111
    Threads: 18
    Joined: Jun 2021
    Reputation: 1
    #6
    03-18-2022, 12:04 AM
    I'm using HDMI kind of widescreen display. currently the display has its own remote control to adjust the brightness. I don't find it useful as the environment is changing dynamically and at times the brightness is too low in the day and brightness is too high at night.

    So, at the moment, I have enable a CAN message to trigger the day and night perfectly. I also found that there is another CAN message that give the light level from the car.
    Can I use the CAN message to trigger the brightness change here https://github.com/Grawa/brisensor/blob/...iSensor.py ?
    can the RPI create different brightness signal for HDMI kind of display?
    GFunkbus76
    Offline

    Member

    Posts: 91
    Threads: 3
    Joined: May 2019
    Reputation: 3
    #7
    03-18-2022, 12:44 PM
    Check out PiShade on github - its a software solution which masks the desktop on command.

    I tested it a bit with my setup on the bench but forget what I did as it was long ago. Had it functioning with both my screens however - not perfect, but a solution for the software side.

    Would be cool if Bluewave added software brightness!

    GFunkbus76
     - Working on dual screen setup to run 1976 bus AV and dash... eventually.
     - Work in long-term progress lol

    YouTube Channel for some related videos
    burnsy180
    Offline

    Junior Member

    Posts: 12
    Threads: 6
    Joined: Oct 2020
    Reputation: 0
    #8
    08-21-2022, 08:31 AM
    I know this is bit late, but i've found a solution for anyone reading this in the future.

    This will change your screen brightness based on the high/low value of a GPIO.

    For example, in my configuration, I have a GPIO wired to my car where the signal will go high when the headlights are turned on (night), and stay low when off (day).
    You'll need to create 2 scripts for this, which can be done through SSH (i'm using PuTTY, but whatever works for you).

    run these commands while connected to the pi in the terminal, or remotely via putty etc:

    sudo nano /usr/local/bin/ButtonMonitor.py

    this creates the 'ButtonMonitor.py' file and opens it for editing.

    paste the below contents into the script in using (right-click is paste in Putty), then save
    #!/usr/bin/python
    
    import RPi.GPIO as GPIO
    import time
    import subprocess, os
    import signal
    GPIO.setmode(GPIO.BCM) # set to BCM if using GPIO numbering, use GPIO.BOARD if using board pin numbers
    GPIO.setwarnings(False)
    Brightness_Switch = 17 # Set GPIO number lights are connected to
    GPIO.setup(Brightness_Switch, GPIO.IN)
    
    print "  Press Ctrl & C to Quit"
    
    try:
    
       while True :
            time.sleep(0.1)
            if GPIO.input(Brightness_Switch)==0: #if lights are off (daytime), set brightness MAX (255)
                    print "Setting Brightness to 255"
                    subprocess.call ("/usr/local/bin/backlight.sh 255", shell=True)
                    while GPIO.input(Brightness_Switch)==0:
                            time.sleep(0.1)
    
            if GPIO.input(Brightness_Switch)==1: #if lights on (night) set brightness to MIN (20)
                    print "Setting Brightness to 20"
                    subprocess.call ("/usr/local/bin/backlight.sh 20", shell=True)
                    while GPIO.input(Brightness_Switch)==1:
                            time.sleep(0.1)
    
    
    
    except KeyboardInterrupt:
      print "  Quit"
      GPIO.cleanup()
    Next do the same to create a 'backlight.sh' script. The backlight.sh script changes the brightness, the ButtonMonitor.py script checks for the GPIO input, and runs the backlight scripts appropriately.

    Create the backlight.sh in the same directory using this:
    sudo nano /usr/local/bin/backlight.sh
    Paste this into the backlight.sh file:
    #!/bin/bash
    
    level=$1
    #echo "level given is $level"
    
    if [ $# != 1 ]; then
    echo "USAGE: $0 brightness_level (0 to 255)"
    exit 1
    fi
    
    if [[ $level -ge 0 && $level -le 255 ]]; then
    #echo "level given is $level"
    echo $level > /sys/class/backlight/rpi_backlight/brightness
    echo "Screen brightness set to $level."
    exit 0
    else
    echo "Brightness level $level is out of range! (0 to 255 only)"
    exit 1
    fi
    You can test the backlight.sh works, by running this command, replacing the xxx with any value between 0 (screen off) and 255 (screen full bright).
    /usr/local/bin/backlight.sh xxx
    Next, make the ButtonMonitor.py script run at startup:
    sudo nano /etc/rc.local
    add this line at the bottom directly ABOVE the 'exit 0'
    python3 /usr/local/bin/ButtonMonitor.py
    The above scripts will change the brightness of your screen (i'm using the official Raspberry Pi 7" screen), to full brightness (255) when headlights are off, and low brightness (20) when headlights are on.
    As the ButtonMonitor.py script runs on startup, it will be constantly monitoring the GPIO pin you set for high/low values, and when the headlights come on/off, the GPIO changes and it executes the backlight.sh to change the brightness.

    I used Everlanders on YT for most of this info, hope it helps someone. It helped me!
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)



    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Help · BlueWave Studio · Shop

    Copyright © bluewavestudio.io. All rights reserved.

    Linear Mode
    Threaded Mode