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.