Relay logic help

panic mode

Joined Oct 10, 2011
5,000
I like ladder. it is simple and easy to follow. so without skimping on relays, one can just do it all in steps and make sure that glitches are removed.
this variant should be a school example of doing this exercise. K3 and K4 are interlocked and only on one at a time - and only while button is pressed.
This allows using them as simple start/stop logic (K5). K2 is used to filter out initial ON state of Lamp2 before button is pressed once. This should be absolutely chatter free regardless of relay switching times.
1728434066943.png
 
Last edited:

eetech00

Joined Jun 8, 2013
4,705
I like ladder. it is simple and easy to follow. so without skimping on relays, one can just do it all in steps and make sure that glitches are removed.
this variant should be a school example of doing this exercise. K3 and K4 are interlocked and only on one at a time - and only while button is pressed.
This allows using them as simple start/stop logic (K5). K2 is used to filter out initial ON state of Lamp2 before button is pressed once. This should be absolutely chatter free regardless of relay switching times.
View attachment 333323
Now show how that's done with 24V AC RELAYS...
 

panic mode

Joined Oct 10, 2011
5,000
don't be distracted by form.... circuit in post #21 is shown in the form of relay ladder diagram.
but it is designed to work with hardwired relays.... and it will also work as ladder logic in a PLC.
the whole point of the redesign was to avoid glitches that relays may not be able to cope with.
for example circuits in posts 13 and 16 could be sensitive (K3 may drop when K1 toggles).

btw, everyone is invited to post their version... did you have implementation in mind that you wish to share?
;)
 
Last edited:

eetech00

Joined Jun 8, 2013
4,705
don't be distracted by form.... circuit in post #21 is shown in the form of relay ladder diagram.
but it is designed to work with hardwired relays.... and it will also work as ladder logic in a PLC.
the whole point of the redesign was to avoid glitches that relays may not be able to cope with.
for example circuits in posts 13 and 16 could be sensitive (K3 may drop when K1 toggles).

btw, everyone is invited to post their version... did you have implementation in mind that you wish to share?
;)
How about implementing your version with AC relays?
 

panic mode

Joined Oct 10, 2011
5,000
the "latch" function seen in logic circuits exists in two forms when using relays:
1. "seal in" option. this matches digital circuits latch exactly. "latch" is retained until circuit is reset or power is lost. circuits are mostly designed to reset when power is restored.
2. "true latch" - using latching relay. this would be equivalent of storing things in flash (state is retained after power cycle).

in case of PLC logic, one would use set/reset coils or latch/unlatch (depending on PLC brand terminology). some PLC products only have certain areas retentive, other memory areas are reset on powerup.

in this example none of the relays are latching type, they all use seal-in contact to maintain state for some time.

an example of "seal in" is with relay K2 in post #21. basically it is an OR circuit...
1728495110010.png
contact K1 is used to energize K2 coil initially... but once K2 is energized, its own contacts change state. one of them is used to form a branch around K1 contact. this way K2 will be stay energized even after K1 is off... for as long as power is applied.
1728493449802.png

in case of K3 for example, trigger is NC contact from K5, that then gets "sealed" by K3 contact. K1 NO and K4 NC are used to enable this only when button is pressed (hence K1 NO) and when K4 is NOT on (hence K4 NC).
in other words, Light 1 request On is only energized when:
- button is pressed, and
- light1 is not on (K5), and
- Light1 off request (K4) is not on.

1728493524472.png

same goes for K4,
Light 1 request OFF is only energized when:
- button is pressed, and
- light1 is already on, and
- Light1 on request (K3) is not on.

1728493814531.png

both K3 and K4 are off (Deenergized when button is not pressed (K1 is off)
they only can be energized one at a time (either K3 or K4) and only when button is pressed and only if the other relays is not already energized. if button is held longer, there is so chatter since relays are wired to maintain their state. when button is released, K1 is off, and both K3 and K4 are off...
the only thing that decides which of the two will be on next time button is pressed - is K5 contact.

finally K5 is simple classic case of start/stop logic that controls the light.
K3 contact is equivalent of a "start" button.
K4 contact is equivalent of a "stop" button.
K5 contact is "seal in" contact so that press on "start button" (K3) does not need to be maintained.

1728494316056.png
the K2 contact is added to prevent initial ON state of the Lamp2. When button is pressed once, K2 is sealed in and stays energized. Only after this lights can turn on.
1728494411952.png
 
Last edited:

panic mode

Joined Oct 10, 2011
5,000
How will you check and latch AC relays (Q and Qbar) such that only one can be energized at a time? (as in a flip flop)

i do not see what this has to do with AC vs DC. relays are energized to move contacts to another state. this works regardless if coils are energized by AC or DC current. relay armature has mass and inertia. so even though with AC coils magnetic flux changes, relay does not have time to switch off on every half-period of the AC. that same inertia is reason why many proposed relay based toggle circuits can work - despite glitches. but nothing stops you from creating glitch free logic.

K5 is the main flip-flop. Q and Q-bar are just contacts of that same relay. and relay can have many contacts. if one needs more contacts, just add another relay - connect coils in parallel and you got the additional contacts.
normally open contact (NO) is equivalent of Q
normally closed contact (NC) is equivalent of Q-bar

now that one has coils and contacts it is possible to create logic.
AND - contacts in series
OR - contacts in parallel
NOT - normally closed contact.
etc.

using those one can build anything... adder, shift register, ALU, memory... entire computers.
https://en.wikichip.org/wiki/relay_computer

btw. silicone, or relays or vacuum tubes or pneumatic valves... are just switching elements. one can use any of them (or anything else) to make computers.
 
Last edited:

Papabravo

Joined Feb 24, 2006
22,083
i do not see what this has to do with AC vs DC. relays are energized to move contacts to another state. this works regardless if coils are energized by AC or DC current. relay armature has mass and inertia. so even though with AC coils magnetic flux changes, relay does not have time to switch off on every half-period of the AC. that same inertia is reason why many proposed relay based toggle circuits can work - despite glitches. but nothing stops you from creating glitch free logic.

K5 is the main flip-fop. Q and Q-bar are just contacts of that same relay. and relay can have many contacts. if one needs more contacts, just add another relay - connect coils in parallel and you got the additional contacts.
normally open contact (NO) is equivalent of Q
normally closed contact (NC) is equivalent of Q-bar

now that one has coils and contacts it is possible to create logic.
AND - contacts in series
OR - contacts in parallel
NOT - normally closed contact.
etc.

using those one can build anything... adder, shift register, ALU, memory... entire computers.
https://en.wikichip.org/wiki/relay_computer

btw. silicone, or relays or vacuum tubes or pneumatic valves... are just switching elements. one can use any of them (or anything else) to make computers.
I think you pretty much nailed it!
 

eetech00

Joined Jun 8, 2013
4,705
i do not see what this has to do with AC vs DC. relays are energized to move contacts to another state. this works regardless if coils are energized by AC or DC current. relay armature has mass and inertia. so even though with AC coils magnetic flux changes, relay does not have time to switch off on every half-period of the AC. that same inertia is reason why many proposed relay based toggle circuits can work - despite glitches. but nothing stops you from creating glitch free logic.

K5 is the main flip-flop. Q and Q-bar are just contacts of that same relay. and relay can have many contacts. if one needs more contacts, just add another relay - connect coils in parallel and you got the additional contacts.
normally open contact (NO) is equivalent of Q
normally closed contact (NC) is equivalent of Q-bar

now that one has coils and contacts it is possible to create logic.
AND - contacts in series
OR - contacts in parallel
NOT - normally closed contact.
etc.

using those one can build anything... adder, shift register, ALU, memory... entire computers.
https://en.wikichip.org/wiki/relay_computer

btw. silicone, or relays or vacuum tubes or pneumatic valves... are just switching elements. one can use any of them (or anything else) to make computers.
Quite an explanation, but you still haven't shown a schematic using AC relays as logic elements.
 
Top