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);
}
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI 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);
}
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