Arduino Interrupt caused by disturbance in power supply

I have created a smal circuit with a relay to control a 230v water pump. I have one push button and two led’s to show the status (if it is on or off). In my arduino code I have attached a interupt to pin 2 so I’m able to other things in the loop (e.g. communicate with an Raspberry Pi etc). The arduino nano is at the moment powered by a USB cable.

My challenge is that any small changes in voltage in the 230v net causes an interrupt. For example when the water pump starts it might cause an interrupt, or if I connect a vacum cleaner to the same power socket as the usb power supply, the interrupt is called.

Is there any way I can stabilize the circuit? (for example by using condensators?)





Try a 1K pullup resistor instead of a 10K.

Keep the mains wiring as far away from the Arduino as possible, your wiring looks lethal.

Look into putting a snubber circuit in series with your pump.

I would not call starting a motor a small change.

Indeed starting or stopping a motor could spike 100's or 1000's of volts into the mains if no snubber is used, and it
doesn't take much capacitive coupling for a kV spike to affect a low voltage high impedance circuit. 10k is
a pretty high impedance if you are looking to avoid interference.

Add a 100nF or so capacitor in parallel with button and decrease R4 to 1-2K

You also need to power the relay from another source - the 5 v pin cannot supply enough current and the relay maybe pulling the supply voltage down .