I'm making automatic water plant system. I'm using:
3.3-6V water pump -https://www.amazon.com/Vipe-Micro-Submersible-Motor-Water/dp/B01N0X3CW4
Capacitive soil moisture sensor - https://www.amazon.com/Gikfun-Capacitive-Corrosion-Resistant-Detection/dp/B07H3P1NRM
I've noticed that when motor turns on sensor readings are much higher. First I thought that the problem is in sensor, but when I measured sensor output in both cases (when motor is on and when motor is off) there was no difference, voltage was the same. Then I measured voltage in analog pin A0 that I used, and I saw there is increase in voltage when pump is on (+0.4V), so my guess is that this voltage is added to sensor output voltage which is giving me higher values in my serial monitor.
For powering my pump I'm using same circuit as in this example: https://www.devacron.com/arduino-tip120-control-dc-motor/
Just except potentiometer there is my sensor, powered via 3.3V Arduino pin (its GND is connected to Arduino GND). I also tried connecting all grounds together in one point, didn't help. I powered Arduino with usb and with 9V supply, in both cases same problem. Tried powering pump and Arduino with same and with different power supplies, no luck either.
I should also add that there is no change in AREF and 5V pin when pump is working. 4.97V in both cases.
Does anyone have any idea what can be the problem and how to solve it?
Here is how I wired everything: https://i.stack.imgur.com/8IDQR.jpg
I also tried with 0.1uF ceramic and 10nF electrolytic capacitors. as suggested, wiring it like this: https://i.stack.imgur.com/fNQnX.jpg Didn't make much difference, problem is still there.