Shop OBEX P1 Docs P2 Docs Learn Events
More transistor questions. — Parallax Forums

More transistor questions.

russ christensenruss christensen Posts: 84
edited 2009-04-30 15:50 in Propeller 1
Hi, i was playing around with multisim, trying to get a switch design working, and since it had a simulator i wouldn't have to constantly rewire stuff.· I am attaching a pictures of the simulator running, with what i thought should work, and wondering if anybody can explain the low voltages i'm getting out of the transistor, and why the led isn't coming on.· If i up the 3.3v in the middle to 5v, the led will come on and i get about 3.9 volts out of the transistor.· Thanks in advance.·

Russ
1280 x 800 - 188K

Comments

  • virtuPICvirtuPIC Posts: 193
    edited 2009-04-29 15:12
    Russ, I don't understand your description completely. Anyway, the datasheet of the 2N222 transistor tells something of a BE-saturation voltage between .6 V and 1.2 V. You have to subtract this from the 3.3 v you feed to the base giving 2.1 to 2.7V for the LED. Actually, I would even add a resistor to restrict the current through the LED although it will eat some more voltage.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-29 15:17
    Unfortunately, the simulation you're using has little to do with the real world. Your circuit is what's called an "emitter follower". If you look at just the base-emitter part of the transistor, the 3.3V base voltage, and the LED, you have a base-emitter diode with a voltage drop of about 0.6V and an LED (presumably red) with a voltage drop of about 1.7V. That's a total drop of 2.3V. By putting a 3.3V source across this, you'll get an infinite current through the transistor and LED burning them out instantly. Practically, any power source has some resistance which would limit the maximum current and both the transistor and the LED's voltage drop varies a little with the amount of current through them, so that part of the circuit may stabilize somewhere short of a meltdown.

    A transistor's collector current depends on the base current (by a factor of the current gain or hFE of the transistor). Typically this gain is somewhere in the range of 20 to 200. That additional current will flow from the 5V source through the LED. Depending on how the simulator handles the LED, this extra current may increase the voltage drop across the LED which will reduce the base-emitter current which will reduce the collector current and things will stabilize at some new level. In a real-world circuit, things would have melted by now and stabilized at a zero current value.

    Does this help any?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-29 15:20
    LEDs won't pass current and turn on until you meet their nominal forward voltage. In your case, if the LED's forward voltage is more than 2.7V, it won't come on with a base voltage of 3.3V. Once you reach the forward voltage, though, the current will rise abruptly. Without a series limiting resistor, an overcurrent condition, with consequent destruction of the LED, is a virtual certainty

    -Phil
  • russ christensenruss christensen Posts: 84
    edited 2009-04-29 15:27
    So what your saying is, i have no idea what i'm doing, and am just vaporizing the leds. lol. Is there anyway i could get a sample circuit to do a similar thing, with the correct voltages. It has to be able to have a 3.3v i guess base voltage to trigger the transistor to the On state, since i'm wanting to control it directly from the propeller. Thanks
  • JerryNJerryN Posts: 32
    edited 2009-04-29 15:33
    I am in agreement with the other replies but my first question is what color LED is being simulated. If that is a red LED and the simulation does not show it to be conducting at a voltage of 2.798, then I would conclude that either the LED model or the simulator is faulty. If the LED is blue, 2.798 volts would not be enough to cause it to conduct. This is probably true of a green LED as well. If you build this using a red LED, I would suggest putting a 100 ohm resistor in series with the LED.

    Jerry
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-29 15:35
    Use a 1K base resistor, ground the emitter, and put the LED and series resistor on the collector side of the circuit. Your series resistor can be calculated as follows:

    ·····R = (Vdd - Vfwd(LED)) / i , where

    i is the desired current. Start with about 10mA.

    -Phil
  • JerryNJerryN Posts: 32
    edited 2009-04-29 15:41
    On the other hand, why not connect the LED to the propeller pin through a 220 ohm resistor and forget the transistor. Unless, of course, you are trying to drive an extra bright high current LED.

    Jerry
  • russ christensenruss christensen Posts: 84
    edited 2009-04-29 15:43
    actually end result, i'll be powering a retail led strip with many leds on it, that runs off 12v. i'm going to assume that its going to run 1+ amps. just trying to figure out how these things work.
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-04-29 15:51
    A more appropriate schematic, with voltages and current is attached. It should help to explain a few things.
  • russ christensenruss christensen Posts: 84
    edited 2009-04-29 15:53
    cool thanks, i appreciate yoru time, i'll take a look at it!
  • russ christensenruss christensen Posts: 84
    edited 2009-04-30 01:54
    thank you very much for that schematic, it helped. i worked it into the sim, and played around with the resistances and stuff, then i took all the components and built the circuit and everything worked physically. then i thought, i'll hook it up to a potentiometer which was built into the ppdb instead of using a resistor, and noticed it worked like a dimmer switch, the higher the resistance the less light i had. pretty neat. i also noticed that if i put 2 lights in series, they both worked but the voltage almost doubled. i'm guessing thats normal. question though, can the 2n2222 handle a 1amp current at 12v? and if so do i still need resistors and stuff? i need to get ahold of the lightbar to do some tests with it, will try to contact the guy tomorrow, let me know if i'm gonna have to make any changes, and if the 3.3v from the prop will still engage it ok. thanks!

    Russ
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-04-30 03:29
    Use phildapill's circuit. It is the standard led driver circuit. And the good news is it will easily turn on with 3V on the base.

    You could try tweaking the base resistor. There are compromises with the value of that resistor. Say you used 1 megohm, well hardly any current would flow into the base and the transistor would not turn on very much and you would get a dim led. Ditto with 100k (try it on a protoboard).

    But if you go too low, eg 10 ohms, then you are wasting current. Current that flows into the base of a transistor is wasted - it flows out of the emitter. You need enough current to saturate the transistor, but any more is not needed. You can work out the current needed if you feel keen and know the gain of the transistor and the current you are switching and are happy with doing V=IR calculations. Or you can just go with ball park figures. I tend to use 2k7 when driving a small signal transistor from 5V, and I'd probably use 1k when driving from 3V. Just a habit I suppose, partly based on the fact I've got lots of those value resistors in the parts drawer.

    Re some of the other questions:
    Can the 2n2222 handle 1 amp. No. But there are other transistors that can, and they only cost a few cents more. Higher current ones tend to be a bit bigger, with different package styles as they are dissipating a bit more heat. If you can give us the maximum current I could suggest some. But 1A is a lot of current for a led - are you switching something else?
    Yes, you will always need resistors!
    What is a lightbar? Could we have a schematic, part # etc, maybe we can suggest a suitable driver circuit.

    Addit: I did a quick google on the 2n2222 and bc549. I tend to use the latter - but I just noticed the gain values. hFE is the gain, and it is 520 for a BC549 but only 75 for a 2n2222. The gain is a useful number to know - essentially any current you put into the base gets multiplied by this amount and can flow from the collector to the emitter. Put in 1mA and 75mA will flow if the gain is 75. Now you can work out V=IR and allow for the 0.6V drop etc, get a feel for what sort of base resistors to use. Try putting a BC549 into the simulator. Perhaps think of the transistor as a current amplifier (which is different to how mosfets work).

    For switching things on and off, you might use a transistor in saturation, ie you put a bit more current into the base than you really need and the transistor is definitely switched on. This means the voltage drop from the collector to the emitter is low, and this means the transistor dissipates little heat. The current flow is then determined by that 220R going into the led. You still need both those resistors though! If you want to adjust the brightness, you could start with 220R on the led (which sets the maxiumum current that can go through the led, and stops it burning out), and then gradually increase the base current resistor. You can then experiment with what happens when the transistor is operated as an amplifier.

    You can switch 12V with a 2n2222. You can go up to 60V if you like, though that would be asking for trouble when a short happens. But say you use 12V. Well, you might drop 10V in a resistor to drive a 2V led. That is very wasteful. But you could put 4 leds in series, drop 8V across the leds and only 4V on the resistor. Now you get 4 times the brightness for the same energy consumption. The energy is going into the leds, not the dropping resistor. If you are driving lots of leds, use a power supply that is just a bit more than the highest voltage drop on a led. Let's say you might use a 4V supply. You can now use a switch mode supply and convert 12V to 4V with 90% efficiency, then use the 4V to run all the leds (philldapill used 5V, and you could use 5V too). This might be the most efficient way of running lots of leds. And if they are all red leds, you might drop that 4V down to 2.8V or something.

    Post Edited (Dr_Acula (James Moxham)) : 4/30/2009 3:52:46 AM GMT
  • TreeLabTreeLab Posts: 138
    edited 2009-04-30 12:29
    Dr_A;
    As a follow up question ... is it possible to use a Darlington (eg TIP120) in a non-saturated mode just by limiting the base current? If I understand correctly the true hFE is highly variable between parts ... how do you properly control the current gain in such a current amplifier circuit? I am guessing the answer is feedback, but can you point me to a description of how it is done?

    I never understood Horowitz's 'Transistor Man' either ...

    Cheers!
    Paul Rowntree
  • kwinnkwinn Posts: 8,697
    edited 2009-04-30 12:37
    The simplest way to do that is with a resistor from ground to the emitter on the darlington to control the current. That produces a constant current source.
  • russ christensenruss christensen Posts: 84
    edited 2009-04-30 13:21
    i too thought about using the tip120, since its supposed to be able to do up to like 5 amps (might be 4 can't remember off the top of my head), but as treelab said, i'm not sure how to control the current to turn it on with the propeller.
  • Brian FairchildBrian Fairchild Posts: 549
    edited 2009-04-30 14:37
    I gave up using bipolar (ordinary) transistors for switching several years ago in favour of MOSFETs. They are just so much easier to use. I use a lot of IRL520s - 100V, 9A, 0.25 Ohms. Driven from 3v3 logic they'll sink 3 - 4 Amps, from 5v they are fully on. Something smaller? - 2N7000/BS107 at around 100v/400mA. The IRLs will set you back around $1.30, the others around $0.10.
  • TreeLabTreeLab Posts: 138
    edited 2009-04-30 15:50
    @kwinn : I was thinking of a C-E current through the transistor that is controlled by the base current in a more-or-less linear manner (ie working like a high-current opamp). I am driving brushed and brushless motors, and being able to control the current in real time would be a major plus, but my skills are not up to it at this point.
Sign In or Register to comment.