9
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ Could you draw a schematic of what you are considering? Makes it much easier to answer. \$\endgroup\$ – zebonaut Jan 25 '13 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 Jan 25 '13 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 Oct 23 '17 at 14:56
  • \$\begingroup\$ I didn't see this was an old post. Sorry. \$\endgroup\$ – mguima Oct 23 '17 at 15:34
12
\$\begingroup\$

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.

\$\endgroup\$
  • \$\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 Jan 25 '13 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 Jan 25 '13 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 Jan 25 '13 at 15:05
  • \$\begingroup\$ 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? \$\endgroup\$ – e-r-a-n Jan 25 '13 at 16:00
  • \$\begingroup\$ 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. \$\endgroup\$ – John U Jan 25 '13 at 16:08
12
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Please add a spike suppressor diode, most common place is over the relais coil. \$\endgroup\$ – Wouter van Ooijen Jan 25 '13 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 Jan 25 '13 at 13:54
  • \$\begingroup\$ Done, added the diode. \$\endgroup\$ – Anindo Ghosh Jan 25 '13 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 Jan 26 '13 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\$ – Anindo Ghosh Jan 26 '13 at 12:04
-3
\$\begingroup\$

Have you tried a voltage doubler?

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

\$\endgroup\$
  • 1
    \$\begingroup\$ a voltage doubler works only with an AC supply, which is likely not what's available here. \$\endgroup\$ – Phil Frost Jan 25 '13 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\$ – DrFriedParts Jan 25 '13 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 Jan 25 '13 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\$ – DrFriedParts Jan 25 '13 at 19:05
  • \$\begingroup\$ There is an implementation in the WISP project. seattle.intel-research.net/WISP \$\endgroup\$ – user468662 Jan 27 '13 at 4:47

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.