Arduino DC Motor with external powersupply

I’m trying to control a DC Motor (5v) with Arduino and a external powersupply (5v).
You can see my circuit below, I’m using a NPN2222 transistor and a 1K resistor.

Somehow, on Tinkercad my circuit is working perfectly, but when I try it on my Arduino the motor doesn’t spin at all. Any recommendations?

My Code:
int motorPin = 3;

void setup() {

pinMode(motorPin, OUTPUT);
}

void loop() {
digitalWrite(motorPin,HIGH);
}

You need a common ground, connect the ground of the external psu to the Arduino.

E40racer: You need a common ground, connect the ground of the external psu to the Arduino.

Thank you for your answer, I tried it. But still no results.

I’m using a NPN2222 transistor and a 1K resistor.

If that’s a 2n2222 it’s miswired. the base and collector are ok but the emitter should go to GND, not 5v.

1024px-2N2222,_PN2222,_and_P2N2222_BJT_Pinout.jpg

raschemmel:
If that’s a 2n2222 it’s miswired. the base and collector are ok but the emitter should go to GND, not 5v.

1024px-2N2222,_PN2222,_and_P2N2222_BJT_Pinout.jpg

Thank you, I am using a PN2222, so i indeed miswired the transistor, I’ve put the transistor in the other way around but the motor is still not working.

I never said it was BACKWARDS. I said it was miswired. The EMITTER SHOULD GO TO GND. Reversing the transistor doesn't correct the miswire on the emitter. Move the emitter wire from 5V to GND .

raschemmel: I never said it was BACKWARDS. I said it was miswired. The EMITTER SHOULD GO TO GND. Reversing the transistor doesn't correct the miswire on the emitter. Move the emitter wire from 5V to GND .

Sorry i've read that too fast. I rewired the system like this: but it's still not working, the emitter is now connected to the GND on my Arduino.

|500x355

So did you test it by moving the wire from the arduino output to +5V ? And did you remove the power and test the transistor on diode scale or at least replace it to see if there is any change ?

How about getting a meter and giving us the voltages on the three transistor pins ? Did you test the motor by connecting it directly to the power supply ?