# window comparator question

Apr 30, 2009
27
0
HI,
I need to implement voltage limits -and relay action- when a valve feedback pot voltage iswithin those limits.A window comparator seems to be the answer, but since the pot is to be connected to 0-5 V on the motor driver feedback input, I cannot get how could this be done.

2. ### mik3 Senior Member

Feb 4, 2008
4,846
63
Can you explain a bit better.

3. ### JDT Well-Known Member

Feb 12, 2009
658
85
Here's a simple circuit (attached).

The relay is OFF when the voltage is between Vmax and Vmin.

Set the valves of R1, R2 and R3 to get the limits you want.

File size:
11 KB
Views:
58
4. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
JDT,
That'll work, but the output sink current for the 393 comparator will prove excessive. If you try to sink more than around 8mA current, you'll tend to overheat the IC.

This driver circuit will take care of that problem:

R1 keeps Q1 turned off when neither 393 output is sinking current.
R2 limits Q1's base current and the 393's sink current to roughly 8mA.
Q1's collector will be able to source at least 80mA, enough for a relay with a coil as low as 150 Ohms.

• ###### 12v 393 relay driver.PNG
File size:
7.5 KB
Views:
115

Apr 30, 2009
27
0
I´ll look into your circuit JDT,as it seems to be what I need.
I will explain better mik3: A feedback pot is linked to a fluid valve shaft.
This pot is connected to a motor driver board through its analog feedback input (gnd-wiper-5V).What I need is to set upper and lower limits to the shaft movement so that a relay is triggered when out of this limits range.
Every window comparator uses a voltage that is compared to Vrefs high and low(limits).
Now, how this can be implemented since the voltage that the pot gives is "busy"
with the motor driver feedback input?
I ´m sure there is something very basic I can´t get.

6. ### BMorse AAC Fanatic!

Sep 26, 2009
2,675
234
You can try a similar circuit as what I have here....
You will just have to remove the voltage dividing resistors (R5,R6 3.3K) and take your input right from the wiper of your pot, I use this circuit to monitor a voltage and have a high and low trip points set. You can probably eliminate the 560 ohm Resistors and LED's as you will not need them in your application.

7. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
So the pot shaft is driven by the motor.

You should tell us what voltage levels correspond to the upper and lower limits you need.
The upper and lower limits can be set in JDT's schematic by adjusting the values of R1, R2, and R3.

The current through the three resistors in the divider network should be around 1mA, so roughly 12k total.
[eta]
If you want the thresholds to be adjustable, just use a couple of 10k potentiometers across +5v and ground.

Last edited: Sep 29, 2009

Apr 30, 2009
27
0
Yes, the pot is driven by the motor reduction shaft.
Regarding limits I would prefer the maximum usable range I can get from the 0-5V swing, changing R1 and R3 with trimpots- leaving R2 fixed¿?, and taking
R1+R2+R3 around 12K total as SgtWookie suggests.
BMorse´s circuit looks great too,thanks.

Apr 30, 2009
27
0
Sorry,I didn´t see your last line SgtWookie, you mean just using only these two 10K pots for the references instead of the three resistors string ?

10. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
OK, see the attached.

R3 thru R6 replace the R1 thru R3 in the original schematic.
R6 and R3 are necessary to make the maximum voltage on R4 and R5 around 5v.

You can adjust R4 and R5 to any window thresholds that you wish from 0v to 5v. Note that if the threshold voltages overlap, the relay coil will always be energized; ie: the threshold on the non-inverting "+" input must be higher than the threshold on the inverting "-" input.

Vcc is 12v. If you change Vcc to another voltage, R6 and R3 will have to have their values changed.

It would be a good idea to use small capacitors (perhaps 10nF to 47nF, or 0.01uF to 0.047uF) from the wipers of R5 and R4 to ground, and also one on the output of your motor-controlled pot. This will help to keep noise under control.

The green trace on the simulated O'scope (bottom) shows the voltage at the comparator's output (D). When the voltage is low, the relay coil is energized; when high it is not energized.

Cyan (B) and yellow (C) show the high and low thresholds, respectively.
Violet (A) shows a simulated sweep of your motor-driven pots' output from 0v to 5v. As you can see, when the pots' output is outside of the thresholds, the relay is energized.

There is no hysteresis in this circuit. There may be some relay chatter during operation right at the thresholds.

• ###### LM393 window relay driver.PNG
File size:
59.1 KB
Views:
42
Last edited: Sep 29, 2009

Apr 30, 2009
27
0
Thanks SgtWookie!
Everything shows really clear to me.
You rule!

12. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
That's originally what I said, but after further consideration I changed my mind.

JDT's original schematic had R1 thru R3 across a 12v supply. To get 1mA current through that network would require a total resistance of 12k.

The schematic I posted will give nearly the same current through the divider using a 5k pot and a 6.8k fixed resistor.

If you are going to use 5v for the pot supply, then you would not use the 6.8k fixed resistors, only the 5k pots.

The voltage supply for the comparators must be between 7v to 18v or so. If you use less than 7v, the comparator may not be able to respond to a high threshold setting; ie: it can't sense within about 1.5v of Vcc.

Apr 30, 2009
27
0
Thanks again for all this helpful information.
I realized reading my initial post that my biggest concern was if
any external circuit (in this case the comparator circuit) connected to the feedback pot and at the same time connected to the motor driver feedback input- could damage or at least
alter the internal circuitry of the motor driver.But as I see this is not the case.

Apr 30, 2009
27
0
15. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
That circuit requires a dual rail supply.
I think the HA4905 comparators are obsolete. The replacements are expensive. An HA1-4905-5 is around \$17 at Newark.

The HA2841 is obsolete. I can't find a known-good supplier that stocks it.

I'm on my way out of town for several days. Perhaps someone else has time to look at it.

Last edited: Sep 29, 2009
16. ### BMorse AAC Fanatic!

Sep 26, 2009
2,675
234
Yeah that's why on my circuit I showed it with a 7808 which is a +8 volt regulator... your circuit is more of what he already has going anyways, with mine he would have to start all over.......

Oct 6, 2009
5
0