barna.deji
Posts: 4
Joined: Fri Apr 20, 2018 2:00 pm

Read PC motherboard led status

Fri Apr 20, 2018 2:05 pm

Hello,

I managed to use a 4n35 optocupler to shutdown/turn on my pc from raspberry, but now I would like to read the status of the power led. Like this I would want to be sure that the PC was turned off and then I can turn it on.

I have red the topics here, but couldn't find one helping in my project.

pcmanbob
Posts: 9610
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Read PC motherboard led status

Fri Apr 20, 2018 3:55 pm

You could use the same 4N35 opto isolator you used before , but this time use the PC on indicator LED circuit to drive the led in the opto isolator and use the transistor output to switch gpio input high or low. If you need help with the circuit I can draw one up for you.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

barna.deji
Posts: 4
Joined: Fri Apr 20, 2018 2:00 pm

Re: Read PC motherboard led status

Fri Apr 20, 2018 5:45 pm

Thank you! I would highly appreciate that.

pcmanbob
Posts: 9610
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Read PC motherboard led status

Fri Apr 20, 2018 7:18 pm

So having checked a couple of spare PC cases there are no resistors in the wiring between the motherboard and the on indicator LED, So I think we can assume that current limiting is done on the motherboard, but you might want to check you specific PC just to be sure.

Image

So you will need to disconnect the existing LED form the mother board and replace it with this circuit using a 4N35 opto isolator.

So when connected if your PC is on you will have a HIGH on the GPIO input and when the PC is off you will have a LOW on the GPIO input.

The 1K resistor is there to protect you GPIO should you accidentally set it as an output.
The 10K resistor is pulling your GPIO input down to ground when your PC is off.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

barna.deji
Posts: 4
Joined: Fri Apr 20, 2018 2:00 pm

Re: Read PC motherboard led status

Fri Apr 20, 2018 7:26 pm

Great! Thanks a lot for the diagram and for the explanation.

Next week I will start building the board and post the pictures.

Just a quick question more. If I would like to have more then one 4n35 can I use a common ground for all of them or each optocupler has to have it's own ground pin on raspberry?

User avatar
thagrol
Posts: 3178
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Read PC motherboard led status

Sat Apr 21, 2018 12:35 pm

If you just want to know whether the PSU is on rather than in stand by, tap the 3.3v line of the motherboard power connector and feed it to a gpio via a current limiting resistor. It'll show a high when the PSU is on, low otherwise

No need for optocouplers and no impact to case LEDs.

Edit: see the full project where I did this here: https://github.com/thagrol/fakewake
Arguing with strangers on the internet since 1993.

barna.deji
Posts: 4
Joined: Fri Apr 20, 2018 2:00 pm

Re: Read PC motherboard led status

Tue May 01, 2018 2:34 pm

thagrol,

This allows me to control 1 PC, but I need to control as many as I can form 1 raspberry.

User avatar
thagrol
Posts: 3178
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Read PC motherboard led status

Tue May 01, 2018 3:23 pm

barna.deji wrote:
Tue May 01, 2018 2:34 pm
thagrol,

This allows me to control 1 PC, but I need to control as many as I can form 1 raspberry.
You're not going to be able to do that without a lot of additional wiringi. Regardless of how you detect whether the PSU is off, you'll need to run at least three wires from each PC back to your PI: ground, power sense, and one to trigger your power switch opto circuit.

For a multiple PCs from one Pi system I'd go with a network based approach:
  • Use WoL to wake the PCs. WoL packets are ignored if the PC is already up so no need to test for PSU/LED state before sending
  • If you need to know that a PC is up, use "ping". No reply = off or crashed
  • Have a small daemon running on each PC to listen for a shutdown command and act on it.
  • Again, use ping to check it has shutdown.
I know ping won't tell you the actual state of the PSU, just whether the OS is responding but monitoring the LED won't tell you what the OS is doing either.
Arguing with strangers on the internet since 1993.

Return to “Other projects”