220v motor resets or crashes Arduino


I was hoping someone could give me some guidance. I have a Arduino that is controlling my aquarium but when the motors turn on or off it will ocasionally cause a locking up of the Ardunio. Sometimes it will reset and sometimes it will hang.
The motors are switched by a Sainsmart relay shield controlled via a MCP23017 16-bit serial expander with I2C serial interface from the Arduino. I also have an I2C LCD shield that sometimes start printing random characters and lock up when the motor switches. I suspect some sort of voltage is being induced in the I2C line.
I had similar problems with some solenoid valves but fixed those by putting diodes across the solenoids. Is there a similar method of suppressing noise from the motors?

For info; the relay shield is running from a separate power supply and the Arduino shield is powered via USB from a wall adapter.

Look up snubber circuits.

Also make sure you aren't running your low-level signal cables alongside mains cables - never
a good idea.

Last solution if every thing else failed.

I2C Optoisolator;-

ADUM1250ARZ-ND, Digikey, $6.00

An separate power supply is plus which OP did already.

An separate power supply is plus

No it's not a plus it is essential otherwise it is not isolated.

However I don't think isolation of the I2C lines is going to help hear because that is not where the problem is. The problem is with the motor generating interference, the I2C lines are only one place where this can get into the system. Better to solve the problem at source.

Even solve the problem at source works, but 220 V AC is networked, Nothing is going to stop neighbors motor noise. I learn this by very hard way.

My own mistake about Plan H;-

I did home fiber optics network many many years ago, the reason for high rejection rate of EMI. I have a pair of plasma speaker (it is not typo. Ionovac, Ionofane at UK). It sounds great but has very high EMI for computer network or AM/FM radio, But it is FCC certify. There is one fiber optics network project going on for work that time, I decide do something at home. I installed 10BASE-F network at home all by myself. I could not find helper and nobody know that time. after few days struggle every thing is working fine. I am so happy and pround what I did until suddenly recognize there are neighbors. I keep use network but never turn on the speaker again.

Plasma speaker - Wikipedia

Classic Ethernet - Wikipedia

My experience of EMI is protection at everywhere. overqualified is better than under-qualified.

Better rejection rate - i2c-optoisolator

Best rejection rate power - Next generation wireless power, laser supply. (FYI)

Laser powered airplane.

Hi Denao,

To put things simply,

what is probably happening is the Arduino is receiving a glitch / pulse , which is causing the processor to jump to an unexpected place in the code, so it hangs.

Now the hassle with these sort of problems, is the cause can be 101 different things, you get the idea from the post above.

I wonder, if you have a radio running near the mains where the arduino is powered from,( on an AM station ), do you hear a noise when the relay switches ?

Have you tried powering the Arduino off a battery , or the usb from a laptop ( laptop not plugged int mains )

sorry yet more suggestions ,


sorry yet more suggestions ,

Why sorry, more is better.

My two silver bullets are;-

  • multiple plans
  • teamwork

The teamwork is key, the suggestion should not limited working one only, failed one could help OP stop fail again. From time to time I

might have provided this type suggestions;-

Dear all,

I am facing same problem with my arduino
If it is sorted out then guide me please

Could you share your schematic?