Arduino Uno resetting itself in specific situation

On my current project I am experiencing an issue with the Arduino Uno appearing to get reset in the middle of running my sketch. However, it does not seem to be caused by the normal reasons and problem is only occurring in a specific and what seems to me to be an unusual situation. I will try to simplify the situation as much as possible with leaving out relevant details. A very brief summary of my project is: 3 push buttons, 4 LEDs, 4 hall sensors, an 8-relay board controlled by the Arduino, and eight 12-volt 30-amp relays each controlled by a smaller corresponding relay. When no power is applied to the 12-volt, 30-amp relays that are on an entirely different power source, everything works perfectly; however, when I apply power to the larger relays (even if there is no load on those relays), when I release one of the two push buttons that activates one or more of the small relays, the Arduino frequently resets and setup() gets executed and all variables are reset. However, it does not always reset and 2 of the 8 relays are much more prone to this issue even though all relays are wired identically. In the most reliably recreatable situation, only one of the 8 small relays is activated so only 1 of the larger relays is activated. The push buttons are wired using standard 10K pull-down resistors. Pressing the buttons never causes the reset – only when they are released. It seems to me that it could be some kind of electrical noise causing the issue, but I wouldn’t expect turning off a relay controlled by a relay could cause this much of an issue for the Arduino. Because it works perfectly without any issues when the secondary 12 volt circuit is powered off, I don’t see how it could be a problem with my sketch. . I consider myself an experienced beginner when it comes to working with Arduinos.

More details concerning components:

HiLetgo 5V 8 Channel Relay Module with OPTO-Isolated Support High and Low Level Trigger

Nilight 50003R Automotive Set 5-Pin 30/40A 12V SPDT with Interlocking Relay Socket and Wiring Harness https://www.amazon.com/gp/product/B0748F1JK4/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Power supply for 12 volt portion of system: DC 12V 50A 600W Power Supply Adapter Transformer Switch AC 110V / 220V to DC 12V 20amp Switching Converter https://www.amazon.com/gp/product/B09NJLNYKH/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&th=1

Power source for Arduino connected to above power supply: Magnolian High Efficiency DC/DC Converter 12V Step Down to 9V 2A 18W Power Supply Module. Also tried running Arduino with just computer USB cable. Both gave same results. https://www.amazon.com/gp/product/B00A71E52G/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&th=1

Either electrical noise in the power leads or an inadequate power supply and "brown-out reset" is almost certainly the problem. If noise is the issue, you need better power supply filtering.

For detailed advice, please post a schematic diagram (hand drawn is preferred), paying particular attention to the power supply arrangement. Post links to the modules and be sure component values are specified.

1 Like

Hi, @keng-ne
Welcome to the forum.

Sorry but had to spread it out to make it clearer.

We need your code and a schematic of you project.

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

Thanks :+1:

Please include relevant details.

If it is a power brown-out situation, wouldn't you expect it to occur when the relays are engaged and start using power rather than than when the button is released and the stop using power?

It seems to be an EMI problem.

First try putting a flyback diode across all of the 12V relay coils and see if that fixes the problem

Any suggestions as to the best flyback diode to use? THANKS!

Hi, @keng-ne

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

In general use a flyback diode that has the same current rating as the load you are trying to suppress. In your case that will be a 1N4001. However, if you have a relay board as opposed to just a relay then it should be fitted with flyback diodes anyway.

Any of these will work:
1N4001
1N4002
1N4003
1N4004
1N4005
1N4006
1N4007
They are all commonly available

The flyback diodes on the secondary 12 volt circuit seems to have worked. THANKS! Although, I'm still a bit surprised that the EMI problem is making its way back to the Arduino through the first set of relays that I believe do have flyback diodes on that board.

EMI - electromagnetic interference - can be transmitted to components in two ways.

  1. By conduction, that is through some sort of ground or other connection.
  2. By radiation - that is like a radio transmitter and doesn't need a connection

The best way to stop both types is the eliminate the EMI at source, which is what you did with the fly-back diode.

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