How to turn On/Off monitor when Raspi Pi turns On/Off
-
@retroprogrammer You intall the CEC libraries, then use
cec-client
to control the HDMI output, see https://blog.gordonturner.com/2016/12/14/using-cec-client-on-a-raspberry-pi/. -
My monitor does not support cec to control the monitor
-
@retroprogrammer looks like you'll have to use the button then
-
@markyh444 Is their any other way, this is for my bartop arcade
-
@retroprogrammer You could link the power sources for both the Pi and Monitor to a single button, so operating it will shutdown/power up both devices.
-
Its possible without additional buttons. There are power strips with master/slave function. Whenever it detects a single master connection got on, then it turns on all other too. When it detects it goes off, then all slaves are set offline too. In most cases you can setup how sensitive it should be.
Btw, I do it without this thing. A single power strips with a button is enough.
-
The most elegant way I have found is if you use a power strip with built in control relay, like this one
https://www.amazon.com/Iot-Relay-Enclosed-High-power-Raspberry/dp/B00WV7GMA2
And then run jumpers from a 3.3 or 5v and a ground GPIO pin to the relay. As soon as the PI powers up the controlled outlets will come on because the power from the Pi triggers the relay, and the reverse when it powers down. That way you can control monitors, amps, lights etc. When I get to my PC I can post a link to exactly how it is done. I will be installing this solution on my cabinet build soon.
-
Here is the link. By the way, the entire build is really useful - I got a lot of ideas for finishing touches from it.
https://andrewdupont.net/2017/09/18/nostalgia-tron-part-11-not-electrocuting-yourself/
-
a cheaper option basically the same as what @DougA has suggest is just to use a simple relay. Something like this https://www.ebay.co.uk/itm/5v-DC-Single-Channel-Relay-Module-Arduino-Raspberry-AVR-Pi-Pic-UK-Hobby-UK-A504/161442238589?epid=1424956013&hash=item2596b5107d:g:KhsAAOSw~05Z2NMd
Its much cheaper and i personally prefer it in a cabinet but you have to be confident you know what you are doing. It is not complicated just double check what you have done. You can get solid ones which do not click when they activate as well. Get one that supports the right voltage for the raspberry pi and your monitor.
-
@crazydude2 Yes, that would definitely cut the cost. I hadn't thought of doing it that way. But, then again, that's the point of being on this forum - getting other people's ideas as well as your own. Thanks
-
I resurrect this old thread just to add some more info for future reference. I came across this topic multiple times while searching the best way to turn on an Iot-relay, such as the one @DougA mentioned above. (My original way was to use a USB plugged into the Pi, with - & + going to the relay)
I am using an ADAfruit arcade bonnet, so some gpio pins were causing conflict with the controls.
To test I used:
sudo su cd /sys/class/gpio echo 8 > export cd gpio8 echo out > direction echo 1 > value
To set a specific pin to turn high/low (on/off), add one of these options in
/boot/config.txt
xx is the BCM number of the GPIO you want to use
dtoverlay=gpio-poweroff,gpiopin=xx
for the default where GPIOxx will go low on boot and high after shutdown
dtoverlay=gpio-poweroff,gpiopin=xx,active_low
to make the GPIO go high while the system is up
Adding to the
/boot/config.txt
allowed my Iot-relay to power on the switched outlets within 1-2 seconds of bootreferences
https://www.raspberrypi.org/forums/viewtopic.php?t=154824
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.