To preface this post I am a programmer who is still very new to learning electronics so I am likely misunderstanding a basic concept and also totally misusing words. Please correct my where I am wrong so I can learn!
Trying to work with an existing piece of hardware and having issues getting it to work how I want. The existing hardware is just two motors on wires, the catch being it terminates at a connector with Motor1 +, Motor 2+ and ground (shared between both motors), attached a fritzing picture of this just incase this wasn't clear (and im pretty sure by Law you have to include one to post on here)
The goal is to be able to individually drive each motor which seems very simple but I just cant figure it out.
I have had success driving one motor at a time with both a MOSFET and an NPN transistor following the online guides below but when I try and get the second one going using the same method I just end up with both running at the same time.
My understanding of this (please correct me if I am wrong) is that because you are switching on the ground in the tutorials as long as either is opening a path to ground both motors will run
Logical next step is to switch on the positive connection side but this gives some strange results between not working at all to switching between low voltage and higher voltage but never off. Also I cannot seem to find any examples where circuits have been wired like this so makes me think this approach is wrong.
I have had success driving one motor at a time with both a MOSFET and an NPN transistor following the online guides below but when I try and get the second one going using the same method I just end up with both running at the same time
Really, it's best to just bypass references to the tutorial, and show us a schematic of the circuit that doesn't work. Is your problem in trying to make them run bidirectionally?
Easiest way is to swap the Power & Gnd connections. With a common power source, then two NPN or two N-channel MOSFETs can be used to make the Gnd connection and turn the motors. This works well when the voltage source is >5V.
Arduino can drive 5V to the "lowside" transistors acting as switches quite readily. Extra components are needed to drive "highside" transistors as the drive signals must also go above 5V.
Also, NPN & N-channel MOSFET usually have lower voltage across them so the motors can see more of the voltage and turn more efficiently.
This is what I am talking about.
Note the extra components. The diode are to prevent the motors from damaging the transistors. 1N4007 or along those lines.
The resistors are to prevent the transistors from damaging the Arduino pins. 150 ohm to 270 ohm will work.
The transistors need to be selected to not be damaged by the current going thru the motors.