CrawfishStu
Posts: 1
Joined: Tue Feb 18, 2020 3:13 pm

Python help with IoT Relay and Power Button

Tue Feb 18, 2020 7:23 pm

Good afternoon.
Pardon the lack of knowledge for proper terms here.
I’m working on an arcade cabinet with my son and I am trying to get some help with python to use a GPIO pin to turn on power to the monitor, marquee, speakers, coin slot lights, etc.
I also added a button that runs shutdown and wake up that I would like to change the button press duration.

My system is pretty simple
Pi 3B+
Retropie 4.5.1
I have a pair of usb encoders with buttons and joysticks.
I’m using the HDMI out to go to a monitor.
Currently, sound is going to the monitor via HDMI but it will run to PC speakers via the 3.5mm jack after I have power sorted out.

I used the instructions here to add a button that will run a shutdown and wake the pi up when pressed.
https://www.youtube.com/watch?v=4nTuzIY0i3k
http://www.barryhubbard.com/raspberry-p ... mment-1232
I have it hooked to an arcade button going to pin number 5 and 6. This is working as it should.
I’m not sure if I am using the correct term for the state that the button puts the Pi in. It still has power, but is ready to be unplugged or started.

I have this IoT Relay.
https://dlidirect.com/products/iot-power-relay
The Pi’s power supply is plugged into the always on. I have the lights, speakers, and the monitor power plugged into the normally off spots.
I ran wires from the 3.3V and a ground to the relay expecting that I would get 3.3V when I pressed my power button and the Pi woke up. However, it seems that this gets voltage at all times when the Pi has power going to it.

So, I’m looking for help with two issues.

I’d like to get a gpio pin to send signal to the IoT relay when the Pi starts / wakes up / turns on / boots. Again, not sure on the right term. But the idea is to turn on the monitor, speakers, and lights as close to when the button is pressed as is reasonable. I’d like signal to the IoT relay to stop when I shutdown/stop the Pi.

Next, I would like my current “power” button to require that you press and hold it for 5 seconds before it shuts down/sleeps. From what I have read, this may require that I use a different set of GPIO pins.

Also, the gpio pins are tiny. Should I be worried about pressure from the wires I have hooked into them with the tiny connectors? I see the small breadboards that are available. Would this be helpful in protecting the Pi pins? What do most people do?

Thank you for the help.

User avatar
ckovel
Posts: 3
Joined: Sat Sep 06, 2014 3:27 pm

Re: Python help with IoT Relay and Power Button

Tue Jul 14, 2020 4:06 pm

did you ever figure this out? I was looking to buy this IOT relay.

Return to “Python”