Relais

Electro-Mechanical Switch Using A Magnetic Field To Separate Circuits

A relais is the ubiquous low cost solution to switching large currents or high voltages, and separating the control circuit from the load circuit.

Basic Principle

All electromechanical relais work the same:

  • Control Circuit: A control circuit is connected to a coil. When electrical power is applied to the coil, it produces a magnetic field.
  • Load Circuit: A (separate) load circuit is placed in close proximity of the coil and uses an iron (or elsehow magnetic) latch. The magnetic field produced by the coil can move the latch physically, thus opening or closing the load circuit.

Advantages

The relais design is cheap, well-proven for many decades, and versatile:

Depending on construction and materials, a relais can be small, or it can switch huge loads. It can be normally open or normally closed, or both.

Disadvantages

In electronic projects, a mechanical relais is problematic primarily because of this:

  • High Power Consumption: The current required for the coil to produce a magnetic field strong enough to operate the latch is comparably high. In car electric, it does not matter whether a relais requires 100-200mA of current just to stay in the on state. In electronics, this is a huge current that cannot be handled by microcontroller GPIO. In addition, a battery-operated device would soon deplete its batteries just by operating the relais.
  • Dangerous Voltage Spikes: When a relais switches from on to off, the magnetic field produced by the coil collapses and induces a momentary spike of high voltage. In simple car electric, this spike does not harm. It can easily destroy sensitive electronics, though.

When using electromechanical relais, motors, or anything else with coils that can produce magnetic fields in sensitive electronics projects, always make sure to use a freewheeling or flyback diode: this is a regular diode that is connected anti-parallel to safely take care of the energy of the collapsing magnetic field: the diode enables the energy to circulate inside the coil, thus prolonging the time it takes for the magnetic field to collapse and protecting the rest of the circuit from unwanted energy spikes.

Controlling Relais

Discrete Solutions

Relais can control powerful loads by using tiny switches or buttons:

Since the control circuit requires only relatively low voltage and current, and since the load circuit is separated from the control circuit, it is sufficient for a switch to be capable of handling only low voltage and current of a few hundred milliamperes.

This is how relais are used in cars: when you turn on the (powerful) head lights with a tiny switch on your dashboard, the switch really only operates a relais. The relais in turn controls the large currents required by the head lamps.

Microcontrollers and Electronics

In microcontroller-based solutions or when using sensitive ICs, even a relais often requires too much current to be operated directly by a GPIO.

This is why transistors are used to amplify the current. Breakout boards with relais, flyback diode and amplifying transistor are readily available for low money.

Remote Control

Relais are often used to remotely control devices over the air. In this scenario, the relais is combined with a receiver:

  • Radio Frequency (RF): Most cost-effective classic remote control solutions use license free radio bands, i.e. 315MHz** (US) or *433MHz (Europe). When the RF signal is picked up by the receiver, it turns the relais on or off.
  • WiFi: With the increasing popularity of home WiFi networks, a relais can also be controlled by WiFi signals. In this case, the relais is connected to a WiFi-enabled microcontroller (such as a cheap ESP8266). This microcontroller can connect to the home WiFi. Instead of using dedicated senders or remote controls, the control signal comes from a smartphone app (and often involves intransparent cloud solutions operated by the vendor).
  • Light: Less common is the use of infrared light (IR) that can also be used to transmit a control signal. Since light needs a free line of sight between sender and receiver, this only works for limited use cases.

WiFi-Controlled Devices

WiFi solutions work very similar to RF solutions and in fact both use radio frequencies.

Whereas RF solutions typically use 315/433MHz, WiFi uses 2.4GHz and can benefit from the potentially wide coverage of your home WiFi network.

The fundamental difference is how control signals are processed:

  • RF: You Are In Control: With RF, there are distinct senders and receivers that directly communicate and that you control.

  • WiFi: Vendor Is In Control: With WiFi (at least with prefabricated switches and remote control solutions), the digital control signals are beyond your control and often involve proprietary cloud processing and non-public encryption keys, controlled alone by the vendor architecture.

Security

WiFi solutions are convenient and flexible in normal times.

Once SHTF, they can quickly become insecure and fragile: should the vendor architecture go offline or fail, so does your remote control architecture. All of your remote switches can be operated by anyone in control of the vendor architecture.

As part of your planning, always consider what you want to remote control, and how critical this is for you and your safety: how would it affect you if someone else starts remote controlling? Turning on and off the lights in the living room probably has a low risk assessment, especially if you can still use regular switches, too. Opening your garage door or turning on the oven may have much more security implications.

Slow Website?

This website is very fast, and pages should appear instantly. If this site is slow for you, then your routing may be messed up, and this issue does not only affect done.land, but potentially a few other websites and downloads as well. Here are simple steps to speed up your Internet experience and fix issues with slow websites and downloads..

Comments

Please do leave comments below. I am using utteran.ce, an open-source and ad-free light-weight commenting system.

Here is how your comments are stored

Whenever you leave a comment, a new github issue is created on your behalf.

  • All comments become trackable issues in the Github Issues section, and I (and you) can follow up on them.

  • There is no third-party provider, no disrupting ads, and everything remains transparent inside github.

Github Users Yes, Spammers No

To keep spammers out and comments attributable, all you do is log in using your (free) github account and grant utteranc.es the permission to submit issues on your behalf.

If you don’t have a github account yet, go get yourself one - it’s free and simple.

If for any reason you do not feel comfortable with letting the commenting system submit issues for you, then visit Github Issues directly, i.e. by clicking the red button Submit Issue at the bottom of each page, and submit your issue manually. You control everything.

Discussions

For chit-chat and quick questions, feel free to visit and participate in Discussions. They work much like classic forums or bulletin boards. Just keep in mind: your valued input isn’t equally well trackable there.

  Show on Github    Submit Issue

(content created Apr 29, 2024)