I have some circuit where my board (Electric imp) can output up to 3.3v, and i need to control a relay with atleast 5v in order to effect the coil and close the circuit. i have a power supply of 5v, so i was thinking maybe using a transistor with gate connected to my 3.3v signal, and somehow to control the transistor to push the 5v power supply to the relay.

but how? the only idea i had is making an inverter, wiring 5v to pmos, pmos drain to vout, and also nmos to drain and from there to GND. and then when 3.3v -> vout = 0, and when 0v -> vout = 5v. not exactly 5v, because i i need to know Vsd

  • \$\begingroup\$ Could you draw a schematic of what you are considering? Makes it much easier to answer. \$\endgroup\$
    – zebonaut
    Commented Jan 25, 2013 at 13:19
  • \$\begingroup\$ Yes. The idea is to be able to control a 2.5kW device (water boiler for showers) remotely. I have a board which i can remotely tell to output 0v or 3.3v and i bought a relay link. the idea is mostly as i sketched here link \$\endgroup\$
    – e-r-a-n
    Commented Jan 25, 2013 at 13:51
  • \$\begingroup\$ Don't use BC574 or 2N2222! You said you're controlling a 2.5kW water boiler, this is not a joke. The relay should not be a simple regular relay, and for the sake of safety please use at least a TIP31. Generally speaking, a circuit to digitally control a 2.5 kW device should not be built by a person that still needs to ask in stackexchange about how to link the digital output to the transistor that will drive the relay. Start with something simpler, like a lamp. \$\endgroup\$
    – mguima
    Commented Oct 23, 2017 at 14:56
  • \$\begingroup\$ I didn't see this was an old post. Sorry. \$\endgroup\$
    – mguima
    Commented Oct 23, 2017 at 15:34

3 Answers 3


Surely you can just low-side switch the relay with a regular transistor?

Edited for the hard of goggling:

Low-side switching circuit

Transistor can be 2n2222, 2n3904, etc.

  • \$\begingroup\$ could you expand? Im not sure what you say exactly. Im not strong in electrical terminology. its my first time trying something practically. \$\endgroup\$
    – e-r-a-n
    Commented Jan 25, 2013 at 14:02
  • 3
    \$\begingroup\$ Use a normal NPN transistor to switch the ground leg of the component. So you apply +5v on one end of the relay coil all the time, put the transistor between the other leg and ground, and when the transistor is turned on by your device it conducts and completes the circuit. \$\endgroup\$
    – John U
    Commented Jan 25, 2013 at 14:51
  • 2
    \$\begingroup\$ @e-r-a-n - I added a picture. This is about the most common way to switch anything using a transistor. \$\endgroup\$
    – John U
    Commented Jan 25, 2013 at 15:05
  • 1
    \$\begingroup\$ Thank you, you've been very helpful. So even 5v on coil with no current flow leaves the relay off. I will probably get 2n3904 bjt npn transistor. so my last question is this: Do I need to calculate the voltage drop on the transistor and reach such Vgs,Vds that I will have Vs - Vds = 5v, or once i have 5v on one "top" of the coil, it doesnt matter the voltage on the GND trigger, and the relay will be on? \$\endgroup\$
    – e-r-a-n
    Commented Jan 25, 2013 at 18:12
  • 1
    \$\begingroup\$ @e-r-a-n The coil voltage ratings typically have a fair bit of flexibility - it is rare that a 5 volt coil will not stay on when the voltage across it drops from 5 volts to say 4 Volts, due to V_ce_sat of the transistor being 1 volt, for instance. \$\endgroup\$ Commented Jan 26, 2013 at 12:37

You can drive the relay primary from the 5 Volt source, while switching it using the 3.3 Volt signal, by using an N-MOSFET as a switch:

N-MOSFET switch

The simulation link is here.

The MOSFET you need should have a logic-level input, or a Vgs(th) of well below 3.3 Volts. Look for something with a threshold of 1.5 volts, ideally.

In a pinch, even a 2n7000 should work acceptably, though it might heat up a bit.

  • \$\begingroup\$ Please add a spike suppressor diode, most common place is over the relais coil. \$\endgroup\$ Commented Jan 25, 2013 at 13:46
  • \$\begingroup\$ A diode on the wire to the coil is a must, as ive read there're voltage spikes when turning on/off the relay. the simulator is nice, thanks! I will try to learn it. about the circuit itself: the relay is eventually connected between the power supply & nmos drain. so its directly connected to the power supply. when the transistor is closed, no current flows on the channel. but the relay is connected to the vdd, so isnt it still getting 5v and therefore the relay closes? \$\endgroup\$
    – e-r-a-n
    Commented Jan 25, 2013 at 13:54
  • \$\begingroup\$ Done, added the diode. \$\endgroup\$ Commented Jan 25, 2013 at 13:55
  • \$\begingroup\$ what is the spike suppressor diode for? to protect who? the top of the coil is attached to the power supply, does it needs protection? \$\endgroup\$
    – e-r-a-n
    Commented Jan 26, 2013 at 11:59
  • \$\begingroup\$ @e-r-a-n At turn-off, a large voltage is generated across the coil due to the collapsing magnetic field. The diode shunts this pulse back to the coil, thus protecting the power supply output-side components, and any other components feeding off that supply rail, from a spike. \$\endgroup\$ Commented Jan 26, 2013 at 12:04

Have you tried a voltage doubler?


  • 1
    \$\begingroup\$ a voltage doubler works only with an AC supply, which is likely not what's available here. \$\endgroup\$
    – Phil Frost
    Commented Jan 25, 2013 at 13:26
  • 2
    \$\begingroup\$ @Phil -- (+1 To try to reach 0). A "Voltage Doubler" has nothing to do with AC or DC. It's just a concept. There are AC-AC voltage doublers, AC-DC voltage doublers, DC-DC voltager doublers, DC-AC voltage doublers. If Vout = 2Vin, it's a voltage doubler... \$\endgroup\$ Commented Jan 25, 2013 at 18:22
  • 1
    \$\begingroup\$ @DrFriedParts I suppose you can make that argument, but a DC "voltage doubler" is actually a DC to AC converter, followed by a voltage doubler, followed by an AC to DC converter, and the arrangement is usually called a "charge pump", not a "voltage doubler". \$\endgroup\$
    – Phil Frost
    Commented Jan 25, 2013 at 18:36
  • \$\begingroup\$ @Phil -- I agree with you, but the link the user provided is very clear about the fact that it is describing the broad concept, not a specific implementation or architecture. \$\endgroup\$ Commented Jan 25, 2013 at 19:05
  • \$\begingroup\$ There is an implementation in the WISP project. seattle.intel-research.net/WISP \$\endgroup\$
    – Paul
    Commented Jan 27, 2013 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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