I need to drive a relay, but my logic signal is limited to 3.3v with a maximum of only 2 mA. Can I use a level shifter? I have a 5V relay with a 125 ohm coil drawing approximately 40 mA. Any other recommendations? Should surge suppression diodes be used? (Using National Instruments VirtualBench digital I/O)

  • \$\begingroup\$ Do you have any other voltage sources available besides the 3.3V? \$\endgroup\$ – Dan Laks Mar 16 '15 at 20:51

Since you only need one channel, something like a ULN2803 is overkill. A single NPN level shifter should work.


simulate this circuit – Schematic created using CircuitLab

But I have to warn you that this is quite possibly marginal. It requires that the transistor be saturated at a gain of about 25, and this is a bit iffy. If the transistor is not quite in saturation, the relay voltage will not be a full 5 volts, and it may not operate reliably. In order to fix this, you might replace the NPN with a small N-type MOSFET with a logic-level gate threshold such as (for instance) a VN0104N3-G. These are available for less than $1.


I had to do this exact thing recently, but in my case I needed to control 8 small relays from 3.3V outputs of a TI chip. So I used a ULN2803, which is an array of 8 darlington transistors, each with built in input resistors and diode protection, to guard against flyback from the relay coils, and each output can drive 500mA. So the 3.3V input can directly feed an input, and the relay coil goes between an output and +5V. If you really only need one, this diagram from the chip data sheet shows how you could make make an individual circuit. But when you consider that some variations of this chip cost only 61¢ at Mouser.com, it almost pays to just get the chip, and leave the other 8 channels for a "future" expansion. ;-)

enter image description here

  • \$\begingroup\$ Okay, but you should mention that the COM pin must be tied to +5 (and with the Darlington the 5V relay won't be seeing anything like 5V). \$\endgroup\$ – Spehro Pefhany Mar 16 '15 at 21:27
  • \$\begingroup\$ "...each output can drive 500mA", please note that the maximum current that each outputs can deliver depends on the number of outputs that are simultaneously in use and the duty cycle. Please refer to electronics.stackexchange.com/a/93083/33841 for the graph of the allowable collector current as a function of duty cycle and number of outputs used (or you can check the device datasheet). \$\endgroup\$ – alexan_e Mar 16 '15 at 21:45
  • \$\begingroup\$ In this case a Darlington arrangement is a better way to go. The second transistor has a better chance of reaching full saturation because of the pre-driver transistor, (so the relay would have a better chance of seeing more of the supply voltage). Even the single transistor circuit above (...Beast) could just have another transistor added to it to create a Darlington setup. \$\endgroup\$ – Nedd Mar 17 '15 at 10:38

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.