Arcade Cab Power Questions
-
I've been doing a lot of reading around the options of installing a power button for my cabinet. Ideally I want to press a button and that turns everything on and the same button switches everything off.
I have the RPi, monitor, usb hub and speakers all plugged into a 4way extension lead. Currently I shutdown through the EmulationStation menu and then switch the main power off at the wall to turn everything else off.
I can easily wire a momentary switch to the GPIO pins which runs a script but has anyone found a way to shutdown the remaining things? Online I found an extension lead that had a relay built in to turn the sockets on and off but for the life of me I can't find anything like that in the UK. Any Recomendations?
Pi Model or other hardware: pi4b 4gb
Power Supply used: 5.1v 3a
RetroPie Version Used (eg 3.6, 3.8.1, 4.1 - do not write latest):4.5.18
Built From: (Pre made SD Image on RetroPie website, Berryboot, or on top of existing OS etc.. - please provide the filename of any image used) running on raspbian 10 buster
USB Devices connected: Keyboard
ES version: 2.9.1rp -
Inspired by PowerBlock, I built my own arcade power management system (for lack of a better name) which allows a graceful power up and power down of the arcade. One other big benefit of this system is that it allows me to put the arcade in standby mode (everything off except RPI). The biggest struggle was getting the microcontroller code to work as desired given I am not a programmer... I am sure my code would give actual programmers the shivers but it seems to be working... so I can't complain.
The picture below shows the control system of my arcade.
The system is controlled by an Arduino Nano (right of blue relay board) that turns things on/off using relays, SSRs, and MOSFETs. While some may argue my choices, this is a summary of why I picked these different control methods:
Audio Amp - Relay (I wanted to use the Keyestudio relay board in my project to keep things compact and reduce wire clutter...)
Button LEDs - Relay (same reason as above)
RPI - Relay (same reason as above)
LED Marquee - MOSFET so that I can control brightness via PWM, and a Relay (to cut power completely - yes I know it is redundant but I had no other use for it anyway...)
RPI Fan - MOSFET (no need to keep fan on while in standby)
Monitor - SSR (take 5V control signal, and it can switch 120V on/off accordingly. Big black box protects it from making contact with anything else)This picture shows the marquee area where you might notice the MOSFET board on the left, and the audio amp in the middle. Amp is 2.1ch as I have a sub connected to this arcade!
The system is operated by a single momentary power button. In a previous arcade I used 2 switches to turn on power and standby modes, but my kids kept pressing the power button which would trigger an irreversible shutdown mid play. I changed the control method to a momentary button so when they press it, it now simply goes into standby mode and a simple second press will bring the arcade back to life where you left off (well maybe with 1 less life...). If you want to power down the arcade, you must hold the power button down for close to 2 seconds when not in standby.
This mess is my control panel... the power button is on the front left next to the bright 4 buttons. The two boards are both from Ultimarc. One is the IPAC2 and the other is their PacLED64 RGB LED control board. Sanwa joysticks and Ultimarc buttons (because I wanted the nicely integrated RGB LEDs).
Please excuse the mess :-S. Arcade - work in progress...
-
Dude, thats some serious work gone into that. Thanks for taking the time to write it all up and explain. Given me lots to think about.
My initial thought was to run everything except the PI from a 4way extension lead that is wired via a relay thats controlled from a GPIO pin. When the pi shuts down it kills the power to the pin, switch off the relay and everything else is off. Turn on the PI, relay is activated and turns on the 4 way extension lead.
It's a pretty butal way to do things given that everything in my cabinet is either 5v or 12v so will definitely be looking at alternatives like your setup.
-
@joesnow81 If you just want to turn everything on and off then PowerBlock is perfect for you:
https://www.petrockblock.com/powerblock-raspberry-pi-power-button/
My setup was aiming at taking it a step further as I wanted some way to turn everything off except the Pi (standby mode) and I also wanted to turn things on/off in a specific and timed sequence. For example... it takes about 6 seconds for the monitor to be ready to display video from the Pi so I turn it on first and give it a heard start before powering up the Pi so that I can see the entire boot process. For the same reason, when it is in standby, and I want to turn everything on again, I time things so that audio and lights come on last so that one can quickly control the system (as the monitor is already displaying the video) in the event the arcade was put in standby with blaring sounds (I have young kids so such a mishap at night would be a big issue).
Either way, PowerBlock (made in EU) has 5V pins you can use to control an external relay or SSR to power whatever else you want.
If you know how to safely build electric equipment, you could use an SSR to power on/off your power strip. They often take 3 to 32V DC on the input and can switch 220V AC 25A (there are larger ones but 25A is more than plenty) on and off. By the way, I am not sure how much these SSRs heat up, if anything, but there are standard heatsinks for them. At the current you are switching, I doubt you need one but I never looked into it so please do if you go this route.
An example is:
I can't speak to reliability and safety of this item as I've never heard of the name. I tried to find one that did not look suspicious and that had recognizable safety markings but did not find any. A brand I would trust is Crydom but the only one I found was overly expensive.
You will find lots of relays but the issue with those is that DC and AC is in close proximity and it is all exposed so unless you know how to build the system in an insulated box, I would avoid it. The same goes with the little boards that have the smaller 5A SSRs on them. I used one of those for my monitor power but the little board is carefully installed in its own plastic enclosure (see black box in images above). I took lots of care to ensure mains power would never contact the DC part (assuming the Omron SSR does its job...).
You could also use a socketed relay which makes mounting easier but you will need to build or source something that can drive it which takes a 5V TTL and outputs 12V required by this large relay:
https://www.amazon.co.uk/General-Purpose-Power-240VAC-Socket/dp/B00EZ2BZ3A/
An example is this:
https://www.amazon.co.uk/HALJIA-IRF520-MOSFET-Arduino-Raspberry/dp/B075QD884C
Connections would be:
VCC >> 5V power supply
SIG >> switched 5V signal from PowerBlock
GND >> negative / gndVIN >> 12V power supply
GND >> negative / gndV+ >> relay
V- >> relayThe giant mosfet on this board is overkill to drive the relay but amazon.co.uk doesn't seem to have as many options as the USA one.
Just some ideas... solution will depend on how comfortable you are at building this stuff.
Hope it helps!
-
It helps massively mate so thank you for taking the time to reply.
I already bought a SSR the same as the one you put a link to and the powerblock seems like a great solution. I was looking at doing it via the GPIO pins though.
My thinking was wire a momentary switch to 2 GPIO pins to shut the pi down and then use another pin to wire to the relay to control a 4 way extension with everything else plugged in. If I'm correct in what I have read then I should be able to enable 3v on a pin with a simple script when the PI is on and not when it is off. I would need to wire a permanent supply for the pi and then a switched 240 via the relay to the 4 way extension lead.
The issue I've had is the script and video I was following (ETA Prime on YT) would turn the PI on but halfway through my splash screen it turned off. I'm sure it's a simple fix in my script but fond an alternative way to do it which is currently working. I have a button that just turns the PI off and then I switch it off at the wall which turns everything else off. Then when I want to turn it on again I which it on at the wall and everything boots up and switches on. It's a bit brutal but it does work for me and it does mean that all power is cut to the cabinet so the fan in the case also goes off. As great as the first option is I'd probably switch the cabinet off at the wall most times anyway as I can go a few days without switching it on.
-
@joesnow81If you want to connect the SSR directly to the RPI GPIO you need to check how much current the LED inside the SSR requires to ensure it does not exceed the GPIO pin output max current. Also, the RPI GPIO operates at 3V which is the low end of the SSR so it makes me wonder if it will always be 100% reliable. I guess it will but it would not be my first choice. The powerblock board has 5V outputs switched on the board and powered by the additional power supply (did not check this but I think it is safe to assume this is correct) so it is much safer for your RPI than connecting directly to it. Also, the powerblock cuts power to the RPI when off which is safer.
Either way, what you are trying to do should work just fine.
You can still use the Powerblock 'driver' to get what you want without needing the board itself. The nice thing about doing so is that it is integrated into the RetroPie setup so it should always remain compatible and not get disabled by updates. Even if it does, you can easily install it from RetroPieSetup menus.
I am using it in my arcade without the board, even though I have two powerblock boards, as it would not fit with the cooler I use, and I wanted to do more as described above. To use it, I had to reverse engineer what the script does (I tried to figure it out from the code but found it easier to use a DMM & scope to look at what happens on the hardware. This is what I found, and use in my Arduino control software:
// Interfacing with SBC
// RPI GPIO 17 goes high when the system boots up, and low once it has shutdown. Power can be cut once this pin goes low.
// RPI GPIO 18 has to be made high for 2 seconds (maybe less?) to initiate the RPI to shutdown.Therefore.... you could connect a button between 3V and GPIO 18 to gracefully shutdown the RPI and you could use GPIO 17 to control the SSR. The original purpose of that line was to ensure the powerblock board would not cut power to the RPI before it finished shutting down, but you can use it to turn on/off the relay for everything except the RPI.
I don't know whether a shutdown RPI can boot up by pressing the button connected to GPIO 17 though... maybe something to check. The powerblock board buts power to the RPI so I expect it will not power it up. Anyway, I wanted to mention this option to you.
As for the issue you mentioned - does it reboot mid splash screen or gracefully shutdown? I ask because I've seen my Pi reboot when current spikes caused by the audio amp happen. You might have a power related issue if the issue is a reboot, while if it is a graceful shutdown then I wonder if the script is seeing a logic low (pin 6 is GND so connecting it to pin 5 to trigger the shutdown is a logic low) at the wrong time. Just to confirm... you are using a momentary button, not a switch, right?
Note for others: The ETA Prime video we are referring to is here:
-
Will definintely take a look at the powerblocks.
When I set up as per the video I get a graceful shutdown when trying to start the pi. Yes I'm using a momentary button. Once I've installed the script I can press the button and the pi shutsdown. Press it again and the pi starts, half way through the splash screen it then shuts down again. Same thing happens everytime I press the button.
Luckily I clone my card each time I try it other wise I wouldn't be able to get into the Pi to remove the script from the startup script
-
@joesnow81 I wonder whether it is a case of button bounce. When you press a button, without debounce circuitry, the signal actually goes up and down a few times so some systems may see that as multiple presses. This can be fixed in hardware (debounce circuit) or software (read button more than once and compare results). Anyhow, if it were that, I would imagine it be a common issue so there should be many posts about it.
-
You could be right. It must be something to do with my setup as he's a very reliable resource and there would be a lot of questions around it if it was causing the issue. When I have the time I'm going to apply the new 4.6 image to a new card so will try the script again. Also need to buy another button anyway as currently using a spare arcade button.
-
@alruf OT: Sorry for offtopic but where did you get those awesome graphics for your bartop? They are looking great and im still searching for good ones. Thanks in advance.
-
@SchwarzBrot The cabinet is from https://gameroomsolutions.com/
-
@joesnow81 said in Arcade Cab Power Questions:
Also need to buy another button anyway as currently using a spare arcade button.
While each switch may have its specific bouncing characteristics, I don't think it will eliminate the issue. I believe bounce is just a normal characteristic of mechanical switches.
There might be another issue causing this too... If you use a digital low to trigger something, the digital line on the RPI should be "pulled high". This is because the input may float up/down causing false triggers. If you pull the input high (3.3V in case of RPI), it will always sit far from its low threshold (around 1V for RPI). When you push the button, it will be pulled down to zero. To pull a digital line up high, you would typical use a resistance between the 3V rail and the digital input unless the board does so itself.
This video says RPI can be configured to do so, therefore I must assume the script you are using configures the input with a pull up resistor, if not, then that might be the issue.
@joesnow81 said in Arcade Cab Power Questions:
Press it again and the pi starts, half way through the splash screen it then shuts down again.
Sorry, I want to double confirm this... when this other undesired shutdown happens, what happens exactly? 1) graceful shutdown 2) power just turns off suddenly 3) it reboots
From what you've said, it would be #1 as you see the shutdown messages, but I wanted to be certain.
What button are you using? Does it have 2 or 3 pins? If it has 3 pins, which ones did you use? You might find 'C', 'NO' and 'NC' labels. A picture of the connections and or labels would help. I haven't tested this but I am wondering whether you connected C and NC, instead of C and NO.
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.