Control the screen on/off?

Hi

I got 2 rpiz with 4inch HypePixel touch on them with some info on them in a room. I would like to control if the screen is on or not through a script?? Like of you have an hdmi-screen it is possible to turn the hdmi-contact on/off with the result that you can control the screen…

Is it possible to do the same with this screen mention above??

Best regards
Jonas
PS/ I have serached a lot on internet and in this forum but i cant find any info regarding this… what I know of anyway… ;)

Hey! I don’t think that you can do that with any rpi , not 100% sure but fairly! If you just want to make something run whenever it starts up you will need to edit one of the boot files - google it - I have seen it in a book but never done it myself, then if you set it to a program (eg python) that involves the gpio pins - whenever the pi boots up it will run that program without the need for a mouse, keyboard and monitor!

Hope this answers your question!

Alex

1 Like

The pinout is here, there is a backlight control on GPIO 19. That might work if you can figure out what signal it needs to turn it off. I have several of the Breakout Garden SPI displays and on those a ground on the BL pin turns that backlight off. I can still see the display data though, just barely, they don’t go completely black. It’s enough of a change for me though. I like to leave the Pi running its code, but turn the backlights off at night so they don’t light up the room.
Hyperpixel4 at Raspberry Pi GPIO Pinout

1 Like

@FutureGaming1 I use crontab to run my python files on bootup.
From terminal I run crontab -e
then add
@reboot python3 /home/pi/my_file.py &
Usually in that file is code to do a proper shutdown on a button press.
os.system("sudo shutdown now -P")
The button grounds a GPIO pin when pressed. I have a bunch of headless setups where I want an option to shut them down without just pulling the plug. ;)

@alphanumeric What is sudo shutdown now -P? I know of sudo shutdown -h now and sudo shutdown -r now

@alphanumeric and you can do that! I didn’t know that you can do it from terminal. I did it by editing the boot files so I don’t kneed a monitor, keyboard and mouse.

I don’t remember what the P does, or why I used it, if I’m Honest. ;)
And Google isn’t helping.
shutdown ? I believe will get you a list of each option and what it does. I don’t have a Pi booted up to a monitor to check it myself at the moment. It’s 7am here and I only just got up. :)

There are several different ways to run code on boot up. It kind of depends on the type of code and what you trying to accomplish as to how you do it. cron works for me and seems pretty reliable for running my python files on boot, so that’s what I use. Plus its easy to setup, just a simple file edit.