I have a pretty big automation project which has one problem: after I turn off 2 pumps and turn on 2 solenoids my arduino dies and stops executing code. I'm attaching the diagram which shows how everything is wired (notice, I did not include other components which work fine).
Could you help me prevent these voltage drops? that shut down the arduino?
That's to be expected with that wiring.
Motors and solenoids need kick back, free wheel, diodes.
Indeed!
While I am pretty sure @Railroader has identified the problem, missing things out is not a good idea because the things you missed might work themselves but be the cause of other things not behaving.
It would help if you read and followed the advice in the pinned post re 'How to get the most from the forum'. One thing you will learn is that kind of photo is not helping. The schematic is the instructioins, we want to know where YOU connected the wires. A simple hand drawn diagram of where every wire goes, lables, datasheet links for not common items then take a photo of the diagram you produced. We also need ALL the source code in code tags and any Serial output that is relevant also in code tags.
Strange, why do so many tutorials don't even mention installing diodes...
So I should put a diode on all solenoids, pumps and relay then?
All inductive loads needs it. Naked relays are electromagnets inside but the relay-modules usually have those diodes already. Motors and solenoids needs it even if relay fingers switch them. The sparcs/voltage kicks when switching of create noise in both wiring and air. Transistors might be blown due to the over voltage generated if the current can free wheel.
Because once they've got your page view they really don't care much if it works?
Welcome!
It appears you are suffering from interference, and your pictures confirm that it is likely to be a serious problem. You have built a fantastic noise generator, not a controlled system.
To get better help you need to post an annotated schematic showing exactly how you wired it. Include all power sources and any external components, such as capacitors, diodes, resistors, and so on.
Also post links to the technical information for the hardware devices you are using. Following is a quick FMEA analysis.
Minimum fixes (before anything else)
If you want this have some semblance of working:
- Physically separate power and logic
keep motor wiring away from Arduino wiring - Twist pairs: power return, step/dir + ground
- Add decoupling, 0.1uF at every module, bulk (100–470uF) near motors/drivers
- Flyback protection directly across every inductive load
- Star ground, one central ground point, high current returns go there, not through logic
- Shorten wires especially signals
- Add a solid ground reference even a simple copper bus or plane helps
This should get you startled. You might want to watch a few tutorials on basic electronics and systems.
Kickback diodes won't prevent voltage drops if that is actually the problem.
Powering the Uno via the 5V output pin is usually not a good idea, especially if you don't have a well regulated and clean supply. I would power it via the Vin pin using 9V-12V.
Because they are not always needed.
Your ground connection arrangement will also cause problems.
The relay GND should connect to the 5V buck ground not the 12V buck ground
The 12V ground should not connect to the 5V ground.

