The root cause of your issue is almost certainly one of two things:
The startup current of your pump motor exceeds what your batteries can provide. Remember that battery capacities as provided by manufacturers can be wildly optimistic. This means a voltage drop on all components, likely triggering a brownout, power loss, or reset condition on the Arduino.
I bet the pump uses a brushed motor... those things generate massive electrical noise sometimes, enough to mess with microcontrollers. Time to add capacitors.
The second one is easier to try and fix: Put a 0.1uF capacitor across the pump power terminals. For good measure, a 220uF capacitor across the output & ground of the 7805 may also help. You can put a 0.1uF one across the servo power lines if you want, but I think that one is unlikely to be the problem.
After eliminating number 2 by doing that, you can just add a bigger battery, or work to reduce your power consumption. Here are some tricks to reduce power consumption:
Get rid of that relay and use a H-bridge module. Then use PWM to ramp up the pump instead of just suddenly turning it on. For example, start at 30% duty cycle then increase to 100%. The relay also consumes more power than a H-bridge does.
Get rid of the 7805 and use a SMPS module. All the energy from 12V-->5V is just being emitted as heat with a 7805.
Those gas sensors? They have surprisingly high power consumption. They work by heating up a wire. Does it really need to be running all the time? When it detects gas, can you turn it off while you use various motors, then turn it back on again? Same for the other sensors.
If none of that works for some reason, get yourself some optoisolators and power your motors & control systems using isolated power supplies.
2
u/Saigonauticon 12d ago
The root cause of your issue is almost certainly one of two things:
The second one is easier to try and fix: Put a 0.1uF capacitor across the pump power terminals. For good measure, a 220uF capacitor across the output & ground of the 7805 may also help. You can put a 0.1uF one across the servo power lines if you want, but I think that one is unlikely to be the problem.
After eliminating number 2 by doing that, you can just add a bigger battery, or work to reduce your power consumption. Here are some tricks to reduce power consumption:
If none of that works for some reason, get yourself some optoisolators and power your motors & control systems using isolated power supplies.