Shop OBEX P1 Docs P2 Docs Learn Events
Circuit question? — Parallax Forums

Circuit question?

BitsBits Posts: 414
edited 2011-10-31 20:08 in General Discussion
Can you think of any problems that I may have over looked? This circuit is intended to protect my circuit (not shown) against a short. The connector will bring power out to a 12Volt DC motor that will never exceed 800ma. The idea is to remove the power to the connector if the leads are shorted.

*smiles / hugs* Attachment not found.
«1

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-28 11:14
    I don't quite understand how that circuit is supposed to work. For one, you have an nMOSFET being used "upside-down", which means it will always conduct through its internal diode. For another, there's nothing to bias the gate into conduction. The resistor will always pull it to V+, and the voltage across the external zener will always be zero.

    -Phil
  • BitsBits Posts: 414
    edited 2011-10-28 11:26
    Phil did I stump you? :)

    The direction of current through the internal diode is correct.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-28 11:29
    Okaaaay, so please explain how the gate circuit is supposed to function if it's always at source potential. And since the internal diode is always conducting, what shuts off the current to the motor?

    -Phil
  • BitsBits Posts: 414
    edited 2011-10-28 11:35
    Reversing Common and Vin will make the circuit not conduct or am I way off here? Perhaps I am mistaken?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-28 11:52
    You didn't say anything about reversing leads in your original post, just shorting them. But still, the gate circuit doesn't do anything, and all of your conduction goes through the internal diode. If the internal diode truly is a zener, it will conduct in reverse, too, if the breakdown voltage is exceeded.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-28 12:04
    BTW, if you want to protect against short circuits, Google current foldback for ideas.

    -Phil
  • BitsBits Posts: 414
    edited 2011-10-28 13:25
    I am embarrassed :thumb: sorry for the miss-communication Phil. Now I am rethinking the design and considering something like this. Problem is the comparator seems to invert the signal and I am not sure how to do this elegantly. The idea is that if the connector is shorted then the comparator will shut off the mosfet. P.S. I will look at the feedback ideas here soon.
    Attachment not found.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-28 13:55
    That's an interesting approach, but I'm afraid it won't work. Even with the correct nMOSFET, instead of the pMOSFET shown, and some necessary biasing on the comparator, it will oscillate under short circuit conditions, maybe even causing the MOSFET to overheat. The reason is that, as soon as the MOSFET is turned off, the overcurrent condition in the sense resistor disappears, and the MOSFET turns on again. What would be best is something that turns off the current and keeps it off until power is removed from the circuit entirely.

    -Phil
  • BitsBits Posts: 414
    edited 2011-10-28 14:09
    I guess ill go with the old tried and true method.
    Attachment not found.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-28 14:18
    No, don't give up! With some additional resistors, your comparator circuit might be tweaked to work. And you'll learn a lot in the process. Hint: How would you alter the comparator circuit to make it latch low when it saw too much voltage across the sense resistor?

    -Phil
  • BitsBits Posts: 414
    edited 2011-10-28 14:20
    Ahh - I think I have an idea Ill be back and post it. Thank you for the encouraging words.
  • BitsBits Posts: 414
    edited 2011-10-28 20:46
    Phil

    Apparently I am lost so please give me a nudge. I have ran numerous configurations of this circuit only to learn that; a struggle with a circuit means you don’t know what you are doing. I have admitted that fact hours ago and in between cooking dinner and reading my old colleague text, I can find yet no definitive solutions; in an elegant fashion that is.

    Here is what I think is fact…

    …The comparator will compare ( + & – ) inputs and if ( - > + ) then the output is negative. If ( + > - ) then the output will be a floating output; hence the pull up resistor. That is why I selected the P-Chan mosfet. The connector under the mosfet simulates a motor and the resistor under that is the voltage reference for the comparator. If a short accrues, speaking about the motor, then the voltage practically evaporates. That is when the comparator should recognize this voltage difference and trigger the mosfet.

    Why can’t I seem to get it to perform correctly? Lets ignore the “latch” suggestion you made earlier, so that I may digest some of the fundamentals.

    Oh - please no solution. I want to solve this, but with a little nudge / help. :)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-29 00:11
    For this app, you definitely want an nMOSFET. You want the default comparator output to be high (floating w/ pullup), so the circuit will be "on" when powered up. As to the comparator, you will have to decide how much voltage on the sense resistor is too much, and have it switch at that point. Hint: rather than picking the resistor ahead of time, think of a convenient (and cheap) low voltage to compare to and size the resistor to accommodate it.

    Once you've done all that, you will still have a system that oscillates on and off or -- worse -- stays somewhere in between. So try to think of a way to make the comparator output stay low once it does low, even though the current through the sense resistor goes to zero.

    One thing about this circuit that bears mentioning: it has a hair trigger. If it were used to charge a large cap, for example, you'd get false shutdowns, due to the large current surges. But, since you said it would be used with a motor, which is an inductive load, the current will build gradually, so it shouldn't trip unnecessarily. But I guess we'll see.

    -Phil
  • BitsBits Posts: 414
    edited 2011-10-29 09:22
    I will describe what this circuit is doing so others can learn as well.

    See attached picture:

    R1 simulates the motor. This value is loosely based on the max current of motor @ ~ 800ma so using Ohms law and ignoring the voltage drop of mosfet I got a 15 Ohm. Not perfect but its in the ball park.

    J1 simulates a short. If its shorted then voltage is almost zero (current will max out), otherwise the voltage is ~12V (current is ~600ma)

    R2 is used as a voltage divider to feed-back into the comparator. The voltage reads uder 2 volts when the motor is not shorted.

    R4 and R5 create another voltage divider to compare against. This is calculated as ~2.5 Volts using the equation ...Vout = Vin (R5 / R5 + R4)

    I have replaced mosfet against my will :) to a N-chan as its making since now Phil - thank you.

    So as of now...
    This circuit works yet does not work. You are correct in that it needs to latch, but how "hum, I think". What about placing a feedback resistor between the output of the comparator and the input to the positive pin? How do I make it latch?


    Attachment not found.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-29 10:22
    Now you're getting there! Good work!
    What about placing a feedback resistor between the output of the comparator and the input to the positive pin? How do I make it latch?

    Aha! This part is a little tricky. Comparators have small offset voltages associated with their inputs. Even if the positive side of the comparator were grounded, it might still not pull its output low, depending on whether the offset is positive or negative. What you want to make sure of is that, when the output goes low, due to a fault, either the positive input is pulled well below the negative input, or the negative input is raised well above the positive input. Think how you might use additional resistors (and maybe a transistor, diode, zener, etc.) to make this happen. The operant word here is "biiasing."

    -Phil
  • ercoerco Posts: 20,259
    edited 2011-10-29 10:25
    Bits wrote: »
    Phil did I stump you? :)

    Phil doesn't get stumped, he gets EVEN. By digging in and helping. We need more PhiPis in this world!
  • BitsBits Posts: 414
    edited 2011-10-29 11:25
    Okay I think I understand however doing as you suggest is a complete nightmare so far. Is this the correct direction to take?

    Attachment not found.

    erco - You are correct! :)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-29 11:34
    Okay, good: you're another step closer! Now, how to deal with that pesky offset? IOW, if both inputs are at ground potential, the output could be high, or it could be low. There's no way to predict which. Think in terms of bias, summing junctions, etc.

    (BTW, your PNP needs a base resistor to limit IBE.)

    -Phil
  • BitsBits Posts: 414
    edited 2011-10-29 12:03
    Could you clarify something? You mention bias - is that for the comparator or the mosfet, I am inclined to assume you are referring to the comparator since you mentioned offset. My next concern "thinking out loud" is that the gate voltage at the mosfet, another reason I initially used a P-chan mosfet, its referenced to source right? That said the comparator ground should be tied to the source of the mosfet? Or am i in left field on this?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-29 12:18
    Yes, the bias is for the comparator.

    You're right about the MOSFET, and I missed that detail in your schematic. But if you put your load on the drain side, instead of on the source side, your gate drive only has to be higher than the source by the usual drive voltage, plus the additional 2.5V or so across the sense resistor. By using a different divider on the comparator's positive side and a lower-value sense resistor, you could lower the sense threshold voltage to a volt or less.

    -Phil
  • LawsonLawson Posts: 870
    edited 2011-10-29 12:29
    A question first. How are you going to switch this motor on and off? I've usually seen the current limiting circuit integrated into the power switch circuit. (this is done for cost and efficiency reasons mostly)

    The following schematic is the simplest circuit I could think of that would latch off when the load is shorted. It is a combination of a two transistor flip flop, a common method of current limiting where an extra transistor steels gate current, and lots of positive feedback.
    CCF10292011_00000.jpg

    *edit* Smile, forgot the ground symbol in my first schematic*edit*

    Rs and the on resistance of the FET set the trip current. (i.e. when the combined voltage drop exceeds ~0.6 volts) Zener diode Dz limits the gate voltage of the FET and is optional at 12 volts. Rt*Ct sets the reaction speed of the circuit, this product should be much greater than the product of Rg and the FET gate capacitance otherwise the circuit is likely to latch off when powered up. A small holding current runs through the load after a short is detected. To reset the circuit, the motor will have to be disconnected, or main power will have to be turned off, or the gate of the NPN will need to be grounded, or the gate of the N-FET will need to be forced on.

    Lawson
    702 x 723 - 51K
  • BitsBits Posts: 414
    edited 2011-10-29 17:58
    Lawson wrote: »
    A question first. How are you going to switch this motor on and off? I've usually seen the current limiting circuit integrated into the power switch circuit. (this is done for cost and efficiency reasons mostly)

    The intent is to leave the motor on with no particular control other than unplugging it from the connector.

    Otherwise thanks for suggesting a different solution to my problem. Now the issue for me will be if I want to partake on your design or continue learning about the comparator. If Phil is not being board to death then I would like to continue picking his head. Ill post more soon I am still reading about op-amps.
  • BitsBits Posts: 414
    edited 2011-10-29 19:59
    Okay after some good sushi and a "blind date gone wrong" I got it to work. All I needed to do was move the mosfet so that it was in a low side configuration. I still want you opinion? This circuit latches.

    Attachment not found.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-29 20:21
    Nicely done! (Good sushi and bad dates do tend to focus the mind.) I believe that putting the sense resistor above the MOSFET as you did precludes any need for a latching circuit. Once the MOSFET turns off, it will stay off until the fault is corrected. Two things of concern, though:
    1. Power dissipation in the sense resistor: 5W @ 1A trip level. I'd use a smaller resistor and put a divider on the positive side of the comparator.

    2. Negative input of LM393 in "off" state will be 12V. LM393 is powered from 5V. I was going to express concern about this, but according to the datasheet (which you must have read):
    Note 6: The input common-mode voltage or either input signal voltage should not be allowed to go negative by more than 0.3V. The upper end of the common-mode
    voltage range is V+−1.5V at 25 ̊C, but either or both inputs can go to 36V without damage, independent of the magnitude of V+.

    It's always good to double-check, though. :)

    -Phil
  • BitsBits Posts: 414
    edited 2011-10-29 20:58
    Without a doubt I have read that dang data sheet, over and over. You ever get sick of reading data sheets, yet, you want to read them all?

    I did select a resistor but you raise a good point – voltage divider. I think Ill install one on the comparators positive input, a potentiometer should do the trick.

    One question in closing, I am a little concerned with the 12 Volts still being available on the top side of the connector ( the + side of XM11 in the picture above). That may pose as a safety issue - albeit very low current under 12ua, hum. Whats your take on this?

    *Edited, see the resistor R1 It is a pull up when the short is active.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-29 21:16
    Bits wrote:
    I am a little concerned with the 12 Volts still being available on the top side of the connector ( the + side of XM11 in the picture above). That may pose as a safety issue - albeit very low current under 12ua, hum. Whats your take on this?

    It all depends on whether there's a chance of it getting shorted to ground. For example, in automotive applications, switching is typically done on the high-side because the chassis is at ground potential. A short to ground with low-side switching could mean either the load being activated all the time or a catastrophic short. Since you didn't mention what your application was, and since low-side switching is easier in a lot of ways, I nudged you in that direction. However, now that you've completed your "exercise", there are fault-tolerant high-side switches out there that are designed specifically for the automotive market. A romp through DigiKey's parametric search pages should prove enlightening. :)

    -Phil
  • LawsonLawson Posts: 870
    edited 2011-10-29 22:14
    Nice use of the examples given. The comparator in your circuit is filling the same role as the NPN transistor in my circuit. (open collector inverter with a useful switching threshold) The comparator is a lot more accurate, stable, and settable though. Also, the higher open loop gain of the comparator will make it even less likely the circuit will get stuck in an intermediate current limiting, or oscillating state.

    I'd check the turn-on behavior of your most recent circuit, I suspect it will start up in the tripped state. (due to the gate capacitance of your FET) Adding Rt and Ct to your circuit will avoid this problem while allowing the substitution of less tolerant comparators.

    Marty
  • BitsBits Posts: 414
    edited 2011-10-30 10:05
    Thanks for all the help fellas, Phil I do appreciate the time you took to help me better understand the comparator. I think I will stick with the design and make the PCB soon.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-30 10:31
    Bits,

    Lawson makes a good point about the MOSFET's gate capacitance. On startup, it will be a race for the pullup to charge the gate before the load passes enough voltage to trip the comparator. Adding a low-pass RC filter to the comparator's negative input would forestall a power-on trip, but it would also increase the trip time for an actual short. A stiffer pullup on the comparator output could also help, as would as a MOSFET with a lower gate threshold and/or lower gate capacitance. I believe you indicated that you breadboarded the circuit and that it works, but it always helps to plan for the worst case and include some extra margins to accommodate them.

    -Phil
  • BitsBits Posts: 414
    edited 2011-10-30 18:04
    Okay so after some consideration I am back to square one. Please don't yell at me for this but why wont this circuit work better? I find that it latches and it has not failed in my testing as of yet.

    I believe it has everything I need, high side switching using a P-chan mosfet sorry Phil :), but this solves the issue of voltage being present on the connector during a short, its simplistic and elegant using only a hand full of parts – cost is minimal, the comparator has an adjustable input allowing for some flexibility when selecting the feedback resistor.

    - Also notice how low the sense resistor is now.

    Let me have it people what is your take on this?

    Attachment not found.
Sign In or Register to comment.