Pages: 1 [2] 3   Go Down
Author Topic: Tansistor help to power motors  (Read 2512 times)
0 Members and 1 Guest are viewing this topic.
Indiana, US
Offline Offline
Full Member
***
Karma: 12
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

There are 10 types of people in the world, those that understand binary, and those that don't.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok
everything is working fine with the 3904 !

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

Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#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 !)
Logged

Indiana, US
Offline Offline
Full Member
***
Karma: 12
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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/

Quote
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.
« Last Edit: January 10, 2013, 10:24:41 pm by patduino » Logged

There are 10 types of people in the world, those that understand binary, and those that don't.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Indiana, US
Offline Offline
Full Member
***
Karma: 12
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

There are 10 types of people in the world, those that understand binary, and those that don't.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
Logged

Indiana, US
Offline Offline
Full Member
***
Karma: 12
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

There are 10 types of people in the world, those that understand binary, and those that don't.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

na, i got it
thnx for the help, smiley-grin
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so which transistor SHOULD i use ?

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

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Full Member
***
Karma: 5
Posts: 113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-wink

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

For whom does the clock pulse? It pulses for you!

Pages: 1 [2] 3   Go Up
Jump to: