Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I am trying to switch on and off a circuit that draws about 0.8 amp at 12 V. The obvious choice is to set a MOSFET. The problem is that the control signal (the one that goes on the gate of the MOSFET) is changing very slowly (1 volt per hour). So when this slow signal reaches MOSFET threshold voltage it is not instantly turned off or on, it is operating in bad non saturated mod for some time.

How do I make a switch that turn on and off instantly?

I tried to use a relay that is controlled by MOSFET with zener diode as voltage sense. That will not work because when relay is switched off the current stops and power supply increases the voltage a little (because no load), and sense circuit thinks that voltage is ok again and turns relay back on. So relay open and closes like crazy near that threshold region!

Diagram

share|improve this question
1  
Could you pelase share your actual circuit with us? And the models of the components you mentioned? Tha would be of great help for someone to help you further. I could say, without knowing much of your application, that dependeing on the mosfet model, the switching frequency would vary. –  Sergio Jul 24 at 10:59
    
here is my circuit imgur.com/S1OXfKB –  dmitry8080 Jul 24 at 11:33

2 Answers 2

up vote 5 down vote accepted

You want to threshold detect a slowly varying signal (1 V/hour). This should be done with something that has high gain around the threshold point, and a little hysteresis. The high gain makes the result full high or full low on either side of the threshold, and the hysteresis prevents chatter due to the inevitable noise on the signal when it is close to the threshold. It also provides a positive snap action. For any finite gain, there would still otherwise be a soft area right around the threshold.

The conceptually simplest way to achieve this is with a comparator. For example:

R3 and R4 form a voltage divider to make 1/2 the supply, which in this case comes out to 2.5 V. C1 filters out small ripples on the supply to make a nice and clean 1/2 supply signal into the negative input of the opamp. The input signal is compared to this 2.5 V threshold. When above, the output goes high, and when below the output goes low.

However, if that was all, there would still be problems when the input signal was very close to the threshold. R2 provides a little positive feedback, which causes the hystersis described above.

When the output goes high, a little bit of that is added to the input that the opamp sees. This effectively lowers the threshold for the input to be interpreted as low. When the output is high, R2 and R1 form a voltage divider, the output of which must be 2.5 V for the opamp output to flip again. To cause that to happen IN must be 25 mV below the 2.5 V threshold. When OUT is low, the same thing happens in reverse. IN must 25 mV above the threshold to flip the state of the opamp again.

This causes a 50 mV hysteresis band around the threshold. The hysteresis band should be sized to be a bit larger than the peak to peak noise on IN.

For purely digital signal levels, you can use a logic gate with Schmitt trigger input. These work like the circuit described above, but the hysteresis is built into the gate. The downside is that the hystersis band is usually quite wide and the threshold somewhat unpredictable. This is because these are intended for logic signals, not for accurately threshold detecting analog signals. Even if you use a Schmitt trigger gate, it's good to understand the theory as illustrated by the circuit above.

share|improve this answer
    
Thanks, that solution is much better that I had before. Hysteresis controlled by R2 is exactly what I needed. –  dmitry8080 Jul 24 at 12:33
    
Nice Olin, I wanted just to add that the standard jelly bean comparator (like the LM393) has an open collector output and needs a pull up resistor. I was looking at spec sheets and I find it a bit disturbing that this info is hard to find. Like here, ti.com/lit/ds/symlink/lm393.pdf So you'll need a few k ohm from output to the +5V rail. –  George Herold Jul 24 at 13:30
    
@George: This is one reason I mentioned using a opamp as comparator instead. That might be more convenient, depending on what is downstream. In any case, it's good to point out that a pullup is needed if a open collector comparator is used. –  Olin Lathrop Jul 24 at 14:00

Assuming that your control signal varies from zero to 12 volts, this circuit has a lot of hysteresis and will power up the load when the control signal gets to 8 volts and turn it off when it drops to 4 volts. The LTspice circuit list is here if you want to play with the circuit:

enter image description here

enter image description here

share|improve this answer

protected by Community Jul 24 at 12:13

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.