Relay
A relay is an automatic switch operated by electrical signals, also called an electromagnetic relay.
We press a switch to turn on or off a light hanging from the ceiling.

The basic principle of a relay is the same, except that instead of manually pressing a switch, a relay is an automatic switch that operates with weak electrical signals.
Electrical signals output from controllers such as PCs, Arduino, and Raspberry Pi are weak-intensity direct current (DC) and cannot output alternating current (AC) or large currents. Since these devices serve as the brain, they can only output weak currents at the control signal level for controlling other devices. The voltage and current that can be output from the digital output pins of Arduino and Raspberry Pi are as follows:
- Arduino: DC 5V, max 40mA
- Raspberry Pi: DC 3.3V, max 8mA
Therefore, controllers cannot directly supply current to devices that consume alternating current or high-current direct current, and instead control them indirectly by turning relay switches on or off using weak-intensity current.
Relays can be broadly classified into contact-type and contactless-type, with the contactless type called SSR (Solid State Relay).


Below is a diagram showing the structure of a contact relay. The basic principle is the same as that of an electromagnet: when a weak current flows through the coil, the contacts close due to magnetic force, and when no current flows, the contacts open due to the spring. It is called a mechanical or contact relay because these closing and opening contacts (contact points) exist.
On the other hand, contactless relays (SSR) have no mechanical moving parts and switch electronically using semiconductors. They have the advantages of faster switching speed and longer lifespan compared to contact-type relays, but are relatively more expensive.