I'm looking for some advice on what type of relay I should use for my circuit.

I have a 5v power supply and I want it to act just like a switch. I will be controlling it with an Arduino like described here: http://tronixstuff.wordpress.com/2010/04/20/getting-started-with-arduino-chapter-three/

  • 1
    \$\begingroup\$ What voltage/power do you want to switch? \$\endgroup\$ – stevenvh Aug 6 '12 at 13:18

The right relay depends on what you want to switch and how fast. What voltage, current, etc...

You won't be able to drive it directly from the Arduino pin, as most general purpose relays require at least 150mW to switch which is >30mA @ 5V. You will need to use something like this:

Relay driver

The NPN can be just about any general purpose NPN (2N2222, BC337, etc) and the diode can be most general purpose diodes (1N4001 or similar) VCC is your +5V.

If you go to somewhere like Farnell, and use the parametric search to narrow down you options, you will get hundreds of choices, here is an example search with 5VDC general purpose relays capable of >10A and >250VAC selected.


It seems this is to turn an ATX supply on by pulling the PC_ON (usually green) connection to ground. In this case the relay is a bit overkill, and a simple open collector NPN transistor circuit can be used:

PC On transistor circuit

The dotted area is inside the PC, so all you need is the NPN transistor (almost any general purpose will do) and the resistor (4.7kOhm is shown, but depending on the transistor gain, R1 can be between say, 50kOhm and 1kOhm - between 1kOhm and 10kOhm should work with just about anything though)
The R_pullup of 1kOhm is assuming about the worst case - it will probably be between 2kOhm and 10kOhm. The circuit as shown would work with a pullup down to around 100 ohms though if needed.

  • \$\begingroup\$ the thing im switching on is a atx computer PSU, to turn it on you just bridge a certain wire to a ground wire, a relay could do this yes? \$\endgroup\$ – Lewis Denny Aug 6 '12 at 13:45
  • \$\begingroup\$ Yes, a relay could do this. If you are referring to the green power on signal connection, since the current is very low you could do this with just the transistor itself (the Arduino would not be isolated from the ATX in this case, but that may not be an issue) \$\endgroup\$ – Oli Glaser Aug 6 '12 at 14:26
  • \$\begingroup\$ The ATX 2.2 spec does not give a value for the pullup resistor, only that it is attached to +5V (see page 21). It's probably safish to assume it's not less than 1k, which would give 5V / 1kOhm = 5mA max. Since it's pulled up to +5V, at 5mA you could drive it from the Arduino pin, but I'd use the transistor (or relay if you want to have things isolated) anyway just in case. \$\endgroup\$ – Oli Glaser Aug 6 '12 at 14:39
  • \$\begingroup\$ So would a transistor be just as safe as a relay, it's not like there will be any power surges though the line or anything \$\endgroup\$ – Lewis Denny Aug 6 '12 at 21:25
  • 1
    \$\begingroup\$ Yes the transistor will be perfectly safe to handle this, the only difference is the relay would provide isolation between the Arduino and the ATX, but if you don't need that then use the transistor. The ATX outputs are isolated (from the HV mains side by a transformer) anyway. In fact if you did need isolation, you would be better to use an optocoupler anyway for such a small load, the relay would be overkill. \$\endgroup\$ – Oli Glaser Aug 6 '12 at 21:35

To select the right relay you'll have to tell us what load you want to switch.

Anyway, for a 5 V power supply you'll need a 5 V relay. A relay usually needs a few hundreds of mW to switch, and at 5 V this means something like 70 to 90 mA. That's much more than an Arduino I/O can supply, so you'll need a transistor to amplify the output current.

enter image description here

Read "+12 V" as "+5 V". The 1 kΩ resistor will give you 4 mA base current, and then any small signal NPN transistor will give you enough output current, for instance a BC547 will do. For diode D1 you can use a 1N4148.


If you are using PS_ON, I'd use an optocoupler instead if a transistor, especially if the PSU is old.

  • 1
    \$\begingroup\$ It's worth expanding this answer a bit to explain why the optocoupler is a good idea. At the moment it reads a bit more like a comment on Oli's answer. \$\endgroup\$ – PeterJ May 11 '14 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.