I am creating a simple robot that is controlled by an Arduino UNO, and given instructions by a button matrix.
One can press 4 buttons for Forward, Backward, Left and right on on the matrix array, which are translated into signals for a custom L293 module (PCB) attached to the UNO. The L293D module is powered by a desktop SMPS at the moment, which is connected to its 5V and 12V pins, while I power the UNO with USB power.
The problem I am facing is that motors don't move even when correct signal is given, which I have verified through Serial Monitor in the Arduino IDE. But they do move if I attach any of the 4 data pins to SMPS' ground line or just touch it with bare hands.
My knowledge of practical electronics is minimal and unsystematic, but I think it has something to do with common ground. I would like to know how I can resolve this problem and can I power both L293D and UNO from a single power source, such as a 12V battery, and if so, how?
Here is the schema of the setup (power sources not shown):