Go Down

Topic: 230v relay with arduino (Read 348 times) previous topic - next topic

Pipo123

Hi,

I wanted to build a simple watering system for my plants and came across a problem considering the relay. On this forum I wasn t able to find any related topic bc I didn t really know what to look for.

I m using an arduino nano and a humidity sensor that can be plugged into the soil and is directly connected to the arduino.
Furthermore i have connected a relay to one of the digitalouts of the arduino that is supposed to trigger the relay whenever the soil passes a certain humidity level.
The relay triggers a 230 v ac plug.

Now to the problem. When I put the humidity sensor in the soil and measure with a multimeter to a ground object(like a heater body) , then the ac voltage reads a value of approx 45 v? The same happens if I connect any pin of the arduino to the heater body(ground).

(If i connect the gnd port of the arduino to the earth(aka ground aka heater body) then the voltage disappears. But how i can fix this problem without always having to connect the gnd port to a big metal object?)

 What can I do to "ground" the entire arduino board?
Is there maybe a common thing that i ve overseen and that you re familiar with?

Cheers Paul

P.S. I put this in the electronics topics area bc it s only related to the relay i think. Had the same issues when i connected only a relay without arduino to the ac electricity and measuring between in1 pin and the heater body

adwsystems

#1
May 17, 2019, 02:02 pm Last Edit: May 17, 2019, 02:03 pm by adwsystems
Can you please draw this out and post, labeling (numbering) all points and describe where you are placing the probes when you take the voltage measurements. I cannot figure out between which two points you are measuring 45V.

The relay when open, should be be like the 230V is not there. So what is voltage measurement when you disconnect the wires from the relay terminals?

We will also need details on you power supply for the arduino. How is it powered (USB or external), and if external please provide information on the power supply.

Pipo123

The problem also ocurrs when the arduino is not even powered yet. It already ocurrs when i connect the ac to the NO and the COM port and then measure the voltage on the other side between and pin that would go to the arduino. I attached a drawing of how I connected the relay with the ac voltage and the arduino.

So I m not sure if it is rather related to the relay than the arduino but didn t know where else to ask. And atill i was wondering how i could make this bulletproof ao that the arduino won t get damaged on future time

Thanks already

Pipo123

And i just added a photo of the entire system. Sorry for the messy cables hanging around but i think you can see where I am measuring the voltage. It s now lower again. Around 11 v. But it seems to differ depending on when and where. I have no idea why.

Any ideas?

adwsystems

#4
May 17, 2019, 02:54 pm Last Edit: May 17, 2019, 02:56 pm by adwsystems
Three items to note about your relay board:

1. The relay is rated for 250VAC
2. The board is not designed for 250VAC (the terminals are too close together)
3. There are no standoffs between the relay board and the wood behind it which means the pins on the bottom of the board have a non-zero ohm connection between them and you are risk a short circuit or fire.

Since all of you PCBs are pressed into the wood behind it, that is one likely source of you issue. Wood is NOT an insulator.

PerryBebbington

In your photo of the unit and the DVM I cannot tell if the low voltage electronics is earthed or not. I can see a yellow wire that might be an earth, but based on what you say I will assume not.

The neutral wire will have 230VAC on it coming from the load while the relays is not operated. As adwsystems pointed out, wood is not a (very good) insulator, so you have 230VAC being applied to the wood at one end and you are measuring some of that at the Arduino USB connector at the other end.

Earth your low voltage electronics and put a good insulator under the board with an air gap. I usually use plastic sheet of similar thickness to window glass, available at DIY places. You can buy nylon nuts and bolts and spacers to mount everything.

adwsystems

Earth your low voltage electronics and put a good insulator under the board with an air gap. I usually use plastic sheet of similar thickness to window glass, available at DIY places. You can buy nylon nuts and bolts and spacers to mount everything.
That depends on the design of the power supply for the Arduino. From the pictures it is not connected, so I cannot say if it would be grounded when the power supply for the Arduino is connected.

MarkT

Quote
Now to the problem. When I put the humidity sensor in the soil and measure with a multimeter to a ground object(like a heater body) , then the ac voltage reads a value of approx 45 v? The same happens if I connect any pin of the arduino to the heater body(ground).

(If i connect the gnd port of the arduino to the earth(aka ground aka heater body) then the voltage disappears. But how i can fix this problem without always having to connect the gnd port to a big metal object?)
I'm guess these are potted plants indoors?

Then they will be picking up capacitively from the mains wiring in the building.  The currents involved are
miniscule and shouldn't affect any low impedance sensor.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

PerryBebbington

#8
May 17, 2019, 04:47 pm Last Edit: May 17, 2019, 05:48 pm by PerryBebbington
Quote
That depends on the design of the power supply for the Arduino. From the pictures it is not connected, so I cannot say if it would be grounded when the power supply for the Arduino is connected.
In the photo it's not, as far as I can see, earthed. I would want it earthed at the point the mains comes in, not rely on some other earth that might or might not be connected.

Pipo123 I don't want to discourage you but I do want you to be safe. If I were building your project I'd do the following:

  • Put everything in a metal box and earth the box.
  • Earth the 0V to the low voltage electronics.
  • Put a sheet of insulating material in the bottom of the box, probably the plastic sheet I mentioned above, maybe 2 or 3mm thick from a DIY store and completely covering the bottom of the box.
  • Mount the electronics on nylon bolts with nylon spacers and make sure there is an air gap between the boards and the insulating board of at least 5mm
  • Take care over the power supply as adwsystems has already mentioned. Maybe build the PSU in the same box taking the same precautions over safety.
  • There should be no conductor coming out of the box on the low voltage side that isn't either connected directly to earth (so 0V) or connected to electronics that is connected to earth at some point.
  • Keep in mind that the load is live all the time that the mains is connected to the box, even if the electronics is off or has the load off. The load is only ever safe if the mains supply has been removed completely (unplugged) from the box.
  • Feed everything from an RCD, either the one in your mains consumer unit (if one is installed) or from one built into a mains plug or similar.

Others here might have more advice.





adwsystems

Keep in mind that the load is live all the time that the mains is connected to the box, even if the electronics is off or has the load off. The load is only ever save if the mains supply has been removed completely (unplugged) from the box.
This can be mitigated by running the Arduino from the same 230V as running the heater(?) thus when one is unplugged the other is too.

It depends on the design and type of wall wart (if used) as connecting the wall wart DC ground may have an effect on the output voltage (and possible the input). There is too much variability in the design of wall warts and I avoid them when possible. If unavoidable I test them for load and "stray" voltage (ie., can DC- out be connected to earth ground). I prefer actual SMPS or linear power supplies as the designs are more consistent across manufacturers. Unfortunately, they are also markedly more expensive. Luckily equally more reliable. As an aside they also tend to be more powerful both per dollar and per cubic inch.

Pipo123

#10
May 17, 2019, 05:54 pm Last Edit: May 17, 2019, 05:58 pm by Pipo123
Oooh thanks that was very helpful and I ll definitely pay attention to your advice on how to proceed. (It was just me assuming that it would be safer to build the system on wood cause it s not conductive but actually it is as all of you pointed out.

Aaand if I was to build it in a metal box with an insulation layer underneath inside, how would i have to ground the electronics? I guess by connecting the yellowgreen wire to the casing and as well the gnd port of the arduino to the casing?


And i was using the usb input for the arduino nano and from the same multi ac plug the wires that go to the relay

PerryBebbington

#11
May 17, 2019, 06:01 pm Last Edit: May 17, 2019, 06:01 pm by PerryBebbington
Quote
Aaand if I was to build it in a metal box with an insulation layer underneath inside, how would i have to ground the electronics? I guess by connecting the yellow-green wire to the casing and as well the gnd port of the arduino to the casing?
Yes, to the yellow-green wire from the mains lead. I usually use a solder tag connected to the earth wire and use a small nut and bolt (metal, not nylon!) to attach it to the inside of the box. I suggest you solder the green-yellow from the mains lead to the tag and also solder another tag to another piece of similar wire, which you connect to 0V on your circuit, then bolt both tags with the same nut and bolt to the inside of the box.

PerryBebbington

#12
May 17, 2019, 06:06 pm Last Edit: May 17, 2019, 06:07 pm by PerryBebbington
This is what happens when you combine electricity with wood Lichtenberg figures

Pipo123

Ok so i ll try once i got the casing done.

And the lichtenberg figures look really nice but well rather what i ll try to avoid.

I just separated the relay from the rest and let it hang freely in the air without touching anything and still there is a noticiple voltage as it can be seen in the attached pictures. How come? Now there is nothing connecte to the relay apart from the blue wire from the ac.

PerryBebbington

Is the blue (neutral) wire connected to the mains? Is the other end of the cable connected to a load of some kind?

Go Up