Loading ...
Sorry, an error occurred while loading the content.

Mosfet switching relay - high or low side ??

Expand Messages
  • beefyandzee
    I m kicking myself for overlooking this decision when I designed my circuit board. I m using a 5v PCB relay that take about 40mA of drive current. A 2N7000
    Message 1 of 28 , Jun 28, 2014
    • 0 Attachment

      I'm kicking myself for overlooking this decision when I designed my circuit board. I'm using a 5v PCB relay that take about 40mA of drive current. A 2N7000 mosfet (n channel) is switching the relay on the high side, i.e. the mosfet drain is connected directly to positive 5v. The gate is connected directly to a microcontroller output which gives out 5v.


      The relay energises BUT it only has about 3.2v across it and the mosfet has 1.8v across the DS. The gate has the full 5v on it.


      Would it have been better to put the mosfet on the low side instead. Would this have turned the DS junction on "harder", reducing the DS on resistance.


      Also don't suppose anyone has any suggestions for a drop in replacement that may have a lower DS voltage drop with my current setup.


      Cheers,


      Keith.

    • "Zoran A. Šćepanović"
      ... Hash: SHA1 ... N MOSFET should be used as Low side switch. Placing MOSFET as you did, there is not enough Gate-Source voltage to keep transistor fully
      Message 2 of 28 , Jun 28, 2014
      • 0 Attachment
        -----BEGIN PGP SIGNED MESSAGE-----
        Hash: SHA1

        On 06/28/2014 12:51 PM, beefyzee@... [Electronics_101] wrote:
        >
        >
        > I'm kicking myself for overlooking this decision when I designed
        > my circuit board. I'm using a 5v PCB relay that take about 40mA of
        > drive current. A 2N7000 mosfet (n channel) is switching the relay
        > on the high side, i.e. the mosfet drain is connected directly to
        > positive 5v. The gate is connected directly to a microcontroller
        > output which gives out 5v.
        >
        >
        > The relay energises BUT it only has about 3.2v across it and the
        > mosfet has 1.8v across the DS. The gate has the full 5v on it.
        >
        >
        > Would it have been better to put the mosfet on the low side
        > instead. Would this have turned the DS junction on "harder",
        > reducing the DS on resistance.
        >
        >
        > Also don't suppose anyone has any suggestions for a drop in
        > replacement that may have a lower DS voltage drop with my current
        > setup.
        >
        >
        > Cheers,
        >
        >
        > Keith.
        >
        >
        >


        N MOSFET should be used as Low side switch. Placing MOSFET as you did,
        there is not enough Gate-Source voltage to keep transistor fully opened.

        - --
        Best regards
        Zoran A. Scepanovic
        zastos@...
        +381 63 609-993


        -----BEGIN PGP SIGNATURE-----
        Version: GnuPG v1

        iQEcBAEBAgAGBQJTrqVCAAoJEB8b5y+tT/OGMeIH/0B3Rw4P3MgUZf65FZkNrbB4
        sP50+vZL4Lmp4VPrXk+2tO5TPU8qcGxuLhnHk+O+kbLNRDKMutbTeYjXLT2n6bmJ
        KsrNoKYAK/BO4RVoUyri4wJeUvE2M7Dts55+BVWyj7ic3qvYpxY6zsLWWNcHdkJA
        MZ2nIMHR+5q+qN8Zt8YHNKW2ctEhi05iXAtIeott0LcXB619OzN993wu48xyRwEV
        HOq/lA3xrtI3YGsS84VtlI0Z1tzlvbofS16PIhvGol8jPQaf6l2UcRxsN1E4lLSl
        kJ3xZQSpZKgQSuQCFOj1EPiZN4FnoNfgcT74jcO7Ku8HW1EvECWdmWMuvh6kHmA=
        =ZO+v
        -----END PGP SIGNATURE-----
      • beefyandzee
        I m wondering if I m screwed as far as using an n-channel mosfet goes because the GS voltage can t get high enough when the source is connected to the relay
        Message 3 of 28 , Jun 28, 2014
        • 0 Attachment
          I'm wondering if I'm screwed as far as using an n-channel mosfet goes because the GS voltage can't get high enough when the source is connected to the relay positive. I mean if the relay coil voltage could get to 5v then that's 0v across the GS because each one is at 5v (as is the drain).

          Would my solution be to either use an NPN transistor with the base emitter junction dropping only 0.6v I could theoretically get a max of 4.4v across the relay coil. My microcontroller pin can easilly supply 20mA.

          Alternatively would I be better replacing the n-channel mosfet with a p-channel mosfet, and instead of 5v turning the mosfet on, a logic low (0v) will turn it on.

          Feel free to tell me if I have it all wrong LOL.

          Keith.
        • "Zoran A. Šćepanović"
          ... Hash: SHA1 ... Even NPN transistor should be used as Low side switch. - -- Best regards Zoran A. Scepanovic zastos@gmail.com +381 63 609-993 ... Version:
          Message 4 of 28 , Jun 28, 2014
          • 0 Attachment
            -----BEGIN PGP SIGNED MESSAGE-----
            Hash: SHA1

            On 06/28/2014 01:25 PM, beefyzee@... [Electronics_101] wrote:
            >
            >
            > I'm wondering if I'm screwed as far as using an n-channel mosfet
            > goes because the GS voltage can't get high enough when the source
            > is connected to the relay positive. I mean if the relay coil
            > voltage could get to 5v then that's 0v across the GS because each
            > one is at 5v (as is the drain).
            >
            > Would my solution be to either use an NPN transistor with the base
            > emitter junction dropping only 0.6v I could theoretically get a max
            > of 4.4v across the relay coil. My microcontroller pin can easilly
            > supply 20mA.
            >
            > Alternatively would I be better replacing the n-channel mosfet with
            > a p-channel mosfet, and instead of 5v turning the mosfet on, a
            > logic low (0v) will turn it on.
            >
            > Feel free to tell me if I have it all wrong LOL.
            >
            > Keith.
            >
            >


            Even NPN transistor should be used as Low side switch.

            - --
            Best regards
            Zoran A. Scepanovic
            zastos@...
            +381 63 609-993


            -----BEGIN PGP SIGNATURE-----
            Version: GnuPG v1

            iQEcBAEBAgAGBQJTrq+mAAoJEB8b5y+tT/OGyisH/1MLz2BAcwUixA3QnpEq+jjg
            J4lA2+hDvtOBM0f4UO4LTTvUgvuitNwHNgUc4DKbbbCkbddWkRVUb02OhaxxCvER
            TrTCBmKL1FU4o3iHbmM+fD3OebmD8XovPChrygg1jn1rhctbfTwa/qvEqdV46Lky
            pqlw2GfZYKVNCUevGMMdxEDLVw0i5AJc3UZu1hMwa0+arpouUiDraGSZZIGxQv1y
            kOp+ApGlp43WNlLDeo4Yhk+naIoYoqEjWf0Y91jFwTVIYadrkO0KLj565/WljBVk
            sy/2ibDWBgfCUoztCPSSP8CDKKed0BZpBjQv43IJypJF0luxozUep2px6+2TWks=
            =9D5r
            -----END PGP SIGNATURE-----
          • redderek
            Here is what is happening... With the configuration of +5V---2N7000---relay---gnd And you apply 5V to the gate of the 2N7000... The Vgs-th (threshold turn-on
            Message 5 of 28 , Jun 28, 2014
            • 0 Attachment
              Here is what is happening...
              With the configuration of 
                  +5V---2N7000---relay---gnd

              And you apply 5V to the gate of the 2N7000...

              The Vgs-th (threshold turn-on of the 2N7000 is around 2.1V. The source will follow the gate if it can, and in your configuration, the source will follow the gate with at a minimum of Vgs-th difference (no accounting for Rds-Id effects). Thus, the source would be about 2.1V less than the drain - the reaso you are seeing the 1.8V. The rest of the voltage drop is across the coil of the relay.

              You could replace the 2N7000 with an NPN mosfet, but then the emitter would be 0.7V less than the base, making about 0.7V drop across the C-E and the remaining 4.3V drop across the relay. However,  your base driver has to be able to supply sufficient base current continuously to keep the device on. Since most output drivers tend to sink more current than source, this may not be the best method; check the specs. Personally, I would not go this route.

              In general, when driving relays with an electronic switch, the switch is typically placed on the lower side of the string - switching the ground on.

              If you insist on using the switch on the high side, go to a P-MOSFET. Then keep the gate high until you want to turn on the relay and then pull it down to 0V. Look at the Diodes Inc, ZVP2106A for an example.

              Anytime when using the switch, one should consider the Vce-sat voltage drop versus the Rds-Id voltage drop. Pick the lesser of the two to minimize power losses.

              Derek Koonce
              DDK Interactive Consulting Services
               
            • Paul
              Hi Keith, Probably the easiest solution is to replace the 2N7000 with a P channel ZVP2106A, although there will be others. Remember to swap the drain and
              Message 6 of 28 , Jun 28, 2014
              • 0 Attachment
                Hi Keith,
                 
                Probably the easiest solution is to replace the 2N7000 with a P channel ZVP2106A, although there will be others.
                Remember to swap the drain and source connections and remember that it will invert, ie a low on th gate will switch the relay on.
                Have fun.
                 
                Cheers
                 
                Paul



                This email is free from viruses and malware because avast! Antivirus protection is active.


              • janrwl
                Use a GERANIUM transistor. It will drop only about 0.2 V. and that is with the operating tolerance of the 5VDC relay, I imagine. Works for me! Use a
                Message 7 of 28 , Jun 28, 2014
                • 0 Attachment
                  Use a GERANIUM transistor.  It will "drop" only about 0.2 V. and that is with the "operating tolerance" of the 5VDC relay, I imagine.  Works for me!  Use a diode "backwards" across the relay-coil, of course!
                • beefyandzee
                  Thank you very much everyone, you are life savers. I ve been Googling like mad since my first two posts and found the very same p mosfet on Digikey and Farnell
                  Message 8 of 28 , Jun 28, 2014
                  • 0 Attachment
                    Thank you very much everyone, you are life savers.

                    I've been Googling like mad since my first two posts and found the very same p mosfet on Digikey and Farnell (Element14 in Australia). Small through hole p channel mosfets don't seem to be out there in abundance.

                    Awesome suggestion too on the germanium transistor, I'm sure I've got some of them in my parts box. Time to set up the breadboard and try it out.

                    Keith.
                  • redderek
                    I am sure the OP is trying to keep it low cost. Derek Koonce DDK Interactive Consulting Services
                    Message 9 of 28 , Jun 28, 2014
                    • 0 Attachment
                      I am sure the OP is trying to keep it low cost.

                      Derek Koonce
                      DDK Interactive Consulting Services
                    • beefyandzee
                      Well I ve certainly learnt my lesson here. Germanium transistors seem to be like ghosts, so looks like it s the p mosfet route. Farnell have them at 42c each
                      Message 10 of 28 , Jun 28, 2014
                      • 0 Attachment
                        Well I've certainly learnt my lesson here.

                        Germanium transistors seem to be like ghosts, so looks like it's the p mosfet route. Farnell have them at 42c each with a minimum of 5 so I'm just going to grab 10 (only need 2 right now). Add unlucky $13 on for postage plus the beloved GST and I'm up for nearly $19.

                        All because I put the transistor on the wrong side LOL

                        I'm also noticing that the two main DIY type suppliers here in Australia (Jaycar & Altronics) have hardly any p-channel mosfets but plenty n-channel, and both stock the 2N7000 I use.

                        Hope my mistake helps others,

                        Keith
                      • beefyandzee
                        Just in case anyone wants to know how things turned out. Got a zillion basic NPN transistors in TO92 package so tested as a drop in replacement to the
                        Message 11 of 28 , Jun 28, 2014
                        • 0 Attachment
                          Just in case anyone wants to know how things turned out.

                          Got a zillion basic NPN transistors in TO92 package so tested as a drop in replacement to the n-channel mosfet on the high side.

                          No base resistors or anything, just a basic NPN transistor as an emmitter follower, full 5v on the base and 5v on the collector, emitter to the relay coil.

                          Base current was tiny at only 0.12 mA (120 uA), mush less than expected. Voltage across relay was 4.3v and coil current 34mA (takes 40mA at the full 5v).

                          After checking the relay data sheet this is well within the specs of the coil minimum operating voltage of 3.75v. Mind you the relay has already been operating at only 3.2v so I think I'm very safe. Also well within the power dissipation of the transistor (BC549  500mW)

                          Still, I would have liked those germanium transistors.

                          Keith.
                        • redderek
                          Keith, If you look at my post on this subject, the NPN was an option and I commented that the relay coil would be around 4.3V due to the Vbe of the NPN of
                          Message 12 of 28 , Jun 28, 2014
                          • 0 Attachment
                            Keith,

                            If you look at my post on this subject, the NPN was an option and I commented that the relay coil would be around 4.3V due to the Vbe of the NPN of 0.7V. The emitter would be 0.7V less than the 5V supply rail and not the typical Vce-sat drop of 0.3V due to the supply being used. Just needed sufficient base current to drive.

                            Glad the NPN looks to be  your best bet. Check for heat just to make sure there will be no problems. I do not know what the current draw is, but the power dissipation in the NPN would be 0.7V * Ic, where Ic is the current through the collector - which is the same as the coil current: 4.7V/Rcoil.

                            Looks like you learned a lot from your project.

                            Derek Koonce
                            DDK Interactive Consulting Services
                          • ahumanbeing2000
                            Yesterday I sent a reply that, it seems, couldn t reach the group. The relay energises BUT it only has about 3.2v across it and the mosfet has 1.8v across the
                            Message 13 of 28 , Jun 29, 2014
                            • 0 Attachment

                              Yesterday I sent a reply that, it seems, couldn't reach the group.


                              "The relay energises BUT it only has about 3.2v across it and the mosfet has 1.8v across the DS. The gate has the full 5v on it."

                              In this case, Vgs = Vg - Vs = 5 - 3.2 = 1.8 V only.
                              This is relatively low to fully turn on the DS channel.

                              "Would it have been better to put the mosfet on the low side instead. Would this have turned the DS junction on "harder", reducing the DS on resistance."

                              Yes, in this case Vgs = 5V which is high enough to let Ron of 2N7000 too small @Ids=40mA.

                              Kerim




                              ---In Electronics_101@yahoogroups.com, <beefyzee@...> wrote :

                              I'm kicking myself for overlooking this decision when I designed my circuit board. I'm using a 5v PCB relay that take about 40mA of drive current. A 2N7000 mosfet (n channel) is switching the relay on the high side, i.e. the mosfet drain is connected directly to positive 5v. The gate is connected directly to a microcontroller output which gives out 5v.


                              The relay energises BUT it only has about 3.2v across it and the mosfet has 1.8v across the DS. The gate has the full 5v on it.


                              Would it have been better to put the mosfet on the low side instead. Would this have turned the DS junction on "harder", reducing the DS on resistance.


                              Also don't suppose anyone has any suggestions for a drop in replacement that may have a lower DS voltage drop with my current setup.


                              Cheers,


                              Keith.

                            • beefyandzee
                              Hi Derek, yes I read your post and the actual tests I did came out exactly as you told me they would. I was expecting the possibility of a large base current
                              Message 14 of 28 , Jun 29, 2014
                              • 0 Attachment
                                Hi Derek,

                                yes I read your post and the actual tests I did came out exactly as you told me they would. I was expecting the possibility of a large base current seeing as there was no base resistor but I guess it's self limiting based on the load current. I pulled out my Art of Electronics book and read up on emitter followers. It described them as "current amplifiers" with a high input impedance and low output impedance.

                                Hi Kerim,

                                I tested the 2N7000 on the breadboard too but on the low side and what a difference. DS volt drop was only about 0.1v leaving 4.9v across the relay coil. I won't be forgetting this in a hurray.

                                Thanks everyone again for your input.

                                Keith.
                              • redderek
                                Keith, Most logic circuits these days do have output current limit circuits. I just was not sure how much current your relay required. The NPN has a spec
                                Message 15 of 28 , Jun 29, 2014
                                • 0 Attachment
                                  Keith,

                                  Most logic circuits these days do have output current limit circuits. I just was not sure how much current your relay required. The NPN has a spec called hfe, this is usually listed as a minimum and typical value in the data sheet.

                                  If the driver ic does get warm, then do add a base resistor to help protect it. Looking at data sheets you could calculate what is needed.

                                  Ib required = Ic (relay) / hfe (spec minimum at Ic rating)
                                  Where Ic could easily be calculated by 4.3V / coil resistance

                                  Then the base resistor would be:

                                  Rb = 0.7V / Ib

                                  But look at the IC spec and see if they do list any output specs. If you have problems seeing this, let me know the IC you are looking at and I can look up the data sheet and guide you.

                                  Derek Koonce
                                  DDK Interactive Consulting Services
                                • beefyandzee
                                  Cheers Derek, the microcontroller is an AVR ATMEGA328P. Each pin can supply a max of 40mA although not every pin at the same time. So according to that info I
                                  Message 16 of 28 , Jun 29, 2014
                                  • 0 Attachment
                                    Cheers Derek,

                                    the microcontroller is an AVR ATMEGA328P. Each pin can supply a max of 40mA although not every pin at the same time. So according to that info I could run the relay direct but reading stuff on Google it has been recommended not to load a pin continuously with more than 20mA. Seeing as the NPN transistor is only taking 0.12mA base current (base connected directly to AVR pin), I've got plenty leeway there. The BC549 data sheet give a max peak base current of 200mA too.

                                    Just based on what I measured I'm getting hfe of 34mA / 0.12mA = 283 !!!!!, much more than the specs. Maybe it has something to do with the emitter follower configuration. Like I said before, I never expected such a low base current (but I'm happy it is). I checked two separate transistors because I know hfe can vary quite a bit between the same model transistor but the base currents only differed by 0.01mA.

                                    This PCB only has a single track running to the base of the transistor so it would be difficult to fit a resistor in the circuit.

                                    I left the breadboard test circuit on for a few minutes and no sign of the transistor even getting warm so at the moment all appears well,

                                    Keith.
                                  • Paul Alciatore
                                    Yes, on the high side use a PNP or P channel device. On the low side, use a NPN or N channel. The other way around and you are just fighting things.
                                    Message 17 of 28 , Jun 29, 2014
                                    • 0 Attachment
                                      Yes, on the high side use a PNP or P channel device. On the low side,
                                      use a NPN or N channel. The other way around and you are just fighting things.
                                    • redderek
                                      Keith, I looked up the BC549 spec and see the minimum hfe listed is 110. Thus, if you need 34mA for the relay, then you need a base current of 34mA / 110 =
                                      Message 18 of 28 , Jun 29, 2014
                                      • 0 Attachment
                                        Keith,

                                        I looked up the BC549 spec and see the minimum hfe listed is 110. Thus, if you need 34mA for the relay, then you need a base current of 
                                            34mA / 110 = 0.31mA

                                        Thus, if the ATMEGA328P can pull up to the 5V rail, you could start with a base resistor of:
                                           0.7V / 0.31mA = 2.25kOhm,

                                        I would suggest 1kOhm and make sure everything works well.

                                        As for the the hfe you calculated, it is what is seen, but the limitation is based on the voltage more than the current. You are basically overdriving the base. Thus the inclusion of a base resistor will help protect the uP.

                                        Otherwise, what is working sounds great.

                                        Derek Koonce
                                        DDK Interactive Consulting Services
                                      • basicpoke
                                        Shouldn t that be (5-0.7)/0.31mA equals 13.9kohms Ron
                                        Message 19 of 28 , Jun 29, 2014
                                        • 0 Attachment
                                          Shouldn't that be (5-0.7)/0.31mA equals 13.9kohms Ron
                                        • alienrelics
                                          I prefer using TULIP transistors. Seriously, though. You could install a Logic Level P channel MOSFET and simply invert the output. Steve Greenfield AE7HD
                                          Message 20 of 28 , Jun 29, 2014
                                          • 0 Attachment
                                            I prefer using TULIP transistors.

                                            Seriously, though. You could install a Logic Level P channel MOSFET and simply invert the output.

                                            Steve Greenfield AE7HD
                                          • Andy
                                            Derek wrote: Thus, if the ATMEGA328P can pull up to the 5V rail, you could start with a base resistor of: ... Tell me again, why do you want a base resistor?
                                            Message 21 of 28 , Jun 29, 2014
                                            • 0 Attachment
                                              Derek wrote:

                                                 "Thus, if the ATMEGA328P can pull up to the 5V rail, you could start with a base resistor of:" ...

                                              Tell me again, why do you want a base resistor?

                                              Is it to protect the driver chip and the transistor if the relay coil short-circuits?

                                              If there are no faults, then you've just got an emitter follower, and you aren't over-driving anything.

                                              OK, the transistor is going close to saturation, but does it matter?  I would not expect the base current to significantly rise, unless the collector voltage were to drop below the base voltage.

                                              Regards,
                                              Andy


                                            • redderek
                                              Steve, Keith s circuit is already laid out and he does not want to spin a new board. The idea now is to work with what he has. Derek Koonce DDK Interactive
                                              Message 22 of 28 , Jun 29, 2014
                                              • 0 Attachment
                                                Steve,
                                                Keith's circuit is already laid out and he does not want to spin a new board. The idea now is to work with what he has.

                                                Derek Koonce
                                                DDK Interactive Consulting Services

                                              • redderek
                                                It is 0.7 V because Keith is driving from the supply rail and there is a Vbe drop of the NPN transistor - 0.7V. The emitter will follow the base with about
                                                Message 23 of 28 , Jun 29, 2014
                                                • 0 Attachment
                                                  It is 0.7 V because Keith is driving from the supply rail and there is a Vbe drop of the NPN transistor - 0.7V. The emitter will follow the base with about 0.7V difference and thus the emitter voltage will be 5-0.7=4.3V. Typically the Vce of a NPN is 0.3V, however, the configuration Keith has is what is called an emitter follower circuit and thus the emitter will follow the base voltage with 0.7V difference.

                                                  So to limit the base current to protect the driving circuit, the uP, you would have:

                                                  +5V --- drive circuit --- NPN base. 

                                                  The base resistor is there to protect the drive circuit in case there is a dead short of the NPN emitter to ground. In this case, the driver would be driving (5V-0.7V) / Rb. I suggested a 1K resistor. Therefore, the maximum current into the base for a shorted emitter is 4.3mA - much less than the uP capability and thus minimal chance that it will burn out the output.

                                                  Derek Koonce
                                                  DDK Interactive Consulting Services
                                                • redderek
                                                  Andy, Base resistor is used to protect the driving circuit; in this case the uP. See my recent post on the basis and how it protects. Without the base current,
                                                  Message 24 of 28 , Jun 29, 2014
                                                  • 0 Attachment
                                                    Andy,

                                                    Base resistor is used to protect the driving circuit; in this case the uP. See my recent post on the basis and how it protects.

                                                    Without the base current, one is over-driving the base and thus wasting power. I am a power / analog / instrumentation engineer with over 25 years experience. I always think about power loss and waste.

                                                    One could skip the base resistor, but if the emitter is shorted, the uP is driving 40mA into the base and thus dissipating excessive heat that could eventually destroy itself if there was not base resistor as a form of protection.

                                                    Derek Koonce
                                                    DDK Interactive Consulting Services

                                                  • Andy
                                                    Derek, I m still not getting you about this. We are talking about the same circuit, yes? The one with the NPN (BJT) on the high side of the relay, where the
                                                    Message 25 of 28 , Jun 30, 2014
                                                    • 0 Attachment
                                                      Derek,

                                                      I'm still not getting you about this.

                                                      We are talking about the same circuit, yes?  The one with the NPN (BJT) on the high side of the relay, where the NPN is just an emitter follower, right?  Then there is no "over-driving" going on here.  The base is being pulled up to whatever voltage, and the emitter follows it, 0.7V lower.  Where is this "over-drive" of which you speak?

                                                      I fail to see why a resistor in series with the base lead does anything helpful, except in the case of a fault.  Maybe the fault contingency is what you are trying to protect?  Is that the whole reason for the resistor?

                                                      Or are you talking about driving an NPN in the low side of the relay?  There, you would need the base resistor, of course, because you would be over-driving the base (and over-loading the driving IC) without it.

                                                         "One could skip the base resistor, but if the emitter is shorted, the uP is driving 40mA into the base and thus dissipating excessive heat that could eventually destroy itself if there was not base resistor as a form of protection."

                                                      Now this sounds like you mean the emitter-follower (NPN in the high side of the relay) and that the resistor is there only to protect against a fault, but the follow-up explanation doesn't make sense.  Why do you say the uP drives only 40mA into the base?  Who's to say it won't be 400mA, or more?  Yup I saw where each pin has a max. spec of 40mA, but I'm sure you know that it's going to supply a heck of a lot more than that, when it tries to drive high into a diode to ground (the B-E junction).  So if that's the case you're trying to protect, then I think the base resistor should not be skipped, and you can't wave it off as only 40mA, because it won't be only 40mA.  It might let out the smoke.

                                                      Maybe it's just me, but power loss and waste would seem like minor concerns in the event of an unlikely fault.  I'd be more concerned about protecting circuits from further damage.  Of course if you think this kind of short-circuit happens often, and that the product needs to continue operating like that indefinitely and not consume too much battery power after the short develops, then you've got a point.

                                                      If the short doesn't happen, then adding a resistor in series with the base isn't going to lower the circuit's power dissipation more than a few hundred nanowatts.

                                                      Regards,
                                                      Andy


                                                    • redderek
                                                      The primary basis is for the protection in case of a short. Another basis is to protect when the relay is turned off. When the relay is turned off, the current
                                                      Message 26 of 28 , Jun 30, 2014
                                                      • 0 Attachment
                                                        The primary basis is for the protection in case of a short.

                                                        Another basis is to protect when the relay is turned off. When the relay is turned off, the current cannot just instantly stop. Thus the emitter node can be yanked to a negative voltage. Again, the base resistor is there to protect the driver circuit.

                                                        A lot is going on with a simple relay and switch.

                                                        Derek Koonce
                                                        DDK Interactive Consulting Services
                                                      • rtstofer
                                                        Because you are using an NPN device in a high-side application, the circuit is called an emitter follower - Google for it. The base wants to get up to the
                                                        Message 27 of 28 , Jun 30, 2014
                                                        • 0 Attachment

                                                          Because you are using an NPN device in a high-side application, the circuit is called an emitter follower - Google for it.

                                                           

                                                          The base wants to get up to the rail, somehow, and the emitter, BY DEFINITION, will be about 0.7V lower.  There is a p-n junction causing that voltage drop between the base and emitter.

                                                           

                                                          Regardless of how high you can drive the base, the emitter will still be 0.7V lower.  And that's the issue when connecting the base to the uC.  The uC may not be able to drive the output anywhere near the rail because there is a MOSFET pulling the pin high.

                                                           

                                                          The hFE (DC Gain) of the transistor will be quite high but, for switching circuits, we usually use a gain of around 10.  So, if the collector current is 40 mA, the base current will need to be 4 mA.  That's easy for a low side configuration.  But how to get 4 mA to flow when the uC output can't reach the rail.  Well, we get as close as possible and try various values of resistors while measuring the current.  This could be an ugly calculation.

                                                           

                                                          Or, we decide to protect the uC by picking a resistor value that will limit the current to the max for the pin.  So, a 3.3V pin with a max of 40 mA requires an 82.5 Ohm resistor to limit the current.  So, we pick 100 Ohms and see how the transistor reacts.  Does the emitter voltage get high enough?  Is the drop between the collector and emitter reasonably low, less than 1V and, hopefully, closer to the theoretical limit of 0.7V?  Does the relay work?

                                                           

                                                          And, of course, the lesson learned:  NEVER use high side switching unless you are building an H-Bridge and don't have any choice.

                                                           

                                                          Richard


                                                           

                                                        • beefyandzee
                                                          Thanks for the addition input everyone. I ll eventually make a new PCB with an n-channel mosfet on the low side (already revised the schematic and PCB pattern)
                                                          Message 28 of 28 , Jun 30, 2014
                                                          • 0 Attachment
                                                            Thanks for the addition input everyone.

                                                            I'll eventually make a new PCB with an n-channel mosfet on the low side (already revised the schematic and PCB pattern) simply based on the fact that if the relay was ever to short circuit, I'd toast the microcontroller. Mind you, I've never personally experienced a relay coil go short circuit, only open circuit.

                                                            For now though this setup is working perfectly and the base current is extremely low at 120uA. That seems to be in line with the Art of Electronics book describing an emitter follower circuit as having a high impedance input, and being a current amplifier as opposed to a voltage amplifier. I've actually got negative voltage gain but lots of current gain which is perfect.

                                                            Keith.


                                                          Your message has been successfully submitted and would be delivered to recipients shortly.