My Arduino becomes erratic when the relay board switches on a motor

So I narrowed the problem down already.

I have a relay board that acts as a H-Bridge to control a linear actuator. The Relay board gets separate 5V from a buck converter. The ground of the Arduino and the Board are common since everything is powered by a 18V battery pack. The Arduino has its own 12V buck converter. To my understanding it is isolated with the JD-VCC pin removed. So separate power but common ground. The rela board should also have some diodes built in.

However when the Relay coils are powered AND the motor is connected, it screws up my Arduino including the serial monitor and erratic LEDs. I narrowed the problem down. This only happens when the electric motor is actually connected. When I remove one lead so the motor is dead, the relays click fine and as expected and nothing is disturbed. So something happens when power flows through the relay and into the motor. What can I do to fix this? Add some diodes or capacitors? But where?

The motor draws about 1A and the cables are plenty thick. They run past the Arduino but only over its edge and with 1cm separation. I doubt it is electomagnetic radiation causing the issue. I think it has to do with currents flowing.

Is the motor powered by the same 12V buck that supplies power to the Arduino?

No, the motor gets its power straight from the 18V battery pack. So the motor gets 18V. The same 18V are applied to the buck converter and that one then powers the Arduino and a RC receiver. The same 18V also power a 5V buck converter which powers the relay. So its all from one battery, but 3 different voltages.

Don't discount EMI. An 18V, 1A DC brushed motor can create a lot of it. The noise can also be radiated by the Ground wire conneted to the motor.
How close is the motor to the arduino?
Which Arduino are you using?
Does the motor have a metal outside?

The motor has two layers of metal outside and is 30cm away. However the metal frame of the project is not connected to ground. I will try that.

It's one of those elusive problems. Without seeing a schematic/wiring diaram and some pictures of your set-up I would only be guessing as to what is wrong.

1 Like

Posting an annotated schematic showing all connections, power, ground and power sources. Note any wires over 10"/25 cm in length. This appears to be EMI to me and currents flowing can cause that.

Sorry I don’t have shematics at the moment, but I am sure my connections are correct. I did this often times before.

The power cables are all about 1m long. How do you fix something like EMI?

Power cables are 1m long, then maybe you have a bunch of 150mm long jumpers connecting to the Arduino, all acting as little receiving antennas. Possibly some poor ground connections somewhere. All will cause problems.

1 Like

Forum members are happy to wait. A schematic is essential for the discussion to continue. A photo of a pencil and paper drawing, with parts, pins and connections clearly labeled, will be fine.

1 Like

I will post pictures on the weekend.

However, I found something! It screws up when the motor turns off. The H-Bridge switches and the linear motor has a noticeable physical jerk. It stops instantly!

I disconnected the motor leads and held them to a battery directly and when I let go there, it keeps freewheeling for a tiny bit.

So I am sure the issue comes from the motor stopping instantly. No idea how to fix that.

One possibility:

See especially post #5.

I just tested 4 diodes between the relay terminals. They work great! However they are also a bit messy. Then I pulled a L298 module out of my junk drawer and I will use that one instead. The motor is only used for height adjustments. So it runs only for a few seconds. PWM control will be nice for that.

Why not show how you tested the diodes, how did you connect them? At this point good luck. I will check back and look for the schematic which was requested about two weeks ago.

Alright for anyone that encounters this problem in the future:

I connected 4 diodes between the outputs of the Relay board. I used two relays. The middle pin of the relays goes to the motor. The left and right pins are 20V and GND. As in post #8 [Solved] Where should I put the flyback diode? - #7 by LarryD

I put the relays going from Positive to the Middle pin (motor) and from the motor further to the left to GND. I did this for both relays. These diodes block the current while the motor is spinning. When it is turned off, the reverse EMF flows through the diodes and they get a little warm for a second.

However, I didn't like this fix. Instead I used A L298N motor driver. These are a bit smaller and cheaper than the BTS7980 and use less pins. So for me it was a good solution. But beware, they only work for up to 2A. My motor only spins for a adjustment, so its very short duration and 0.5A.

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