DC motors, transistors, resistors and diodes

A while back I got the idea if plugging in my DC motor to my Uno at the 5v and Gnd. Sure enough just plugging the Uno made the motor run.

Then I changed the 5v for a digital pin and wrote voltage to it. Again it worked beautifully.

Today I'm looking for motor tutorials and ran across 2 tutorials that make a more sophisticated connection using diode, transistor and resistor.

I'm not an electronics major but I have a decent understanding of basic electricity. I understand a resistor is necessary to limit the current flow in a led circuit because less are so sensitive to current flow. But I'm asking for help understanding what transistor and diode do in the motor circuit and more importantly how the setup can be interpreted.

http://m.dummies.com/how-to/content/how-to-spin-a-dc-motor-with-the-arduino.html

How would you guys explain what is happening in this circuit in layman's terms?

What are you struggling with? That's a pretty well written explanation, where are you getting lost?

I don’t understand how the current is flowing and being controlled by these 2 components (assuming I have a grip on resistors).

Iow, how does the diode controlling electric flow and why? How does the transistor work and what is it used for? What exactly are these components adding to the simple digital pin & Gnd setup I originally had?

The main current path is from the +5volt pin, through the motor, through the collector/emitter to ground. The base of the transistor controls that flow.

No base current, no collector/emitter flow. Small amount of base current, lots of collector/emitter flow.

Now the Arduino pin only has to produce a small amount of base current. Not the actual motor current.

The base/emitter junction is like a LED. It needs a current limiting resistor.

I would lower the base resistor to 220ohm for a motor. 1k is ok for smaller loads like a relay. 2k2 as in the article is dangerous. It doesn't switch the transistor fully on. The transistor will most likely get hot, and could pop it's top.

The diode across the motor kills spikes that could destroy the transistor. Leo..

Ok so, in my setup, the “current flows” in from pin 3 into pin 26, thru the resistor and into the base of the transistor in row 16.

That resistor is there to limit the current flow so that it doesnt damage the transistor in the same way high current flow could damage a LED, which is a diode, which is similar to a transistor.

The emitter in the transistor is hooked up to the GND and the collector is hooked up to the diode. The striped side is the cathode which is connected to the + terminal on the motor and board. So if the diode is there to control current flow direction, which way is it flowing?

The fact that resistors lower the current flow of a circuit no matter if you connect them to the + or - side is what is confusing me here. :slight_smile:

Thanks

That resistor is there to limit the current flow so that it doesnt damage the transistor in the same way high current flow could damage a LED, which is a diode, which is similar to a transistor.

The purpose of limiting current flow is to prevent destroying your $20 arduino, not your 12c LED.

The base current will not damage your transistor.

but I have a decent understanding of basic electricity.

Np. You don't. Really.

You got most of it. A resistor just restricts the current flow. Just like a garden hose. Connect two garden hoses in series, and you have less flow. Swap the nozzle and the tap side of the hose makes no difference. The hose is not "directional".

The diode confuses you. You think it's connected "the wrong way". The diode does indeed nothing when current flows through the motor. But when the transistor suddenly [u]turns off[/u], the motor works as a generator. That voltage spike could destroy the transistor. The diode dumps that small amount of energy back onto the supply line. Leo..

Thanks Leo.

Actually its nothing to do with the motor working as a generator, that's doesn't generate spikes, its the windings of the motor being inductors that is the issue. Whenver you switch off the current to an inductor it will fight back to keep the current flowing, developing whatever voltage is necessary to do this unless there is a safe path for the current. The diode provides a safe path to prevent these voltage spikes.

Yes, I know that. But I think OP is not ready yet for the full picture. I only wanted him to understand that the diode is there for the s**t when you turn the food tap off. Leo..

I may not be ready but Im sure interested.

When the motor turns off it will fight to keep the current flowing by developing the necessary voltage?

How does the motor do that? :o

When the supply current stops the magnetism in the coils collapse. This collapse causes an induced voltage, opposite in polarity, across the coil. The voltage can be very high (without a diode). The diode across the coil forward biases and consumes the stored energy from the coil.

Figures 1-3 here show the flow of current with the switch closed, and then open with and without the diode.