10

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

e-r-a-n
  • 227
  • 1
  • 2
  • 10
  • Could you draw a schematic of what you are considering? Makes it much easier to answer. – zebonaut Jan 25 '13 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](http://www.ebay.com/itm/Power-Relay-Module-30A-Appliance-Control-Current-Spreading-Arduino-12V24V-T90-/130823499870?_trksid=p5197.m1992&_trkparms=aid%3D111000%26algo%3DREC.CURRENT%26ao%3D1%26asc%3D14%26meid%3D5124765611530834146%26pid%3D100015%26prg%3D1006%26rk%3D1%26sd%3D130823499870%26). the idea is mostly as i sketched here [link](http://img811.imageshack.us/img811/836/screenshot20130125at349.png) – e-r-a-n Jan 25 '13 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. – mguima Oct 23 '17 at 14:56
  • I didn't see this was an old post. Sorry. – mguima Oct 23 '17 at 15:34

3 Answers3

13

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.

John U
  • 7,041
  • 2
  • 21
  • 34
  • could you expand? Im not sure what you say exactly. Im not strong in electrical terminology. its my first time trying something practically. – e-r-a-n Jan 25 '13 at 14:02
  • 3
    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. – John U Jan 25 '13 at 14:51
  • 2
    @e-r-a-n - I added a picture. This is about the most common way to switch anything using a transistor. – John U Jan 25 '13 at 15:05
  • thanks, I have few questions i hope its ok. I havent used relays before. My relay should have i/o: GND,VIN,VOUT,VCOIL. Vcoil is my constant 5v and the ground is the collector, So if the ground is not attached(since the bjt is closed), even with 5v at vcoil, the relay wont work? does it matter bjt or nmos for this argument? When the datasheet says 5V control signal, it means VCoil - Vgnd, yes? Do I need to take into consideration the voltage drop on the transistor? BTW, it reminds me a little CS Amplifier, isnt it? – e-r-a-n Jan 25 '13 at 16:00
  • The names of the relay terminals may vary. If there is 5v on "top" of the coil and the transistor is off, then there will be no current flow and there will be 5v on the bottom of the coil too (ohm's law). This setup is applicable to other similar devices (FET etc.) but they will have different parameters & design considerations, as would different transistors. – John U Jan 25 '13 at 16:08
  • Anindo's answer above shows the same principle using a MOSFET, I assume he's taken into account the characteristics of the device. – John U Jan 25 '13 at 16:09
  • 1
    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? – e-r-a-n Jan 25 '13 at 18:12
  • 1
    @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. – Anindo Ghosh Jan 26 '13 at 12:37
  • Ok, so i guess its just a test on the go thing, who knows maybe 3.3v from my board will be enough. anyway, since Vce(sat)=1v, i might just boost the voltage a little from 5v to 6-7v, in case its needed. Thank you for your help – e-r-a-n Jan 26 '13 at 14:28
  • I am using this 5V relay http://wiki.iteadstudio.com/5V_Relay connected to an arduino, I did connected it to a 3.3V output and it works :) my question is if it could get damaged if I leave it working with less voltage ?? thanks – Nehemias Herrera Sep 25 '15 at 17:31
  • Can i use bc547 instead of 2n222? I have the same problem: control 5v or 12v with 3.3v but with an additional requirement: base-emitter current must be below 10mA. – nagylzs Dec 29 '15 at 19:50
  • It's a very basic transistor circuit that you can find all the parameters for by a quick use of google and a skim of the transistor data. Or you could go super advanced and use a FET. – John U Jan 04 '16 at 18:07
  • 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. – mguima Oct 23 '17 at 14:54
  • I didn't see this was an old post. Sorry. – mguima Oct 23 '17 at 15:34
  • @JohnU how can we calculate resistance values? – Varun Jul 02 '21 at 16:12
  • @e-r-a-n - were you able to solve the problem.. i too am stuck on same issue – Varun Jul 02 '21 at 16:12
12

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.

Anindo Ghosh
  • 50,188
  • 8
  • 103
  • 200
  • Please add a spike suppressor diode, most common place is over the relais coil. – Wouter van Ooijen Jan 25 '13 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? – e-r-a-n Jan 25 '13 at 13:54
  • Done, added the diode. – Anindo Ghosh Jan 25 '13 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? – e-r-a-n Jan 26 '13 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. – Anindo Ghosh Jan 26 '13 at 12:04
  • If my board is attached directly to the coil giving it enough voltage to power on/off, Should I wire the diode in parallel or serial? here a [sketch](http://img441.imageshack.us/img441/3555/screenshot20130126at543.png) From the posts here i would say option2 is the way, but isnt the meaning of the diode is allowing current only in one direction, thus in serial between the board & relay, it will make no spikes go back to the board? – e-r-a-n Jan 26 '13 at 15:45
  • @e-r-a-n Option 2 is the right way, and is what my schematic shows as well... The diode in this arrangement does not just prevent a backwash, as per your description of Option 1 - In Option 2 the diode actually acts as a shunt allowing the coil energy to be short-circuited back to the coil, to dissipate internally. – Anindo Ghosh Jan 26 '13 at 16:02
-3

Have you tried a voltage doubler?

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

Paul
  • 379
  • 2
  • 8
  • 1
    a voltage doubler works only with an AC supply, which is likely not what's available here. – Phil Frost Jan 25 '13 at 13:26
  • 2
    @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... – DrFriedParts Jan 25 '13 at 18:22
  • 1
    @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". – Phil Frost Jan 25 '13 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. – DrFriedParts Jan 25 '13 at 19:05
  • There is an implementation in the WISP project. http://www.seattle.intel-research.net/WISP/ – Paul Jan 27 '13 at 04:47
  • -1 for link-only answer. – Anindo Ghosh Nov 11 '13 at 17:40