Hello,
For a project, i need to detect when the pc shuts down to activate a servo. I know there is USB ports that are always powered, and that there is already some posts that have quite the same question. But I never understood how it was done, so I'm asking here: how can I read the input of a USB port to detect when the pc shuts down, and what cable to use? Thanks
I'm not sure that USB monitoring is a good choice because for example when the computer is stopped it is possible to have power for example to be able to start via a button on the keyboard.
I doubt very much that there is ANY universal indicator that your PC is shutting down.
I plan to have a battery, so it's not a big problem, but I was wondering, is it possible to detect when the pc shuts down by using the power pins, since I will have a battery to execute the code? And I also need to power on the pc, but I think testing if a button is pressed and if yes, sending a high input on a pin will work?
You could monitor its current with an isolated sensor such as a current clamp.
Maybe if you monitor if the power LED lights up by measuring its voltage. If you mount the microcontroller in the computer case, you probably won't need a battery because the ATX according to the specification provides a standby 5 volts of at least 1.5 amps if I'm not mistaken. You can use it to power the microcontroller and if you monitor any of the other voltages you should be able to tell if the computer is running or off.
If you want to get into the wiring of the computer the power supply supply's a "power good" signal and the cable for the drives will power down.
To detect whether a computer is running properly, most people program it to send a periodic "I'm OK" signal to an external, independent device.
Failure to receive that signal within a timeout period is a sign that something is wrong.
Arduinos have that feature built in, called a watchdog timer. It can reboot the Arduino if a periodic signal is not received from the running program.
I'd check the signals available on any I/O ports to see if there's a signal that's active when PC is on and goes inactive when PC is off.
.02
I want a non destructive way to do it, because, first I'm afraid to broke my pc and I'm not sure I can do it correctly
I'll try that thank you
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.