0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ What is the load (voltage, power) controlled by the relay? \$\endgroup\$ – Macit Apr 8 '17 at 11:49
  • \$\begingroup\$ @Majid_L Is that relevant? Most relays I have at hand go up to 250VAC@10A or 30VDC@10A. I would only switch a safe "signal-level" voltage though (12V max). \$\endgroup\$ – orestis Apr 10 '17 at 10:32
  • \$\begingroup\$ I would prefer to choose an adapter with a voltage suitable for my load's voltage. If you are going to drive a 12v motor as an example you had better choose a 12v adapter instead of a 9v one. \$\endgroup\$ – Macit Apr 10 '17 at 12:46
  • \$\begingroup\$ Ah, I see. The load of the relay could be "whatever" in this case. It would not be driven/powered by the control circuit. \$\endgroup\$ – orestis Apr 11 '17 at 12:29
0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Thank you for mentioning latching relays. I will keep the option in mind, though I think for this project a normal relay would work best. It would be mostly off, switching on 2-3 times a day for a minute or so. \$\endgroup\$ – orestis Apr 10 '17 at 10:33
  • \$\begingroup\$ So you confirm that 5V vs 12V relay makes no actual difference? I measured a 5V relay and its current draw is only 70mA so an Arduino should be able to supply that. \$\endgroup\$ – orestis Apr 10 '17 at 10:35
  • \$\begingroup\$ The voltage makes absolutely no difference. If it's 5V and the current is low enough, you just use the Arduino without external circuitry. If it's 12V, you need a transistor that can handle 12V @ 70mA (pretty much any regular transistor: BC547, BC337, BC517, 2N2222) or a (logic-level) MOSFET. Now you do seem to have a problem: you really shouldn't draw >20mA from an Arduino pin for longer than a few seconds. More info here. \$\endgroup\$ – andrejr Apr 10 '17 at 12:19
  • \$\begingroup\$ There are two solutions to your problem: either use an external transistor (or transistor array) or parallel up multiple outputs and switch them at the same time. I'll draw up the 2 schematics. What relay are You using? \$\endgroup\$ – andrejr Apr 10 '17 at 12:29
  • \$\begingroup\$ Wait a minute; you shouldn't need to draw 20mA from an Arduino pin just to switch a BJ transistor, right? At least, not for < 100mA of load... So that shouldn't be a problem. \$\endgroup\$ – orestis Apr 10 '17 at 12:29

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.