How do I use a 5V relay with a 3.3V arduino pro mini?

There are an awfull lot of ways to connect a 5V device to a 3.3V output pin.

//edited The original/accepted answer can be found below. This edited part should be an improved version of the original one.

Mind that this answer is for driving relays, if you're going to switch 20VDC at ~3A, a MOSFET will be a better/cheaper solution, as you don't need the relay.

Output pins shouldn't be used to drive anything. Output signals are low current control signals. It is somewhat accepted to drive a LED directly from an output pin (if using a high enough current limiting resistor), but it may lead to problems, since the total current over multiple pins can also be limited by the hardware. For communications, it may sometimes work to use 3.3V since it could be registered as a logical high, but you better not rely on it, for any serious applications.

You can choose a relay that can work with low voltage/low current. Your best bet would be a "solid state relay", since these do not require a coil to be energized and may work on low voltage/current. Check the specs to find one that fits your needs.

Usually, you're ging to power the 3.3V device from something like 5V USB or 9V plug. These sources can often provide the power required to energize the coil of your relay. You will have to make the control signal of your board and switch the "input power" over the coil of your relay. (TODO add diagram, I'm currently unable to, give me 12h)

Mind that some relay breakouts already have circuitry for this. And that your input voltage shouldn't be higher/lower than what the coil is rated for. Your source should be able to supply enough current for the relay.

The coil may "suddenly" take a lot of current, you may see that the voltage on your board drops, or that it resets. Often, the power supply isn't "responsive enough". You can fix this by adding a capacitor to "buffer" the power, so it can be releases at the very moment the coil needs to be energized, and it won't take the power away from the rest of the board.

//end of edit

  1. Just connect it. (The wrong way)**

This might work in some scenario's, but not this scenario. The relay will draw too much current. For connecting a low current data-connection, it can actually work since the 3.3V might be seen as a logic HIGH.

2. The Arduino way.

Buy a TTL Logic Level Shifter - https://www.sparkfun.com/products/12009

This little board will change output 5V, when given 3.3V at the signal in. The only problem, however, is that you will need a 5V on the input of the board.

3. The Electronics way.

You can easily use a transistor or mosfet to switch another (higher) current. This doesn't really differ that much from option 2, but it's a litte more complicated, but cheaper.

4. Another way, like a boss.

Search Stack-Exchange/Google for people with the same problem. I've found that you can actually step up 3.3V to 5V, so that you won't need a 5V supply. https://www.circuitsathome.com/dc-dc/33v-to-5v-dc-dc-converter

5. Workaround

Get a relay that works on your battery voltage and can be triggered from 3.3V. You could consider something like this: http://www.ebay.com/itm/5PCS-3V-3-3V-Relay-High-Level-Driver-Module-optocouple-Relay-Module-for-Arduino-/331413255692

It has an optocoupler, to isolate the arduino from the actual relay. It might be better to get one that actually works on your battery voltage range. So that you can hook it up to the battery (and the signal pin to the Arduino). So the coil isn't activated directly by the arduino, which would draw too much current.

6. Using a 5V supply

You can turn the things around if you really want to. You might want to use an USB-Powerbank (or some self-made/supplied circuitry) for powering your pro mini, the pro mini will be able to take the 5V directly.(https://www.arduino.cc/en/Main/ArduinoBoardProMini)

You can now use the 5V to power your relay using options 2, 3 or 5.


This circuit can solve you problem. I hope it works for 3.3 V supply and 5V relay as well. To explain the reason it works, quote from the linked page:

"This circuit allows a 12v relay to operate on a 6v or 9v supply. Most 12v relays need about 12v to "pull-in" but will "hold" on about 6v. The 220u charges via the 2k2 and bottom diode. When an input above 1.5v is applied to the input of the circuit, both transistors are turned ON and the 5v across the electrolytic causes the negative end of the electro to go below the 0v rail by about 4.5v and this puts about 10v across the relay. "

enter image description here