Announcement

Collapse
No announcement yet.

Current flowing through transistor even when base is shunted to ground.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Current flowing through transistor even when base is shunted to ground.

    I made a small project where a motion sensor triggers an Arduino pin and when the pin from the motion sensor goes high, another pin that's connected directly to the base of a 2N3904 goes high, which switches some LEDs through a 10V source.

    When I breadboarded the project, it worked perfectly. But now that I have it soldered onto one of those generic project PCBs when the circuit is idling and there is no motion triggering the pin, the LEDs light up ever so slightly, indicating to me that the transistor is still allowing current to flow from emitter to collector even when the base is at 0 volts. I even tried shunting the base directly to ground and the behavior did not change.

    Any idea what the problem might be?

    Here is the schematic:

    Attached Files

    #2
    Re: Current flowing through transistor even when base is shunted to ground.

    i dont know the issue, but you may have damaged the transistor - you need a resistor between the base and the mcu

    Comment


      #3
      Re: Current flowing through transistor even when base is shunted to ground.

      You need to have bias resistor for he Base of the Transistor.
      When is the Voltage at the B-E when the D3 is LO?
      Last edited by budm; 09-08-2020, 01:04 PM.
      Never stop learning
      Basic LCD TV and Monitor troubleshooting guides.
      http://www.badcaps.net/forum/showthr...956#post305956

      Voltage Regulator (LDO) testing:
      http://www.badcaps.net/forum/showthr...999#post300999

      Inverter testing using old CFL:
      http://www.badcaps.net/forum/showthr...er+testing+cfl

      Tear down pictures : Hit the ">" Show Albums and stories" on the left side
      http://s807.photobucket.com/user/budm/library/

      TV Factory reset codes listing:
      http://www.badcaps.net/forum/showthread.php?t=24809

      Comment


        #4
        Re: Current flowing through transistor even when base is shunted to ground.

        Transistor is now damaged and leaking due to missing base resistor. Nano's output voltage should be low enough to keep it in cutoff.

        Probably should have used a 2N7000 if you really don't want to put a resistor there. That is also to possibly protect the Nano's output, too.

        Comment


          #5
          Re: Current flowing through transistor even when base is shunted to ground.

          Originally posted by stj View Post
          i dont know the issue, but you may have damaged the transistor - you need a resistor between the base and the mcu
          That would just serve to limit the current through the BE junction. Presumably, the output impedance of the MCU is high enough that the "resistor" is actually part of the MCU.

          (The OP would note that the output of the MCU swings between 0V and ~0.6V as the BE junction clamps Vo(h) to that level.)

          A wiser approach might be to add the resistor AND a pulldown at the base to cover the case when the MCU is "in reset" and the pin may float before the software has a chance to configure it as an output -- assuming that is a possibility (I don't use arduinos)

          Note that you want to size the pulldown so that it "soaks up" any leakage current from the MCU.

          Also, looks like the OP is driving those LEDs pretty hard... a few hundred mA?

          Comment


            #6
            Re: Current flowing through transistor even when base is shunted to ground.

            Originally posted by Curious.George View Post
            A wiser approach might be to add the resistor AND a pulldown at the base to cover the case when the MCU is "in reset" and the pin may float before the software has a chance to configure it as an output -- assuming that is a possibility (I don't use arduinos)
            ^ This.

            Although BJTs require a relatively significant amount of current to bias (as in, it's unlikely that stray external noise / electrical signals can turn it On), it's still a good idea to include pull down / pull up resistors (depending on BJT type and/pr desired operation.) And for MOSFETs, this is practically required. Leaving a Gate pin floating can make a MOSFET self-bias from stray noise.

            Also, as I learned in digital electronics classes the hard way, never leave input pins on a CMOS chip floating - that too, is asking for trouble. Heck, even for TTL chips it's a good idea to always tie down inputs to something.

            Comment


              #7
              Re: Current flowing through transistor even when base is shunted to ground.

              Originally posted by budm View Post
              You need to have bias resistor for he Base of the Transistor.
              When is the Voltage at the B-E when the D3 is LO?
              I assume you mean a resistor between pin D3 and the base of the transistor. What should its value be, and what does that resistor do?

              The B-E voltage when D3 is low, is 0.002 according to my Fluke meter.

              Comment


                #8
                Re: Current flowing through transistor even when base is shunted to ground.

                Originally posted by momaka View Post
                ^ This.

                Although BJTs require a relatively significant amount of current to bias (as in, it's unlikely that stray external noise / electrical signals can turn it On), it's still a good idea to include pull down / pull up resistors (depending on BJT type and/pr desired operation.) And for MOSFETs, this is practically required. Leaving a Gate pin floating can make a MOSFET self-bias from stray noise.

                Also, as I learned in digital electronics classes the hard way, never leave input pins on a CMOS chip floating - that too, is asking for trouble. Heck, even for TTL chips it's a good idea to always tie down inputs to something.
                On the Arduino Nano, when you designate an input pin as INPUT_PULLUP, it assigns a pullup resistor to the pin internally. That keeps the pin idling at 5V until you do something to it that pulls it down ... the output from the motion sensor in my case pulls it down low enough to trigger the interrupt which I use as the condition to fire the LEDs.

                Comment


                  #9
                  Re: Current flowing through transistor even when base is shunted to ground.

                  Originally posted by Curious.George View Post
                  Also, looks like the OP is driving those LEDs pretty hard... a few hundred mA?
                  The LEDs are rated at 3V @ 150ma each. When I turn them on, they only stay on for 200ms then off for 100ms and that repeats a few times, then they stay off. They aren't turned on for very long at all. I used an online LED array calculator to get the layout of the LEDs and the value of the resistor (6.8 Ω). The actual supply voltage is 9.8V.

                  Comment


                    #10
                    Re: Current flowing through transistor even when base is shunted to ground.

                    Originally posted by EasyGoing1 View Post
                    I assume you mean a resistor between pin D3 and the base of the transistor. What should its value be, and what does that resistor do?
                    It limits the current going into the Base. It's the same reason you don't connect an LED directly to a power source without a resistor or some other type of circuit to limit current - the diode/LED will draw a lot of current and burn out.

                    For the purpose of driving those LEDs with that transistor, a 1-KOhm resistor should do fine (though I imagine anything in the range of 510 Ohms to 5.1 KOhms would work OK too.)
                    Last edited by momaka; 09-09-2020, 12:43 PM.

                    Comment


                      #11
                      Re: Current flowing through transistor even when base is shunted to ground.

                      Originally posted by eccerr0r View Post
                      Transistor is now damaged and leaking due to missing base resistor. Nano's output voltage should be low enough to keep it in cutoff.

                      Probably should have used a 2N7000 if you really don't want to put a resistor there. That is also to possibly protect the Nano's output, too.
                      I try to be quick when I'm soldering, but I did consider the possibility that I damaged it when soldering it up... I don't have a 2N7000, but I do have these NPNs that came in a transistor kit that I purchased:

                      BC337
                      2N2222
                      S8050
                      C1815

                      And these PNPs:
                      BC327
                      2N2907
                      2N3906
                      S8550
                      A1015

                      Comment


                        #12
                        Re: Current flowing through transistor even when base is shunted to ground.

                        Originally posted by momaka View Post
                        It's the same reason you don't connect an LED directly to a power source without a resistor or some other type of circuit to limit current.
                        Now THAT makes a lot of sense. I've noticed that resistor values make a huge difference when choosing one for LEDs. I was surprised when you said anything from 500 to 5k should work fine ... I guess bias current in a transistor isn't as sensitive in terms of results as a current limiting resistor is for LEDs?

                        Comment


                          #13
                          Re: Current flowing through transistor even when base is shunted to ground.

                          Originally posted by EasyGoing1 View Post
                          I was surprised when you said anything from 500 to 5k should work fine ... I guess bias current in a transistor isn't as sensitive in terms of results as a current limiting resistor is for LEDs?
                          Well, BJTs are more or less current amplifiers: a small current going into the Base (for NPN) will produce a larger current going out of the Emitter (supplied by a larger current going into the Collector.)

                          The relationship between Base, Collector, and Emitter currents is:
                          Ie = Ib + Ic
                          where Ic = collector current, Ib = base current, and Ie = emitter current.
                          What determines the Emitter current from the Base current is the transistor current gain, usually noted as h_FE in datasheets (a dimensionless number/ratio.)

                          h_FE is not a "solid" value and changes with voltage across the transistor C-E terminals, along with Emitter current. However, datasheets usually give you a pretty good idea with the expected range.

                          For that 3904, for example, the minimum current gain is stated as 30 and maximum as 300.

                          This means that in the worst case, if the current gain is indeed 30, then 0.01 Amps (10 mA) of current going into the base can make *up to* 0.3 Amps (300 mA) of current from the Emitter. Since Ib is relatively small in most cases compared to Ic and Ie, then you can approximate Ic and Ie as nearly equal, which means the Collector can also sink close to 0.30 Amps (300 mA) of current.

                          Of course with the LEDs and their series resistor in your above circuit, only as much current will flow through them as the LED series resistor allows. Thus, you really only need to bias the transistor as much as is needed to drive the load.

                          With that said and given your above circuit...
                          If the MCU is supplied by 5V and it can output up to 5V on D3 pin, then with a 1-KOhm resistor between Base and D3, the Base current will be approx. Ib = 5 - 0.7 / 1000 = 0.0043 Amps. Since you're not driving the transistor too hard, the gain (h_FE) will likely be around 100 (or more, but not more than 300). But even in the worst case when h_FE is 30, Ie can be up to 30 * 0.0043 = 0.129 Amps.

                          Now if the LEDs only actually draw, say for example, 100 mA of current, then you won't see 129 mA flowing out of the Emitter of your BJT and will just see 100 mA instead.
                          However, if the LED load does want to draw 200 mA, it will become limited by the 129 mA Ie we calculated and only 129 mA of current will be allowed through the LED load. If this is not enough, then reducing the value of the series Base resistor of the BJT will increase the Emitter current. Say you go with a 510 Ohm resistor instead. Now Ib will be 5 - 0.7 / 510 = 0.0084 mA (about 8.4 mA)... and with that you can do the rest of the calculations, I think, given the previous example above.
                          Last edited by momaka; 09-09-2020, 01:19 PM.

                          Comment


                            #14
                            Re: Current flowing through transistor even when base is shunted to ground.

                            Originally posted by EasyGoing1 View Post
                            Now THAT makes a lot of sense. I've noticed that resistor values make a huge difference when choosing one for LEDs. I was surprised when you said anything from 500 to 5k should work fine ... I guess bias current in a transistor isn't as sensitive in terms of results as a current limiting resistor is for LEDs?
                            It's not important if you are SATURATING the transistor -- i.e., using it as an ON/OFF switch.

                            If you fail to deliver enough base current, then the collector current will be reduced. This can result in the transistor operating in its linear region. There, it will dissipate power -- heat!

                            E.g., if you have 9V across the LEDs (at some particular operating current), the saturation voltage -- Vce(sat) -- of the transistor is probably around 0.2 - 0.3V (i.e., the transistor manifests as a 0.2V drop in much the same way the LEDs manifest as a 3 x 3V drop).

                            With 9.8V supply, less 9V of LED, less 0.3V across the SATURATED transistor means you have to drop 0.5V across your 6.8ohm ballast. 0.5/6.8=74mA flowing through the resistor (and, hence, the LEDs).

                            [Of course, the LEDs will likely have a lower voltage drop at that reduced current so there may be a higher voltage across the resistor -> higher current through it -> higher drop across LEDs, etc. You need to figure out where you REALLY are operating the LEDs in order to know for sure]

                            Now, imagine the transistor didn't "conduct enough" to give you this 0.2-0.3V saturation. Imagine only 10mA flowed through the collector. Again, pretend 9V across the LEDs and 10mA through 6.8V drops just ~.1V across the resistor. So, the remaining 0.7V appears across the transistor -- it's operating in its linear region.

                            How do you get just 10mA through the transistor? If your base drive is too low ("light"), then the transistor doesn't turn on hard enough. In order to saturate the transistor, you want to ensure your base current is more than your desired collector current divided by your worst case (lowest) gain AT THAT COLLECTOR CURRENT.

                            In your case, if you are hoping for 150mA, then you need at least 1/30th of that into the base (because the minimum gain at 150mA Ic is about 30).

                            Then, you have to look to see how much current the MCU's output can source (cuz the base current has to come from somewhere!). You need to ensure you can drive the base to ~0.7V with ~5mA. E.g., old fashioned tonka toy logic could never do this because it can't source current very well. (as a result, you'd typically SINK current when driving a hefty load).

                            If your MCU output has a low output impedance, then you'd take the Voh (output high voltage) - 0.7V (the base voltage required to turn on the transistor) and figure out the resistance required to allow ~5mA to flow.

                            If, OTOH, your output isn't as "stiff", then it will sag as you put load on it -- because there is effectively an internal resistance in series with your load! So, you may have to tweak the resistance LOWER in order to get the 5mA.

                            Comment


                              #15
                              Re: Current flowing through transistor even when base is shunted to ground.

                              "Then, you have to look to see how much current the MCU's output can source (cuz the base current has to come from somewhere!)."

                              +10, always look at the spec sheet to know how much the device can Source and Sink.
                              Never stop learning
                              Basic LCD TV and Monitor troubleshooting guides.
                              http://www.badcaps.net/forum/showthr...956#post305956

                              Voltage Regulator (LDO) testing:
                              http://www.badcaps.net/forum/showthr...999#post300999

                              Inverter testing using old CFL:
                              http://www.badcaps.net/forum/showthr...er+testing+cfl

                              Tear down pictures : Hit the ">" Show Albums and stories" on the left side
                              http://s807.photobucket.com/user/budm/library/

                              TV Factory reset codes listing:
                              http://www.badcaps.net/forum/showthread.php?t=24809

                              Comment


                                #16
                                Re: Current flowing through transistor even when base is shunted to ground.

                                Originally posted by Curious.George View Post
                                It's not important if you are SATURATING the transistor -- i.e., using it as an ON/OFF switch.
                                Which is technically what I'm doing here. However, hypothetically, if your source voltage for the base of the transistor was ... let's say 5V but it was capable of supplying 5 amps of current, without that base resistor, wouldn't it fry the BE junction?

                                Originally posted by Curious.George View Post
                                If you fail to deliver enough base current, then the collector current will be reduced. This can result in the transistor operating in its linear region. There, it will dissipate power -- heat!

                                E.g., if you have 9V across the LEDs (at some particular operating current), the saturation voltage -- Vce(sat) -- of the transistor is probably around 0.2 - 0.3V (i.e., the transistor manifests as a 0.2V drop in much the same way the LEDs manifest as a 3 x 3V drop).

                                With 9.8V supply, less 9V of LED, less 0.3V across the SATURATED transistor means you have to drop 0.5V across your 6.8ohm ballast. 0.5/6.8=74mA flowing through the resistor (and, hence, the LEDs).

                                [Of course, the LEDs will likely have a lower voltage drop at that reduced current so there may be a higher voltage across the resistor -> higher current through it -> higher drop across LEDs, etc. You need to figure out where you REALLY are operating the LEDs in order to know for sure]
                                Interesting that simply adding the transistor can complicate the LED circuit that much. It makes perfect sense of course. As it happens to be, when these LEDs turn on in this application, they are plenty bright enough to where normally, I would not look for any reason to change any of the parameters of the circuit. Based on what you're saying, I'm most likely not giving the LEDs their full 150ma, which is fine because that only means that I'm driving them at a safer current and hence they will last longer and the risk of any of them being damaged from overcurrent is a non-issue.

                                Originally posted by Curious.George View Post
                                Now, imagine the transistor didn't "conduct enough" to give you this 0.2-0.3V saturation. Imagine only 10mA flowed through the collector. Again, pretend 9V across the LEDs and 10mA through 6.8V drops just ~.1V across the resistor. So, the remaining 0.7V appears across the transistor -- it's operating in its linear region.

                                How do you get just 10mA through the transistor? If your base drive is too low ("light"), then the transistor doesn't turn on hard enough. In order to saturate the transistor, you want to ensure your base current is more than your desired collector current divided by your worst case (lowest) gain AT THAT COLLECTOR CURRENT.

                                In your case, if you are hoping for 150mA, then you need at least 1/30th of that into the base (because the minimum gain at 150mA Ic is about 30).

                                Then, you have to look to see how much current the MCU's output can source (cuz the base current has to come from somewhere!). You need to ensure you can drive the base to ~0.7V with ~5mA. E.g., old fashioned tonka toy logic could never do this because it can't source current very well. (as a result, you'd typically SINK current when driving a hefty load).

                                If your MCU output has a low output impedance, then you'd take the Voh (output high voltage) - 0.7V (the base voltage required to turn on the transistor) and figure out the resistance required to allow ~5mA to flow.

                                If, OTOH, your output isn't as "stiff", then it will sag as you put load on it -- because there is effectively an internal resistance in series with your load! So, you may have to tweak the resistance LOWER in order to get the 5mA.
                                I did change the circuit. Here is the updated schematic:


                                Based on what you're saying, since the output of pin 4 is roughly 5 volts (minus the .7 for the B-E junction), then when I divide that by 1.7k, I get a current of 2.5ma ... which shouldn't be enough to saturate the transistor. However, the LEDs are plenty bright enough (so much so, that you can't look at them directly without causing some discomfort - but they will be diffused in the final application of the circuit) ... so since I'm only driving the base at 2.5ma (the source is capable of 40ma), does that mean that the LEDs are not getting the full current that I originally intended?
                                Attached Files

                                Comment


                                  #17
                                  Re: Current flowing through transistor even when base is shunted to ground.

                                  The other conversations that spun off here I'd like to keep going as I'm learning some things that I have forgotten over the years. However, as to the original problem, I replaced the transistor with a BC337 and I added a 1.7k resistor between the base and the output pin (schematic below). I also lowered the temp of my iron and used the full length of the transistors leads and got in and out quickly with the solder and the problem went away. When the circuit is idling, the LEDs are completely dark.

                                  Attached Files

                                  Comment


                                    #18
                                    Re: Current flowing through transistor even when base is shunted to ground.

                                    "Which is technically what I'm doing here. However, hypothetically, if your source voltage for the base of the transistor was ... let's say 5V but it was capable of supplying 5 amps of current, without that base resistor, wouldn't it fry the BE junction?"

                                    Do the experiment, set power supply to 5V with 5A limit then apply it to the E-B junction of spare Transistor you have and see what happen.

                                    " so since I'm only driving the base at 2.5ma (the source is capable of 40ma), does that mean that the LEDs are not getting the full current that I originally intended?"

                                    Just check the Vdrops on the resistor and the Vdrops on E-C junction then you can calculate what the current flow is and if the Transistor is in saturation or not.
                                    Last edited by budm; 09-09-2020, 03:58 PM.
                                    Never stop learning
                                    Basic LCD TV and Monitor troubleshooting guides.
                                    http://www.badcaps.net/forum/showthr...956#post305956

                                    Voltage Regulator (LDO) testing:
                                    http://www.badcaps.net/forum/showthr...999#post300999

                                    Inverter testing using old CFL:
                                    http://www.badcaps.net/forum/showthr...er+testing+cfl

                                    Tear down pictures : Hit the ">" Show Albums and stories" on the left side
                                    http://s807.photobucket.com/user/budm/library/

                                    TV Factory reset codes listing:
                                    http://www.badcaps.net/forum/showthread.php?t=24809

                                    Comment


                                      #19
                                      Re: Current flowing through transistor even when base is shunted to ground.

                                      Originally posted by momaka View Post
                                      Now if the LEDs only actually draw, say for example, 100 mA of current, then you won't see 129 mA flowing out of the Emitter of your BJT and will just see 100 mA instead.
                                      However, if the LED load does want to draw 200 mA, it will become limited by the 129 mA Ie we calculated and only 129 mA of current will be allowed through the LED load. If this is not enough, then reducing the value of the series Base resistor of the BJT will increase the Emitter current. Say you go with a 510 Ohm resistor instead. Now Ib will be 5 - 0.7 / 510 = 0.0084 mA (about 8.4 mA)... and with that you can do the rest of the calculations, I think, given the previous example above.
                                      I followed everything you said here, thank you. I get it now... my final circuit has a BC337 and its datasheet lists Hfe as a function of collector current. The range of Hfe being from 100 to 630. Since I'm using a resistor at the base of 1.7k and assuming a 5v output from the Arduino pin, my Ibe would be 2.5ma. The minimum gain is 100 so worst case, I can have 250ma at the collector, which would be limited by that 6.8Ω resistor in series with the LEDs, so since my actual source voltage for the LEDs is 9.8, and considering the voltage drop Vce, I am most likely giving those LEDs less than 150ma, which means they are being driven well within tolerance.

                                      What I also realized reading your post, is that it would theoretically be possible to drive LEDs without a series resistor by properly selecting your base current and knowing exactly what your H value would be at that base current and voltage... which would take some experimentation to determine, but in theory it would be possible, would it not?

                                      Comment


                                        #20
                                        Re: Current flowing through transistor even when base is shunted to ground.

                                        Originally posted by budm View Post
                                        [I]"Do the experiment, set power supply to 5V with 5A limit then apply it to the E-B junction of spare Transistor you have and see what happen.
                                        Do I need a complete transistor circuit to perform the test? In other words, do I need a circuit to complete C-E before B-E will saturate? I'm thinking not???

                                        Comment

                                        Working...
                                        X