What is a relay?
Relay is just a switch. This switch can be controlled by electrical signals. This electrical signal can be generated by any microcontroller like Arduino or nodemcu (ESP8266). Commonly it has 5 pins. Two Input pins and three out pins.
How to purchase a 5V relay from Amazon India?
5V relay price is only ₹19 per piece
Buy Now: https://www.amazon.in/dp/B0BGP6K32P
How relay switching is working?
The relay coil is working as a temporary magnet when we apply electric signals to coil pins (PIN 1 and PIN 3). Simultaneously it will attract the metal upper part of the relay then the switch is closed. The relay coil is de-energizing when there is an electrical signal the metal part of the relay is going back by spring action.
5V Relay Pinout

PIN 1 – It is a common connection. We can connect to load.
PIN 2, PIN 5 – These two pins are connected to the relay coil. It is helping to energize the coil by the electrical signal.
PIN 4 – NC (Normally closed) This is directly connected to a common pin (PIN 1) without input signal to PIN 2 and PIN 5.
PIN 3 – NO (Normally open) This will connect to the common pin (PIN 1) when we apply a signal to PIN 2 and PIN 5.
5V Relay Simple Circuit

It is a simple 5V Relay circuit. We need to provide 5V or 3.3V to pin to switch on the relay (energize coil). Then the current pass from PIN 1 to PIN 3. The diode (flywheel diode) is helping to protect from over-voltage during the power supply is disconnected.
