3

So I am new to Arduino and new to electronics in general. I've looked up a few tutorials and they all have a simple early tutorial that turns on a DC motor and turns it off again. Something like this:

Valid XHTML

The transistor I am using is a 2N2222 and the motor is a little 3V DC toy motor.

The problem is that the when I use this circuit, the motor barely turns (I need to give it a little help to get it it moving). I know my code is right (motor is on for 5 seconds, off for 1). i can tell this is working but clearly something is not right.

I am powering the Arduino off the USB port.

As a test, I swapped out the 2.2K Ohm resistor for a 560 Ohm resistor and the motor seems to run fine. However, it creeps during the "off" time (the motor is not under any load). Also, the transistor gets very hot after about a minute of running this loop.

So my questions are:

1) Why does the motor not work when I use the 2.2K Ohm resistor when I see that 2.2K Ohm resistor in different circuit diagrams that demonstrate this type of circuit?

2) Why does changing to the 560 Ohm have the effect that it does

3) Why does the motor creep during the off cycle when using the 560 Ohm?

4) Why does the transistor get so hot using the 560 Ohm resistor?

5) Finally, sometimes as a test, to simple try to turn turn the motor on, I will just reroute to pin 9 wire directly to the Arduino 5V on my breadboard (bypassing Arduino control altogether). Is there any reason this is a bad idea?

I am anticipating questions about current draw but my multimeter maxes out at 200mA; I am getting a new one that goes to 10A and will help me see how much I am drawing.

Thanks in advance of any help. I have tried to be clear and concise so hopefully this does not elicit any snark. If there are any resources to point me to, I would be happy to hear them.

Thank you!

Jim

  • 2
    Are you using external power source? USB is not strong enough for driving DC motor. – KIIV Feb 12 '17 at 18:57
  • 2
    Are you sure you have wired the transistor the right way round? – Majenko Feb 12 '17 at 19:01
6

I see a couple of issues here, which are related to your questions. I will use numbers here, but these do not necessarily correspond to the numbers you have used when asking.

  1. The first thing you need to do when controlling a motor is to know it maximum stall current. The stall current is the current that will circulate through the motor (and through the transistor) when you apply an external force to stop the motor's shaft. But it's also the same current needed for the motor to start when it's completely stopped. So, for dimentioning a transistor, you typically will select one that has, as a rule of thumb, a collector current two times bigger than the motor's stall current.

  2. The 2N2222 has a maximum Ic of 800 mA (best case, since there are 600 mA versions as far as I know). Although you are not specifying much about your particular motor, a typical 3V DC motor may easily be asking for 500+ mA. Some small motors (specially bad quality ones) may have stall currents bigger than 1 A.

  3. If your motor is asking for, let's say 300 mA when continuously running, then, you are near enough of the maximum current of the 2N2222.

  4. But there is something more important here: dropout voltage in the transistor. The 2N2222 is a bipolar one, so it will have a Vce superior to 1V (probably around 2V), which means that you are dissipating a non trivial amount of power in the transistor. That power is not useful for your motor, nor for your transistor. Here, if the motor has a 3V nominal voltage, the 2V dropout in the transistor is even desirable, but I don't see your calculations about the real dropout in your description. So I assume that you are just counting that there will be an approximate 2V dropout. That means that, if your motor is taking 0.5A to work, you are dissipating 2V x 0.5A = 1W (Watt) in the transistor. But the poor 2N2222 is a 0.5W transistor! But even if your motor is using much less current, let's say 0.25 A, you are sill using it at its limits. That will explain why it's getting hot.

  5. So, my advice is to go for a bigger transistor, if you want to count on its dropout to do not apply a voltage bigger than 3V to the motor (which can really reduce it lifespan a lot), AND do some calculations to be sure that at the currents you are using, you will have the Vce that you want.

  6. Another option, probably better, is to replace that bipolar old transistor by a MOSFET, but you will need to provide the apropiate voltage for supplying the motor, since if not you will get nearly all the 5V to the motor (due to the very low Ron on Mosfets, and thus very low dropout voltage), and that will be very bad.

  7. Also, please note that the 500mA of the USB port are probably not enough for your setup. But even if you are powering your Arduino from an external power supply through its power jack, you will find a good idea to use common grounds but different Vcc sources for logic and for the motor.

  8. Finally a short advice: be sure that the diode protecting the back EMF (the diode connected with its cathode to Vcc in your circuit) is a fast diode. A slow, 1Nxxxx diode is usually to slow for effectively protecting your transistor. If you are using for example an 1N4007, you can switch to a UF4007 (Ultra Fast).

  9. Regarding your 560R vs 2K2 resistor, this exceeds the answer a bit, so my advice is to read something about base resistors in transistors, like this. Also something about open collector configurations may help.

  10. Finally, the practice of connecting the base resistor to Vcc in this kind of circuit to test the transistor should be fine. But DO NOT CONNECT the transistor's base directly, use always the resistor.

  • The links to the evilmadscientist alone is worth a +1, but very nice answer. I have the same issue with a sample Arduino kit and a motor that stalls at start so now I know how to approach it. – Kelly S. French Jul 16 '18 at 16:37
0

***ERROR CORRECTION: Sorry all, I did have one error in my code that explains the creep. I thought I was running a loop to simply turn the motor on and off but actually it was running full on for 5 sec (255) and partial speed (120) of 1 sec, thus the creep. When resetting the code to on on for 5 sec, fully off for 1 sec, with a 560 Ohm resistor, things work as expected. (I still have the problem with the 2.2K Ohm though so most of my question stands.

nbloqs, Thank you ; I will review your answer in detail.

What would so many tutorials show this basic schematic if to has so many issues?

Thanks again!

  • Some of the tutorials are designed for kits that come with motors where they know the currents involved. Also, usually they are pretty basic and most of them will not deal with base resistor values, or proper transistor selection. I was not saying that the 2N2222 will not work, but it will probably operate at its limits and thus will be heating (specially if the motor is kind of unknown). Regarding your resistor, I added point 9 to my answer. – nbloqs Feb 12 '17 at 20:56
  • Also added point 10 about your "test with Vcc" question. – nbloqs Feb 12 '17 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.