1.3” SPI Colour LCD (240x240) Breakout Backligh

Hi,

I’ve an interesting issue with the display. You can turn the display off by setting the BL pin to low.

However, if you then shutdown your pi, but don’t physically remove the power to the pi, the displays screen with turn itself back on during the shutdown and stays on. Which is somewhat annoying.

I’ve tried multiple BL pins to see if that has any effect. But it doesn’t seem to.

Any suggestions?

The only one I’ve found so far is by putting a transistor between the power/gnd and use another pin to control that. Although possibly I could use the BL pin for that (haven’t tried).

Currently I’m using PWM on the BL pin to dim the display. It works for me, although the BL pin is somewhat a mystery. If the display is on (whether I’m using pwm or not) and I remove the BL pin, the display stays on.

So it seems to be more of a toggle.

Does it use an active “low” (ground) to turn the backlight “off”?
If yes the reason why it comes back on is that GPIO pin will go to a floating state when Raspbian shuts down. No more ground / low to the BL pin keep it off. It will be floating as if its disconnected.

Is there any possibility perhaps of fitting a pull-down resistor to the BL pin.
That would, in the absence of power, turn off the display?
(just thinking out loud as I don’t know the practicalities of this)

You can add your own pull up, pull down resistors, I’ve done it. If you do that you want to make sure the Pi’s GPIO resistor is disabled. I did this on the one I added my own resistor. Its set as an input not an output. This has me thinking? I may want to try this on my Fan Shim, it uses a ground to disable the fan, thus my fan just keeps running when I power down the Pi. For the same issue you have, the fan control pin goes to a floating state when Raspbian shuts down.

GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_OFF)
Is what I used on that other Pi.

Keep in mind, if you do that, you will have to pull that pin high to enable the backlight. The default state will change from floating always on, to grounded always off.

Thanks for the replies. Well I’m more confused now than before.

I did try a 10k resistor to pull it to ground. It didn’t help.

From the driver :-

        GPIO.setup(backlight, GPIO.OUT)
        GPIO.output(backlight, GPIO.LOW)
        time.sleep(0.1)
        GPIO.output(backlight, GPIO.HIGH)

So clearly the driver sees it as an output.

I can set the output to LOW and it then has 0v on it. But the moment the Pi stops doing that, the backlight comes back on (I did modify the driver to turn the display off, but that is separate from the backlight). Although in some ways that’s worse as you can’t easily tell now the display is still on. Unless you look it at from the correct angle.

So with the Pi shutdown, the backlight pin still has 3.0v on it.

So while you can set the output to low from the Pi, the moment the Pi stops doing that (like you shut it down), then it reverts back.

My setup is more of a noise filter. Its a voltage divider with a capacitor in the mix. I for the life of me can’t find the diagram of it that I know I saved. I think its pretty close to this

EDIT: I use the above on a headless Pi to do an OS shutdown via a button press. I was getting false shutdowns from noise spikes when I plugged in my power supply to recharge the battery.

GPIO.add_event_detect(5, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)

Shutdown calls up another block of code in the file that does os.system("sudo shutdown now -P")

Worked for me. I wired a 10k resistor from the Fan Shim, Fan Control pin, GPIO 18 physical pin 12 to ground. A pull down resistor that will make the default state of the fan off. I have to command it on, with either the dtoverlay=gpio-fan config.tx entry, or via the Pimoroni software Daemon. I tested both and it worked as I wanted. The Fan turned on and off when it should with the Daemon, and turned on as it should with the dtovery entry. Pressing the button on the Fan Shim to do a shutdown had the fan stop right away. And stay off even with the power supply plugged into the Pi. Pressing the button again on boot up the fan was off if the temp was below the on threshold. :D