Go Down

Topic: PWM controls current or voltage? (Read 9810 times) previous topic - next topic

raschemmel

#15
Jul 31, 2015, 12:39 am Last Edit: Jul 31, 2015, 12:45 am by raschemmel
Quote
Ohm's Law is a law of nature and it's always true.
Quote
You might want to read up a bit more about that...
You know what he meant. He meant that
Quote
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.  

jack wp

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.

raschemmel

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

Coding Badly

#18
Jul 31, 2015, 01:50 am Last Edit: Jul 31, 2015, 01:50 am by Coding Badly

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


jack wp

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

raschemmel

The ON/OFF states of the transistors running in PWM mode changes the collector to emitter resistance but since PWM is duty cycle controlled , these changes in resistance are reflected differently in lighting devices like LEDs than in inductive devices like motors.
Light travels at , well , the speed of light, so inertia is not a factor. Your eye sees the photons emitted from every pulse but POV, makes it seem like it's on all the time , whereas with motors, the sudden drop in resistance when it turns on does not result in an instantaneous result in the motor shaft because it needs some time to overcome inertia.
Once it is up to speed then the shaft speed can change quicker but still not immediately.
The bottom line is that the change in resistance is realized immediately with light but not so with motors.

Wawa

If you only read OP's posts, you will see that he has trouble understanding the Arduino > base resistor > base-emitter junction part. And we all are overwhelming him with things that happen behind that transistor.
Back to basics....

An Arduino output pin can only have two states. High or low.
On a 5volt Arduino, high is 5volt, and low is 0volt.

Let's connect a LED to the pin.
We know that the LED has a working voltage of 2volts.

If we connect the LED between the Arduino pin and ground, something could go wrong.
Because the LED can't go higher than 2volt, and the Arduino pin tries to give it 5volt.

If we connect a resistor between Arduino pin and LED, both are happy again.
The resistor takes care of the 3volt difference.

By using the right value resistor, we can control the current from the Arduino pin to the LED.

By making the pin high or low, we can turn the LED on or off.
We can do that slow or fast.

If we turn the LED on/off very fast, our eyes/brain can't see the switching anymore.
We think it's dim.
Arduino can do that fast switching for us automatically.

Arduino can turn the LED on 50% of the time, and off 50% of the time.
Or on 20% of the time, and off 80% of the time.
This is called PWM.
PWM controls the on/off time, and our eyes see it as dimming.

Driving a NPN transistor is much the same as driving a LED.
We only drive the base-emitter diode of the transistor.
The base-emitter diode has a forward voltage of 0.7volt.

By using the right pin-to-base resistor, be can set the base current.

Arduino pin > LED voltage difference was 3volt.
Arduino pin > base-emitter diode difference is 4.3volt.
Arduino pins prefer a current upto 20mA, and 40mA is the absolute maximum.
With these facts we can calculate the ideal resistor.

* Some things have been left out for clarity
Leo..













raschemmel

"Details are omitted for clarity...."

secretgarden

#23
Sep 02, 2019, 04:14 pm Last Edit: Sep 02, 2019, 04:19 pm by secretgarden
I have difficulties about calculating the collector current... please help.

1. When Arduino PWM is used to supply base of a transistor, will the transistor be in saturated mode or linear mode? (I guess this depends on base current value?)

2. How do I calculate collector current from different base current value?
My guess is since there are only LOW and HIGH values from base current, the collector current is either LOW or HIGH as well. But since collector current is also PWM, the collector current value eventually changes as well (to the load). Is this correct?


sterretje

I have difficulties about calculating the collector current... please help.

1. Whttps://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/troubleshooting-and-faq? (I guess this depends on base current value?)

2. How do I calculate collector current from different base current value?
My guess is since there are only LOW and HIGH values from base current, the collector current is either LOW or HIGH as well. But since collector current is also PWM, the collector current value eventually changes as well (to the load). Is this correct?
This is my understanding (!)

Let's say you want to switch a led using a transistor.
1)
The current you want is e.g. 10 mA (you limit this with a resistor); that's Ic.
2)
You look in the datasheet of the transistor that you use and find the minimum specified hFE; this is e.g. 110.
3)
Divide the Ic by the hFE to get the needed base current (Ib) to drive the transistor in saturation; that will result in an Ib of 10/110 = 90 uA.
4)
The transistor datasheet will also tell you what the base-emitter voltage is when the transistor is in saturation (e.g. 700 mV).
5)
Subtract that from the output voltage of the Arduino (e.g. 5V).
6)
You can now calculate the required resistor ((5.0V - 0.7V)/90uA = 48k. Any value lower (47k, 39k etc) will drive the transistor in saturation when Ib is 10 mA. It's advisable to have some safety margin so a 27k can be used.

The numbers come from the BC546/BC547/BC548/BC549/BC550 datasheet.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

raschemmel

#25
Sep 02, 2019, 05:47 pm Last Edit: Sep 02, 2019, 06:14 pm by raschemmel
Quote
Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.
It's like riding a bicycle, you never forget, right ?

Nice explanation of how to calculate the collector current, but based on the following comment, I'm not sure the OP is actually ready for such a straight forward explanation:

Quote
My guess is since there are only LOW and HIGH values from base current, the collector current is either LOW or HIGH as well. But since collector current is also PWM, the collector current value eventually changes as well (to the load). Is this correct?
  
@OP,
For switching applications, the transistor is always in saturation mode.
Sorry to tell you this but the above comment is not valid because LOW and HIGH have no meaning for
a transistor. Those are digital terms. A transistor is either in linear mode or saturation mode and that is determined by the base resistor value which you did not supply. (hence, the current mode is unknown at this time but for PWM should be saturation mode)

 Read sterretje's explanation several times and then google PWM.

secretgarden

#26
Sep 03, 2019, 06:29 am Last Edit: Sep 03, 2019, 06:35 am by secretgarden
I guess what I wanted to ask is:

For base current from Arduino PWM ouput, will the collector current change based on different average base current value (average according to PWM duty cycle)?


Say, after calculations, the base current value is either 0 (PWM LOW) or Ib (PWM HIGH). When the base current is Ib, the transistor will be in saturation mode with collector current value Ic.

What if I vary the duty cycle of PWM? If I have a really low duty cycle, and the average base current value is really low, will the transistor still be in saturation mode?
I think there are two possibilities:
1. The transistor will no longer be in saturation mode and I can find new Ic' from linear mode parameter hFE.
2. The transistor will still be in saturation mode. When the base current is 0, the collector current is 0. When the base current is Ib, the transistor will be in saturation mode with collector current Ic. And I can find the "average" Ic value from the same duty cycle of base current.

Grumpy_Mike

Well congratulations on hijacking a thread from 2015. You should have started your own thread.

With PWM the transistor is either on which means fully saturated or off,  it conducting at all. It will never go into linear mode unless you average the duty cycle by adding a low pass filter between the PWM signal and your transistor base.

Note it is the peak current that is important for things like current ratings on a device not the average current.

MarkT

#28
Sep 03, 2019, 07:04 pm Last Edit: Sep 03, 2019, 07:05 pm by MarkT
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.
Oh not this old chestnut again.

Ohm's law is not a fundamental law of physics.  Its definitely not always true as it only applies to metals under reasonable conditions.

Ohm's law states that for (metallic) conductors the current is proportional to the applied voltage at a fixed temperature.  Its an observation.

That's equivalent to saying the resistance of a metal is a constant dependent on temperature - under normal circumstances.

Extremely high current densities and the "law" breaks down due to high drift velocities.
At very low temperatures the "law" breaks down due to quantum effects.

It doesn't apply to semiconductors or insulators or a vacuum.

The equation V = IR is the definition of resistance, not Ohm's law.  The constraint that R is constant is Ohm's law.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Grumpy_Mike

Quote
Ohm's law is not a fundamental law of physics.
Very true.
It is simply the definition of the relationship between voltage and current. It defines a quantity that links the two as "resistance". The mistake most people make is assuming that this relationship is linear. When it is liner then ohms law can predict what will happen if any one of the current or voltage change.

At any instant the quantity we call resistance is defined by the voltage over the current, that is the law bit. But in many materials the resistance is dependent on voltage and / or current, so it can not be used to make predictions as to what the effect of changing the current and voltage will be.

But the resistance is always the voltage divided by the current. So you can think of a dynamic resistance if you like, one that changes according to material, temperature, inductance and capacitance. I find this sort of construct often helps beginners get a grip of what is going on rather than having to throw out the law altogether. It is an approach that allows incremental tackling of the many issues in learning electronics, which if you try and teach them all at once is almost overwhelming.

Go Up