Maker Pro
Maker Pro

FET switch circuit - is it correct

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
The schematic is a proposed circuit for using a N-channel FET to switch on/off the circuit as well as a load on the battery(J2). To start the circuit you have to press SW1 and hold it until the pic raises GP5 at which point, if the circuit works as desired, the FET will ground the Com of the LM7805 as well as pin 1 of J2, completing the circuits(for the load on J2 and the power to the PIC).
Note: This is to replace the relay on my LiPo protection project on another thread.

A few things bother me:
1. Is the circuit the right way around to use a N-channel FET switching ground rather than the positive voltage?
2. What will the LM7805 do when it has 12V on its input but no ground? Will it still draw current because of the load connected to its output? And if so, what will the output voltage be?
3. Do I need a resistor between the FET and the PIC? I think not as the gate current should be very low, but I don't know which figure to look at in the data sheet or how to calculate it.

This is my first attempt at using a FET so feel free to shoot me down. Any suggested improvements will be greatly appreciated.
I looked at using a P-channel FET so I could switch the positive side, but that would require a FET driver, which this does not as the FET used can be switched with the 5V from the PIC even though the Rds(on) will be quite high (0.045R) which will result in quite high heat when switching on 30A or so. I might need 2 FETs in parallel but I will cross that bridge when I get to it - first the basics.

The intended operation.
1. When the battery is connected, nothing happens as the LM7805 has no ground and the J2 negative terminal is not connected to ground, so the load, connected to J2, remains switched off.
2. Push the start switch(SW1) and that connects the ground of the 7805 and the negative terminal of J2. The PIC starts running and raises GP5.
3. Let go the push button and the FET takes over and keeps the LM7805 and the negative terminal of J2 connected to ground.
4. It is not possible to switch the circuit off as I am out of inputs on the PIC. I could add another switch(normally closed), but can easily do without.

@Steve:
I am not hard headed about using a LM7805, it is the regulator I know(and have lots in my bitsbox) and it is easy to use but I will change it to suggested improvements.FETSwitch.jpg
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I don't think you can switch the COM terminal on the 7805 that way. I don't know what it will do, but I don't think it would be good.

If you are going to use a regulator, why not use one with a shutdown pin? I don't know the part number off the top of my head, but I know they exist. Then you could use the same trick to hold it in shutdown until a button is pressed, and then use a PIC pin to keep it on.

Edit: I just simulated on LTSPICE and with 9V in, COM not connected and a 1K resistor from out to ground, it gets 8V at the output terminal. So no, don't do that!

Edit 2: Here is an example of a regulator with shutdown:

http://www.ti.com/lit/ds/slvs522n/slvs522n.pdf

Bob
 
Last edited:

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Yes Bobs right. You can't do this because the input will feed through one of the internal transistors to the disconnected com pin. And because the output is connected to the com pin through two series resistors you will get a voltage on the output. If you don't have a regulator with shut down function could high side switch the regulators output through a P-FET?
Thanks
Adam
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
FETSwitch.jpg
Arouse, BobK, thanks for your answers. I was just about to try 7805 behaviour on a breadbord.
I use Linux. Are there any simulators that are any good running on Linux. I tried TINA but it will not even run under WINE. LTSpice is a bit out of my price bracket.

I looked at using a P-channel FET, but the gate voltage requirements are such that a PIC cannot switch them without a FET driver, from several web articles I found. Also I have these FETs lying around looking for a purpose, much the same as the 7805s and BC557s.

How would this work?

Is the rest of the circuit OK?
1. Do I need a resistor from GP5 to the gate of the FET?
2. Anything else missing/wrong?
 

Attachments

  • FETSwitch.jpg
    FETSwitch.jpg
    69.8 KB · Views: 167

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
you don't strictly need a gate resistor. There are a couple of reasons to use them, but in this circuit I doubt it would make a practical difference.

As a couple of examples, the gate resistor can limit peak gate current, or protect the uC somewhat if the mosfet dies with the gate shorted to the drain and/or source.

In your case the former is not an issue and the latter is probably not either as the battery self destructing will probably be more important. (Certainly if this is in close proximity with the battery it will.)
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The wire going from Q1 to Q2 needs to be connected to drain of Q1, then I think it might work. With that change, you have a high-side switch + a level shifter.

I would still use a modern low-dropout regulator with a shutdown pin to save on battery. The 7805 will use more quiescent current than you micro will use as operating current. They are basically obsolete at this point in time.

Bob
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
tmp.jpg @Bobk:Unless I have got it wrong, that would leave the base of Q2 floating while the circuit is not 'ON'. The way it is connected the base is held low while the circuit is off through the 2 resistors keepimg the power to the PIC off. I don't know what will happen if the base is floating, but I am guessing it will be undesirable. The way it is, pushing the button will power the PIC that will pull GP5 high switching on Q2 and keeping itself powered when the button is released. A high on GP5 will also cause Q1 to conduct switching on J2.
Unless I misunderstand the circuit, it is a low side switch.

It might be a good idea to connect the gate of Q1 to the collector of Q2, instead of to GP5. as that will put 12V on the gate(when GP5 is high) which will switch the FET on harder with consequently a lower Rds(on) resistance.

The previous is not stated fact, it is the way I understand the circuit and designed it. So please correct me if I am wrong.

View attachment 13295
 
Last edited:

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
Would the LM317 be a better choice for a voltage regulator? I found some in my bitsbox.
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
@OLIVE2222:
Thanks for your response.
LM317 turn off. The circuit must fully turn off to stop draiinng the battery any further, The question is whether the LM317 is a better voltage regulator than the 7805. I don't know which values to look at on the data sheet to compare them.

The links to FET circuits, I have looked at many FET circuits. However I don't just want to copy a circuit. I am also trying to understand what I am doing and do my own circuits and so learning about electronics. That is why I also like to know which are the critical bits of a data sheet I must look at for a given application. This is a hobby for me.


So having done a lot of googling and reading, I think my circuit above should work, but it will be nice to get confirmatiob and some input on bad parts of the circuit(like Steve saying the 7805 is a bad regulator and BobK suggesting a different connection between Q1 and Q2.).
This is the only way I know how to learn and understand and not just be a parrot. If I can build a circuit that works with a given set of components then it means I most likely understand how they work.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Working from the schematic in post #8.

Your simplest option is to replace Q2 with a P-channel MOSFET. Source to emitter position, drain to collector position, and gate to base position. The MOSFET will work just like a PNP transistor except that its gate current is practically zero and its drain-source resistance (and therefore its voltage loss) can be extremely low as well.

You'll also need a gate-source resistor (e.g. 100k) and the bottom end of R2 needs to come from the collector of a transistor (or the drain of a small N-channel MOSFET) that is turned ON by voltage from the micro. This is needed because R2 needs to pull all the way up to the positive battery voltage in order for Q2 to turn OFF; the micro will not allow that.

It would really help if you drew the diagram with the 0V rail running along the bottom and the positive rails at the top. The battery could go at the right hand end, then working leftwards, the P-channel MOSFET, then the regulator. Also, please show the battery voltage, as this can be relevant for choosing components.

A 7805 (even a 78L05, the lower power version) draws significant quiescent current (also called "ground current"). Many more modern regulators have a far lower quiescent current. Have a look on Digikey.
 

OLIVE2222

Oct 2, 2011
690
Joined
Oct 2, 2011
Messages
690
Yes a FET will be better, that's why I send you the mosaic link . The link contain very detailed information's of how it's work, nice way to learn (without becoming a parrot).
The figure 3 of this link http://www.mosaic-industries.com/em...r-switch#press-on-press-off-latching-circuits is "close" to your drawing. Indeed the 7805 is not the most modern one available, however he will be OK for experiment purpose, when everything works you can replace it wit a more modern one, like the LM1117.
 
Last edited:

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
@kris:
Thanks for your reply. Looking at the data sheets for the 7805 it has a quiescent current of 5mA while the LM317 has an adjustment pin current(which I think is the same parameter) of 100uA, so it seems it is a much better choice.
I will redraw the circuit, but I would like to make it work with the N-channel FET to see that I understand what I am doing. Most of the articles I found seem to recommend using a FET driver to drive P-channel FETs from a micro so the gate voltage can be closer to the source voltage and therefore the Rds(on) is much lower. This is also true for N-channel FETs, but they seem more forgiving(if I understand the articles correctly). The N-channel FET that I have has an Rds(on) of 0.045R at 5V on its gate and 0.027R at 10V, so it definitely becomes more efficient for higher gate voltages.

This switch is for my LiPo protection circuit, so the battery voltage will be 12.6V(max) for a 3 cell LiPo.

I will redraw the circuit now.
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
The new circuit diagram.
I am still using an N-channel FET as I have those, the BC557 and LM317s.
I hope the circuit is more readable.
Critical question is will it work as I intend:
1. Connect the battery. There is no supply to the LM317, so the whole circuit is off. The gate of the FET is pulled to ground so that is also off.
2. Push the switch to supply power to the LM317 input. That powers the PIC that raises GP5 and causes the BC557 to switch on and take over supplying power to the LM317.
3. The BC557 also raises the Gate of the FET to 12V switching it on hard and now we have a completed supply to the LOAD connector.

To switch off requires unplugging the battery or when the voltage drops below the level allowed by the PIC, GP5 will be set low and the whole lot should switch off.FETSwitch.jpg
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Hello, after all this can't you just use a toggle switch? :) only joking, I know you want to have a play with more fancy circuits .

Ok so I see R1 might be in the wrong place and should pull the base of the transistor Q1 to +V otherwise your circuit will be on all the time. A couple of other things that might be an issue.

(1) is when the PIC is off before you press the button you have effectively a diode and a 100R connected from the supply to a non powered processor which has a common connection.

What will happen, well that depends on the PIC's input, but it is not good practice, also any current from this connection finding it's way to common could switch the transistor on anyway.

(2) What's the purpose of the PIC being connected to the base of the transistor, in this configuration it can't control anything even if you wanted it to.

To resolve these two problems I think you need to connect the emitter of Q1 to the regulator output (PIC Supply). And leave the switch connected to your battery.


What is the point of Q2, as it's on when the circuit is active. I first thought ah it's to isolate the load for some reason, but you have to disconnect the battery to reset everything so there won't be a battery that needs isolating for what ever reason.

Why don't you control this from the PIC and add some current sense circuitry which you could then switch out the load and indicate such a condition on say an LED if your circuit current limited.

Also why not add an LED to let you know when you can release the push button.

Just a thought

Thanks
Adam
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The 240R + 720R will be drawing over 5mA when the regulator is on, so it is not better than a 7805. Why so much resistance to using the correct part, which is low quiescent current, low dropout regulator with a shutdown function? Right now, you are just adding more and more complexity without improving the circuit at all. Using parts just because they happen to be in your cabinet does not lead to good designs.

Bob
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
You're right that the LM317 has a lower "ground" current, but the presence of R4 and R5 will draw 5.2 mA from the 5V rail. So you lose the efficiency that you gained.

Olivier recommended an LM1117 which is a low-dropout regulator (a feature you don't need) and has a typical quiescent current of 5 mA anyway, so you wouldn't gain anything there. There are more suitable devices available but you should tell us more about your project first, including how much extra load current you can tolerate being drawn from the battery by this circuit.

Yes you're right, MOSFETs do saturate better with higher gate-source voltages. In this case that works out nicely because 11~13V is enough to saturate a MOSFET nicely, but not enough to damage it (at least, not for larger geometry ones).

You could use an N-channel MOSFET; these are available with lower ON-resistances. But unless you're switching the negative side of the battery, you will need an extra circuit to generate a bias rail for the MOSFET's gate. A P-channel MOSFET is slightly tidier in this application and you don't need a MOSFET gate driver; you can just drive it from an open collector of a transistor that switches to 0V (or a small N-channel MOSFET) which is controlled by the micro.

Another alternative is to use a common positive rail and a negative regulator to supply -5V for VSS for the micro. Then have the micro drive a small PNP or P-channel MOSFET that provides gate bias for an N-channel MOSFET that switches the negative side of the battery.

Do you really need a microcontroller there? What functions does it need to perform? If it's just a timer, you could probably use a CD4060 instead.
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
FETSwitch.jpg View attachment 13346 Hi Adam, Thanks you for that informative response, it is much appreciated.

1. I understand this and will correct the circuit to avoid this problem.
2. I don't follow this bit. Ignoring the incorrect use of the BC557, the intention is:
a. When the circuit is powered, the gate of Q2 is pulled low through the 10K resistor, turning it off and so breaking the ground to the LOAD.
b. The PIC should control the base of the BC557. When the 557 turns on(base controlled by GP5 of the PIC), it powers the circuit, but also raises the voltage on the gate of Q2 to somewhere close to 12V, switching it on and therefore providing ground to LOAD, which means the LOAD is turned on.
If I connect the emitter of Q1 to the output of the LM317 then the supply voltage to the LM317 will only be 5V and it will not be able to supply 5V to the PIC(unless I have this wrong for the LM317).

So here is the changed circuit as I understand it.
The 2N222 now blocks the current from the BC557 and it now is controlled by the PIC's GP5.
I have not done anything to the FET bit of the circuit as I think it works as intended, but please correct me if I am wrong.View attachment 13342
 
Last edited:
Top