Two motors with shared ground, Induvidual control

Hi All,

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.

Thanks in advance for any help!

kwhohasamullet:
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?

No problems, ill draw the circuit and post it up.

Direction doesn’t matter. All I need to do is switch the motor on and off with the arduino.
ie. (Turn on motor 1, delay for 100ms, Turn off Motor 1, Turn on motor 2, Delay 1000ms)

THanks

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.

Circuit layout that's currently on my breadboard (Gone with this rather than a schematic because I know this is connect, Don't want to put out a wrong schematic and confuse things)

Currently if I turn either pin 9 or 10 high both motors will run.
Goal if if i have pin 9 high and 10 low only motor 1 will run.

Thanks @crossroads, Any chance you have a link to a diagram of what that would look like? cant quite visual what you are suggesting

Thanks,

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.

3,5,6,9,10,11 are all PWM pins. If you can drive the transistor with PWM, you can control its speed. They will likely need some minimum PWM level to start spinning.

Amazing, I see where I was going wrong now and have got it working on my breadboard!

Thank you for the quick and incredibly detailed response :slight_smile: