# help calculating feedback resistors for opamp hysteresis

Discussion in 'General Electronics Chat' started by vitroblue, Nov 19, 2010.

1. ### vitroblue Thread Starter New Member

Nov 19, 2010
3
0
hi
i'm having a bit of troubles calculating an adecuate resistor for this opams

here's my schematic. asume potentiometers are set to 50-50, vcc is 5V, R42 = R43 and R14 = R15. lets call the line that gets lost to the left X and REG goes to a microcontroller

with this, I'm monitoring X: if X goes out of a range set by the pots, the opams are supposed to set REG to high. but the current values i calculated for the resistors set a very wide histeresis window for both opams that overlap so the signal is ALWAYS set to 1 xept when i'm from 2.8 to 3.2 V aprox (VERY narrow acceptance margin) and i need to set this values farther appart!

lets say, the lower opam should turn on below 1.5V and off at 1.8V, while the upper opam should turn on avobe 4.5V and off at 4.2V (this ARE NOT accurate values, i must be able to adjust them with the pots; i just wrote them as an example)

i want the equation to get the resistors, not quite the values the resistors must have

can anyone help me figuring this out??

2. ### beenthere Retired Moderator

Apr 20, 2004
15,815
283
Some difficulty comes from trying to use an op amp as a voltage comparator. An op amp is meant to be used as an amplifier. Deliberately driving the output into saturation is not reccommended.

This link goes to a lengthy article on the us of voltage comparators. One section deal with making a "window comparator", which is the circuit you are trying to get to work - http://home.cogeco.ca/~rpaisley4/Comparators.html

3. ### vitroblue Thread Starter New Member

Nov 19, 2010
3
0
hi!

i looked at the site you sugested.

they are doing sort of the same i do at the "adding hysteresis to a comparator circuit" section. I'm just using two of them to make a window comparator: checks against the upper level, checks agaist the lower level. in the end, the diodes are the ones generating the OR between both output signals so my micro reads the alert right

the circuits in the site are based upon a lm339 i think, while i'm using a lm324.
i checked out both datasheets and, while there're a few important differences between them, still the 324 seems more suited to my needs. (please correct me if i'm wrong and i missed something else!!)

i'm checking out the equations in the site (sorry, i'm rather slow at math magic, my attention tends to drift a lot). I'll write back if i still havent figured out some useful values for my design

still, if someone else has some other suggestions, i'll really appreciate them, so feel free to post them!

4. ### t_n_k AAC Fanatic!

Mar 6, 2009
5,448
783

So if Vcc=5V you have a range of 2.26V to 3.98V

Perhaps you should re-jig that part of the circuit first.

The notional comparator hysteresis voltages wil be

(Voh-Vol)*R14/(R42+R14)

or

(Voh-Vol)*R15/(R43+R15)

Where Voh is the high output voltage and Vol is the low output voltage for the op amp.

With the LM324 op-amp powered between 0V and +12V the likely values would be of the order Voh=10.5V and Vol=1.5V

You require a hysteresis of 0.3V so

(Voh-Vol)*R14/(R14+R42)=0.3

9*R14/(R14+R42)=0.3

R42=(8.7/0.3)*R14=29*R14

If R14=6k2 with R42=180k you have some preferred values.

Edit:

I checked the LM324 data sheet. It seems Vol=0V. So that would change the aforementioned calculations somewhat.

Namely, R42=34*R14.

With R14=2.2k, R42=75k is a possible selection. Or R14=22k & R42=750k.

Last edited: Nov 20, 2010
5. ### eblc1388 Senior Member

Nov 28, 2008
1,542
102
Your current circuit will NOT do that, because of the diode AND gate at the opamp outputs. Both opamps need to NOT operate(high) at either ends of the voltage range for this to happen and so it won't.

However, it will do the reverse of setting REG to LOW just fine if the voltage X goes out of range.

A quick simulation proves the circuit will give that result with roughly the hysteresis you required.

I have left out the two fixed resistors(R10 & R13 in your original circuit) for the 5K variable resistors or else the Hi/Low trip settings adjustment will interact with each other.

File size:
30 KB
Views:
246