![Wink :wink:](./images/smilies/icon_wink.gif)
In order to solve this, i separated the electricity of the motors from that of the processing unit (so the motors work with a separate battery, while the arduino and the other sensors work with another separate battery), and i linked the arduino with the mosfets using optocouplers (pc817)
( have a further understanding of Optocoupler working principle and basics=http://www.apogeeweb.net/article/69.html). This solved the problem of having common ground, but the system became more complicated.
One of my friends told me later that i didn't need to do this, and that this problem (that of common ground) can be solved easily by just rerouting the circuit in a certain way that separates the physical traces of the digital devices than that of the mosfet and motors.
I don't know what is the best solution. Can anyone help me with that? Thank you in advance.