Using a transistor as a relay

Thread Starter

StealthRT

Joined Mar 20, 2009
303
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
 
Last edited:

panic mode

Joined Oct 10, 2011
2,746
ok this does not seem to violate any rules.
normal desktop has connector for power button (momentary switch).
normally all button inputs have one side tied to dc ground.
suppose you are using NPN transistor like 2N2222 or whatever,
then emitter would go to low voltage (DC ground) and collector to input.
this would not do anything until transistor is energized,
this is accomplished by adding base resistor and connecting to some voltage.
note, this does NOT provide isolation.

does this answer it or you need more help?
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
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.
 

panic mode

Joined Oct 10, 2011
2,746
you need to put resistor between arduino output and base of transistor. then connect collector and emitter to two wires going to power button. also emitter will need to connect to 0VDC of the arduino.
this is non-isolated connection.


to make isolated connection, use optocoupler like HA11 or similar.
connect one side of optocoupler through resistor to output and dc common of your arduino. connect collector and emitter of the optocoupler to two wires that go to PC power switch. if it does not work, it means polarity is wrong, so just swap the collector and emitter.
do not connect dc common of arduino to pc ground.
 

Wendy

Joined Mar 24, 2008
23,421
There are many cases something like this is practical, without making measurements it is hard to tell. My brother wired up a remote control toy with NPN transistors and it worked fine.

The rules are very simple, it needs to be low voltage DC (not AC). If this is the case, I would suggest giving it a try and see, making sure you have the polarity right. In the case of a NPN, emitter is negative, collector is possitive, and make sure there is a resistor on the base.

It is not a violation of the rules.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Alright correction. This is the type of switch i will be connecting to:



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
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
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
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Well i tested this out and i'm not sure about the setup values.

At both times i get 0v when the 5v port is on (HIGH) or when its off (LOW) using a 330ohm resistor.

At this point it would seem it would turn on the pc even in the off (low) state?

Any ideas?
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
OK im going to switch gears here. I got a 5v relay that i will now be using.

I hooked it up and it triggers the relay closed when the digital output is high. And i have it feeding a gnd to the middle and the output pin on the relay is reading 0v. However when i hook that end up to one side of the switch and the other side to the arduino gnd it does not trigger the motherboard on once the relay is closed.

 
Top