SOLVED - Beginner circuit with DC motor

I am a beginner working sequentially through the first part of Arduino for Dummies. I was rocking along and I feel like I understand everything very well so far, but for some reason I can’t seem to get the “Motor Sketch” to work. This is just a very simple sketch using a digital pin and a transistor to turn a DC motor off and on (1 sec intervals). I built the circuit and uploaded the sketch expecting it to work, but the motor didn’t turn.

Since this was my first time using both the motor and the transistor, I split the circuit into two parts and tested each separately. I know the transistor works because if I replace the motor with an LED (and resistor), it blinks off and on as expected. I know the motor works, because if I hook it straight up to +5v and GND (with diode), it spins great. But when I put the two halves together, I get nothing. Since I am using pin 13 on the board for the signal, I can see that it is working because the on-board LED blinks.

The transistor is a PN2222A. I think everything else is visible in the attached photo. I swear that this matches both the diagram and the schematic in the book. But electrons don’t lie, so there must be something wrong with it. If you can see my error, please let me know.

Thank you!

P.S. First post, so hoping photo uploads successfully…

Many problems.

Note: The PN2222A terminals are EBC left to right as shown in image.
The base appears to have no resistor, if it's 1K or 2K - the value is too high.
The two 1K resistors appear to be connected in series.
The emitter should be tied to ground - not the motor.
The collector should switch the motor.
The kickback diode is installed incorrectly.
If the motor draws more than 500mA, you should use a more powerful transistor (i.e. 1.5A or higher).
The 9V battery cannot source much current - not meant to drive a motor.
There's more ... this is a start.

In the future, a closer photo taken directly above the circuit would make it easier to see. Also, a schematic
would help.

Thanks for taking the time to view and respond. I'm sure you are right about some things. But just to clarify:

  1. There are two resistors in series between the 13 pin and the base. They are 2k and 200 ohm. The book shows a 2.2k ohm resistor, but my kit didn't come with one that size. Aren't resistors in series additive? In any case, it seems to control the transistor fine when I am only using it to control an LED rather than a motor.

  2. I was not sure about the transistor pin out, so I tried it both ways. When I reverse it, the motor still doesn't spin, but the transistor gets hot. I thought that was a sign it should be flipped back, but maybe it's a sign of something else. Then again, the transistor works as connected when there's an LED in front of it instead of a motor.

  3. It does not seem like the motor draws too much current (though I have not checked any ratings, it just came in my starter kit). It spins great when connected without the transistor. And it is not even getting 9v, because it is only connected to the 5v pin on the board. I have not even tried connecting it directly to the battery, or by using Vin.

  4. How should the diode be connected? What's wrong with it as connected? I spent a couple hours looking at similar circuits on YouTube and elsewhere, and it looked to me like they were all the same as mine. That's why I am getting frustrated.

Guess I'll keep digging online until I figure it out...

  1. Use something like 150 ohm or 220 ohm for the base resistor - you want to fully
    saturate the transistor (otherwise it will get very hot very quickly). In a switching
    configuration the difference between 2k and 2k2 is immaterial, its the order of magnitude
    that matters!

  2. Check the datasheet for pin-out and get it right before applying power - you can
    easily damage a transistor by guessing, then all bets are off... Datasheets have a little
    diagram you can compare to your circuit to reassure yourself.

  3. You misunderstand - a motor running with no load may take quite a small current,
    but its stall current can be several amps - this is the current peak it takes at startup
    until the rotor is spinning, this is the current that can damage sensitive semiconductor
    components. With the 9V battery the current is limited by the battery, actually giving
    the transistor an easier time, but reducing the torque the motor can provide under load
    which depends directly on the current.

  4. Diode backwards across the motor - as far as I can tell you have this right.

Thanks @MarkT! Your response was dead-on. Yes, I had the transistor backwards in the photo, but that's actually not the main thing that was throwing me off. The words I needed to hear were "you want to fully saturate the transistor". As soon as I switched from 2.2k ohms to 200 ohms for the base resistor, I was able to get the motor spinning in less than a minute. The transistor does get pretty warm, so maybe I do need to get one with a higher capacity. But that's a separate issue.

I was previously thrown off by two things: (a) the Dummies book said to use 2.2k ohms; and (b) the transistor successfully blinks an LED with the 2.2k ohms. But MarkT's comment #3 helped me to understand not just what I needed to do, but also why. The motor needs much more current than an LED, and with only a tiny current flowing to the base of the transistor, the resistance between the collector and the emitter was too high.

Essentially, I was thinking of the transistor as an on-off switch, but that's not what it is. At least in this simple circuit, it seems more like a variable resistor. And it's the current to the base pin that determines the level of resistance.

Essentially, I was thinking of the transistor as an on-off switch, but that’s not what it is. At least in this simple circuit, it seems more like a variable resistor. And it’s the current to the base pin that determines the level of resistance.

The transistor is what you want to be . By Ohms Law, if you put 2.2k resistor in series with the base the current to transistor is:

Vcc- VBE/RBase= 5V-0.7/2200 = 0.0021 A = 2.1 mA.

The transistor is ON, but it is NOT a variable resistor because 2.2 ohms is a FIXED value and does not change.

If you vary the current , (using an op amp or other means) is is variable resistor.

If you read the datasheet for the transistor, the VBE for SATURATION is probably 0.2 V
If the hfe is 100 , 2.1 mA * 100 = 210 mA which is probably not enough for the motor.
Changing the resistor to 200 ohms makes it SWITCH because it results in saturation (or close to it).