How does a relay work?

Placed on
Relay 5V Relay 5V

What is a Relay?

A relay is an electromagnet-operated switch that can open or close any number of switch contacts.

With a relatively small voltage, a relay can therefore switch a (much) larger voltage. Relays are used, for example, to operate a large electrical device with a micro switch. Namely, the microswitch only needs to carry the current and voltage to the coil, not the large current for the switched device. As a result, the high (and possibly dangerous) voltage never reaches the switch.
Schedule relay Schedule relay

How does a relay work?

The most important part of a relay is the coil, which creates an electromagnetic field when voltage is applied to it. This turns the relay into a switch.

The electromagnetic field makes the iron core in the coil magnetic, which attracts the metal switch towards itself.

This causes the switch (connected to a 'common' terminal) to connect to one of the contacts.

When the voltage is removed again, the switch springs back to the initial contact.

How do I use a relay?

Relays are available as ready-to-use modules; a print with relays and supporting electronics that can be used immediately. When a relay has to be integrated into your own project, a separate relay is in some cases a better choice. The following points should still be taken into account:
  • A relay can easily ask for around 50mA, a lot of I/O is limited to 20mA, so a transistor to control the relay is desirable.
  • A diode in parallel with the relay is important to dissipate the excess current when the relay is turned off. A coil holds current, which flows back into the circuit after the relay has been switched off.
Relay example Relay example
A relay is a must for switching electronics that require more current or voltage than the microcontroller can supply. It also saves dangerous situations by keeping circuits separated from each other. To completely shield it, an optocoupler can be used.
5V Relay 10A5V Relay with a switching capacity of 10A. By means of a relay, a circuit with much more power (10A, 250VAC) can be switched with a relatively small current. In stock € 1,95
Relay module 5V5V Relay module with optocoupler for safe control of high voltage devices. Features compact size, easy-to-use interface, handles up to 10A, plug-and-play design, and indicator light for reliable operation. In stock € 2,50
Posted by Website I am interested in electronics, programming and especially the combination between them. For Opencircuit I write blogs in which I explain how electronics and modules work.


The Netherlands Kristien Wentholt
I didn't know what a relay switch was. When the elevator in our apartment complex broke down, a new switch turned out to be necessary. The elevator is working fine again and I now know how it works. Nice!
Placed on 
The Netherlands Tom
Does a 5 volt device also work on a 9 volt relay (and vice versa) or does it only work on a 5 volt relay and if not why doesn't that work, I mean if a relay works as a switch then it just connects interrupted metals together and If they touch each other, current should flow through them or it doesn't work that way.
Placed on 
The Netherlands R. De Graaf
Can relays hum and cause vibrations in a home
Placed on 
Webwinkelkeur Kiyoh Trustpilot Opencircuit