relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate a switch, but other operating principles are also used, such as solid-state relays. Relays are used where it is necessary to control a circuit by a separate low-power signal, or where several circuits must be controlled by one signal. [Wikipedia]

Controlling Relay

Controlling relay is like setting a pin HIGH / LOW.

different types of relay modules are available in the market but most widely used relays are Low-level trigger Relays.

Low-level trigger means it is activated at LOW voltage and de-activated at HIGH voltage




Relay have three pins

  • NO (Normally Open)
  • Common
  • NC ( Normally Connected )

When relay is not energized connection is from Com to NC and when it is energized the connection moves from NC to NO and hence we can switch the circuits.

evive 5V Relay circuit Fritzing Diagram



Example code when relay is connected to pin 2 and a low level trigger is used