Using a transistor as a relay

Discussion in 'General Electronics Chat' started by StealthRT, Jun 12, 2012.

  1. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    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: Jun 12, 2012
  2. panic mode

    Senior Member

    Oct 10, 2011
    1,318
    304
    what are you trying to do and why?
     
  3. panic mode

    Senior Member

    Oct 10, 2011
    1,318
    304
    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?
     
  4. absf

    Senior Member

    Dec 29, 2010
    1,490
    371
    Are you trying to switch on your PC remotely?;)
     
  5. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    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.
     
  6. panic mode

    Senior Member

    Oct 10, 2011
    1,318
    304
    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.
     
  7. panic mode

    Senior Member

    Oct 10, 2011
    1,318
    304
    something like this
     
  8. Wendy

    Moderator

    Mar 24, 2008
    20,764
    2,534
    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.
     
  9. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    alright so this then:
    [​IMG]
     
    Last edited: Jun 14, 2012
  10. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    Updated the image in my previous post to reflect the changes suggested.
     
  11. panic mode

    Senior Member

    Oct 10, 2011
    1,318
    304
    more like:
     
  12. StealthRT

    Thread Starter Active Member

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

    [​IMG]

    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
     
  13. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    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
     
  14. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    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?
     
  15. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    Here is my current hookup:

    [​IMG]
     
  16. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    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.

    [​IMG]
     
  17. StealthRT

    Thread Starter Active Member

    Mar 20, 2009
    223
    0
    Fixed by doing the following:

     
Loading...