Arduino resetting when relay is activated despite protection

hello everyone, I've been diagnosing this problem for 4 days now without finding a solution (not really understanding the problem), I'm building a boxing arcade, I already made a basketball arcade with a lot of shared components and it works. the problem is when the relay is triggered to close the circuit of the electric lock my arduino resets sometimes (not all the time), so I started disconnecting one thing at a time (servo, other arduinos etc) to identify the problem, I'm powering the arduino and the electric lock from a 12v 5 amp power supply, and the relay from a separate 5v 10A power supply (to benefit from opto isolators of the relay), I tried everything but nothing seems to fix the problem, the arduino doesn't reset every time, but about twice or once every 10 times, I connected grounds of arduino directly to ground of 12v, then to ground of 5 volts, I checked the voltage of 12v supply when the relay is activating and it didn't drop, I powered the electric lock from a second 12v5a power supply just to isolate it, but the problem still occurred from time to time, this forum is kinda my last hope hhh, feel free to ask questions and offer suggestions and why not straight solutions (with explanation hopefully), thank you





This looks like you are most likely experiencing enough of a dip in power when the solenoid activates to reset the Uno. The 12v supply that is feeding the Uno is the same supply that is powering the solenoid. If it is only minor dips in power(which it sounds like it is) then you could try adding a capacitor on the line side of the Uno to help compensate for those fluctuations and another for the solenoid. Even better would be to use an isolated power source for the Uno.

Two issues:

You should have a flyback diode across the solenoid/lock.

I have see several locks on the web with that same part number (JF-S1670DL) but with different current ratings. Some say 2A some 3A. I suspect it's actually more than 400mA.

Can you confirm it's only 400mA?

2 Likes

Since you've got a 5V power supply, try running the Arduino off of that (connected to 5V, not Vin).

With a separate power supply for the lock, the Arduino and lock solenoid don't even need a common ground.

And yes, you should have a "reversed" flyback diode across the lock coil.

You might need an oscilloscope to see a short-duration glitch in the power.

Be careful when using the power plug or Vin. Powering through Vin or the power jack means that the Arduino and all peripherals that are on the 5V rail are powered by the onboard 5V regulator. The on board 5V regulator is not heat sinked so will supply limited current before it overheats and shuts down. The amount of current depends on the voltage input to Vin or the power jack. The higher the voltage the less current can by supplied. I would use a buck converter to drop the 12V to 5V and connect that to the 5V on the Arduino, bypassing the, weak, 5V regulator. Then the rated current of the DC DC converter is available on the 5V line.

If you are powering just a couple of sensors or small LEDs from the 5V, you are fine with Vin or the jack, just be aware the for heavier currents the on board regulator may not hold up.

So in this case a buck converter will add some isolation between the 12V power supply and the Uno.

+1 for using the 5V already available to power the Uno, through the 5V pin, if it has the current capability to run the relay coil and the Uno.

I did use two power supplies one for the uno and one for the lock, the problem persisted
Thanks

Yes even though it says 500mA I've read on some seller descriptions that it peaks at 2amps, and the standard diodes that I found are rated for 1 amp, so I should look for other diodes ? Any suggestion is appreciated. Thanks

There was some voltage change but it wasn't significant, like 12.015 to 12.023 i think, will that cause an issue ? Do you have any suggesting regarding the model of the diodes that needs to be used, is there a more elegant solution like a small board that does the job, since this is a commercial product. Thank you

How was this measured?

Yes, I noticed it got hot on a previous project, so in this one I'm powering all 5v peripherals from the supply, I'm not sure if powering the Arduino with the 5v will solve the issue, since I already tried powering both of them from different power supplies and the problem still existed, thanks for the suggestion

Multimeter

And the sampling rate of the unnamed multimeter is . . ?

CORRECT, I would use a 17 ~ 24V TVS diode for quicker release though.
EDIT: I would use a relay module with 12V relay, since you already have a 12V source.

  • I don't see a ground connection between the relay module and the Arduino

  • 5V is an OUTPUT NOT an INPUT. Arduino does NOT recommend using it as a power input and neither do I.

  • A good choice for the flyback diode would be a 1N5408G but any general purpose diode with a 2A or higher rating with a voltage of 500V or more will do.

Should the “NO” and “COM” pins on the relay be reversed?

According kdz41 (the OP), the relay module is opto-isolated, the 5V power is for the isolated side of the module. No ground connection between the Arduino and the relay board is needed or advisable.

I found this manual:

http://wiki.sunfounder.cc/index.php?title=2_Channel_5V_Relay_Module

It shows a terminal named RY-VCC. It looks like the same point that is labeled JD-VCC on your picture. In order to take advantage of the opto-isolation yo must remov the jumper between JD-VCC and VCC. Otherwise you might be gettin spikes from the relay board that are stopping the Arduino.

This will not change anything. Relay contacts don’t care which way the electrons move through them.

Why?
The diode will never see more than 12volt.
Leo..

1 Like

Hi,
Can you please post some images of your project?
So we can see your component layout.

Can you dress your wiring so that the lock circuitry is not near the other circuitry?

Have you got your lock circuit connected directly to the power supply like this?
This will minimise the effect of lock current on the current going to the UNO.

Tom... :smiley: :+1: :coffee: :australia:

OOPS! Wrong topic. :grimacing: