Basic beginner circuit question.

Hey guys I was playing around with the circuit pictured in the attached image. The code I have loaded just turns the motor on and off in a loop through the transistor. Just out of curiosity I took the jumper ends out from the 5v and ground and attached them to a 9v battery. I thought this would still work since its just the power supply. Nothing happened though with the battery attached ( I tried switching the terminals as well). The battery is good and when attached to the motor directly spun it very fast.

I also tried hooking up a LED and a resistor in place of the motor and when I hooked up the battery in place of the normal 5v and ground I could see a very dim blinking (It blinked quite bright when hooked up to the ardiuno).

I was just curious if anyone had any insight into why this was. I thought a nine volt battery would drive the motor harder and light the led brighter then the 5v supply. Thanks.

Ok, I see your image, here's a better guide to look at with different power supplies.

Yes, you must have forgotten to connect the Arduino ground to the negative end of the battery.

Thanks guys, that was it. Ok, so I know I this is going to expose my considerable level of ignorance but I have a follow up question. Why does it need to return to ground on the arduino? My thinking was that hooking the wires up to the battery directly it makes a complete circuit when the transistor is activated with the pin 9 output. Obviously this must be wrong but I don't understand why. Thanks.

Your Arduino is turning the transistor on and off. To do this the Arduino needs a complete path for the base current to flow. Out of the Arduino pin, through the base resistor, into base of the transistor, out of the emitter to ground and back to the Arduino ground. Hence a complete path.

Byork thank for the link, very good info.

Larry thanks that makes sense. So the current from the switching signal flows out of the transistor along with the current its switching but it needs a path back to its own ground. Is this correct?


Ok Thanks. I know this is stupid simple but I understand a lot better now.

"The only stupid question is one that isn't asked."

If you want to run something connected to an Arduino from a separate power source, you must connect the grounds together.

Look at the attached picture .
The golden line - the power arduino gives to the driver - should have a GND . So arduino’s GND has to be connected to the others .
However , some drivers - for example , EasyDriver stepper driver - has a little gnd near step/dir which is for arduino’s gnd . Makes things easier .
The ‘transistor’ is the driver . Drivers are transistors . So to make things simpler , instead of a driver , here’s a single transistor .

You should not be powering any inductive load such as motor, relay, solenoid from
a logic supply such at the Arduino’s 5V rail, since that’s a really easy way to trash all
your electronics, or if you are lucky have sporadic resets.

Inductive loads can put all sorts of spikes and drop-outs on the supply, logic chips need
clean steady power with no over-voltage spikes.