Tansistor help to power motors

i cant tell you the motor ratings because im using an rc car(the chasis and the motors, after ripping the circuitry apart )

but i guess the TIP122 is rated much more than my motor.

Can you post your code? Put it in a code block by selecting it and pressing the # button above.

It might help find the problem.

ok
everything is working fine with the 3904 !

(i burned up 3 of those, , but got one running in the SAME breadboard)

#define fadePin 9

void setup(){
  pinMode(fadePin, OUTPUT);
}

void loop(){

  for(int i = 0; i<360; i++){
    //convert 0-360 angle to radian (needed for sin function)
    float rad = DEG_TO_RAD * i;

    //calculate sin of angle as number between 0 and 255
    int sinOut = constrain((sin(rad) * 128) + 128, 0, 255); 

    
    analogWrite(fadePin,sinOut);
if(sinOut==0)
delay(200);
    delay(15);
  }

}

im 100% sure that the code is not wrong(its too basic to go any wrong !)

Yes, the code looks fine. I even tested it myself to make sure that the sinOut variable went the full range from 0-255, which it does.

Motors have a very low resistance and require a lot of current (which is why the 3904 got so hot). This is why the project plan required the high-current Darlington transistor.

If you haven't yet - go back to your original design with the TIP-120 or -122 and make sure you include the resistor and diode. If you can, try a fresh transistor:

Quote from http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/

What’s the diode used for?
This circuit is pretty simple. This type of transistor is switched by current and not voltage, so we need to make sure to supply the correct current to the base to switch it, so a resistor is connected from the Arduino to the base to limit the current to the proper amount.

You can see that in ... illustrations, there is a diode parallel to the device we are powering. Any time you are powering a device with a coil, such as a relay, solenoid, or motor, you need this guy, and don’t leave home without it. What happens is when you stop powering the coil, a reverse voltage, up to several hundred volts, spikes back. This only lasts a few microseconds, but it is enough to kill our transistor. So this diode (only allows current to pass one way) is normally facing the wrong direction and does nothing. But when that voltage spikes comes flowing the opposite direction, the diode allows it to flow back to the coil and not the transistor. We will need a diode fast enough to react to the kickback, and strong enough to take the load. A rectifier diode like the 1N4001 or SB560 should do the job. If you are looking for extra protection you could use an optoisolator between the Arduino and the transistor. An optoisolator optically isolates both sides (high and low power) of the circuit so the high-voltage can not possibly come back to the microcontroller.

Just make sure that protection diode is facing the correct way (stripe facing the V+ of device). If it is facing the wrong direction, the device you are trying to power will not work as the diode will just allow the current to bypass it.

i have been thinking about it

whats the point of having 4 transistors in an H-Bridge?
i mean, wont i be able to reverse, foward and stop a motor using just two transistors?

H bridges make it easier to control, and allow for forward/reverse switching. They typically are designed to handle the higher (and constant) current motors need. They're pretty inexpensive.

Motor controllers and motor control shields are even better, but can cost much more. They're designed for more current.

Did you get new transistors yet? I still suspect that the reverse voltage spikes fried yours.

btw

in that link , its written 2.2 K ohm
is that correct?

i mean, isnt 2K ohms a lot of resistance?
shouldnt it be more like 220 ohms ?

and as for that transistor, i will draw a schematic to show you what i mean :slight_smile:

It doesn't take much current into the base to turn on the transistor. 1k - 2.2k resistors are typical.

Google "transistor as a switch" to learn more. It can sound complicated, but its really straight forward. There are dozens of good links.

na, i got it
thnx for the help, :smiley:

2N3904 is not suitable for controlling a motor, it's optimised for switching currents of around 10mA. At higher currents (such as needed by motors) its current gain is low and its saturation voltage is high, and that is why it gets hot. Small motors can be driven using medium-current transistors such as BC337 or 2N2222A.

so which transistor SHOULD i use ?

and, will the TIP122 be best for it?
(i need the motor to STOP, so no noise !)

Post a link to the motor and we can better advise you. In general terms:

  • for motors with stall current up to about 0.5A, use a medium current bipolar transistor, such as BC337, 2N222A or ZTX851 (the ZTX851 is OK up to about 1A).
  • for higher currents, use a logic level mosfet such as IRLU8729PBF. This is a better solution than a darlington such as TIP122, because it has lower voltage drop, which allows the motors to run at full speed and avoids the need for a heatsink.

the thing is, i cant tell you the motor details
im even just testing my luck when i say it runs at 9v :confused:

In that case, measure its resistance several times with a multimeter, rotating the shaft slightly between readings. Report the lowest reading you get.

I suspect that you are pulling way too much current for that poor little tranny and no heat sink.

To run a car motor you should be using (a bank) of MosFETs They will exhibit ultra low on resistance, but will still need heat sinks.

Although a little harder to drive, they are well worth the effort - you will probably find that the fixed PWM frequency is not best suited to your motor, so try writing your own dedicated PWM.

And also a soft start - That will be fun to get right for your motor too :wink:

"what you can do" and "doing it right" ain't always the same! :wink:

i dont understand y i should use a mosfet

please enlighten me :smiley:

You need to establish the DC resistance of your motor and hence its stall current. See my reply #28. If the stall current is less than about 500mA, you can use a transistor to control the motor speed. If it is more, you should use a mosfet.

harshvardhan:
i dont understand y i should use a mosfet

please enlighten me :smiley:

You don't have to :wink: (although I did leave a a huge clue why you might want to)

I would suggest some reading... DC42's posts are a good start,and re-reading the article you posted (it tells you what the diode is for!) and find some data sheets on your motor, your transistor and then maybe also compare your requirements against a mosfet and see what conclusions you come to.

Draw an H=Bridge and see if you can understand how it works (think of the transistors as switches). Hint - nothing to do with high currents as suggested above. patduino suggested reading about transistors as switches - great idea (although you didn't seem to think so)

The exercise will hold you in good stead for your next project. Asking questions is a good way to learn, but doing it off you own back with a few pointers to get you going is so much more rewarding than expecting someone to do it for you! It really is worth the time and effort.
Lets hope your next post is a video of you controlling your motor! :smiley:

Kind regards