Shop OBEX P1 Docs P2 Docs Learn Events
Basic current (as in i= v/r) question from a noob — Parallax Forums

Basic current (as in i= v/r) question from a noob

Henry ChouHenry Chou Posts: 3
edited 2009-06-20 20:16 in BASIC Stamp
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.

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2009-06-19 22:02
    No confusion in your analysis! You worked it out fine.

    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
    ·
  • Henry ChouHenry Chou Posts: 3
    edited 2009-06-19 22:38
    I guess the part that was confusing was the idea that I might be able to blow the LED even with 1 volt if the resistor is ever left out of the equation. Normally consumers like me don't think in terms of current; when I buy batteries for toys and remotes I deal with volts and never worry about how much current might be pulled. It blows my mind to think that a little dinky LED would try to pull an infinite amount of current. I took some basic circuit analysis in college but the concepts of what current is, still don't sit well with me (I'm CS not EE).
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-19 22:43
    Practically speaking, a dinky LED would not be able to pull anything near infinite current. The bonding wires in the LED would evaporate first acting as a fuse and your power source has some resistance and would typically shut down at current levels on the order of an Ampere, but that's enough to damage a Stamp I/O pin quite permanently (probably by melting the connections on the chip).

    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.
  • Henry ChouHenry Chou Posts: 3
    edited 2009-06-20 17:05
    Thanks. Yes, that seems to be the classic analogy, although I also have a weak grasp of plumbing. lol.gif

    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?
  • stamptrolstamptrol Posts: 1,731
    edited 2009-06-20 20:11
    If Vdd is 5 volts (not to be confused with Vin, which is upstream of the voltage regulator), the pins can tolerate direct connection to Vdd because they're designed to work at that level. There is only a small difference in voltage, so not much pressure to drive current. In fact a usual current flowing into a pin on the Stamp is about 7 mA.

    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
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-20 20:16
    An I/O pin has three possible states:

    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.
Sign In or Register to comment.