Arduino keeps getting reset randomly

Thread Starter

va28

Joined Feb 8, 2023
13
Hello,
I connected the Arduino with 4 relays, the relays are further connected to 4 motors, and i am giving 12 Volts external supply to motors, now the problem is, when I turn off the power supply of the motor, then the Arduino is working fine with relays, but when I turn on the power supply of the motor, i.e, when I try to run motors, then the Arduino get reset randomly during execution, can you please tell me any solution to solve this?
 

ApacheKid

Joined Jan 12, 2015
1,762
Hello,
I connected the Arduino with 4 relays, the relays are further connected to 4 motors, and i am giving 12 Volts external supply to motors, now the problem is, when I turn off the power supply of the motor, then the Arduino is working fine with relays, but when I turn on the power supply of the motor, i.e, when I try to run motors, then the Arduino get reset randomly during execution, can you please tell me any solution to solve this?
Draw a circuit diagram, does the Arduino and the motors share any connections, like ground or +ve? This is very likely caused by noise on the supply lines of the Arduino, at least that would be my first suspect.
 

Thread Starter

va28

Joined Feb 8, 2023
13
Draw a circuit diagram, does the Arduino and the motors share any connections, like ground or +ve? This is very likely caused by noise on the supply lines of the Arduino, at least that would be my first suspect.
IMG-20230425-WA0002.jpg
 
Last edited by a moderator:

DickCappels

Joined Aug 21, 2008
10,661
You also need power supply bypass capacitors, diodes across the motors and relay coils to limit voltage spikes when drive to the coils is switched off, and probably some drivers for the relays and motors.

The idea is to minimize the high frequency noise and prevent it from getting into any pin of the Arduino.
 

Thread Starter

va28

Joined Feb 8, 2023
13
You also need power supply bypass capacitors, diodes across the motors and relay coils to limit voltage spikes when drive to the coils is switched off, and probably some drivers for the relays and motors.

The idea is to minimize the high frequency noise and prevent it from getting into any pin of the Arduino.
The diode and the driver transistor is already present on the relay module
 

DickCappels

Joined Aug 21, 2008
10,661
Now keep going to reduce the noise that may be present on lines leading to the Arduino. That may even mean passing signals from the drivers up the line to the Arduino.

Remember to bypass the power supplies to the relays to keep the noise there instead of on the power supply lines. You won't know what solves the problem until it is solved. It is like what an automobile mechanic told me: "When you get your bill the last part on the list of parts replaced is the one that fixed the problem."
 

djsfantasi

Joined Apr 11, 2010
9,237
Since the circuit works without the motors powered, my first thought is that the motor noise is being coupled into the Arduino pins.

Since it appears that the motors run in one direction only, I would add a reverse biased diode and a capacitor across the motor terminals to prevent that noise entering the motor power lines.

Even though the motors are mechanically and
isolated from the Arduino pins, their feeds act as antennas sending noise back into the Arduino.
 

ApacheKid

Joined Jan 12, 2015
1,762
I've not done anything like this since I was like 20, but back in the late 70s I built a small "robot" from various surplus motors, gear boxes and so on. It was controlled by one of these:

1682440918143.png

A 6502 based MCU board. Anyway, that unit had two 6v lead acid batteries one for the motors and one for the MCU board, there was no electrical coupling, it used relays as does your circuit but the two systems were galvanically isolated.

The motors switching on and off. reversing etc generated noise but that noise was unable to induce issues in the MCU board.

So my advice is to - from the outset - design such a system like that, as two distinct electrical circuits with no electrical connections between them, do that as well as add bypass capacitors to as Dick and DJS suggests and your problems will likely vanish.

Also consider solid state relays and opto isolation too, it all helps. My little robot didn't do much (it had edge detector microswitches so could remain on a large table, every time it detected and edge it would alter its path, so it remained on the table all the time) but the MCU never crashed, it was stable all the time, never misbehaved (it did in the beginning, hence the isolation was added).
 
Top