Does this relay switch have a flyback diode?

I bought these from Amazon:

How do I figure out if they have, or don't have, a flyback diode?
Would you expect it to have one? These are the same switch everybody sells -- they all look the same, they change the names each time...

I am experiencing random resets when I power a pump with it. I power the arduino and the pump with the same power (12V brought down to 5V with a buck converter, placed in the 5V pin in the arduino.

(I checked these very forums, and people mentioned that Arduino NANO is actually fine to be powered via this. However, I wonder if powering it from the Vin pin would help, although it would mean getting ANOTHER buck converter and step the power to 9V...)

The small part to the right of the green LED is the flyback diode.

Thank you. I HAVE to say this... I am a software engineer... the software is BEAUTIFUL. With automatic testing, automatic and manual code auditing done, carefully checking each variable -- the program is really big, across 10 files, as the thing I built really does a million things and it's very configurable. I wrote it all without even knowing C/C++ -- I learned it on the spot, remembering bits and pieces from 35 years ago.

I SUCK AT ELECTRONICS! I DO! I DO!

And it frustrates me. It really does. I am trying to figure out why it resets, and I realise that the quality of my circuit as a whole, design to execution, is the equivalent of a bunch of horrible spaghetti code that works only 80% of the time. Sucking at electronics drives me crazy.

I would have never known that's the flyback diode. You knew by looking at a picture on Amazon. I am humbled and feel the need to get my electronics skills of pars of my software engineering skills.

It's just that my lifespan expectation doesn't make this look very likely... It took me years to get software development really right, and I started as a kid!

Either your power supply is to weak, your pump runs from the same power supply as the arduino and misses the flyback diode or you get some other noise from the pump when turning it on/off (which translate to bad power supply + bad wiring). Sidenote: get a multimeter and use it if you do electronics.

Are you using one of those little 5V submersible pumps?

There is no picture of that.

You might consider using a 5V supply that is a 5V supply.
Or, better, using 12V relay modules to go with the 12V supply, assuming it has sufficient capacity.

Either your power supply is to weak, your pump runs from the same power supply as the arduino

Nope, this is not possible. The power supply is 1amp; the pump won't be anywhere near that.

you get some other noise from the pump when turning it on/off (which translate to bad power supply + bad wiring)

The power comes from this buck converter:

I use this to step down the power from 12V to 5V and feed the arduino.
So... when you say "bad wiring", what do you mean?
This is what my board looks like:

Sidenote: get a multimeter and use it if you do electronics

I HAVE a multimeter! What should I check?
I can reproduce the reboots easily -- I basically open and close the solenoid continuously every 20ms, and the board rebootsfreezes within 3 seconds...

You said it was a pump. So which?

1 Like

That, 50Hz, is pretty fast for such a thing.
Monitor the 5V - see if it sags - might be hard to tell with a DMM. (Maybe yours has a dot-bar?)

Apologies. I have a pump and an electromagnetic solenoid pump. I use them interchangeably...
I have the exact same problems with both.

I am trying it with 200ms, and ... ah there you go. It takes about 20 seconds to finally crash, but it does crash each time.

A friend recommended this:

0.1µF Capacitor: Place as close as possible to the Arduino's VCC and GND pins.
10µF Capacitor: Place near the Arduino's power pins, ensuring it's still relatively close for effective decoupling.

Will this help?

Won't hurt.

Won't hurt.

Will if fix the issue though?

If you have such, try it.

Maybe.
I recommend a flyback diode and a 0.1uF cap on the pump and the solenoid as close as possible to the pump/solenoid

I will buy them... premium $$$ on Amazon...

I would effectively solder the diode and the capacitor to the across the terminals of the solenoid valve?
Like, across these:

Yes, same with pump.
Also, I don't recommend powering an Arduino via the 5V output pin.
If you want to power an Arduino via the 5V output pin, it must be well regulated, free of voltage spikes and noise.
I doubt if the buck converter with the pump load is well regulated and clean

Like I said, if you have such. I did not advocate a purchase order.

Running one relay and one little pump/motor should not be the end of the world like this.
"Buck converting" 12V to 5V to run a 5V relay module is everything bassackwards.