Using Flip Flop or Latch.

Thread Starter

ts2019

Joined Jul 22, 2019
4
Hello Engineers,

First of all, electronics is not my field so I am zero in electronics.

I have a circuit which have two outputs each switching between 0v & +4.45v as per trigger to their inputs . When its 0v on both outputs I want to trigger a 5VDC relay to operate a device. And when its +4.45v on both outputs the relay coil needs to be shut down.

So I thought of using flip flop [may be SR latch, I still don't have any]. I don't know whether I am on right path or not. But as I said electronics is not my field, so more I try to go in detail of flip flops more I am getting confused.

The relay coil is using probably 0.060Amps if I measured it right.

So if anyone could please help me to know what circuit or IC should I use to complete this circuit.

Lots of thanks in advance.
 

AnalogKid

Joined Aug 1, 2013
8,157
This could be a pretty simple circuit plus a relay driver transistor, but first some questions.

What about the two intermediate cases when one output is high and the other is low? What is the relay state then? Should it stay latched in the most recent valid state (either on or off), waiting for the next valid state?

When you say you want to "trigger" the new relay, do you mean activate, as in come on and stay on?

Do you prefer bipolar (TTL, LS, ALS, etc.) or CMOS (CD, HC, AC, etc.) logic types?

Based on the requirements so far, it sounds like a flipflop, a NAND or AND gate to detect one relay state, and a NOR or OR gate to detect the other. Because logic gates always come in groups of the same type, this smells like two chips to get both the NAND and NOR functions. The flipflop can be built with unused gates in either package. Two cheap chips plus one transistor, and a logic trick (DeMorgan's Theorem) can be used to keep both chips the same type even with the different logic functions.

For CMOS logic, look up the datasheets for a CD4093 quad Schmitt trigger NAND gate and a 2N7002 n-channel MOSFET.

ak
 

Thread Starter

ts2019

Joined Jul 22, 2019
4
Thanks everyone for the reply.

And sorry, I forgot to mention that important point.

When output A and output B is 0v the relay will be in off condition.

When output A is +4.45v and output B is 0v the relay is still off.

Now when output A and output B both becomes +4.45v the relay should switch on.

After sometime first output B would become 0v, the relay is still on and when output A also becomes 0v the relay should switch off.

In my first question I have by mistake mentioned the reverse condition of output volt wrt relay working, sorry for that.

I would like to mention again that I have zero knowledge about electronics so doesn't know about cmos, ttl, etc.

Thanks.
 

AnalogKid

Joined Aug 1, 2013
8,157
Here is a first pass at your logic circuit. It looks complicated but it is two simple gate chips emulating other things.

U1A, B, and C form an OR gate. U1C pin 10 goes low when both inputs are low, resetting the flipflop (U2A and B), which makes U2 pin 10 low, which turns off the transistor and the relay.

U1D is a NAND gate. U1D pin 11 goes low when both inputs are high, setting the ff and turning on Q1 and the relay.

U2D is a spare.

R1 and C1 filter any short spikes that might be caused when the inputs change state at <almost> the same time. C3 and C4 are decoupling caps for the two chips; C2 is the decoupling cap for the relay, and should be located near its connection to the circuit.

ak
Relay-Trigger-1.gif
 
Last edited:

AnalogKid

Joined Aug 1, 2013
8,157
The R1-C1 noise filter raises a question, because it is not the perfect solution. There are two input change conditions that can cause a problem:

A B to A B
1 0 -> 0 1
0 1 -> 1 0

In either case there is a possibility or a brief 00 or 11, which might cause the ff to change state depending on which state it is in and which error occurs. SO, can the two inputs change states at the same time? Ever? Asked another way, what is the maximum amount of time between the two changes?

ak
 
Last edited:

AnalogKid

Joined Aug 1, 2013
8,157
Here is an updated version with fewer parts. The three-gate OR function (actually an inverted-input NAND) is replaced with a diode-OR circuit.

ak
Relay-Trigger-2.gif
 

Thread Starter

ts2019

Joined Jul 22, 2019
4
Hello AK,

Are you sure this is going to work? I will try to study your proposed circuit on Sunday. I have to purchase all these things and connect all of them and check if they work or not. If anyone has tried similar circuit in actual or on any software then please let us know.

Meanwhile both the inputs doesn't go high / low simultaneously. There is atleast one minutes time between their switching.

Thanks.
 

AnalogKid

Joined Aug 1, 2013
8,157
1. What is the source of the A and B inputs?

2. Are either of the inputs coming from mechanical switches (limit switch, pushbutton, toggle, whatever)? The issue is whether or not the inputs changes states cleanly, or have a short noise burst.

3. Are you sure that the two inputs never "trade states" as in post #7?

Depending on the answers, R1, C1, and U2C might go away.

4. What are the relay manufacturer and part number?

Where are you located?

ak
 

Thread Starter

ts2019

Joined Jul 22, 2019
4
1. What is the source of the A and B inputs?

2. Are either of the inputs coming from mechanical switches (limit switch, pushbutton, toggle, whatever)? The issue is whether or not the inputs changes states cleanly, or have a short noise burst.

3. Are you sure that the two inputs never "trade states" as in post #7?

Depending on the answers, R1, C1, and U2C might go away.

4. What are the relay manufacturer and part number?

Where are you located?

ak
Hello AK,

Thanks for your continuous help. The inputs for A & B are coming from an IC [its no. not clear]. I am pretty sure that both are not going to change the state simultaneously atleast when they are in continuous working state. But when we power on the circuit, only at that time the voltage on both inputs first goes to 4.45v simultaneously and then they switch to 0v or 4.45v as per signal from IC and all these happens in some milli seconds.

I am from India. The link for relay similar to what I have is here: https://www.dnatechindia.com/5-Volt-SPDT-CUBE-RELAY.html?search=relay

Thanks.
 
Top