# 12V battery through a transistor then pump not working

I connected 12V to pump and to a transistor then connnected all of them to an Arduino:

It did not turn on.

I used this program:

int pump = 4;
voidsetup(){
pinMode(pump, OUTPUT);
}
voidloop(){
digitalWrite(pump, HIGH);
}

• Yes, that circuit won't work. Please ask a question that can be answered. Mar 4 at 16:31
• That schematic looks very confusing and very wrong. Mar 4 at 16:31
• Your transistor is upside-down, in the wrong place in the circuit, and missing a base resistor. Try reading through here: electronics.stackexchange.com/questions/5336/… Mar 4 at 16:34
• Also, why have you connected VIN and D4 together? Mar 4 at 16:38
• Does the motor need to be connected to BAT3-, or would BAT3+ be just as well? Mar 4 at 16:54

The transistor is intended to carry current in one direction only, and the way you have it wired, that direction is wrong.

You've connected the Arduino's output directly to the transistor's base, which could break something. Use a resistor (R1).

Also, while small motors are unlikely to damage the transistor, it's always a good idea to protect the transistor from the motor with a diode (D1) in reverse across the motor.

The following schematic has these corrections, and will work (assuming motor current is not more than about 1A).

Please note how I've made all the interconnections clear and easy to follow, avoiding wiring intersections where possible. All higher voltages towards the top. Please make a similar effort in your own schematics if you intend to share them, or ask others for help with them.

simulate this circuit – Schematic created using CircuitLab

• The Arduino needs a power source, although the OP is probably depending on power through the USB programming connection. Mar 5 at 4:52
• @PeterBennett Yeah, I didn't want to go where $V_{IN}$ and +5V are not the same, maybe this is an IC, maybe it's an Arduino module with regulator, and so on. Perhaps it's important, but I got lazy, and didn't want to go there. Mar 5 at 7:42