What is Relay?
A relay is just a simple switch with combination of an electromagnet use to change the state of switch. As other switches come into types like SPST, SPDT, DPDT etc, in the same way relay has types like these switches.
Moreover as they have electromagnet/current carrying coil inside with the addition of simple switch that’s why its rating contains two types. One rating shows the minimum threshold voltage at which coil gets energized and other rating shows the highest value of current and voltage that relay can bear.
If something like this is written on the relay:
DC 6V 110VDC / 220VAC 5A
It means its coil gets energized by applying 5 Volts on the terminals of coils. And you can apply 220V AC or 110V DC on the terminals of switch and that switch can bear 5 Ampere of load.
To Buy a Cheap 4 channel Relay Module Click on the image below:
Principle of Relay action:
A relay works on the principle of Biot Savart’s law. According to Biot Savart's Law, magnetic field produce around the current carrying wire will be directly proportional to that current.
Internal Components of a Relay:
This is low voltage side of relay having a yellow coil which needs 5 Volts to energize it. Small silver plate inside circle is in fact the connections that are going to the low voltage side terminals (which got broken during opening the relay and not present in the circle). In the unbroken relay this silver plate connects with the yellow color coil. Current rating of these "coil terminals" are normally 5-50 mili Amps.
This is high voltage side of relay having 6 terminals which are responsible to perform the connection and disconnection of the load. Basically these 6 "high side terminals" can control 2 loads at a time. It means if controlling of one load is required than only 3 terminals can be used as well. Normally relays have only 3 "high side terminals". Current rating of these "coil terminals" are normally 1-100 Amps
Side Note: To check the status of "high side terminals", apply and disconnect 5V to the "coil terminals" and in both cases check with Digital Multi Meter that which "high side terminals"" are getting short(zero resistance).
This is basically that switch which is controlling the "high side terminals". This switch have three plates out of which two plates ( that are away from the yellow coil) always stick with each other in normal state. When coil gets energize by applying 5 volts, the middle plate connects with the plate near to the coil due to magnetic attraction of the coil. In this way load can be connect/disconnect by using relay.
Relay circuit with Micro-Controller:
Here, the resistor is for the protection of the controlling device to limit the current. Its value varies according to transistor type. Some transistor want more gate current like 10mA to start the transistor action. On the other hand, some transistors want very minor current like 10uA to start the action. So here 1k is enough with BC548. The diode present here is use for avoid back emf action of coil. It force current to flow in one direction in the coil.