How to latch a comparator?

I'm working on a failsafe alarm system monitoring 12 separate normally- closed switches. When a switch is momentarily opens I want it's circuit to latch OPEN until I press a Reset.

I figured out how to have a normally closed switch latch a relay Open but it has 2 problems... 1) The relays are energized all the time so the 12 of them draw almost an Amp (they share a 'common'). 2) The circuit goes "tripped" (open) on power-up. I had to add a 555 circtuit to do a power-up reset.

I'd rather use solid state devices but am not sure the best way to do it. Latches, Flip-Flops, Comparators...?

I'm thinking of sending a couple mA@5V to the switches which then go to ground. When a switch opens the 'signal' line goes high and a comparator flips. The comparator output will throw an analog switch to OPEN. My question is how do I latch this?? Once I get that part I think I can figure out the Reset button.

Reply to
creek
Loading thread data ...

You can use positive feedback (a resistor from the output to the noninverting input) to make a comparator latch. The exact configuration and the resistor values depend on whether you have your 12 alarm switches connected at the positive rail or at ground (..and are they in series? you didn't say), and whether you want your output switch to control your load from the high side or the low side... or maybe it's optional? You really need to go into detail. A diagram of the circuit you use now would help a lot.

Reply to
gearhead

Ideally, use a microcontroller, e.g. a PIC. That involves a one-off expense, namely the cost of the programmer, plus the learning curve. But after that, just about any simple low-speed digital logic circuit is one chip, i.e. a microcontroller.

If you want to do it using discretes, use an S/R (or J/K) flip-flop for the latch. An S/R latch built from 2 NAND gates (for active-low signals) or 2 NOR gates (for active-high signals) is fine.

You don't need comparators if your signals are 0V/5V, although you might want an R-C low-pass filter at the digital end of the wire to filter out any noise on the cables (a stray sub-microsecond pulse won't cause a relay to latch, but it will cause a semiconductor flip-flop to latch).

Reply to
Nobody

Barring either buying a real alarm system, or doing this with a microprocessor, you want to use something called an "RS flip-flop". Check the literature and the web, and keep in mind that many other sorts of flip flops (i.e. the 74xx76) have an RS flip-flop buried inside of them -- look for "asynchronous set and reset".

Condition your signal, and use it to set the flip flop. Then use the flip flop for an analog switch or a relay.

--
http://www.wescottdesign.com
Reply to
Tim Wescott

You can use an SCR in series with each switch. You will need to do a power on reset to turn things on.

  • --+-----------+-----}}------+ | | | | [Circuit 1] [Circuit N] | | | | [Switch 1] [Switch N] | |a |a | _|_ _|_ | \ / Scr 1 \ / Scr N [PB] --- --- | g/|k g/|k | | | | | +---[R]-+-+ | +--}}---+ | | | | | +-- | --+ | | | Gnd ------------+-------------+

Pressing the (normally open) pushbutton will turn on all the scrs and the associated circuits. Opening a switch will turn off the associated scr and circuit, and it will stay off even when the switch closes. All other scrs and circuits will be unaffected - they will remain on, until the switch associated with the scr and circuit transfers. The only common action is the turn on - otherwise the thing acts like N individual circuits. Be aware that, unlike the switch, there is a voltage drop across the SCR.

Ed

Reply to
ehsjr

A 555 can be configured as a latch. It already contains two comparators and a flip-flop with buffered output. Output can source or sink from any input. Output can also be inverted easily. Most relays have both NO and NC contacts in the same package.

Reply to
bw

uoted text -

My attempt at ASCII art for my comparator idea:

5V | > 4.7K < R(latch) > +-----^^^-------+ | | | G---N/C--+--+--|+ | |comparator--+--analog switch 2.5V---|-

More details: The switches are remote and wired with up to 200 feet of 26AWG wire. I think (??) the signal might be

Reply to
creek

text -

--
That\'s a good thing, since it\'ll alert you to the fact that that switch
needs to be cleared before the system is once again properly armed.
Reply to
John Fields

The 555 can be used as a flip flop.

The trigger and Threshold would be like the Set and Reset etc...

formatting link
"

Reply to
Jamie

quoted text -

Here's what I came up with just now. Kind of in a hurry, so if I made any mistakes the mob will chase me with pitchforks (just kidding). You will need a comparator for every switch in this scheme, and wire all the comparator outputs together.

5v | ,----+-+-------, | | | R1 | R2 100k | 10k | reset | | switch | | | R3 | | +---47k---+ | | | | | |\\ | | +--|+\\ | | | | \\ | | | | >--+---out | | | / +----|--|-/ | | |/ R4 R5 100k 100k | | alarm | switch | N/C | | | '--+-' | gnd

Under normal conditions, -in is at 1/2 Vcc, +in is at 2/3 Vcc, and the comparator output is high. An alarm (switch opens) causes -in to go high, pulling the output low; this also pulls +in low, latching the condition. Before hitting the reset switch, you have to find the open alarm switch and close it. Then hitting the reset switch will return the circuit to the normal condition.

Reply to
gearhead

e

de quoted text -

Okay, it's late. The circuit I drew requires a reset switch for each N/C alarm switch. Instead of putting it where I drew it in the circuit above, just put a switch from the comparator outputs, which are all tied together, to Vcc. That's your reset switch, just one instead of a dozen. Still need a dozen comparators, though (three quads). You might want to go with something simpler. There might be some scheme that puts each N/C switch in series with a resistor and then ties the resistors together, and when one of the switches opens you have a circuit that detects the attendant (slight) change in voltage. Probably could do it with a comparator, but it'll have to wait for tomorrow.

Reply to
gearhead

ou

the

Hide quoted text -

e
e

ext -

Ahem, not such a good idea to short the comparator output to Vcc. The reset switch needs a resistor in series with it. Like I said, new try tomorrow.

Reply to
gearhead

e

de quoted text -

This circuit will work with just a single comparator:

5v | ,----+-+-------, | | | R1 | R2 10k | 1k | reset | | switch | | | R3 | | +---8k6---+ | | | | | |\\ | | +--|+\\ | | | | \\ | | | | >--+---out | | | / +----|--|-/ | | |/ | R5 | 10k | | ---120k--+ gnd | . X12 . . | ---120k--'

The gang of 12 120k resistors goes to the nc switches, obviously. Use 1 or 2 percent resistors, or be prepared to bung a couple of extra hundred ohms in one of the voltage dividers to bring you into the operating window. You get a voltage change of about 9 percent on the inverting input when one of the nc switches opens. On the output, you can use a bjt or a small mosfet like a 2N7000 to drive a relay. You don't want to load down the output, however, because you need it set accurately and it has a high impedance, so I suggest using a mosfet. If you use a common-emitter bjt, you will drag the comparator's output toward one of the rails. Emitter follower might work -- but a mosfet is foolproof. Other guys have suggested using flip-flops and other solutions, which may be more in line with conventional practice. But in your original post you asked about comparators. Or... you could just put all the nc switches in series, with a relay, and not use any silicon!

Reply to
gearhead

ou

the

Hide quoted text -

e
e
5V | > 4.7K < R(latch) > +-----^^^-------+ | | | G---N/C--+--+--|+ | |comparator--+--analog switch 2.5V---|-

John Fields... Thanks. I like the latching the NANDs rather than the comparator. My Vsens is connected to Vcc with the 4.7K (to give me 1mA to the switches). With the long thin leads I thought (?) the Vsens might be

Reply to
creek

Oops... Comparator input polarities were reversed and there's no need for series resistors from the NC switches to the inverting inputs of the comparators.

Should be:

.VCC--------------------+-----+----+------------+ . | | | | .VSENS>----+---+----+ | | | | . | | | | | [R] [R] . | [R] [R] | | | | . | | | | | | | . |O-------|---+----|---|----|-\\ | | . |--+---A | . |O--+ | | +---|--+-|+/ NAND Y--+--|--->ALARM1 . | | | | | | | +--B | | . | | [C] [R] | | | | | | . | | | | | | | | A--+ | .GND>-+----|---+--+-+---|--|--+ +--Y NAND | . | | | | B-----+ . | | | | | . | | | | | . . . . . . . . . . . . . . . . . . . | | | | | . | | | | | . | | +--|--+----+ | . | | | | | | . +--+ | | | | | . | | | | [R] | . [R] | | | | | . | | | | | | . |O----------+---|--------|-|-\\ | | . |--+---A | . |O--+ | | +-|+/ NAND Y--+--|--->ALARM12 . | [C] | | +--B | | . | | | | | | | . | | | | | A--+ | . +-------+---+-+---------+ +--Y NAND | . | B-----+---+ . | | | . | | O | . | RESET-->| [C] . | | O | . | | | . +---------------------------+---+

JF

Reply to
John Fields

. | | | | | | | +--B | | . | | [C] [R] | | | | | | . | | | | | | | | A--+ | .GND>-+----|---+--+-+---|--|--+ +--Y NAND | . | | | | B-----+ . | | | | | . | | | | | . . . . . . . . . . . . . . . . . . . | | | | | . | | | | | . | | +--|--+----+ | . | | | | | | . +--+ | | | | | . | | | | [R] | . [R] | | | | | . | | | | | | . |O----------+---|--------|-|-\\ | | . |--+---A | . |O--+ | | +-|+/ NAND Y--+--|--->ALARM12 . | [C] | | +--B | | . | | | | | | | . | | | | | A--+ | . +-------+---+-+---------+ +--Y NAND | . | B-----+---+ . | | | . | | O | . | RESET-->| [C] . | | O | . | | | . +---------------------------+---+

--
>Re. SR Flip Flops and race condition.   Your reply: That\'s a good
>thing, since it\'ll alert you to the fact that that switch needs to be
>cleared before the system is once again properly armed.
>So, if the operator presses the Rest button while a switch is still
>open the corrosponding flip-flop will race but when he releases the
>button everyting will go back to "normal", i.e. still tripped and not
>left in some random state.  Is this correct?
Reply to
John Fields

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.