# how to use a 3v output to control a 5v relay

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

• Could you draw a schematic of what you are considering? Makes it much easier to answer. Commented Jan 25, 2013 at 13:19
• 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 Commented Jan 25, 2013 at 13:51
• 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. Commented Oct 23, 2017 at 14:56
• I didn't see this was an old post. Sorry. Commented Oct 23, 2017 at 15:34

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

Edited for the hard of goggling:

Transistor can be 2n2222, 2n3904, etc.

• could you expand? Im not sure what you say exactly. Im not strong in electrical terminology. its my first time trying something practically. Commented Jan 25, 2013 at 14:02
• 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. Commented Jan 25, 2013 at 14:51
• @e-r-a-n - I added a picture. This is about the most common way to switch anything using a transistor. Commented Jan 25, 2013 at 15:05
• 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? Commented Jan 25, 2013 at 18:12
• @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. 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:

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.

• Please add a spike suppressor diode, most common place is over the relais coil. Commented Jan 25, 2013 at 13:46
• 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? Commented Jan 25, 2013 at 13:54
• Done, added the diode. Commented Jan 25, 2013 at 13:55
• 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? Commented Jan 26, 2013 at 11:59
• @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. Commented Jan 26, 2013 at 12:04

Have you tried a voltage doubler?

http://en.wikipedia.org/wiki/Voltage_doubler

• a voltage doubler works only with an AC supply, which is likely not what's available here. Commented Jan 25, 2013 at 13:26
• @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... Commented Jan 25, 2013 at 18:22
• @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". Commented Jan 25, 2013 at 18:36
• @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. Commented Jan 25, 2013 at 19:05
• There is an implementation in the WISP project. seattle.intel-research.net/WISP
– Paul
Commented Jan 27, 2013 at 4:47