Simulate a Computer Power Switch Button

Hey guys,
First and foremost, my degree of knowledge in electronics is shallow at its best, and thus why I'm asking you guys for help :slight_smile: and thanks :slight_smile:

That said, the problem in hands is somewhat the very basic of electronics, but I just want to validate my idea and the schematics, before I fried my personal computer, and actually try to figure out if this is going to work after all.

So basically I'm simulating the power switch button using an esp8266, the power switch of the computer basically connects common to the input when pressed, and runs on 5V.

A simple schematics that shows the above.
H1 is the power switch of the computer, connected to the esp8266
H2 is connected to the computer, and will act as the simulated switch
R1 & R2 I'm not entirely sure if I need these?

On the code side, I have something like:

#define WOL 20

void setup() {
  Serial.begin(115200);

  pinMode(WOL, INPUT);
}

void loop() {
  if([SOME_EVENT]) {
    pinMode(WOL, OUTPUT);
    digitalWrite(WOL, LOW);
    delay(300);
    pinMode(WOL, INPUT);
  }
}

I will leave comments on the electronics to others, but as to the code, you only need to set the pinMode() once so do it in setup(). Did you perhaps mean to set the output LOW then HIGH when the event is triggered ?

Basically I want to preserve the two methods for powering on the computer, pushing the button, as usual, and sending an EVENT to the esp.
As my understanding that to simulate the power button I only need to short it with the ground, thus why I'm setting the pinMode() to INPUT in the setup, to prevent the computer to turn on immediately, and setting it to OUTPUT when an event has been triggered.
I think if I had this configuration:

#define WOL 20

void setup() {
Serial.begin(115200);

pinMode(WOL, OUTPUT);
}

void loop() {
if([SOME_EVENT]) {
digitalWrite(WOL, HIGH);
delay(300);
digitalWrite(WOL, LOW);
}
}
the pc would turn on as soon as the setup is initialized.

You may not be able to pull low if there's a 2k2 series resistor in there.
R2 is 10.2 ohms? That's what the diagram says!

MarkT:
You may not be able to pull low if there's a 2k2 series resistor in there.
R2 is 10.2 ohms? That's what the diagram says!

I reckon that R2 is redundant, and probably should be removed, but why would the pull down not work?
Sould I use a 1K just to be on the safe side?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.