Problem switching an AC 120v motor with relay

Hello,

I have a simple circuit, I use an Arduino and a relay module like this (see picture).
I want to switch the motor on and off (no speed control) via that relay, the issue I have is that as soon I connect the relay to the motor the Arduino program is going crazy and it does random things. When I disconnect the power from the relay it works. I tried different modules but as soon the motor is connected to the relay the code doesn't work anymore. Any idea what can cause this issue?
Without the motor connected the relay and code work just fine. Is it possible that the 120v somehow gets through the relay into the Arduino?

You will have to show you connection diagram and a photo of the physical connections.

Also let us know what other devices are connected to the board.

Reactions like this are often related to grounds not being where they should.

This is the diagram, they didn't have a symbol for the module, but it gets 5V, GND, and the signal.
There is also a button connected to Arduino which triggers the code. The motor is 120W / 1A

We need to know where the power supply is connected.

And just to save another go around. What I understand is the processor goes "crazy" when you connect +5V to the relay module.

Curious, how do you know the UNO goes crazy? Nothing else is connected.

The Arduino is connected to a 5V power supply that is plugged in at the same outlet as the motor.
When the relay is connected to the Arduino but without the motor the program works fine. The relay will do the on off sequence as programed when pushing the button (10 sec on then off for 2 sec then 5 sec on then off)
When the motor is connected and you press the button it will go on for a random time then off or it keeps on. It's different every time, some times on off very fast or it doesn't even start with the first push but after you push the button 3-4 times. Total random.

Are the motor wires and the Arduino button wires near each other? I'll assume the internal pullup is enabled on D13. However perhaps you need a stronger pullup. 5k or 10k.

A quick test would be to replace the motor with a 100 watt incandescent light bulb. Perhaps use a table lamp plug.
Paul

No the cables are not near, I use the internal pull-up. I will try and use some 10k to see if that works.

Ok so the solid state relay just came and that worked without any problem. I think maybe the mechanical relay they use in the modules are not the best and maybe leaking some voltage from the the AC to the DC side.

Could still be noise because the mechanical relay will turn on when the AC line is not at 0 volts. The SSR will only turn on at 0 V
But I'm glad to see you have it working :slight_smile:

It is your pull up resistor (the internal pull up) you are using is at least 20K. This will not adsorbed and dissipate much noise. What it does dissipate occurs in the micro its most sensitive area for noise. I would use an external resistor at least a 5K or lower bringing the load to the switch to at least 1 mA. This will dissipate the noise outside the micro in the resistor. You could also add a snubber across the relay contacts as well.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.