Basic current (as in i= v/r) question from a noob
Henry Chou
Posts: 3
Hi, I just got the BOE yesterday. This is my first post. I'm going through the "What is a microcontroller" book (I find it very clear and well written so far) and I'm up to the example of lighting an LED. In all the examples the book says to use a 470 ohm resistor in series with the LED so as not to draw too much current. That got me to thinking... how am I supposed to know exactly how big of a resistor is needed for LEDs on my own future projects?
And in general, how do you find out how much current is being drawn by devices and how much is too much?
I know we have V=IR
I think I read somewhere that the voltage across a diode is always 1.7v, that leaves 3.3 volts over the resister assuming the diode has no resistance and the voltage across both resister and LED is 5v from Vdd to Vss, so:
The current through the resister is:
I = V/R = 3.3v/470 ohm = 7 mA, and since the resister is in series with the LED the current should be the same everywhere... so the LED is "drawing" 7mA?
Whereas if we don't use a resister, or R very close to zero, according to I = V/R, for any value of V the component is trying to draw an infinite amount of current?!
I'm confused.
And in general, how do you find out how much current is being drawn by devices and how much is too much?
I know we have V=IR
I think I read somewhere that the voltage across a diode is always 1.7v, that leaves 3.3 volts over the resister assuming the diode has no resistance and the voltage across both resister and LED is 5v from Vdd to Vss, so:
The current through the resister is:
I = V/R = 3.3v/470 ohm = 7 mA, and since the resister is in series with the LED the current should be the same everywhere... so the LED is "drawing" 7mA?
Whereas if we don't use a resister, or R very close to zero, according to I = V/R, for any value of V the component is trying to draw an infinite amount of current?!
I'm confused.
Comments
Leds typically operate over a range of 5 to 25 mA with 20 being the usual maximum. Its all determined by the manufacturer and the characteristics of the device. Thats why data sheets are so important, especially the first page or two where they talk about Absolute Maximum ratings.
Most multimeters can measure current in a few ranges although you may find they add some resistance of their own in the lower current settings.
Here's another example: a Stamp pin can safely deliver a maximum of about 25 mA. What's the minimum resistance to ever be used between a pin and Vss?
R= v/i= 5/.025 = 200 ohms.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
Think of current as water flowing through pipes. The water pressure is the voltage. Resistance is any restriction in flow like a partially closed valve.
If voltage is the water pressure shooting down the pipe, wouldn't a tighter closed valve (more resistance) cause greater water pressure further down the line, since we are pushing same amount of water through a smaller hole? I dunno... I'll get it some day with a eureka moment.
So am I hearing (reading) correctly that if I hook up Vdd directly to the stamp i/o pin with no resister I'll definitely fry the pin? That's good to know! Though... after the voltage drop through that protective resistor I put in place... aren't we inputting something less than 5v due to the voltage drop after the resistor? Or is it ok, because the voltage is still within the threshold to be interpreted as binary 1?
Now if you hook the pin to Vdd then tell it to go LOW in your program, you've just connected Vdd to Vss and that will definitely hurt your Stamp. Thats why many of us recommend always having some resistance in series with the pins (say 100 ohms or so) so when programming mistakes occur, a sudden puff of smoke won't ensue.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
1a) Output mode, high voltage. Here the I/O pin is connected through an FET to Vdd. This FET and the wiring (metalization) to it can handle 25mA to 30mA roughly. If you connect the I/O pin to ground (Vss), it will probably be damaged by the (relatively) high current flow from Vdd through the transistor and wiring to Vss.
1b) Output mode, low voltage. Here the I/O pin is connected through an FET to Vss. All the same stuff applies except that the short circuit case is when the I/O pin is connected to Vdd.
2) Input mode. Here both transistors are turned off and (effectively) are of no consequence. The I/O pin is connected through some protective circuitry to the gate of an FET which is a high impedance point. For voltages from Vss to Vdd (and a little beyond), this is effectively like a 1MOhm or higher resistance and conducts virtually no current, particularly at steady state. There is some capacitance that has to be charged up when the voltage changes, but it's small.
Note that the protective circuitry is called into play above Vdd and below Vss and itself has limited "fault" current carrying capacity. You can easily (and instantly) blow out the protective diode if you connect an I/O pin directly to a source of 9V for example.