Hi,
I'm pretty new to this. I have cobbled together something like the attached.
The button activates the transistor which runs a pump for a given period. If the button is pressed while the D2 pin is high the pump stops. It should be pretty simple.
The Node MCU is powered by a USB 5v power supply and works ok, the motor is powered by a 240v -> 12v PSU (something cheap and Chinese).
Everything seems to work ok until I plug the 12v Power Supply in, then if I get close to the signal cable for the switch it triggers the switch. Sometimes the switch will trigger itself (seemingly randomly, but I'd imagine there is some predictable causation).
I'm guessing the issue is with noise from the ground?? as that is all I can see they have in common... Or have I missed something pretty fundamental here?
Any help much appreciated (sorry for my janky diagram).
Kind Regards
Ryan