# 1st time designing with logic chips. Check my idea?

#### jacmac

Joined Nov 24, 2023
6
The purpose of the circuit is to lock out switch B when switch A is on, and indicate that a lock out situation exists by "flashing" the LED of switch A when B is pressed.

The switches are, and need to be, momentary types. The relays are, and need to be, non latching types.

I know VERY little about logic chips, so YES, I have no idea if there is a smarter way to do this with different gates or whatever. I played with circuit verse's simulator and the "chips" they offered until I found one (DFF) that would latch and flip the way I wanted.

Trying the simulation for yourself would be best, but I will try to describe it here:

SWITCH A is a switch that can be turned on or off without consequence to the device that this will go into. i.e. it won't hurt nothin.
SWITCH B, however, will do bad things if it is switched when A is on.

Turning A ON will lock B to whichever state it is currently in, ON or OFF.
If one tries to switch B when A is on, the the LED for A will "FLASH" with each press of B to indicate there is a lock situation.
To solve the lock out "ERROR" one just turns A off, switches B to what they want, and then is free to turn A back on.

I hope this makes sense.

There are many ways to solve this, and yes, I have dreamed up mechanical ones with just relays(although not yet with the flashing LED idea.)

This is a bit academic now, as I would love to learn about LOGIC chips. I find this world fascinating.

#### Attachments

• 312.7 KB Views: 19

#### Ian0

Joined Aug 7, 2020
9,531
You really need to say which device you used in the simulation.
"DFF" gives me a clue that it was a D-type flip-flop, but there are dozens to choose from. 4013 and 7474 are popular types, but they operate in different ways.
One thing you will need is a switch-debounce circuit. https://www.nuvation.com/resources/article/switch-debouncing-electronic-product-designs
Apart from that - you seem to be heading in the right direction.

#### Irving

Joined Jan 30, 2016
3,813
If switches A & B are momentary then the statement " turns A off, switches B to what they want, and then is free to turn A back on. " is meaningless as A & B are either Pressed or NotPressed, ON & OFF are generally states assigned to a toggle switch, but here I think you mean to assign them to Relay_A and Relay_B not to the switches. Having said that, your circuit works as intended...

Or does it? There is a possible unintentional 'side effect'. if B is held pressed then subsequent presses of A also toggle Relay_B, meaning B can be ON when A is on...

#### jacmac

Joined Nov 24, 2023
6
The simulator (circuit verse) didn't say what kind of D Flip Flop is was, but I think I would want a 4013 as the ability to use 12Vdc as the power rail is desirable for me.

One thing I'm not sure of, in my schematic, are my SET and RESEST pins etc, being activated or not? I know they are being held low, but as I understand it, that is activated on a 4013 and not say on a 7474.

#### jacmac

Joined Nov 24, 2023
6
I simulated B being held high and found that error as well. jeeeeez how does one force a chip to listen to one and only one pulse?

#### Irving

Joined Jan 30, 2016
3,813
The simulator (circuit verse) didn't say what kind of D Flip Flop is was, but I think I would want a 4013 as the ability to use 12Vdc as the power rail is desirable for me.

One thing I'm not sure of, in my schematic, are my SET and RESEST pins etc, being activated or not? I know they are being held low, but as I understand it, that is activated on a 4013 and not say on a 7474.
On a 4013, set and reset are active high, tie them to ground if not used....

I simulated B being held high and found that error as well. jeeeeez how does one force a chip to listen to one and only one pulse?
You need to be more precise about your relative timing of Relay_A and Relay_B. You originally stated that " SWITCH B, however, will do bad things if it is switched when A is on. ", which I think referred to Relay outputs not the push buttons, but your original circuit didn't stop Relay_B being on when Relay_A was on.. I took it to mean that Relay_B shouldn't change state when Relay_A was on. Is that what you meant?

Try drawing some timing diagrams for Relay_A and Relay_B showing what's allowed and also what's not allowed...

#### jacmac

Joined Nov 24, 2023
6
Okay, I've added a scheme to lock out A when B is held down. Does this work?

#### Attachments

• 261.6 KB Views: 4

#### Irving

Joined Jan 30, 2016
3,813
Not really, it just makes A and B behave similarly... Now button B can toggle Relay_A and can lock out both buttons so nothing can change...

As I said, define your required outcomes fully... both in terms of steady state and when transitions can occur. eg if Relay_A and Relay_B can never be on simultaneously the following table is true:

#### Irving

Joined Jan 30, 2016
3,813
If you want to only toggle the relays on a pushbutton transition then you cannot rely on simple logic gates, you need an active component that generates a single pulse from the transition - a monostable - which will also help resolve switch contact bounce.

#### dl324

Joined Mar 30, 2015
16,732
Welcome to AAC!
The purpose of the circuit is to lock out switch B when switch A is on, and indicate that a lock out situation exists by "flashing" the LED of switch A when B is pressed.
Does flashing mean blink continuously until the state changes? If that's the case, a one shot won't do it. You could use a 555 timer configured as an astable.

You show the output of the D flip flops driving relays. Few logic families will be able to sink/source enough current to energize relays (unless you're using solid state relays).

Since you're new, your schematics would look nicer if you removed unnecessary whitespace and wire bends.

#### jjjmac

Joined Sep 25, 2015
1
REALY A and B can be on at the same time. The changing states of B is not allowed when A is on.

#### jacmac

Joined Nov 24, 2023
6
Does flashing mean blink continuously until the state changes? If that's the case, a one shot won't do it. You could use a 555 timer configured as an astable.
No, just once each time B button is pressed when the circuit is in the lockout condition.

#### dl324

Joined Mar 30, 2015
16,732
No, just once each time B button is pressed when the circuit is in the lockout condition.
You could use a Schmitt inverter with a resistor and capacitor, and another gate to buffer the one shot.

Here are some I designed using Schmitt inverters:

You'll need several inverters and maybe an extra cap or diode.

Last edited:

#### Irving

Joined Jan 30, 2016
3,813
Or use a purpose built monostable IC... Here's an example that locks out changes to Relay_B when Relay_A is ON, and has no side effect when B is held on and Relay_A goes off.

I've also shown the easiest way to drive the relays, using a couple of discrete MOSFETs.

#### Attachments

• 121.2 KB Views: 6
Last edited: