Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: PC Smart Switch  (Read 49133 times)

0 Members and 7 Guests are viewing this topic.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5192
  • Last login:April 08, 2026, 06:31:20 pm
  • Wheres my coffee?
    • Skenny's Outpost
PC Smart Switch
« on: September 19, 2025, 03:39:53 pm »
I was thinking it would be neat to have one switch to fire up the arcade and to shut it down, especially if you have mamed an old original cabinet.
Some folks say just turn the power off, but windows OS dont like that. So I came up with this circuit using two 12VDc relays.



With this circuit, a "always on" 12 vdc power supply is used. Also the power from the PC power supply. (12 volt and 5 volt, for my purposes).
On start, the power switch is off, the PC is off.
Flip the power switch to ON and CR2 comes on.
This closes the contact in to complete the circuit through normally closed CR1 to turn on the PC  by the motherboard connection.
This also turns on teh AUX relay, which switches high voltage to monitor, marquee lamp, etc.
When PC power supply comes on (should be pretty quick), CR1 comes on, which breaks the circuit to motherboard power on.
In my circuit, this also turns on the 12vdc cabinet cooling fan.
PC is up and running.
Now turn power switch to off.
This turns off CR2 and AUX relays.
The normally closed CR2 contact completes the path to the keyboard encoder.
I use two diodes to make the P1 joystick left and right to energize.
I have an AHK script running on the PC that when it sees both left and right, it shutdowns the PC.
Windows is happy and so am I.

Now the drawback to this (which really irritated my OCD), is if the power fails (Unplug cabinet from wall, fuse blows, etc), when the power comes back on, and if the power switch is left in ON position, the PC will fire up. This is the case also if you are working on the PC and decide to shut it down from Windows.

So I came up with this circuit:



Here I use an optoisolator, which is turned on when the power switch is off.
When turning the power switch ON, a capacitor keeps the opto on long enough for CR1 to come on and "seal" around it to keep CR2 on.
Now if power fails for whatever reason, or you shutdown windows from the windows shutdown, the pwer switch must be returned to OFF then back to ON to turn on the cabinet.
It worked great for over a month until I replaced relays and optoisolator with some Logical AND gate chips.

I will post the AHK script im using later.
You can use 5vdc relays but you will have to use the 5vdc from computer power supply, and the "always on" power supply will have to be 5vdc.
I had 12 vdc relays in my junk box so thats what I used.





baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 825
  • Last login:April 04, 2026, 02:36:29 am
Re: PC Smart Switch
« Reply #1 on: October 01, 2025, 01:35:04 am »
There are various solutions to the "problem".
One is adding a small capacitor between the power on line and ground.
The other, even simpler, is using the "power on after power loss" (or whatever itnis called) at BIOS level.
Nice to see circuits, anyway :)

Zebidee

  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3507
  • Last login:Yesterday at 01:28:46 pm
Re: PC Smart Switch
« Reply #2 on: October 01, 2025, 10:09:54 am »
I do this for my cabs using a ~$2 5v relay and a ~$3 momentary power button with built-in LED which lights up a standard power logo/symbol (so you always know if it it powered on).

The power button controls the PC on/off, and the 5v relay is controlled by the PC's power supply via molex. Once the PC comes on, relay trips and power will flow to the rest of the cab (monitor, amp, marquee). You could cut-up an old power board/power strip to plug stuff into, or go all-in and use some terminal blocks for power distribution.

Power comes to the cab via a ~$3-4 PC-style female socket, which means you can use a normal PC power cable (we all have plenty of those) and even remove it as needed (e.g. moving, storing). Socket includes a rocker SPST switch, LED (so you know when it is on) and a fuse.

My family and guests like this setup because it is dead simple and obvious. Press the obvious power button and cab starts up, press it again and cab turns off. As an added bonus, I waste less time explaining how to use the cab.

The cap trick is also handy for getting certain stubborn TVs, and very old PCs (without the BIOS power-on feature), to always come on when power is applied.
« Last Edit: October 01, 2025, 11:05:11 am by Zebidee »
Check out my completed projects!


DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5192
  • Last login:April 08, 2026, 06:31:20 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: PC Smart Switch
« Reply #3 on: January 05, 2026, 06:33:09 pm »
A little update.
I swapped out the relays with a circuit using 1 triple 3 input AND gate chip and a quad inverter chip.
Only using two of inverters.
This is basically doing the same as the relays, just less power draw and a much smaller foot print.
Whats so special abut this idea?
You can use a switch like an original arcade cab. Flip switch on, PC powers up.
Flip switch off and a AHK script is triggered to exit Mala and do a clean shutdown on the PC.
The purpose of the jumper is to power off auxiliaries (monitor, lights, audio amp, etc), either immediately when switch is flipped to OFF. Cab goes dark and pc shutdowns in the background.
Or you can select to control auxiliaries with PC shutdown. (good for troubleshooting any problems you may have and need to watch it shutdown.)
After I built it, I saw where I didnt really need the third 3 input AND gate.

Hope everyone had a good Christmas and a good start to the new year.
One of my resolutions is to start contributing more to this group.



DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5192
  • Last login:April 08, 2026, 06:31:20 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: PC Smart Switch
« Reply #4 on: March 24, 2026, 02:48:28 pm »
Update. This circuit worked exactly like designed, BUT the AHK script it triggers could never issue an ESCAPE command to exit Mame.
I almost gave up several times.
I had an extra RPi Pico and I have a great idea.
Why not have the smart switch instead of triggering P1 left + P1 right to activate the AHK script, why not just have it trigger the Pico to issue the key press commands?
So I did that, it took the AHK script completely out of the picture.
So I programmed the Pico to send an ESCAPE key pressed to the pc, then a few seconds later send a V key pressed. (Im using V to exit mala) Then issue a shutdown command.
That didnt work either.
Mame just refused to exit and the PC would shutdown before Mala came back on screen.
Why am I so intent on doing this, you might ask? Well, I wanted to preserve the old cabinet feel of a toggle switch that you flip up to start the PC, then flip down to shut everything down.
Why worry about shutting down correctly, you might also ask?
Well Windows doesnt like to be shutdown improperly. And if you shutdown before Mala properly exits, the last emulator and game played will not pop up on the next Mala start up.
Looks like Mala saves all that info on a proper exit.
Again, I was about ready to shelve the whole idea. But my OCD would not allow that.
So I came up with another idea, program the Pico to do what my first circuit did, except send signals directly to the push buttons. first ESC then V.
This works like a charm!
Enough of these rambling on.
Here is a diagram of how I interfaced everything to the Pico.
I used opto-isolators to make sure nothing harms the PC of the key board emulator (Keywiz Max.)
I suppose you could use transistors, but I just feel safer with opto-isolators.
I used what i had in my junk box. I like the TIl119, but I thin kit is obsolete now, im sure just about any opto will work, but you may hae to adjust the input resistor values, and dont use the ones that have a base connection on pin6.
I tied the optos to the pins on the motherboard. (Power button and front panel ON Led).
I used a 150 ohm resistor on the PC is ON opto, that output on my PC is current regulated, so a resistor may not be necessary.
Some PC's go into sleep mode and the ON LED blinks, this cannot be used on this circuit. The signal must remain on solid when PC is on.
It can be tied to the 5 VDC power of the PC power supply if desired, but the resistor will need to be 300 or so ohms. I figured I could add a 150 ohm resistor to get 300, if I need to do that, but so far the ON led pins are working great for me.
Anyway, enough of this book.
Here is the schematic of how I wired everything to the Pico.
The Pico is powered by a 5 vdc regulated wall wart, (made for the RPi), that stays on all the time. (Cabinet off, Pico still on.)
I will post the code I wrote for the Pico soon, and maybe some pics of the setup.
Thanks for your attention to this matter.







DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5192
  • Last login:April 08, 2026, 06:31:20 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: PC Smart Switch
« Reply #5 on: March 24, 2026, 03:02:11 pm »
And heres the code I have so far, if I edit it I will post an update.
RPI Pico, using Circuit Python language.

Final UPDATE: (Hopefully anyway).
I changed the code to allow you to use either a maintained toggle like switch or a momentary pushbutton to start and shutdown.
You can use a jumper soldered to the pico to choose which mode without having to open the code.
But i figured why? Just set MODE flag True or False depending on if you use a switch or button.
Theres probably not a reason to have a hardwired jumper that I can think of, but if you want me to post code using the jumper, I can.
Or you can change the code below to use the jumper. (Instructions in the comments #)


This seems to be working great.


Code: [Select]
#Using RPi PICO to start up and shutdown my arcade cabinet. KRR 04/08/2026
#Coded in CircuitPython

import time
import board
import digitalio
from digitalio import DigitalInOut, Direction, Pull

#board led
led = DigitalInOut(board.LED)
led.direction = Direction.OUTPUT
led.value = False

#inputs
#power switch On=LOW
SWITCH = digitalio.DigitalInOut(board.GP3)
SWITCH.direction= Direction.INPUT
SWITCH.pull = Pull.UP

#pc is on input (Low when on)
PCON = digitalio.DigitalInOut(board.GP5)
PCON.direction= Direction.INPUT
PCON.pull = Pull.UP

#outputs
#pc on button
PCSTART= digitalio.DigitalInOut(board.GP4)
PCSTART.direction= Direction.OUTPUT
PCSTART.value=False

#ACC relay
ACCON= digitalio.DigitalInOut(board.GP6)
ACCON.direction= Direction.OUTPUT
ACCON.value=False

#electrically press ESC button
ESCBUTT= digitalio.DigitalInOut(board.GP7)
ESCBUTT.direction= Direction.OUTPUT
ESCBUTT.value=False

#electrically Press front end exit button
FEEXIT= digitalio.DigitalInOut(board.GP8)
FEEXIT.direction= Direction.OUTPUT
FEEXIT.value=False

#if you use a onboard jumper to choose switch or button, Remove the #'s below
#and use GPIO number the jumper is placed on
#you will also need to change all instance of MODE to MODE.value

#jumper to select switch or button
#MODE=digitalio.DigitalInOut(board.GP13)
#MODE.direction= Direction.INPUT
#MODE.pull = Pull.UP

temp_flag=False

#if not using hardware jumper,
#If using momentary pushbutton, MODE=True
#If using maintained switch, MODE=False
MODE=False

time.sleep(0.25)
#MODE can be jumper pins on Pico (GP13 and Ground, Pins 17 & 18) uncomment the assignment above
#or MODE can made high or low here, if you dont use a real-time jumper. Example: MODE=False (or True)

while True:
    if MODE: #momentary pushbutton is used
        if not SWITCH.value: #switch is on
            if PCON.value: #PC is off
                if not temp_flag: #only scan once, in case button is held in
                    led.value=True
                    PCSTART.value=True
                    time.sleep(.25)
                    PCSTART.value=False
                    ACCON.value=True
                    temp_flag=True
            else: #PC is on, shut er down
                PCSTART.value=False
                ACCON.value=False
                led.value=False
                ESCBUTT.value= True
                time.sleep(0.25)
                ESCBUTT.value= False
                time.sleep(1.5)
                FEEXIT.value= True
                time.sleep(0.25)
                FEEXIT.value= False
        else: #switch is off       
            temp_flag=False #reset the flag
        time.sleep(.025)
    else:
        temp_flag=False   
        break

#Maintained switch used
while True:
    if SWITCH.value: break
    led.value=True   
    time.sleep(.25)
    led.value=False
    time.sleep(0.25)
   
while True:
    if not SWITCH.value:
        led.value=True
        ACCON.value=True
        if PCON.value:           
            if not temp_flag:
               PCSTART.value=True
               time.sleep(0.25)
               PCSTART.value=False     
               temp_flag=True       
    else:
        led.value=False       
        if  not PCON.value:
            if temp_flag:
                PCSTART.value=False
                ACCON.value=False
                ESCBUTT.value= True
                time.sleep(0.25)
                ESCBUTT.value= False
                time.sleep(1.5)
                FEEXIT.value= True
                time.sleep(0.25)
                FEEXIT.value= False
        temp_flag=False
    time.sleep(0.5)   

« Last Edit: April 08, 2026, 11:57:46 am by DaOld Man »

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5192
  • Last login:April 08, 2026, 06:31:20 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: PC Smart Switch
« Reply #6 on: March 24, 2026, 03:18:18 pm »
Id also like to add, that I have the option to "shutdown PC when Mala exits" selected, in Mala Options.
If I want to do work on the PC I can plug in a mouse and exit Mala by right clicking then choosing exit.
This does not shut down the PC. Only drawback that unlike my first circuit, turning the switch off will not shut down PC, I will have to shut it down with windows start/shutdown button. The main switch will have to be turned to off then to on to restart the PC.

Also, not in the diagram, I added a jumper on the output leads of the Auxiliary relay opto. The power for this relay comes from PC 12 volt supply.

Auxiliaries are monitor power, marquee light, speaker amp, and the lighted pushbuttons and joystick servos. (Controlled by 12 VDC relay)
If the jumper is installed, all the auxiliaries stay on until the PC shuts down, if jumper is removed, the auxiliaries will go off as soon as the power switch is turned off.

Having this option gives it an original arcade cabinet feel, but allows you to keep everything on for troubleshooting while shutting down, if necessary.
I need to add this jumper to the schematic.
I power my coin door lights off the PC 12 volt supply, so if for whatever reason the PC doesnt shutdown I will know by the coin lights staying on.



DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5192
  • Last login:April 08, 2026, 06:31:20 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: PC Smart Switch
« Reply #7 on: April 06, 2026, 10:22:00 pm »
Here is a pic of pico and interface board mounted and wired up to my cabinet.
I have modified the code to use a momentary button as press on/ press off in place of the maintained toggle switch.
Im thinking of adding a jumper on the pico to choose switch or button.
I havent tested the code yet but will update the post above when it tests good.
In the pic, I didnt label the switch connection to the interface board. Its the blue terminal strip at bottom of board.

« Last Edit: April 06, 2026, 10:24:41 pm by DaOld Man »

Zebidee

  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3507
  • Last login:Yesterday at 01:28:46 pm
Re: PC Smart Switch
« Reply #8 on: April 08, 2026, 07:42:30 am »
My original post was wrong because I missed something, so deleted it.  :dunno
« Last Edit: April 08, 2026, 07:50:43 am by Zebidee »
Check out my completed projects!


DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5192
  • Last login:April 08, 2026, 06:31:20 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: PC Smart Switch
« Reply #9 on: April 08, 2026, 11:48:46 am »
My original post was wrong because I missed something, so deleted it.  :dunno

No prob, want me to delete this post?

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5192
  • Last login:April 08, 2026, 06:31:20 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: PC Smart Switch
« Reply #10 on: April 08, 2026, 12:00:41 pm »
Updated code to use either switch (on/off) or push button (push on release off)
If you use a push button that is maintained (push on push again off), then you will need to select the switch mode.
See the code above.

I have tested it on my cabinet and it works great for me.
« Last Edit: April 08, 2026, 12:03:33 pm by DaOld Man »

Zebidee

  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3507
  • Last login:Yesterday at 01:28:46 pm
Re: PC Smart Switch
« Reply #11 on: April 08, 2026, 05:23:59 pm »
All I was going to say is, make sure to put a reverse-biased diode across the DC input terminals for your relays. I'm guessing it is already there as part of that relay symbol on your diagram, but not sure.

Protects your ICs and other sensitive parts, including the relay coil itself, from high voltage spikes as the EM field collapses (when you turn it off). It will still work and test fine without the diode, but damage will be cumulative.
Check out my completed projects!


DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5192
  • Last login:April 08, 2026, 06:31:20 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: PC Smart Switch
« Reply #12 on: April 08, 2026, 06:25:58 pm »
All I was going to say is, make sure to put a reverse-biased diode across the DC input terminals for your relays. I'm guessing it is already there as part of that relay symbol on your diagram, but not sure.

Protects your ICs and other sensitive parts, including the relay coil itself, from high voltage spikes as the EM field collapses (when you turn it off). It will still work and test fine without the diode, but damage will be cumulative.

Yes. Always! I have the diode across the relay coil terminals. Thanks for bringing that up, it is very important when working with electronics.