Shop OBEX P1 Docs P2 Docs Learn Events
Transistors and LEDs — Parallax Forums

Transistors and LEDs

ProfessorwizProfessorwiz Posts: 153
edited 2007-03-23 15:47 in Learn with BlocklyProp
Hello all,
I'm pretty new to electronics and the basic stamp.· I'm taking a college course on the subject, the only prereq on the class was beginning algebra and basic programming.· I wish they would have had DC electronics included in the prereq he doesn't go into much detail on the electronic portion of it.

I am hitting a brain stumbling block.· I'm looking at this schematic and I understand the transistor is acting like a valve opening the current for the Led so that the VDD goes though the led and the transistor to the ground, but I thought you always used a resistor tied to an LED going to the VDD.· In the 2nd page (P267), it shows the p8 going though a parallel configuration of resistors turning the transistor on and off.· Wouldn't the full 5V of the Vdd go though the LED?!?

Any help would be appriciated, I just can't seem to really get why this would happen, other than the 2 resistors are still limiting the flow enough, but that doesn't seem right to me.

Russ·

Comments

  • LSBLSB Posts: 175
    edited 2007-03-23 12:42
    Professor,
    Kind of you to list the page number, but what book are you referring to?

    Typically a resistor is placed in series with an LED to limit current. There are cases where this resistor is provided internally or isn't needed--for example: if some other component provides resistance ...or perhaps the diagram is in error.

    Try the circuit WITH a resistor, if the LED is dim, remove it.
  • ProfessorwizProfessorwiz Posts: 153
    edited 2007-03-23 12:51
    It's in the What's a Microcontroller manual - students guide.· I've attached the 2 pages as PDF here.
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-03-23 12:56
    Yes, DC electronics would have been helpful. There's an equation you need.

    V = IR. Voltage == Current * Resistance. This means, if you put a voltage across a resistance, then V/R amps of current will flow.

    Now, a transistor and an LED are current activated devices. So yes, if you do nothing to limit the current through an LED (to no more than 20 mA, and usually 10 mA will work well) then the LED will act like a flash-bulb and burn out.

    The way an LED works, once you have about 5 mA across it, it has a fixed 1.4 volt drop no matter what voltage you put across it. So, if all you wanted to do was light up an LED, a 220 ohm resistor needs to be in there.

    And the current for a 220 Ohm resistor in series with an LED, with 5 volts across the whole thing, is:

    Vled == 1.4 volts. Voltage across resistor == 5V - 1.4V == 3.6 Volts. Current through resistor == 3.6/220 == .016 Amps, or 16 milli-Amps (mA).

    Now, the current through a 'branch' of a circuit is the same for all devices in that branch. So the LED will also 'see' 16 mA, and light up.

    Now, if you put a transistor in that circuit, a 'saturated' transistor has about 0.1 volts between collector and emitter (typical, depends on the transistor). So you can take that 0.1 volts away from the voltage that must be 'dropped' by the resistor (if you really want to -- 0.1 volts is pretty negligible compared to that 3.6 volts above).
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-03-23 12:56
    The circuit is designed so that the transistor does not go fully into saturation, that is it not fully on or conduction. The current through the LED is controlled by the current of the base. It is configured so that the LED does not get more current than it can handle.

    This is why when the potentiometer is turned the LED will lighted and darken - it is operating in the active region amplifying the base current instead of being fully on or off.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-03-23 12:59
    Ah, that explains it then. The transistor is not "saturated" (fully on). The example runs in the "linear" region of the transistor, where the current from Collector to Emitter == Beta * (Current from Base to Emitter).

    Thus the Transistor is acting as your current limiting device in this example -- which lets you control the brightness of the LED. But the principle is the same -- you always need some way to limit the current through an LED, either a fixed resistor, or a properly biased transistor.
  • ProfessorwizProfessorwiz Posts: 153
    edited 2007-03-23 13:02
    I think I've got it now, that makes a bunch of sense. I think I've got the transistor idea where it acts like a water valve and a little pressure controlls the flow and fully open is saturated. If I'm correct taking out the resistors before the transistor would cause the transistor to go saturated and then would need a resistor in line with the LED correct?
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-03-23 13:19
    Yup, that transistor can pass about 100mA, which is enough to damage the transistor. When we look at things like stereos, they are biased so that a very small signal (FM receiver) controls a much larger current to drive the speakers in the same manner.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-03-23 13:23
    OK, just to do the rough math - 5V/50K = 0.1mA = approximate base current

    The transistor has a Beta, or amplification factor of 100.

    100 x 0.1mA = 10mA = current of the collector.

    LED maximum current is around 30mA, so safely within operational parameters.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • ProfessorwizProfessorwiz Posts: 153
    edited 2007-03-23 13:26
    If that's true, and the basic stamp can only source 20 ma, then why do we need to use a resistor when going from the basic stamp pin outs, or is it just good practice?
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-03-23 14:10
    Well, see, that's the problem with specifications.

    The 20 mA specification is how much the BS2 can source "without damage". It CAN source more than that (for a short time), but will blow out the output transistor if you try to do so. People have done this.

    With electronics, the Voltage is the "pusher" or "puller". The "resistance" is a property of the circuit. The amount of current that will flow is a RESULT of the voltage and resistance. So when somebody says an LED can take 20 mA without damage, what they mean is, you'd better engineer your circuit so the RESULTING current through the LED is less than 20 mA.

    To use the water analogy, the Voltage is the height of the water in a pipe. The resistance is the diameter of the pipe. The amount of water flowing is the Current. And basically, if you have no resistance (a large diameter pipe), huge amounts of current can flow, which results in heat, which results in damage. Thus the need for SOME "current limiting" device in the circuit somewhere.

    Most current specifications for devices are how much current it can take without damage. Most current specifications for Batteries (or other voltage supply devices) are how much current it can supply at a particular voltage. It's still up to your circuit to limit how much current it allows through itself.
  • ProfessorwizProfessorwiz Posts: 153
    edited 2007-03-23 15:25
    Thanks for all your help! I'd be alot worse off if not for this great forum, and great assistance from all you guys! I really wish I could have taken the DC class first it would have made things click alot easier. The terrible part of it all is they aren't even going to offer the dc class in the spring / summer semester so I'll have to wait 6 months before taking it. I hope I don't forget everthing I'm learning now.
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2007-03-23 15:47
    Professorwiz,

    "If that's true, and the basic stamp can only source 20 ma, then why do we need to use a resistor when going from the basic stamp pin outs, or is it just good practice?"

    There is also a voltage difference to consider, the Stamp outputs roughly 5V while most LED's want something in the neighborhood of 1.3V to 1.9V


    The "LED resistor formula" is really just Ohms law in disguise.... what you basically want to do is take the difference in voltage between your source, and your LED.
    In the example of driving a LED from a Stamp I/O pin, this would be 5V - 1.4V or 3.6V would be the difference ...Next determine what current the LED requires.
    ...In this example say 15mA. Using Ohms law ... 3.6V / 15mA = 240 Ohms ...Since the current will be consistent through each series device (i.e. the LED and resistor),
    basically what we have done is to calculate the resistor value based on the voltage drop you want to see across the resistor. In this case 3.6V If you measure the voltage
    across the LED, you should see about 1.4V. Coincidently the voltage across the LED + the voltage across the resistor should equal your supply voltage.

    R_LED = (Vsupply - V_LED) / I_LED

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
Sign In or Register to comment.