Go Down

Topic: Arduino, Relays and separate power supplies (Read 2860 times) previous topic - next topic

jcollin

Hi,

I am trying to design a wireless relay switch to automate appliance or lamps running on 230 V AC. In the examples I found on internet, one recurring advice is to have separated power supplies and ground for the arduino on one hand and for the relay on the other hand.
This implies that I should have for example a 12 V DC power supply for the arduino and wireless module plugged in the wall and another 12v DC power supply for the relay.

Now, if you look at commercial home automation modules, e.g: X10 modules, they never have a separate power supply, they even get their load from the main they are supposed to switch on and off.

Does anyone know how they do it? It would really help me as I would like later on to build this module based on a standalone atmega 328 and this would be a real burden to have to plug it twice.

Thank you in advance,
Jerome

dc42

It is entirely possible to use the same power supply for both the Arduino and the relay, provided you are careful with the wiring layout. The bigger problem is to prevent the transients caused when the relay switches the load on or off from interfering with the Arduino.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

joe mcd

I assume your are using solid-state opto-isolated relays.  Please!!!
Do not let 230vac anywhere near the Arduino.
Solid state relays generate little noise, essentially none if they are zero-crossing.
I see no problem if you a following this path.  1 12v wall wart will suffice.

jcollin

Thanks for your answers.

At the moment, I did not pick up any relay yet. I am still investigating the best solution.

So, thanks to you, I know I have to properly isolate the arduino from the relay and that I have to choose Solid State Relays.

I will start from this schema : http://playground.arduino.cc/uploads/Learning/relays.pdf

I will make use of an opto-isolator between the arduino and the NPN transistor that will drive the relay so the arduino will be isolated on that side. On the other side, the flywheel diode should be sufficient to allow the dissipation of the EMF current through the coil so it will not blow the transistor or goes back through V+ (if this is possible).

Do you a bias in my reasoning of something I am overlooking?

Thank you for your help.

Jérome

dc42

There are two types of relays: mechanical relays, and solid state relays. Both provide isolation between the control circuit (connected to the Arduino) and the load (connected to the mains). You do not need additional isolation. However, when using either type of relay, you need to keep the wiring to the switched side away from the wiring to the control side.

Both types of relay have advantages and disadvantages. The solid state relay has the advantage that it needs very little current to activate it, so it can be driven directly from a Arduino pin. One disadvantage is that it leaks a small amount of current through to the load when it is supposed to be off. So don't use it to switch modern types of lighting (i.e. mains-powered LED or CFL). Another disadvantage is that an SSR that is passing a lot of current needs a heatsink.

The mechanical relay does not leak, and does not need a heatsink. However, a mechanical relay capable of switching mains-powered devices cannot be driven directly from an Arduino, because the coil needs too much current. So you need to drive it via a transistor, as in the schematic you linked to. Another disadvantage is that depending on the load you use to to switch, you may get arcing between the contacts (causing them to fail eventually) and it may generate interference. Connecting a snubber network across the relay contacts may alleviate both of these.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

jcollin

Thank you for your quick answer.

It is very helpful, I learned a lot in a few hours and lots of my concerns have been answered. So I am now going for mechanical relays and I will have a look at how to build a snubber network to avoid arcing between the contacts.

Thanks again.

Jerome

michael--g


Another disadvantage [of "normal" relays] is that depending on the load you use to to switch, you may get arcing between the contacts (causing them to fail eventually) and it may generate interference. Connecting a snubber network across the relay contacts may alleviate both of these.

Thank you for this hint. I run a snubber at the pump already, that I switch with my relay (the usual cheap China-ebay-8-relay-card). It's a resistor in series with a capacitor. Switching the relay and sometime not even that usually ruins my arduino, so the LCD shows garbage characters and over the long run the arduino also stops working. Now, I use a SSR and it works fine. But the problem with the old relay still puzzles me. Do you mean, that I also should install a RC-snubber onto the relay?

Thanks
MIchael

dc42



Another disadvantage [of "normal" relays] is that depending on the load you use to to switch, you may get arcing between the contacts (causing them to fail eventually) and it may generate interference. Connecting a snubber network across the relay contacts may alleviate both of these.

Thank you for this hint. I run a snubber at the pump already, that I switch with my relay (the usual cheap China-ebay-8-relay-card). It's a resistor in series with a capacitor. Switching the relay and sometime not even that usually ruins my arduino, so the LCD shows garbage characters and over the long run the arduino also stops working. Now, I use a SSR and it works fine. But the problem with the old relay still puzzles me. Do you mean, that I also should install a RC-snubber onto the relay?


A snubber across the pump should be enough, provided it is an adequate snubber for the current draw and inductance of the pump. What value resistor and capacitor are you using, and how much current does the pump draw? Your SSR probably has a built-in snubber, which may be more suitable than your home-made one.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

michael--g

I see. There are different things that use 230 VAC. For example a valve, that frequently crashed the system: It draws only 4W when the motor runs. And it takes 15 seconds to close or open the valve - often stopping when the valve i sturned and instantly crashing the Arduino. The cap has 200pF and the resistor 4,7KOhm.

It was strange, the relay and everything worked perfectly without power being connected to the relay. But when I attached power that went through the relay to the valve everything broke up. And sometimes even the switching of different machines in the cellar nearby had the same effect. I tried almost everything: a different power sourrce for the relays, even connected to a different L in the house, snubbers, distance between power and data lines etc. All makes sense but in sum it never worked. After minutes or days the LCD began producing garbage and the Mega carshed.

Until I switches from the normal "magnetic" relays to SSR. Now it (seems) OK. But I'm a little bit reserved to say it works, at least until now it works ;-)

dc42


The cap has 200pF and the resistor 4,7KOhm.


That "snubber" will have almost no effect. The capacitor is way too small and the resistor is probably too large. The capacitor needs to be more like like 0.1uF to 1uF (rated at 250VAC or more) and the resistor more like 100 ohms to 1K. It's impossible to be precise without knowing the current draw of the pump (it will be greater than 4W/230V = 17mA because of the inductance of the pump).

Did you keep the ground wiring for the LCD separate from the ground wiring for the relay board?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

michael--g

You are right, the snubber is designed for much smaller devices. I'll try a larger one for my small 4W-device.
And yes, the relay board has its own power and GNDs were separate.

(By the way. Now, that I use SSR, the same power source and the same small snubber work in there and there are no problems)

dc42


(By the way. Now, that I use SSR, the same power source and the same small snubber work in there and there are no problems)


That may mean that the SSR contains a snubber. What model is it?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

michael--g

It has the following ebay-Url:
http://www.ebay.de/itm/251125409076?ru=http%3A%2F%2Fwww.ebay.de%2Fsch%2Fi.html%3F_sacat%3D0%26_from%3DR40%26_nkw%3D251125409076%26_rdc%3D1

But maybe it is not the snubber, that produces the problem.
The display garbage etc. do also occur, when the relais doesn't switch at all.

I guess, there is some electrical "misunderstanding" or incompatibility of some kind when connecting arduino the the relays. Here is the ebay-picture:
http://www.ebay.com/itm/New-8-Channel-5V-Relay-Module-8-Kanal-Relais-for-Arduino-DSP-AVR-PIC-ARM/250944121324?rt=nc&_trksid=p2047675.m1851&_trkparms=aid%3D222002%26algo%3DSIC.FIT%26ao%3D1%26asc%3D287%26meid%3D754012616025879792%26pid%3D100005%26prg%3D1073%26rk%3D4%26rkt%3D5%26sd%3D320853753972%26

dc42

1. How may relays (at most) did you have turned on at once?

2. How were you providing power to the Arduino and the relay board?

3. Did you keep the relay board +5V and ground lines completely separate from the LCD +5V and ground lines?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

michael--g

Thank you for the questitions.
1) At most I turned all on, but the problems were also present, when I turned a single one: the one of the valve (when it was connected to power; when this relay was not connected to 230V-power everything worked)
2) Both were separate; two different power supplies even on different 230V-Lines of the house, GNDs not connected.
3) Yes

Go Up