If you only know that, then you need extra components.
BUT, connect one end of your DMM to a random GND point of the PC and the other end to the switch while pressed (doesn't matter witch pin because the switch connects both of course). Do you read 5V or 0V?
I suspect 0V. If so, the 5V line is just pulled up and thus the real switch input. If you power that Arduino from the same PC OR use a separate isolated supply (like a phone charger) of which you connect the GND to the GND of the PC (can be the 0v line of the switch) you can connect the other pin to any IO pin of the Arduino. Although I would only let it FLOAT (pinMode(pin, INPUT)) for not pressed or pull it LOW* for pressed.
If you read 5V, the 0V line is pulled down and thus the real switch input. For that to work you can do the above but you would need a real GND point and you need to drive the pin FLOAT / HIGH.
If you only use pinMode(pin, INPUT) and want a driving LOW, all you need to do is call pinMode(pin, OUTPUT)
Meh, I would say a logic level fet only makes things more complicated. You still need to figure out if you need N or P and I doubt you need it for the current.
If you want simple (as in, no measuring), grab an opto (like the PC817).
Hi,
Do you know that if you have your arduino turning the power supply off, the arduino will need to open circuit the existing ON/OFF button is part of.
Do you realize that when you open the circuit, the arduino will have to keep the circuit open.
If power is disconnected from the Arduino, the computer will turn back on.
Draw a circuit showing how you want to switch the ON/OFF button system please.
Can you please tell us your electronics, programming, Arduino, hardware experience?
@mikechale, yes. Because a relay can cause problems of it's own, especial in a PC. If you really don't want to measure anything more, like I said, a opto will do fine. And it's like 100x smaller then a relay. And second, I think that would kind of be a ass move. First ask for help but after we tell you some basic stuff, just ditch everything.
And two footnotes
I would not shut down the PC but put it in hibernate. It would really suck if you lost work because of it.
Be sure not to activate the "button" to long. >5 seconds will cause a hard shutdown of the PC which your OS does not like.
No idea about gcafepro, no idea what it is. I was just thinking normal desktop.
And what I suspected. Just pull the line low from an Arduino (don't forget to make a common GND if you use a different supply than the PC itself!) and your done.
A relay is the ideal way to operate the shutdown or reset buttons as it provides safe isolation from the PC workings . It won’t cause any issues with the PC operating .
Only get involved in this stuff if you know what you are doing .
Cathode of the opto to GND. Anode via a +-470Ω resistor to an Arduino pin. Emitter and Collector to the header where you connect the power switch. If it doesn't work, switch Emitter and Collector.
This is what i'm doing with my ups, the relay just triggered 2 time, wake & shutdown.
without any timer, you just need put some delay to make interval relay become NC then NO again.