Will this comparator circuit work ?

Please take a look at this slight modification of a basic comparator circuit. For the sake of brevity, I won't go into details about the choice of components or why this particular arrangement (later if necessary). Is there any reason why it won't work ?

Threshold = 2.5V, adjustable to +/- 50mV hysteresis 5mV approx

+12V

___| | | | \\ Preset to 85k -->/ (calculated) \\ / | 2.2M | |________/\\/\\/\\________ _____| | | | | | | External adj | \\ \\ 10k | | 1k / / +|\\ | | \\ \\

Reply to
pjdd
Loading thread data ...

On a sunny day (11 Nov 2006 02:28:37 -0800) it happened snipped-for-privacy@rediffmail.com wrote in :

Would it not be simpler to take the positive feedback 2M2 resistor from the LM358 output? It may work or not, enter it is spice :-) Anyways you seem to want to create some hysteresis.

Reply to
Jan Panteltje

I took the +ve feedback from the base of the transistor to reduce the required value of feedback resistor for the small amount of hysteresis. Taking it from the opamp output would need something like 39 or 47M. Such values are not commonly available here.

Correction : There's no need for the 10k base resistor. I included it at first to avoid biasing the transistor via the 2.2M resistor in the off state. But the 4.7k resistor will do that anyway since the LM358 output goes down virtually to 0.

Reply to
pjdd

On a sunny day (11 Nov 2006 06:37:47 -0800) it happened snipped-for-privacy@rediffmail.com wrote in :

OK, got it. What made me think for a moment is the asymmetry, the Vb of the transistor will go to +0.7V, and to 0V in the other case, so it sort of shifts the set point a bit, the 2M2 becomes part of the reference divider.

0.7V swing with a divider approx 22k / 2M2 = 100x = 7 mV, should be about in the ballpark.
Reply to
Jan Panteltje

Don't know, can't be bothered. You'll have to work out an error budget based on what you think you have got and what you think you need.......

Using a device/load/transient/load current/temperature/other stuff dependent Vbe drop to set hysteresis looks dodgy.

Using a 12V 'supply' to set the reference looks dodgy. What is its tolerance and how does it vary?

The Larkin might have some comments about your presets but...... if you are trying to be cheap then 1% of 12V is 120mV. I can't be bothered to work out wether your set point will remain in range.

Input bias/offset currents.... input offset voltages. Temperature coefficients. Component tolerances.......

There are many things in your circuit that will not be satisfied by ohms law alone. Once you've looked at some of the things above you might find that what you have got is not 'manufacturable'....

Then you get to think about its AC/Switching characteristics.

I'm not telling you much but you might begin to see that there are some hidden nightmares hiding about in there.

DNA

Reply to
Genome

The purpose of my question was whether it will work as a comparator, especially whether altering the classic +ve feedback points could introduce some problem I didn't think of.

But since you brought up those other points, let me try to answer them -

The fact that I'm using a cheap general-purpose opamp as the active device should be your first clue that it's not intended for some super-precise control.

There will be two identical units, each controlling quantities whose relative values are more important than the absolute one. They will operate from the same power supply in a closely coupled ambient.

Hysteresis is not critical. It's there only to prevent uncontrolled oscillation around the set point.

Neither is maintaining the threshold at an absolute rock-steady level. The P.S. should stay within 0.2% of the nominal value. This translates to a change of 5mV of switching level. 10mV is still quite acceptable. I'll investigate further, and if necessary, make modifications.

I've worked out the efects of drift in bias/offset voltages and currents. They seem to be within acceptable limits. I'll double-check these too.

Components tolerances, including initial opamp offset and bias, should be taken care of by the preset.

I hope I don't come across as a know-it-all. Just trying to explain the situation. Thanks for the response.

If there are any other pitfalls, I'll be grateful if you or anyone would point them out.

Reply to
pjdd

Actually, for designs like this, it may often be simpler to use say a PIC 12F675,

formatting link
it has build in AD, and for hysteresis you can do something like if Uin < setpoint - 1 then output = 1, else if Uin > set point -1 then output = 0 in the ADC interrupt or where ever.

Stabilise the supply with a LM317 at 3 or 5V, that PIC has an internal oscillator, no xtal needed, and will set you back 73 cents. It has EEPROM so you can program / calibrate the set point in EEPROM once, for a given LM317.... And it can probably replace your transistor too. So that leaves you, inclusive supply, 6 components: LM317, PIC12F675, 2 resistors, 2 electrolytics.

Of course many other functions can also be integrated in the software.

Speed may be an issue, some microseconds to milliseconds AD acquisition time and interrupt response.

Reply to
Jan Panteltje

12F675,

formatting link

Should be +1 of course

Reply to
Jan Panteltje

What are the supply voltages to the op-amp? If they're +12 and ground, you have problems.

The op-amp may not be able to go down low enough to ground to turn off the transistor. You need something like a diode or two to drop the voltage down. See the LM358 spec sheet for low output voltage worst case.

----- Another problem:

The feedback from the transistor base is going to be swinging something less than 0.6 volts, and temperature dependent and slow to boot. Better to take it off the op-amp output, which will at least have a wider swing and less temp dependency at least percentagewise. To get

5mV hysteresis you may need a voltage divider too.

Also the feedback will work a bit better going directly to the - input.

And use a 1K pot to reduce bias current effects by 10x.

Reply to
Ancient_Hacker

Thanks for the interest, and sorry about the late reply. I was typing it when my ISP went dead and stayed down for the rest of the day. It's barely crawling even now.

I've used the humble LM358 for many simple and not-so-simple projects for years and I know the specs practically by heart. It's designed specifically for a single power rail and the common-mode input is rated down to the -ve supply, i.e., ground in this case.

The low-state output at low sink current is 20mV max, so there shouldn't be any problem turning the transistor off without any extra diodes.

These two characteristics are the main reasons why I chose the LM358 for this and many other projects where its shortcomings are not important.

Re the +ve feedback takeoff point, I didn't use the opamp output because, as I wrote in reply to another poster, that would require a very high-value feedback resistor for the small amount of hysteresis I wanted.

Your suggestion to use a resistive voltage divider has merit and in fact, I did consider it. But the hysteresis level need not be precise or very stable, so I said what the hell, the transistor Vbe should be good enough, is conveniently low, and results in a slightly simpler circuit.

The arrangement at the non-inverting input is something I omitted explaining at first for the sake of brevity. I live in a really remote region and pots of less than 10k are not commonly available.

Using a 10k pot directly would require either a high-resistance divider chain and the opamp bias current would start to have a significant effect, OR a more complex circuit which I want to avoid.

With this arrangement, if I feed the +ve feedback directly to the opamp input, changing the pot setting would result in wide variations in feedback ratio, and therefore the hysteresis level. Although I said that the hysteresis level need not be precise, it has to stay within reasonable limits.

Reply to
pjdd

12F675,

formatting link

oscillator,

and interrupt

I'll look into it. That seems to be a technically sound solution. Speed is not an issue here. However, restrictions imposed by the remoteness of my location make it undesireable to use anything but the most commonly available parts. Sigh.

Reply to
pjdd

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.