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 43150 times)

0 Members and 4 Guests are viewing this topic.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5188
  • Last login:March 28, 2026, 08:06:45 am
  • 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:Today at 01:45:00 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: 3505
  • Last login:Today at 06:25:13 am
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: 5188
  • Last login:March 28, 2026, 08:06:45 am
  • 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: 5188
  • Last login:March 28, 2026, 08:06:45 am
  • 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: 5188
  • Last login:March 28, 2026, 08:06:45 am
  • 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.

Code: [Select]
#attempt to have a shutdown system that works. 03/18/1026
#Author: KRR

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 start
PCSTART= digitalio.DigitalInOut(board.GP4)
PCSTART.direction= Direction.OUTPUT
PCSTART.value=False

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

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

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


temp_flag=False
while True:
  if SWITCH.value: break
  time.sleep(.25)
   
def pcstart():
   
   if PCON.value:
     global temp_flag
     if not temp_flag:PCSTART.value=True
     time.sleep(0.25)
     PCSTART.value=False     
     temp_flag=True
   
def pcoff():
     PCSTART.value=False)
     ACCON.value=False
     ESCBUTT.value= True
     time.sleep(0.25)
     ESCBUTT.value= False
     time.sleep(1)
     FEEXIT.value= True
     time.sleep(0.25)
     FEEXIT.value= False
     global temp_flag
     temp_flag=False
     while True:
      if PCON.value: break
      time.sleep(0.10)
     alloff()   


def alloff():
     PCSTART.value=False
     ACCON.value=False
     ESCBUTT.value= False
     FEEXIT.value= False
     temp_flag= False

while True:
   #PCSTART.value=False
   if  not SWITCH.value:
     if not temp_flag:pcstart()
     led.value=True
     ACCON.value=True
   else:
     led.value=False 
     if not PCON.value:
       if temp_flag: pcoff()
     else:
       ACCON.value=False
       temp_flag= False
   time.sleep(0.5)   
   

« Last Edit: March 24, 2026, 03:59:17 pm by DaOld Man »

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5188
  • Last login:March 28, 2026, 08:06:45 am
  • 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.