Electrical – Choosing external adapter voltage to power Arduino & Relay

arduinopowerpower supplyrelayvoltage-regulator

I am designing a simple Arduino Nano-based circuit that will control a relay. The constraint is that it's going to run unattended, in a sealed box, for many days/weeks/months. So I'm worried about about choosing a power supply and how to power both Arduino Nano and the relay from it, with regards to longevity/heat.

Additionally, I want to use an external power transformer to keep the circuit at a low voltage, and I would like to use a relay module with all the necessary circuitry to be controlled via Arduino.

I can think of the following options:

1) Use 9V adapter, 5V relay, power the Arduino through its unregulated input pin with 9V, power relay through the Arduino 5V output pin.

2) Use 12V adapter, 12V relay, power relay directly from Vin, power Arduino with 12V through its unregulated power supply input pin.

3) Use 12V adapter, 12V relay, power relay directly from Vin, use a step-down converter to get 7V into Arduino's unregulated power supply input pin.

Option 1: I'm not sure though about the relay module's power requirements when powering through Arduino.

Option 2: 12V is at the upper limit of what the on-board linear regulator can handle.

Option 3: Extra components, but potentially more safe/stable?

As a sub-question, how can I source a decent power supply with a nice, regulated output? Do I care about "noise"? Should I get a switching supply or a transformer-based one? I need them to have "plugs" for easier installation and some semblance of electrical code compliance.

Best Answer

tl;dr 9V or 5V adapter, Arduino powers a 5V latching relay

If the load isn't going to be switched very frequently, you should go with a latching relay. Actually, the only proper use for a non latching relay is in a device that switches to one state (on or off) occasionally, for short periods of time. If the device isn't switched more frequently than once in a couple of seconds, go with a latching relay.

If you use a single-winding latching relay, you can connect its coil to 2 digital outputs and set them to input-high-impedance when the relay is in a stable state. When you want the relay to switch over to one position, you pulse one of its coil pins with high, and the other with low for several milliseconds (look at the datasheet). If you want the relay to switch the other way, you do the opposite - pulse the other one high, and the first one low.

The actuation voltage has nothing to do with the voltage or power that goes through a relay. There are no advantages to using a 12V relay, and you'd need an external driver for it (or at least a transistor / darlington pair). The solution I proposed above, with a 5V latching relay, is optimal. Just put two diodes in reverse parallel across the coil to prevent collapsing-magnetic-field-induced voltage spikes from damaging your Arduino.