Arduino Forum

Using Arduino => General Electronics => Topic started by: sone0121 on Jun 01, 2020, 11:27 pm

Title: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 01, 2020, 11:27 pm
I am an absolute beginner to state first! I'm a mechanic, not an electronic guy, but so far I learned some of the basics of AC and DC power, and let's say that now coding is my new schooling program.
Also I'm bit of tired as I'm trying to figure out this for almost a week and maybe I forgot to mention something but if I remember I'll add up ;)
I can post my sketch if needed

Using:
Mega 2560
LCD 16x2
DS1307RTC
DHT22
4 channel relay with opto(not so great protection as I see now)

Made a working code for my greenhouse and now when I implemented everything, I found out that some of my components freeze arduino and/or dht when releys switch ON or OFF.

Relays are controlling next:

Duct fan 230V 0.11A(23W) 50Hz // also I made a dimmer(triac based), not sure if I can use it
Ultrasonic humidifier 220-240V 30W 50Hz
Small Air Pump 220-240V 2.5W 50Hz
Small Water pump 220-240V 2.5W 50Hz

and I have one more inline fan (230V, 14W, 50-60Hz) for just in case if it gets very hot to turn on manually and its connected on the same relay output where the other fan is, but so far I haven't used it in my setup (have separate switches after relays)

So far Humidifier works pefectly fine, switching it ON/OFF is fine, but then my first fan would crash LCD from time to time
Then we come to the bigger problem with air and water pump, which randomly switching on or off would freeze my arduino or sensor.

I measured spikes, I have a cheap multimeter, so I can say only what I saw and read.
With the use of 471 and 104 caps and 1N4001 diodes, I was able to lower spikes from 4.98V
to 5.00-5.04V (they went 5.10 and higher before)

Using PC PSU, MEGA is conected to 12V and relays to 5V rail, also I conected both grounds together.

What should I use here to sort this out? I found that one guy sorted this with using only ferrite rings, which I plan to add up too.
I was thinking about MOVs but need help to calculate values for it.
Also capacitor - snuber on AC side ? but dont know which one.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: SteveMann on Jun 02, 2020, 01:57 am
There's no need to show grounds since all grounds should be connected together.  Same thing with the neutral wires on your mains- they should all be connected together, so no need to show every one of them. You only need one ground from the Mega- all others are redundant.

Your (almost) schematic shows you sending 12V AND 5V to the Mega??  One or the other, but not both.

What are the diodes supposed to do?

Other than the PSU, the Mega is completely separated from the motors, but depending on the quality of your PSU, that could be a vector for the voltage spikes.  Also, when you describe voltages, spikes or otherwise, don't use relative values.  Are you saying that your voltmeter would jump to 10V when the motors turn on?  If that's the case, I would seriously look at the PSU.


Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 02, 2020, 02:25 am
Sorry, my mistake, I forgot to end up those two lines, it's where I measure voltage but no, the upper side of the board is 5psu and lower is from Megas 5v.

I tought diodes act in one way only, so I placed them so they can't backfire voltage back to Mega? or I misplaced something?

No, not at all that high, I was watching over the multimeter while alarm triggered one of the channels, and I saw a jump, when switched off, from 4.99 to 5.1V, not 10V

I forgot to ask, does it matter if it's actually 5.3V from PSU, and not round 5V ?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: JCA34F on Jun 02, 2020, 03:42 am
First thing, get rid of the ground wire from the MEGA to the relay module, it's not needed and may carry switching noise. The only connections between MEGA and relay module should be: 1 wire from MEGA 5V to relay Vcc and 1 wire from each MEGA output pin to a relay "in" pin. NO GND.
If you have the diodes in series the relay board is getting about 4.7V for power and 4.4V for signal.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 02, 2020, 04:36 am
Yes, this is one of those rare situations where removing a ground wire is beneficial. Your relay board will gain full opto isolation from the Arduino.

You'll need a suitable MOV (or snubber) connected across the switched contacts of each relay. This will greatly reduce interference and contact arcing and will prolong the life of the relays. Make sure the MOVs are rated for at least 275VAC continuous ... here's some possibilities (https://www.digikey.com/en/products/filter/tvs-varistors-movs/141?s=N4IgjCBcpgbFoDGUBmBDANgZwKYBoQB7KAbRAGZyBOAJlnJAMttgFZGLq74mvYB2DszpUhXfgAYxtfg14yALCAC6BAA4AXKCADKGgE4BLAHYBzEAF8CsUdBDJI6bPiKkQCsGAAcVQapCa2npGZpYEnvB2Dk64BMSQZLAA1gCCHLAAdKypHPxZOQReBeASxWA0ZeRl2WkENKVp-oGQIACqxoYaAPIoALI4aFgArvo4YeBUPgj2qJixrgkgUk1aLcEm5lYgNGCsEFGzznFuNPysAGoq6qttHd19A8Oj4wC0NNMOBkMu8WTsK9pLFt3osALaEABuKgsQA).
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 02, 2020, 05:00 am
I removed the ground wire and since my PSU share the same ground on 12V and 5V, I have used old 5V phone charger for relays
Arduino crashed again, but at least this time I could see LCD showing unreadable words and letters.

Now I wonder, can my sketch cause arduino to crash?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 02, 2020, 05:12 am
The MOVs are really, really important.

Anyways, if you were controlling everything ... I would start by disconnecting all 220VAC load from all relays. Just get the low voltage DC components and sketch working first.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 02, 2020, 05:12 am
Yes, this is one of those rare situations where removing a ground wire is beneficial. Your relay board will gain full opto isolation from the Arduino.

You'll need a suitable MOV (or snubber) connected across the switched contacts of each relay. This will greatly reduce interference and contact arcing and will prolong the life of the relays. Make sure the MOVs are rated for at least 275VAC continuous ... here's some possibilities (https://www.digikey.com/en/products/filter/tvs-varistors-movs/141?s=N4IgjCBcpgbFoDGUBmBDANgZwKYBoQB7KAbRAGZyBOAJlnJAMttgFZGLq74mvYB2DszpUhXfgAYxtfg14yALCAC6BAA4AXKCADKGgE4BLAHYBzEAF8CsUdBDJI6bPiKkQCsGAAcVQapCa2npGZpYEnvB2Dk64BMSQZLAA1gCCHLAAdKypHPxZOQReBeASxWA0ZeRl2WkENKVp-oGQIACqxoYaAPIoALI4aFgArvo4YeBUPgj2qJixrgkgUk1aLcEm5lYgNGCsEFGzznFuNPysAGoq6qttHd19A8Oj4wC0NNMOBkMu8WTsK9pLFt3osALaEABuKgsQA).
Yes, I was thinking as well to get 275V with max of ~400V, but I don't know how much Farads do I need?
Also I was thinking of using metalized poly film cap of like 250V and resistor of 20-30ohms to make snubber, but I still don't know which capacity to use ?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 02, 2020, 05:19 am
Quote
Yes, I was thinking as well to get 275V with max of ~400V, but I don't know how much Farads do I need?
They're rated/sized mainly by voltage, current surge and energy. Any on that list provided should work fine.
You wouldn't need to make snuibbers if you use MOVs.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 02, 2020, 05:29 am
Yeah tested without AC now and I remembered that I already tested sketch a few times before I set everything up and connected to AC. I'm just a bit tired and already slamming my head for days to make this work.

Any recommendations for caps and resistors, considering I have low power consumers and as I will be on my way to the store in a few hours, so I'm thinking to pick a few of those while I'm there as some ferrite rings too

EDIT: I saw your msg before you edited. OK then and what about ferrite rings?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 02, 2020, 05:43 am
Yeah, the ferrite rings are also beneficial. You shouldn't need to worry about the caps and resistors.

Some things to consider:

Keep all AC wiring away from the DC circuitry.
Move the relay board away from close proximity to the Arduino MCU and other electronics.
Use a common point for grounding ... usually at the power supply.
Use a separate ground wire for each GND terminal, all connecting to the common point (star-point connection). Don't jumper from one GND to the next ... this will cause ground loops.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 02, 2020, 06:09 am
Yeah, the ferrite rings are also beneficial. You shouldn't need to worry about the caps and resistors.

Some things to consider:

Keep all AC wiring away from the DC circuitry.
Move the relay board away from close proximity to the Arduino MCU and other electronics.
Use a common point for grounding ... usually at the power supply.
Use a separate ground wire for each GND terminal, all connecting to the common point (star-point connection). Don't jumper from one GND to the next ... this will cause ground loops.
Thank you for your advice. Wires are already separated and will move relays further away, when I add MOVs
I do that always, as I had previous experience in automotive with loose grounds ;)

Here is a pic how it should look after and just to make sure I'm placing MOV and ferrite alright.

PS Don't confuse my bad paint skills, my wiring doesn't look like that, which may be the result of slight OCD :D
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 02, 2020, 07:17 am
Ideal relay board connections...

(https://i.imgur.com/6m95zlV.jpg)


Four MOVs...

(https://i.imgur.com/zV2l46L.png)


With the Mega powered at 12V, it may not be able to provide enough current for all the connected components. It will provide more current with a lower voltage supply, ideally 7.5V, or if not available, then 9V.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 02, 2020, 07:36 am
Yes, that's how the relay board is connected.
 I was lazy to draw MOVs on all cables. . .
And ferrite goes after the MOV, on the side going to device.

I'll report my results back after setup and test.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 02, 2020, 02:38 pm
The only other thing that I'm quite sure is an issue is the 12V supply. Here's why. (https://forum.arduino.cc/index.php?topic=639600.msg4329023#msg4329023)

Using (1W / (Vin - 5V):
With 12V  supply, you'll have about 142 mA available.
With 9.0V supply, you'll have about 250 mA available.
With 7.5V supply, you'll have about 400 mA available.

Approx Power requirements:
Mega: 70 mA
Relay Board: 60 mA
Other stuff (LCD display, etc) ?? mA  <--- only 12mA remaining when using 12V at Vin!
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 02, 2020, 03:37 pm
Hey man, thank you very much, you are No1, I have readen other topics where you helped other people and I admire your knowledge, right on point :)

I think we fixed crashing. I got 14n431k MOVs and ferrite rings and it worked a few times without any crashes.

Next thing I wanted to say is that my LCD is bothering me, it gets blank fields sometimes and it just might be what you have just said.

So as I got my 5V(5.3V) rail free on my PSU I can use it now to power Mega, should I go directly to Vin or should I use power jack?
Or should I stick strictly to 7.5V?
BTW I was then confused by the official statement, saying that you need from 6 to 12V to power you board, and I went for 12, as of thinking that more would be better, but now I see I was wrong

PS I got LCD16x2, RTC and DHT22 there too, and I plan to add up one or two more relays, but for controlling 12V power about 5A, maybe 10A max
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 02, 2020, 05:13 pm
You can use Vin or +5V pin (not both of course) or you could use the USB as an input to provide your 5V power.
If using the +5V pin, note that there will be no overload current protection.
If you use USB to provide the +5V, then this will take advantage of the on-board 0.5A polyfuse.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: TomGeorge on Jun 02, 2020, 05:58 pm
Hi,
Welcome to the forum.
Can you post a picture of your project so we can see your component layout.
Wiring layout is very important when using mains AC due to wiring interference.
Have you got your mains wiring away from any of the MEGA and its power supply wires.

Have you got fuses wired into the mains power inlet tot your project, or do you have one in the power plug, as in UK?

Tom... :)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 03, 2020, 01:12 am
Hello
Yes, my wiring is separated AC from DC, in the pic, it might seem some are contacting each other, but actually small ones for VCC and signals are in the air not touching anything

I'm opting for power jack input then.


Also, this made me thinking what would be the next step of improvement in a similar setup, one set of relays just for control of the other set, with different power sources, like one would be only DC power, controlling AC on the other end?
Or there are just better and more expensive ones to go, and or what about SSR?
Some of my googling in past few weeks indicate that SSR is better, or it is dependant situation to control specific devices? Like where speed would matter?

(https://imgur.com/zRcBi9H)
idk if u can see img, here is it in code
img (https://imgur.com/zRcBi9H)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 03, 2020, 02:06 am
Totally forgot about drop down on Vin and power jack sides, so it's directly to 5V.
This makes me worry a bit, do I need some capacitor on there or something for protection, considering it varies from 5.2 to 5.3V?

PS I forgot to answer in the previous post, only fuse is in the wall 10A

EDIT: I just found out that switching device off manually, after the relay, it would again cause a crash
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 03, 2020, 03:15 am
After going with 5V and few test again I didn't see anything wrong, LCD, Mega works fine

And after some logical thinking about manual switch (in the post before), I'm thinking I would need one more set of MOVs connecting N and G, but I don't know if this would cause any harm or problems considering I already have one before
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 03, 2020, 04:32 am
I think the MOVs would work better if they were connected from each relay Normally Open (NO) and Neutral. This could be across the L1 and N terminals at each load if easier. This should clamp the peak much better like this.
The ferrites work best if there are 4 to 7 turns of wire through each of them.
If the interference problem persists, identify which load is causing it and make sure it also has a ferrite.
If the problem still persists, could try a suitable RC snubber and ferrite.

EDIT: As mentioned by TomGeorge, it would be good to get a picture of your project.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: TomGeorge on Jun 03, 2020, 05:45 am
Hi,
Ops layout;
(https://forum.arduino.cc/index.php?action=dlattach;topic=687818.0;attach=366667)

Thanks.. Tom... :)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 03, 2020, 05:59 am
(https://imgur.com/zRcBi9H)
I'm posting pic again, I don't know if can see it or whats wrong, but here is THE LINK (https://imgur.com/zRcBi9H) too

Well that was my first thought when I opened the topic(L and N), but then I followed ur instructions for instal on L only after relay.
I'm going to test that too now. And I also expect a better result too. Just made me thinking what would be better if MOV is placed closer to switch or to power consumer?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 03, 2020, 06:43 am
There's 6 wires coming from the relay board to the Arduino (should only be 5)
Please remove the ground wire, leaving just +5V, IN1, IN2, IN3, and IN4.
This will enable galvanic (opto) isolation.

The opto IRLED and LED circuit works like this (no ground) ....

(https://i.imgur.com/P6SyZu0.png)

(https://i.imgur.com/0WCjkUi.png)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 03, 2020, 07:05 am
It isn't connected

PIC1 (https://imgur.com/viXhuC0)
PIC2 (https://imgur.com/UHEsviZ)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 03, 2020, 07:18 am
Ah, I see ... thanks for the pics. I think you were trying to trick me on that one ... :)

Quote
Well that was my first thought when I opened the topic(L and N), but then I followed ur instructions for instal on L only after relay.
I'm going to test that too now. And I also expect a better result too. Just made me thinking what would be better if MOV is placed closer to switch or to power consumer?
Normally you see them installed across the relay contacts ... but you might need to try the other possibilities and use whatever method works best.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 03, 2020, 08:38 am
So far from tests, where I had most of the crashes with timers, now in 70 events, I had none :) (doesn't matter how MOV is placed)
I need to revert MOV on the fan, across the relay, instead of L and N. If I switch it OFF with or without dimmer it corrupts arduino, not LCD !
Then it can be switched manually if I use it trough my dimmer, where I have pf capacitor and resistor in it. If I switch it off or on with dimmer I can get just LCD error sometimes. Which leads me to the point that RC snubber is needed for fan.

Everything else seems ok with just MOV and ferrite.

PICTURE (https://imgur.com/VyI0lNY) of LCD while corrupted, arduino still working

EDITED and will do more tests later
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: TomGeorge on Jun 03, 2020, 10:17 am
Hi,
Can I suggest that using protoboard and jumpers (length of conductors, and connection method) may also be contributing to the resets?

Have you got bypass capacitors on the protoboard where 5V and gnd run?

Tom..... :)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 03, 2020, 03:19 pm
Umm ... this might relate back to that same wire:

Quote
I need to revert MOV on the fan, across the relay, instead of L and N. If I switch it OFF with or without dimmer it corrupts arduino, not LCD !
Then it can be switched manually if I use it trough my dimmer, where I have pf capacitor and resistor in it. If I switch it off or on with dimmer I can get just LCD error sometimes. Which leads me to the point that RC snubber is needed for fan.
If the fan is "vent" (ventilation relay pin) in your code, then ...

It looks like the blue wire (ventilation relay pin) is connected to Mega pin 12, which is IN1 at the relay board. If the grey wire in parallel with it is connected to GND at the relay board, then this wire can cause interference issues through capacitive coupling and inductive coupling (https://electronics.stackexchange.com/questions/21675/what-should-i-know-about-interference-between-wires-in-a-multi-conductor-cable). If connected to GND at the relay board (can't tell from the picture), then try a test with it disconnected from GND at the relay board.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 03, 2020, 09:27 pm
Hi,
Can I suggest that using protoboard and jumpers (length of conductors, and connection method) may also be contributing to the resets?

Have you got bypass capacitors on the protoboard where 5V and gnd run?

Tom..... :)
I have one ceramic 471 on there, if I go larger like 473 I get more LCD problems.

Umm ... this might relate back to that same wire:
If the fan is "vent" (ventilation relay pin) in your code, then ...

It looks like the blue wire (ventilation relay pin) is connected to Mega pin 12, which is IN1 at the relay board. If the grey wire in parallel with it is connected to GND at the relay board, then this wire can cause interference issues through capacitive coupling and inductive coupling (https://electronics.stackexchange.com/questions/21675/what-should-i-know-about-interference-between-wires-in-a-multi-conductor-cable). If connected to GND at the relay board (can't tell from the picture), then try a test with it disconnected from GND at the relay board.
You are referring to white(grey) wire you marked in your post #24, which you can see in post #25, in the first pic on the relay, it is hanging in the air, not connected to anything, next pic column on the protoboard is empty and also not connected.

Thanks for pointing interference. I have removed and placed further away LCDs positive wire from the negative ones. It was short test, but I didn't saw any corruption so far.

It made me thinking that it may be something with my PSU, as it is an old one and it maybe doesn't have good protection or it is just low quality.
Since it is in the same plug as the fan, for example, switching fan ON/OFF may interfere with PSU and its constant and power delivery?
This leads me to open it again and check if there is a MOV or capacitor in it, as I can't remember if I saw one.

What would you recommend to use/build for common positives and grounds instead of protoboard?
Simple empty board, that I should just solder pins with one ground line and one positive?

UPDATE: I tried different plug for PSU from a different line and its all the same. . .
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 03, 2020, 10:32 pm
Quote
You are referring to white(grey) wire you marked in your post #24, which you can see in post #25, in the first pic on the relay, it is hanging in the air, not connected to anything, next pic column on the protoboard is empty and also not connected.
Yes, not connected to anything at both ends is OK.

Quote
It made me thinking that it may be something with my PSU, as it is an old one and it maybe doesn't have good protection or it is just low quality.
Since it is in the same plug as the fan, for example, switching fan ON/OFF may interfere with PSU and its constant and power delivery?
Yes, good quality power supplies and using decoupling/filtering capacitors (see reply #28) are excellent suggestions. Note that its really important that the relay board have its own, completely independent power supply.

Quote
What would you recommend to use/build for common positives and grounds instead of protoboard?
Simple empty board, that I should just solder pins with one ground line and one positive?
My only recommendation would be to use a PCB that has solder mask (green coating) over everything except the copper hole pads. There are PCBs available that mimic a bread board layout.

It seems like you may have everything working. If not, my only other suggestion would be to try moving the relay board and AC wiring at least 1 meter (3ft) away from the Arduino.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 04, 2020, 12:36 am
Yes, everything works, I'm just a bit insecure about stability.
Thank you for your help and time, I owe you a beer or a coffee at least :)

One more thing, why does a higher rated capacitor disturbs my LCD more (471 vs 473)?

Can you show me an example of how would you setup decoupling for my situation? And/or what ratings should I go for. I just have my 471 in between "+" and "-". Do I need a resistor?

Now I just need to find small PSU rated 5V 1A. . . or power adapter could work as well, something from 7V to 9V? (again I'm thinking of the quality of those...)
Also, separate power for relays adds more complication which I'm not so much happy about as I need two sources to actually power one working thing. . . which wasn't my plan at the start of this project...

This made me thinking I shouldn't have gone at all with arduino and I should just have bought a finished product, as it seems in the end this will cost me more than something plug and play. . . And I lost about a month just to make it work.
I say this because it doesn't give me confidence with stability and reliability, I'm afraid one day I might come to find my garden is flooded and some device is fried. . . but we'll see.

I'll keep this updated as I upgrade/downgrade :D down the path and let you know what I came up with. ;)

At least I learned something new from this experience, which isn't that bad at all :) every school has its price ;) is what we say over here :)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: TomGeorge on Jun 04, 2020, 12:47 am
I have one ceramic 471 on there, if I go larger like 473 I get more LCD problems.
Across the 5V to gnd, the LCD has problems?
It sounds like you have some power supply wiring and connection issues, have you checked ALL your jumper connections to and from the protoboard?
Tom.... :)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 04, 2020, 02:04 am
It actually runs better without one at all lol

Maybe I'm doing something wrong, I'm supplying arduino with 5V, then from arduino to protoboard. Or it should be the other way around?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: TomGeorge on Jun 04, 2020, 02:11 am
Hi,
To what pins are you supplying 5V?
What is the supply?
Do you have a DMM to monitor the 5V supply when the fault occurs?

Thanks.. Tom.... :)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 04, 2020, 02:53 am
I was supplying to power pins, two that are next to each other, 5V and gnd.
I changed now supply to the protoboard and this is how I'm powering arduino now
(https://i.imgur.com/3yvLutc.jpg)

It is a PC power supply, I think it's switching one, it says on the sticker it has 30A @5V and 20A @12V, but I doubt it

Yes, I monitor it, it shows 5.25V with 471 and it varies from 5.24V to 5.26V, low % of faults
If I go larger like 473 I get jumps from 5.25V to 5.28V, I get high % of faults.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 04, 2020, 11:05 am
I think I solved it, I removed MOV from humidifier terminal and replaced fans MOV from L&N to after switch L&L :)
I didn't see single LCD error in a couple of hours, at least for now :D

Also added one more ground wire from PSUs molex connector and all I see now is stable 5.26V (it may drop to 5.25V if two or more relays are open at the same time)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 08, 2020, 12:12 am
Just to report back, everything works fine with switching circuits, except I found a new problem.

If I plug a new device, for example, a simple table fan, again I get a voltage spike that backfires at relays. I noticed when switching added device, relays LEDs would slightly blink, barely noticeable in dark, but still noticeable. This would cause Mega to crash once in like 10 on/off switches.

Is it safe to add on more MOV, to protect relay circuit, in a red circle where power comes from the wall in my circuit which looks like this now?
(https://i.imgur.com/kDBDXYN.jpg)
Or I need to change rest of MOVs to L&L after switch, and connect just that one to L&N ?

Also, I'm still thinking to add RC to aid MOVs, like 1k ohm Resistor(or 10k) and 275VAC 220nF Capacitor, would this be sufficient or I need higher values?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 08, 2020, 01:16 am
Quote
Is it safe to add on more MOV, to protect relay circuit, in a red circle where power comes from the wall in my circuit which looks like this now?
Yes (they do this in surge protection devices)

Quote
Also, I'm still thinking to add RC to aid MOVs, like 1k ohm Resistor(or 10k) and 275VAC 220nF Capacitor, would this be sufficient or I need higher values?
For these RC snubber modules (https://www.aliexpress.com/item/32944554113.html?spm=a2g0o.detail.1000014.3.69b3cab8yV825S&gps-id=pcDetailBottomMoreOtherSeller&scm=1007.14976.157518.0&scm_id=1007.14976.157518.0&scm-url=1007.14976.157518.0&pvid=ef3a8360-d323-4715-81a2-996c83bf43ad&_t=gps-id:pcDetailBottomMoreOtherSeller,scm-url:1007.14976.157518.0,pvid:ef3a8360-d323-4715-81a2-996c83bf43ad,tpp_buckets:668%230%23131923%2312_668%23808%234093%23798_668%23888%233325%2312_4976%230%23157518%230_4976%232711%237538%23814_4976%233104%239652%231_668%232846%238107%232_668%232717%237561%23333) rated for 220VAC, they use a 0.1uF/630V capacitor and a 220 ohm 3 or 5W high voltage resistor. They also include an MOV.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 08, 2020, 01:51 am
Thank you very much.
I was looking at the same snubber, I just couldn't find tech info about it.
As I already have MOVs, I will stop by the store tomorrow and get the rest of the components and build it.
Should one be enough on main, or I would have to go for each device alone?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 08, 2020, 02:02 am
The RC snubbers would work best at each relay, same as where existing MOVs are.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 12, 2020, 01:03 am
Btw do I connect snubber with COM and NO(L&L) or L and N terminals?
I searched around and now I got confused...
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 12, 2020, 01:56 am
Normally across the relay contacts (switched load (https://en.wikipedia.org/wiki/Snubber#/media/File:RC_Snubber_(Model).PNG)) which is COM and NO, same terminals as your wiring connections.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 12, 2020, 02:48 am
Thank you. I saw there are two ways to do it so I wasn't sure.
Btw is it ok if I use lower watts resistor? 220 ohm 1/4w 5%? or ceramic one with 5w? what is a better/safe option? Because atm they don't have them at the store, just ceramic ones, but I never went into what is the difference. . .
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 12, 2020, 03:57 am
Quote
Btw is it ok if I use lower watts resistor? 220 ohm 1/4w 5%? or ceramic one with 5w? what is a better/safe option?
The 1/4w 220 ohm resistor wouldn't have a high enough voltage rating, but the 5W 220 ohm resistor should be OK.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 12, 2020, 11:44 am
Ok, I just don't know the difference between small ones and these and why are they so big, that's why I asked
(https://images-na.ssl-images-amazon.com/images/I/41U81XSVs8L._SX342_.jpg)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 12, 2020, 02:07 pm
If your supplier can get the RR02 (https://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=3-1773449-2&DocType=DS&DocLang=English) or similar, it would have about the same size as shown on those snubber modules. The main thing is the voltage ... the RR02 has a limiting voltage rating of 500V. I wouldn't go with anything less than 500V.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 12, 2020, 03:30 pm
Ok, while you mention voltage, I can't find anything about the one in the pic
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 12, 2020, 05:01 pm
With low ohms resistors, can't test continuous max voltage as this would exceed the power rating. They do state this in the datasheet (https://www.mouser.ca/datasheet/2/351/xicon_01272016_XC-600041-1201717.pdf):
Dielectric withstanding voltage: No evidence of flashover, mechanical damage, arcing or insulation break down
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 12, 2020, 05:20 pm
The reason I ask is I already got them, before you posted about RR series, I was in town and picked them up.
So I wonder can I still use them? I don't care about size, latter on I can change them if I decide to go smaller.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 12, 2020, 11:01 pm
Yes, you can still use them.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 13, 2020, 09:50 am
If I would add one more relay module to control 12v (about 6-7A) power only, how should I power it?
From arduino alone or I need another new power source or same old that is powering 220V module?
Would I need also some protection across the switch? I saw ppl go with simple RC only
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 13, 2020, 01:41 pm
Controlling 12V loads is much simpler. If its an inductive load, then only a flyback diode is needed and connected across the coil (solenoids). Yes, sometimes simple RC or a capacitor only is used across motor loads. Many have had success without Opto-isolation and use the same external power source as the Arduino. I would recommend that the supply be separate from the 220VAC relay power supply.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 13, 2020, 06:58 pm
I want to try something with Peltier module, I suppose it is a resistive load, but as I understand, it can produce "Seeback voltage".
What would you recommend, if anything at all is needed for protection?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 16, 2020, 10:50 pm
I connected snubber across the switch and my devices started working although relay was closed, which I was afraid it might happen as they pass through some current, and they are to be used with much higher consumers which don't mind little current flowing through. Live and learn I guess...

So far everything works fine with MOVs and ferrite rings, I moved AC lines further away from the board and PSU and lined them better.

So far my only trouble is when the relay is closed (working) and if I manually switch off one of the devices I get an instant error and arduino freezes.

MOVs are all placed across the switches and one more on the main L&N terminal.

I have also checked PSU and it got a few MOVs, resistors and capacitors where the main lines come in, so it is protected too.

So is there any other solution on how to sort this out or I'll have to live with this and continue without touching manual switches?
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 17, 2020, 12:50 am
Quote
So far my only trouble is when the relay is closed (working) and if I manually switch off one of the devices I get an instant error and arduino freezes.
Ahh, while any relay is energized, it essentially shorts out the snubber and MOV. When the relay contacts open, the snubber and MOV do their job and protect the relay and reduce arcing/EMI. However, if there's a manual switch connected in series and its opened while the relay is energized, there's no filtering or protection.

If you could connect the manual switch like this, then all contacts would be protected:

(https://i.imgur.com/fYJYVlR.png)
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 17, 2020, 01:38 am
Hmm, I will try that in the next couple of days. Now when I look at it, it's logical and I feel sort of dumb now. . .

I just noticed I did a typo here:
I connected snubber across the switch and my devices started working although relay was closed, which I was afraid it might happen as they pass through some current, and they are to be used with much higher consumers which don't mind little current flowing through. Live and learn I guess...
Which I actually meant open (not working)!
I just want to confirm if this is as I described or I did something wrong?
So I dumped snubbers and left it with MOVs only.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 17, 2020, 01:55 am
Maybe you had the switch connected in parallel to the relay contacts. In that case, the switch would only work if the relay contacts were open. Anyways, connected in series is what you would need. The switch could also be connected in series but be located on the load side of the relay.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: sone0121 on Jun 17, 2020, 02:33 am
Urgh, another typo or we misunderstand, sorry it's getting late over here.

Across the relay is what I mean, so NO and COM was where I placed snubber and while relay was OPEN (not working) my device turned on.
That made me take off snubbers and left it with MOVs only.
Title: Re: Arduino-dht freeze, help make/select rc snuber, mov, caps to protect from 220v
Post by: dlloyd on Jun 17, 2020, 04:16 am
Ahh, got it ... yeah, the current through the snubber can cause issues if the load is quite small.
Good luck in your testing.