Latching switch to trigger a dual edge pulse?

Thread Starter

ThatJamieSGuy

Joined Mar 28, 2024
9
Hi all,

I am a mechanical engineer and very limited in my electronics knowledge so please forgive me if this is a fairly simple question for you wizards.

I am working on a hobby project where I'm fitting an Intel NUC into a GameCube case. I want to reuse the GC's original power switch, which is a latching switch, to turn on the NUC.

The datasheet for the NUC shows that to turn on the PC, the POWER\_ON pin must be pulled to GROUND for at least 50ms (and no more than 3s, or it will go into the power button menu) via a momentary normally open SPST switch.

I have a couple of ideas of how to reuse the GC power button:

1. Analogue - GC power switch hooked up to some sort of dual edge detector (RC network maybe? I tried simulating one but could only get it to trigger on close) that, when the switch is closed or opened, generates a pulse. From what I've read, it looks like this may need to be combined with a few things: a NAND gate flip-flop (such as one fashioned from a 74HC00) such that the switch being on/off triggers a change in state of the flip-flop. The flip-flop change in state then (somehow - can't wrap my head around this) triggers a 555 timer one-shot monostable circuit to lengthen the pulse, which then finally drives a relay or a mosfet to give the power header an isolated path to ground. However the circuit is structured, it would either be powered by the 5V USB header or a watch battery.
2. Digital - GC power switch hooked up to an ATtiny85. ATtiny registers when the power switch is opened or closed then outputs a pulse which drives a mosfet/relay. Powered by USB header or watch battery. Sounds a lot simpler but I have no idea what circuitry I'd need to detect the open/closing of the power switch by the Attiny (unless it can determine if there is a short or open circuit between pins?) or how to drive the isolated path to ground switch.
3. Mechanical - Least preferred because this involves just finding a momentary switch that feels similar to the GC one. Part of the reason I am doing this is to learn more about electronics so this feels like a cop out.

Your thoughts would be much appreciated :)
 

MisterBill2

Joined Jan 23, 2018
18,934
It seems like the best choice will be to use a normally open push button. Closure between 50 mS and 3S should be easy. OR did you want something really cool?
 

Thread Starter

ThatJamieSGuy

Joined Mar 28, 2024
9
It seems like the best choice will be to use a normally open push button. Closure between 50 mS and 3S should be easy. OR did you want something really cool?
As I mentioned, I'm determined to reuse the original gamecube power button, despite the added complications. So I'm willing to go down the really cool route ;)
 
Since I don’t know how the Switch is connected I placed it to the ground. On both edges one of optocouplers diode is temporary triggered for time given by capacitors value, so one of optocouplers transistor pull the Power-on pin down.
You may need to solve a SW debouncing a little, but the overall principle should be ok.
 

Attachments

Last edited:

Thread Starter

ThatJamieSGuy

Joined Mar 28, 2024
9
Since I don’t know how the Switch is connected I placed it to the ground. On both edges one of optocouplers diode is temporary triggered for time given by capacitors value, so one of optocouplers transistor pull the Power-on pin down.
You may need to solve a SW debouncing a little, but the overall principle should be ok.
Thanks for the diagram, I really appreciate you taking the time to work this out.

Here is my interpretation of how this works, can you confirm whether I'm correct?

While the switch is closed, 5v is shorted to ground via the 4.7k resistor and the upper capacitor/resistor/optocoupler network. When it closes,
 

Thread Starter

ThatJamieSGuy

Joined Mar 28, 2024
9
Since I don’t know how the Switch is connected I placed it to the ground. On both edges one of optocouplers diode is temporary triggered for time given by capacitors value, so one of optocouplers transistor pull the Power-on pin down.

You may need to solve a SW debouncing a little, but the overall principle should be ok.
Thanks for the diagram, I really appreciate you taking the time to work this out.

Here is my interpretation of how this works, can you confirm whether I'm correct?

While the switch is closed, 5v is shorted to ground via the 4.7k resistor and the upper capacitor/resistor/optocoupler network.

When it is opened, T1 as you've labelled it enables current to pass through. Because of the diode, the current goes through the lower resistor/cap/opto network to ground instead.

At each transition the caps discharge enough current to drive the other side of the optocouplers. When they finish discharging, the voltage isn't high enough to bypass the 1k resistor on the right, so it takes the steady state pathway instead.

I've created a little simulation of this which helped me wrap my head around it. Ive just realised the mosfet inverter isn't strictly necessary as I can just change which pin of the relay is active.

Would you mind sharing in more detail how you chose the values for the resistors and caps? I would be so grateful as you have just solved in a matter of minutes what has taken me 3 days of trying to figure out
 

Attachments

Thread Starter

ThatJamieSGuy

Joined Mar 28, 2024
9
Since I don’t know how the Switch is connected I placed it to the ground. On both edges one of optocouplers diode is temporary triggered for time given by capacitors value, so one of optocouplers transistor pull the Power-on pin down.
You may need to solve a SW debouncing a little, but the overall principle should be ok.
Also apologies for the double message. I accidentally clicked send before I was finished and I can't seem to edit or delete it.

I have spent a couple of hours experimenting with the simulation and have made the following observations but I'm still stuck in some places:

Larger values of R7 make the tail end of the output pulse "sharper", but too high causes it to overshoot. I've found 30k seems to be a good compromise.

R3 and R4 affect the length of the output pulse as the switch opens. R4 and R6 have the same impact but for the pulse as the switch closes. The larger they are, the longer the pulse is but if they're too large they shorten the pulse. What is the reason behind this relationship and what else does the value of each pair affect?

Cap size has the most impact on the output pulse width. As I'm looking for at least 50ms, caps in tbe region of 500u-700u seem to be the sweet spot.

R2 provides enough resistance that when the switch is open, some current is forced to go through the diode instead of straight down to ground. This then activates T1. I presume that the primary driver for the size of R2 is how much power T1 can handle on the gate?

I'm not sure what the function of R1 is. It doesn't seem to affect the output pulse in any way, so I assume it's just to pull some current down to ground when the switch is closed. What does the size of R1 impact?

Also I was wrong about not needing the mosfet inverter. The circuit doesn't function without it...
 

MisterBill2

Joined Jan 23, 2018
18,934
OK, I described on another post, to generate the short pulse using half of a CD 4013 Dual CMOS FF. The button can deliver a trigger pulse to the FF "T" input, the short pulse from the "Q" output, which also feeds a resistor tied to the "reset" input, which also has a small capacitor from "R" to power common. That will provide the suitable short pulse .
 

eetech00

Joined Jun 8, 2013
4,004
This is untested on bench but should work. Designed for supply of 5V.
It uses 3ea SN74HCS86 XOR gates (1 chip has 4 gates).
U1A/U1B is Debouncer/Buffer, U13 is Dual edge detector.
M1 should have VGS(th) less than 2.5v.
Output pulse is ~150ms and adjust with R1/C1.

1712428973438.png
 
ThatJamieSGuy:

You have certainly catch the idea.
The T1,D1 forms a follower, so the caps common point has low impedance agains Vcc and Gnd also. Otherwise without this follower you get low impedance against Gnd only.
The size of resistors around this follower (R1,R2) doesn’t do too much.
For timing the caps size has the most impact.
With R3,R4 resistor you can shape the pulse a little, but anyway the Leds needs about 1mA at least.

The relay buffer can be done/simplified as in attachment.
The push-pull you add works nice in simulation, but bad in reality. Mosfets Vth needs to matched to avoid shot-through, etc…
 

Attachments

Last edited:

Thread Starter

ThatJamieSGuy

Joined Mar 28, 2024
9
This is untested on bench but should work. Designed for supply of 5V.
It uses 3ea SN74HCS86 XOR gates (1 chip has 4 gates).
U1A/U1B is Debouncer/Buffer, U13 is Dual edge detector.
M1 should have VGS(th) less than 2.5v.
Output pulse is ~150ms and adjust with R1/C1.

View attachment 319283
If one chip contains 4 gates, why do you need 3 chips? Or have I misinterpreted...

And I assume you mean U1C is the dual edge detector? Thanks for the schematic I'll have a play and see if I can wrap my head around it.
 

eetech00

Joined Jun 8, 2013
4,004
If one chip contains 4 gates, why do you need 3 chips? Or have I misinterpreted...

And I assume you mean U1C is the dual edge detector? Thanks for the schematic I'll have a play and see if I can wrap my head around it.
A switch debounce circuit is needed since the input is a mechanical switch contact. Hence, U1A/B.
Yes...U1C is the actual dual edge detector.

And...you don't need three chips. Just one chip is needed. U1A,B,C,D are gates in a single chip (U1D is not used).
 

Thread Starter

ThatJamieSGuy

Joined Mar 28, 2024
9
Thanks for the explanation. Just tried your simplified version in simulation and it provides a much cleaner pulse too.

Looks like I have some learning to do regarding followers and mosfets!

1000025490.jpg
 

Thread Starter

ThatJamieSGuy

Joined Mar 28, 2024
9
A switch debounce circuit is needed since the input is a mechanical switch contact. Hence, U1A/B.
Yes...U1C is the actual dual edge detector.

And...you don't need three chips. Just one chip is needed. U1A,B,C,D are gates in a single chip (U1D is not used).
Ah, gotcha. I thought you were suggesting U1A, U1B and U1C were separate chips that contain Debounce/edge detection functionality.

This looks like a much simpler solution than the "more analogue" approach that Michal has proposed. I'll have a look into it
 
Switching the relay requires sharp rising edge only (for switching on) to make a good contact. Sometimes the designers even overdrive the coil for a few ms.
For releasing (switch off) the edge isn’t critical, the only difference is the accumulated coil energy is dumped on transistor (slow release) or snubber diode (fast release).

Btw, I’m still not sure if you need relay at all.
 

Thread Starter

ThatJamieSGuy

Joined Mar 28, 2024
9
Switching the relay requires sharp rising edge only (for switching on) to make a good contact. Sometimes the designers even overdrive the coil for a few ms.
For releasing (switch off) the edge isn’t critical, the only difference is the accumulated coil energy is dumped on transistor (slow release) or snubber diode (fast release).

Btw, I’m still not sure if you need relay at all.
Why wouldn't I need the relay? I want to isolate the Power on->gnd from the rest of the circuit to avoid frying the mainboard because there are no details on the specs of the pins other than it must be connected via a momentary switch.
 
Top