Relay is an electrical switch. It opens and closes under control of electric curent applied. The switch is operated by an electromagnet to open or close sets of contacts. When a current flows through the coil, the generated magnetic field attracts an armature, mechanically linked to a moving contact. The movement either makes or breaks a connection with a fixed contact.
The contacts are either Normally Open (NO), Normally Closed (NC), or Double Throw (also known as "Form C" or change-over (CO)) contacts.
Most relays are manufactured to operate quickly. In order to reduce noise in a low voltage application, and to reduce arcing in high voltage or high current application.
In the AND gate circuit, both relays, in series with their own switch buttons are placed (in parallel) independently from each other, yet connected to the same source. The lamp (output) circuit is also connected to the same source. However, the lamp is connected in series with NORMALY OPEN contact of relay A, then in series with NORMALY open contacts of relay B. So the lamp will light up only if … both contacts will be closed. And it will happen only if both relays be activated.
In the OR gate circuit, both relays, in series with their own switch buttons are placed (in parallel) independently from each other, yet connected to the same source. The lamp (output) circuit is also connected to the same source. However, the lamp is connected in series with NORMALY OPEN contact of relay A, parallel to the contactsof relay A the normally open contact of relay B is placed. So the lamp will light up only if either contact of relay A or the contact of relay B will be closed. And it will happen if any one of relays be activated.
In the NAND gate circuit, both relays, in series with their own switch buttons are placed (in parallel) independently from each other, yet connected to the same source. The lamp (output) circuit is also connected to the same source. However, the lamp is connected in series with NORMALY CLOSE contact of relay A, parallel to the contacts of relay A the normally closed contact of relay B is placed. So the lamp will light up only if either contact of relay A or the contact of relay B will be closed. And it will happen if either NONE or just ONE of relays be activated. But not the both, when both normally closed contacts will be open.
In the NOR gate circuit, both relays, in series with their own switch buttons are placed (in parallel) independently from each other, yet connected to the same source. The lamp (output) circuit is also connected to the same source. However, the lamp is connected in series with NORMALY CLOSED contact of relay A, then in series with NORMALY closed contacts of relay B. So the lamp will light up only if … both contacts will be closed. And it will happen only if NONE of the relays be activated. If some of the relays be activated, it will open the normally closed contacts which comprise the serial circuit with a LAMP (output) so the entire circuit will be open, and the lamp will not light up.
In the XOR gate circuit, both relays, in series with their own switch buttons are placed (in parallel) independently from each other, yet connected to the same source. The lamp (output) circuit is also connected to the same source.
The contact arrangement is more complex if compared with previous ones. XOR gate outputs 1 if either one of the inputs is one, but NOT THE BOTH. So, speaking in other words, XOR’s output is 0 if both inputs are the same. XOR’s output is 1 if the inputs are different. In our circuit it is achieved by the below-described structure, in series with a lamp:
Two parallel chains of contacts, where in a first chain the Normally Open contact of relay A is in series with Normally Closed contact of relay B; and in the second chain, the Normally Closed contact of Relay A is in series with Normally open contact of relay B
So, if relay A is activated its contact in upper chain will be closed and its contact in lower chain will be open. And if relay B is not activated its contact in upper chain is closed and in lower is open. It provides a normal conductivity for a lamp to light up.
If relay B is activated, its normally open contact in a second chain will be closed, and normally closed contacts of relay A will be closed (relay A is not activated) and the circuit will work.
If both relays will be activated, the chains will look like this “closed-open” “open-closed” -- neither one provides conductivity and the lamp will not light up.
Fast to energize, and slow to de-energize
A capacitor, placed in parallel with relay, acts as a conductor when a voltage is supplied to it. With a passage of time, it becomes charged, and when a voltage on its plates build up as high as relay activation voltage – the relay will pull in. Deenergizing the circuit, the some charge will be still left in the capacitor. When it will discharge through the resistance of the relay coil, and a voltage across its plates will drop below the relay drop-out voltage, the relay will drop out.
Parallel to relay there is an RC (resistor-capacitor) chain. When the circuit is energized, the voltage across relay coil is a power voltage. Since relay coil is connected directly to the power source (yet parallel with an RC chain) the voltage across it is the same as a power voltage. However, the voltage in RC chain varies (across Capacitor vs. across resistor) When the circuit is de-energized, the capacitor discharges through the resistance of a resistor in series with the resistance of a coil. It takes time for the voltage to drop from a power voltage to the drop out voltage of the relay.
When a power is suddenly connected to the coil of relay, the current is built up in the coil. The votage in the coil is a Delta I / Delta t … Delta t (change of time) is small, so the big voltage may arise, destroying the relay. So, we need to couple a resistor with relay. In our circuit, the resistor is placed across the normally closed contacts of relay. When the relay is activated they open, “replacing a conductor by a resistor” and all the induction current will be dissipated through this resistor.
When a relay coil is de-energized, its electromagnetic field collapses, which induces a brief voltage spike into the coil's wire. This voltage can damage connected components in the circuit. So in order to suppress it, a diode is placed across the relay such that it will conduct current in direction of the spike, effectively short-circuiting the coil in the reverse direction. The energy in the spike is thus converted to heat by the internal resistance of the diode, and dissipated.