PWM controls current or voltage?

Hi,

I read a lot about transistor in the internet but I still have a question. I know the transistor amplifies the current in the base to an equivalent amount of current in the collector/emitter. As far as I know I control the voltage across the base with an Arduino using analogWrite(pin,0), analogWrite(pin,100)..., analogWrite(pin,255). But you see, I am controlling the voltage not the current! So how does changing the voltage across the the base am I also changing the current? I am not using any resistor in my base, I connected it directly to my arduino PWN pin. But when I change the voltag across the base I can see a very different current coming out from the transistor so probably changing the voltage in the base is someway changing the current in the base which changes the current in the output of the transistor.

Thank you all!

You MUST use a base resistor or you will end up destroying the output of the Arduino. 220 Ohms is the minimum value to safely use.

A suitably chosen base resistor converts the PWM voltage (minus the transistor base-emitter voltage drop) into a base current, which is amplified by the transistor.

PWM controls current or voltage?

Voltage. It switches between 0V and 5V at about 450Hz. At 0V you'll get (almost) zero current.

At 5V you'll get maximum current (determined by the load). But with no base resistor, you'll get the maximum current the Arduino can deliver (POTENTIALLY DAMAGING IT) and you'll get less than 5V.

The relationship between voltage, current, and resistance is described by [u]Ohm's Law[/u]. Higher voltage = higher current. Higher resistance = lower current.)

This gets tricky with transistors & diodes because the resistance changes when the voltage changes. For example, with less than 0.5V across a diode junction (or the base-emitter junction of a transistor) the resistance is low and very little current flows. As you reach 0.7V the resistance drops to almost zero and you'll get a ton of current if there's nothing to limit it.

LEDs are diodes and they behave the same way, but they have a higher "breakdown" voltage.

Ohm's Law is a law of nature and it's always true. But, we can't directly apply it to diodes and transistors because we generally don't know the changing resistance.

So when we make current calculations for an LED, we apply Ohm's Law to the series resistor. (We also apply [u]Kirchhoff's Law[/u] to determine the voltage across the resistor from the known breakdown voltage across the LED.)

A transistor is a current amplifier, but in digital circuits it's either on (saturated) or off. It's generally used as a "switch" to switch on & off a voltage at a higher current than is available from the control device.

Most amplifier circuits are also voltage amplifiers even though a transistor by itself is a current amplifier. For example, say you have an amplifier with a gain of 10... You put 1V in and you get 10V out. You put 2V in and you get 20V out. And, the current depends on the resistance of the load.

@jremington thank you I will use one :slight_smile:

@DVDdoug thank you so much, you were veery clear. But check this out: if I dont use a base resistor, I still can control the output current of the transistor when I use analogWrite(pin,100) or analogWirte(pin,255). According to you and according to @jremington, the lack of a base resistor should make arduino output the A LOT of current and destroy it. BUT if that was the case I could not control the output current from the transistor but I can! If I connect and LED to the output of the transistor it changes the brightness when I send a 100, 150... 255 PWM.

Probably there is something wrong with my understanding cause my arduino is not getting destroyed, the pin is working perfectly and I still can control the brightness of my LED without resistor.

The Arduino will probably work for a while without the resistor, and then it will stop working.

Sorta like, "your car will run for a while, without water in the radiator" But I wouldn't want to keep doing it.

Thanks I will use it! But can you explain me how I can control the transistor only changing the voltage across the base pin?

The same exact way you were doing it without a base resistor.

Since PWM is either on or off (switching between them very fast), either you're putting 0v onto the base resistor, which means the voltage on the base is 0v - no current flows since base and emitter are at same voltage, or it's on, in which case you're putting 5v onto the base resistor. This voltage will result in current flow through the base resistor and from there through the transistor's base, which turns it on. The voltage on the base will be... a volt or two, depending on the specifics of the transistor you're using.

I usually figure the base to emitter voltage Vbe will be 0.7V, or about 1 diode drop, and will allow all the current it can until it burns up.
The Arduino will output 4.2 to 5V, depending on the current it has to output.
So putting a current limit resistor in series from Arduino to base, you have 5V on one side, and 0.7V on the other, and you can use Ohms Law to select a resistor value such that (5V - 0.7V) = 4.3V across the resistor determines the current flow.
With 20mA into the base of the transistor, that's usually enough to turn the transistor hard (i.e. drive it into saturation) so that the collector/emitter current is determined by the load circuit and not the base current, allowing the transistor to act as a simple switch to the maximum extent it can.
So plug some numbers into Ohm's Law, V=IR, voltage = current x resistance.
Can rearrange a little too: V/I = R, and V/R = I. If you know 2 out 3, you can solve for the 3rd:
V/R = R: (5V - 0.7V)/20mA = 215 ohm resistor, 220 is standard value and works well.
If Arduino voltage drops to 4.2V:
V/R = I: (4.2V - 0.7)/220 ohm =15.6mA, should still be enough to turn a transistor on hard generally.
Knowing the specifics for your transistor, a better calculation can be made.

Does this mean generally mean as you begin to lower the voltage the current also drops as the resistance going to the base is a constant.

Is the current drain to emitter proportional to the current/voltage applied to the gate?

Ohm's Law is a law of nature and it's always true.

You might want to read up a bit more about that...

Hi,

http://www.williamson-labs.com/480_xtor.htm

Check out the animations, particularly the one about not using a base resistor.

Tom.... :slight_smile:

Just my 2cents worth.
This is not something that should keep you awake at night.

If the source can provide the power (amps), then the two things that will determine the amps in a circuit are the voltage, and the resistance.

You can't change the amps alone.

If you increase the volts, then the amps will increase.
If you increase the resistance, then the amps will decrease.

If you remove the resistance (open load), then you will have max voltage, but NO amps.

They all work hand in hand.

For example, with less than 0.5V across a diode junction (or the base-emitter junction of a transistor) the resistance is low and very little current flows.

DVDDoug meant to say "... the resistance is high and very little current flows."

I read a lot about transistor in the internet but I still have a question. I know the transistor amplifies the current in the base to an equivalent amount of current in the collector/emitter. As far as I know I control the voltage across the base with an Arduino using analogWrite(pin,0), analogWrite(pin,100)..., analogWrite(pin,255). But you see, I am controlling the voltage not the current! So how does changing the voltage across the the base am I also changing the current? I am not using any resistor in my base, I connected it directly to my arduino PWN pin. But when I change the voltag across the base I can see a very different current coming out from the transistor so probably changing the voltage in the base is someway changing the current in the base which changes the current in the output of the transistor.

If I connect and LED to the output of the transistor it changes the brightness when I send a 100, 150... 255 PWM.

There are many uses for PWM. Use of PWM for any lighting device suggests that changing the duty cycle varies the current, but as we on the forum know, that is an illusion based on the POV phenomenon making it seem to vary the brightness when in fact it is varying the number of photons hitting our eyeballs and Persistance of Vision is taking care of the rest. Use of PWM for motors is another matter. Changing the duty cycle changes the amount of energy (Joules per second) through the motor by changing the time constant for each ON pulse. Unlike the POV phenomenon, we see the motor shaft changing speed because there is a direct correlation between energy in J/s and shaft speed. If the speed changes were beyond the visibly detectable range of the human eye we wouldn't know the speed was changing unless the shaft was driving a system that enabled one to see the change in speed, (ie: a winch lifting a load with a pulley). The correlation between PWM duty cycle and motor current is such that inertia prevents us from seeing the difference between an ON state and OFF state of the mosfet driving the motor . What we see is the shaft speed changing because of the correlation of energy to torque and hence speed. The bottom line is that it is irrelevant whether you discuss whether PWM controls voltage or current if you are driving LEDs or motors. The fact is PWM controls brightness in LEDs and shaft speed in motors. That's really all that matters.

Ohm's Law is a law of nature and it's always true.

You might want to read up a bit more about that...

You know what he meant. He meant that

The law was named after the German physicist Georg Ohm, who, in a treatise published in 1827, described measurements of applied voltage and current through simple electrical circuits

The physics principles upon which Ohm's Law is based are based on laws of physics, which you could say are part of nature because they are natural laws.

The fact that this may not be readily apparent to you from the way he chose his words does not in any way change the fact that the REST OF US know what he meant.

I find it amusing that someone with a Post count of 464 and a Karma count of 12 would have the gall to try to correct someone with a Post count of 2308 and a Karma count of 95.

I find it refreshing that anyone on the forum can voice their opinion (may it be the same as yours or not). If you disagree, then you are free to say so, and hope you can explain why.

Refreshing?
To suggest thst DVDDoug has any misconceptions about Ohm's Law is nothing short of absurd.

I find it refreshing that the next post will be on-topic.

The topic at hand can be found here...
http://forum.arduino.cc/index.php?topic=338809.msg2335818#msg2335818

I think the PWM changes current and voltage. It does not change resistance.