Using a transistor as a relay

StealthRT

Sep 4, 2010
147
Joined
Sep 4, 2010
Messages
147
Is there anyway i can use a transistor in place of a relay in order to turn on the power switch to my PC?

Any help would be great!

David
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
Maybe, depends on the current required...

Are you talking about the main power switch where it plugs into the mains around back? Or are you talking about the soft power on switch upfront the WOL (Wake-up On Lan) switch that just wakes up the power supply?

ATX power supplies are always on unless you cut the mains power, they supply a minimal current 5 volts to the motherboard all the time, this allows the motherboard to tell them when it's time to wake up and power up everything else, or you can jump start it with the front push button...
 
Last edited:

StealthRT

Sep 4, 2010
147
Joined
Sep 4, 2010
Messages
147
Maybe, depends on the current required...

Are you talking about the main power switch where it plugs into the mains around back? Or are you talking about the soft power on switch upfront the WOL (Wake-up On Lan) switch that just wakes up the power supply?

ATX power supplies are always on unless you cut the mains power, they supply a minimal current 5 volts to the motherboard all the time, this allows the motherboard to tell them when it's time to wake up and power up everything else, or you can jump start it with the front push button...

Its the soft power on cable (the one going to the motherboard PW pins). Just looking for something to act as a momentary switch for it to be turned on or off without the need for a relay to do it.
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
The ATX only supplies the motherboard with 5 volts @ 750mA so a common transistor would be fine, but you would have to share a common ground...

A better option might be an optocoupler so you isolate your on/off circuit from the motherboard entirely...
 

StealthRT

Sep 4, 2010
147
Joined
Sep 4, 2010
Messages
147
The ATX only supplies the motherboard with 5 volts @ 750mA so a common transistor would be fine, but you would have to share a common ground...

A better option might be an optocoupler so you isolate your on/off circuit from the motherboard entirely...

Sorry maybe this will help: I am planing on using an arduino digital pin out to the transistor to act as a switch whenever i touch a touch sensor. Since the digital pin has an output of 5v to the base of the transistor i just needed to know how to use the Emitter and Collector.
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
What I said above still applies, your Arduino and the computer will need to share a common ground if you use a transistor... You need to bring the WOL pin low to turn on the computer and to do that with a transistor you will need to share ground... If you use a optocoupler you will not have to worry about any of that...
 

StealthRT

Sep 4, 2010
147
Joined
Sep 4, 2010
Messages
147
What I said above still applies, your Arduino and the computer will need to share a common ground if you use a transistor... You need to bring the WOL pin low to turn on the computer and to do that with a transistor you will need to share ground... If you use a optocoupler you will not have to worry about any of that...

Would there be any way to show me what all need to be hooked up to the E/C and B of the PNP 2222 transistor?
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
A 2N2222 is an NPN transistor not a PNP transistor, it makes a difference!

First you need to take the two WOL lines at the front of the computer or the motheboard and determine what one is GND and what one is signal... Should be as simple as using a volt meter, the signal line should be positive at+ 5 volts (possibly 3.3) and the GND will be ground aka negative... Any volt meter will tell you what is positive and negative, if it reads a negative value flip the test probes around...

See attached, it should work... A momentary high signal from the Arduino should turn on the computer...
 

Attachments

  • npn.jpg
    npn.jpg
    9.4 KB · Views: 457
Last edited:

StealthRT

Sep 4, 2010
147
Joined
Sep 4, 2010
Messages
147
A 2N2222 is an NPN transistor not a PNP transistor, it makes a difference!

First you need to take the two WOL lines at the front of the computer or the motheboard and determine what one is GND and what one is signal... Should be as simple as using a volt meter, the signal line should be positive at+ 5 volts (possibly 3.3) and the GND will be ground aka negative... Any volt meter will tell you what is positive and negative, if it reads a negative value flip the test probes around...

See attached, it should work... A momentary high signal from the Arduino should turn on the computer...


Who wire do i connect to the C? The positive or negative from the power switch on the PC?
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
The Computer WOL Signal, the positive one... The negative is ground and should be connected common with ground just like the picture shows...
 

weird_dave

May 9, 2012
36
Joined
May 9, 2012
Messages
36
I'd simplify the circuit by removing a component, the Arduino, it really isn't required (or even useful) for what you have described.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I'd simplify the circuit by removing a component, the Arduino, it really isn't required (or even useful) for what you have described.
Yes, it could be replaced by an Intel Core i7 :)


Bob
 

StealthRT

Sep 4, 2010
147
Joined
Sep 4, 2010
Messages
147
I'd simplify the circuit by removing a component, the Arduino, it really isn't required (or even useful) for what you have described.

I have more things to Arduino will do other than turn the PC on or off. I have a program that has a menu and i will be using a thumbstick to navigate in it using the com of the Arduino to move it. etc etc.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I have more things to Arduino will do other than turn the PC on or off. I have a program that has a menu and i will be using a thumbstick to navigate in it using the com of the Arduino to move it. etc etc.
Yeah, but it still could be replaced by and Intel Core i7. (disclaimer: I work for Intel)

Bob
 

StealthRT

Sep 4, 2010
147
Joined
Sep 4, 2010
Messages
147
Alright so this:
android-powersbutton.jpg
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
That appears correct from what I see, double check your transistor datasheet and use the correct company when checking the datasheet, believe it or not for whatever reason (especially in Radio Shack repacks or cross referenced or rebadged parts) the pin out on the transistor might be swapped around... Not a regular occurrence but, I have seen it...

You might also want to verify the negative from the PC connection, if you are using a strip board like that, where you have it connected might not be common across the break line right under the 'n' in 'Arduino Analog'

And mind that it's not the PC +5 volt line you are connecting to, its the WOL signal line that is almost certainly held high with a weak pull up...
 

StealthRT

Sep 4, 2010
147
Joined
Sep 4, 2010
Messages
147
Alright correction. This is the type of switch i will be connecting to:

boards.jpg


When i connect those points shown in the picture together the PC starts up. Holding the wire on them for a couple seconds turns it right back off.

Would the same setup be needed for this as well?

David
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
Can't say on the new one, it might be high or low logic that turns it on, I was able to give you help with the last one because ATX specifications are documented and universal... When you get into proprietary systems more testing is needed...
 

StealthRT

Sep 4, 2010
147
Joined
Sep 4, 2010
Messages
147
Can't say on the new one, it might be high or low logic that turns it on, I was able to give you help with the last one because ATX specifications are documented and universal... When you get into proprietary systems more testing is needed...

I just checked with a voltmeter those 2 points. When the motherboard is OFF it reads around 2.96v (So i'm going to call that 3v) and when i push the button down it goes to 0v. Releasing the button makes it go back to 2.96v (3v).

David
 
Top