Relay is one of the most interesting and important components. Relays are switches that open and close circuits when actuated when an electrical signal. Because relays are the link between the low power digital electronics and high power devices. It allows digital circuits and digital microcontrollers to high power devices on and off. Simply, it is used to on/off power circuits using microcontrollers. Relays operate with AC or DC at common voltages like 12V, 24V, 48V, 120V and 230V. Relays can control currents ranging from 2A – 30A. When the switch is closed, the circuit is closed – or on. When the switch is opened, the circuit is open – or off. When a switch can be actuated with an electrical signal, the device is then typically referred to as a relay. The actuation of the relay will change the state of the contacts from open to closed or vice verses, depending on the contact configuration. We will look into the details of relay working, types and relay Interfacing with 8051 in this article.
The major use of relay started during the invention of telephones. Relay act as an important role in switching calls in a telephone exchange. They were used to switch the signal coming from one source to another destination. After the invention of computers, they were also used to perform Boolean and other logical operations. Relays are also used in our day to day devices like Refrigerators, Washing Machines, Heaters, and Air Conditioning.
Relays are mainly used for two basic operations. One is a low voltage application and the other is high voltage. For low voltage applications, more preference will be given to reduce the noise of the whole circuit. For high voltage applications, they are mainly designed to reduce a phenomenon called arcing.
A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron core, an iron yoke which provides a low reluctance path for magnetic flux, a movable iron armature, and one or more sets of contacts. The armature is hinged to the yoke and mechanically linked to one or more sets of moving contacts. It is held in place by a spring so that when the relay is de-energized there is an air gap in the magnetic circuit. In this condition, one of the two sets of contacts in the relay pictured is closed, and the other set is open. Other relays may have more or fewer sets of contacts depending on their function.
When an electric current is passed through the coil it generates a magnetic field that activates the armature, and the consequent movement of the movable contact either makes or breaks a connection with a fixed contact. If the set of contact was closed when the relay was de-energized, then the movement opens and breaks the connection, and vice versa if the contact were open. When the current to the coil is switched off, the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually, this force is provided by a spring, but gravity is also used as commonly in industrial motor starters.
When the coil is energized with direct current, a diode is often placed across the coil to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a voltage spike dangerous to semiconductor circuit components.
An electromechanical relay consists of three terminals namely common (COM), normally closed (NC) and normally opened (NO) contacts. These can either get opened or closed when the relay is in operation.
When the relay is not energized then the Normally Closed(NC) and Common will be connected. If it is energized (it means the current is passed), Normally Open(NO) and Common will be connected.
Single Pole Single Throw(SPST): The SPST is the simplest configuration that has only two configurations. It has a total of four terminals. Out of these two terminals can be connected or disconnected. The other two terminals are needed for the coil to be connected.
Single Pole Double Throw(SPDT): It has three contacts. SPDT relay has a total of five terminals. Out of these two are the coil terminals. A common terminal is also included which connects to either of two others.
Double Pole Single Throw(DPST): The DPST relay has a total of six terminals. These terminals are further divided into two pairs. Thus they can act as two SPST’s which are actuated by a single coil. Out of the six terminals, two of them are coil terminals.
Double Pole Double Throw(DPDT): The DPDT relay is the biggest of all. It has mainly eight relay terminals. Out of these two rows are designed to change over terminals. They are designed to act as two SPDT relays which are actuated by a single coil.
Polarized Relay
Non-Polarized Relay
Here we have to write the firmware for interfacing relay with 8051. Relay is connected to PORT 3 and change the relay position to ON and OFF condition.
Now, reg51.h is the header file used in the Embedded C coding of the micro-controller based on 8051 architecture.
#include<reg51.h> //header file
The sbit type defines a bit within a special function register (SFR). Here, we have to initialize the port. The relay_pin indicates the name of the SFR bit. Port 3 is the base address and ‘0’ indicates the bit position to access.
sbit relay_pin = P3^0; //port declaration
The delay function that should give the delay in a millisecond. This function is used to provide a delay while the relay works.
void Delay(int k) { int j; int i; for(i=0;i<k;i++) { for(j=0;j<100;j++); } }
Initially, the relay is in ON condition and provide a 1-sec delay. After that, the relay is OFF and again provide a 1-sec delay. Repeat this block of code, until a condition is met.
while(1) //infinite loop { relay_pin = 0; //Relay ON Delay(1000); //1 sec delay relay_pin = 1; //Relay OFF Delay(1000); //1 sec delay }
Here we are using transistor which is wired as a switch for Interfacing relay with 8051. This transistor which drives the relay. The transistor will be in OFF state when the pin P3.0 is in the LOW state. When 1 is written to P3.0 current will flow to the base of the transistor and the relay energizes.
[fusion_global id=”18383″]