Wi-Fi Relay: Design, Operating Principle, and Practical Applications

Have you ever wondered how an ordinary light bulb or heater can turn on according to a schedule, respond to voice commands, or even be controlled from the other side of the world? Behind this magic lies a simple yet ingenious device— Wi-Fi relayIt has become a bridge between physical devices and the digital world, allowing any "dumb" technology to be turned into a part smart home without costly equipment replacement.

In this article we will look at How does a Wi-Fi relay work? At the level of electrical circuits and network protocols, we'll discuss the different types of relays (single-channel, multi-channel, and power-measuring), and how to properly connect them to different types of loads—from LED strips to powerful heaters. We'll pay special attention to Hidden risks when working with 220V and typical mistakes made by beginners that lead to relay failure within the first day of operation.

What is a Wi-Fi relay and why is it needed?

Wi-Fi relay is electromechanical or solid-state device, which controls the on/off of an electrical circuit based on a command transmitted over a wireless network. Unlike traditional relays, which require a physical button press or a signal from a controller, Wi-Fi models connect to your router and can receive commands:

  • 📱 From a mobile app (for example, eWeLink For Sonoff or Shelly Cloud)
  • 🗣️ Through voice assistants (Alice, Google Assistant, Amazon Alexa)
  • ⏰ Scheduled (timers, automation scenarios)
  • 🌡️ In response to data from sensors (temperature, motion, lighting)

The main advantage of such relays is versatilityThey can be embedded in:

  • 💡 Lighting (chandeliers, sconces, street lamps)
  • 🔥 Heaters, heated floors, boilers
  • 🌿 Irrigation systems or greenhouse climate control
  • 🚪 Electric locks, gates, barriers

The price of a Wi-Fi relay starts from 500–800 rubles (for the base model, it seems Sonoff Basic), which is several times cheaper than purchasing "smart" appliances. For example, replacing a conventional heater with a Wi-Fi-enabled model will cost 5,000–10,000 rubles, while connecting it via a relay will cost less than 1,000 rubles.

📊 What do you plan to use the Wi-Fi relay for?
Lighting control
Heating automation
Smart watering
Remote control of equipment
Other

Design and operating principle: from signal to click

To understand how a Wi-Fi relay works, let's look at its "anatomy" using a popular model as an example. Sonoff Basic R3Inside the case are three key components:

  1. Wi-Fi module (usually chip based ESP8266 or ESP32) - is responsible for connecting to the network and processing commands.
  2. Microcontroller — controls the operating logic, processes signals from sensors (if any).
  3. Electromagnetic relay - physically closes/opens the circuit under the control of the microcontroller.

The work process can be described in 5 steps:

  1. Your device (smartphone, tablet, smart home server) sends a command via a Wi-Fi router.
  2. The Wi-Fi relay module receives a data packet and decodes it (for example, recognizes the command {"power":"on"}).
  3. The microcontroller checks the command for correctness and, if everything is OK, supplies voltage to the relay coil.
  4. The coil attracts the armature, closing the contacts - the load circuit (light bulb, heater) is closed.
  5. When the shutdown command is given, the process is repeated in reverse order.

An important point: most Wi-Fi relays work on the principle "normally open" contactsThis means that when the device is off, the circuit is open, but when a command is given, it closes. This design is safer, as if a power failure or relay failure occurs, the device will shut off automatically.

What is the difference between a solid state relay and an electromechanical relay?

Solid-state relays (SSRs) have no moving parts—they use semiconductors (thyristors, triacs) for switching. Their advantages include quiet operation, long service life (up to 1 million cycles), and vibration resistance. Disadvantages include sensitivity to overheating, higher cost, and inability to operate with direct current. Electromechanical relays are cheaper and simpler, but wear out faster (100,000–500,000 cycles) and produce a clicking sound when triggered.

Wi-Fi Relay Types: Which One to Choose for Your Needs

All Wi-Fi relays can be classified according to several criteria. Here are the main parameters to consider when choosing:

Characteristic Options Application
Number of channels 1, 2, 4, 8, 16 Single-channel – for a single load (lamp). Multi-channel – for controlling multiple devices (for example, an RGB strip).
Switching type Electromechanical / Solid State (SSR) Electromechanical – for household appliances. SSR – for loads with a high switching frequency (e.g., 3D printers).
Maximum current 10A, 16A, 20A, 30A 10A — for LED lamps. 16A and above — for heaters, pumps, and electric motors.
Supply voltage 5V, 12V, 24V, 220V 220V — for connecting to a socket. 5V/12V — for installation in low-voltage systems (e.g., cars).
Additional functions Power meter, temperature sensor, RGB lighting, local control button Power metering – for monitoring energy consumption. Temperature sensor – for heating automation.

Examples of popular models and their applications:

  • 🔌 Sonoff Basic R3 — basic 10A relay, ideal for lighting and low-power devices.
  • 🌡️ Shelly 2.5 — two-channel relay with power measurement, suitable for controlling heaters.
  • 🚀 Aqara Smart Wall Switch - relay in wall switch format, compatible with Apple HomeKit.
  • 🔋 Wemos D1 Mini + Relay Module — a solution for DIY projects based on ESP8266.
⚠️ Warning: If you plan to drive inductive load (for example, a refrigerator compressor or a pump), select a relay with surge protection (varistor or RC circuit). Otherwise, the relay contacts may "weld" together when turned off.

Wiring diagrams: how to avoid burning out a relay on the first day

Connection errors are the main cause of Wi-Fi relay failure. Let's look at three-phase circuits that cover 90% of household tasks.

1. Connecting a lamp or heater (simple load)

The most common circuit. Here the relay breaks the phase wire (L), and zero (N) goes directly to the load.


220V socket

├───L────┬───[Relay]───┬───Lamp

└───N────┘ └───Lamp

Important: Never disconnect the neutral wire instead of the live wire! This not only violates safety regulations but can also cause the lamp to glow dimly even when turned off (due to stray currents).

2. Motor or pump control (inductive load)

For loads with electric motors (e.g. heating circulation pump) be sure to use diode or varistor to protect against back EMF.


220V socket

├───L────┬───[Relay]───┬───┬───Motor

└───N────┘ └───┴───Motor

└───[Varistor 470V]

3. Connection via an external power source (for low-voltage relays)

If your relay is rated for 5V or 12V, don't connect it directly to 220V! Use a power supply:


Power supply 220V→5V

├───5V────[5V Relay]───┬───Load (e.g. 12V LED strip)

└───GND───────────────┘

The wire cross-section corresponds to the load current (minimum 0.75 mm² for 10A)

The relay is designed for the voltage and current of your network (220V/16A for most household appliances)

The phase wire (L) is connected to the input contact of the relay, not to the output contact

The load does not exceed the maximum power of the relay (e.g. 2200W for 10A)

The relay housing is secured in a dry place, inaccessible to children-->

⚠️ Caution: If you connect the relay to three-phase load (for example, a machine tool or a powerful compressor), use specialized three-phase relays (for example, Sonoff 3CH Pro) or contactors. A single-phase relay in such a circuit will burn out instantly!

Control protocols: MQTT, HTTP, and cloud services

Wi-Fi relays can be controlled in different ways, and the choice of protocol depends on your needs:

Protocol Example of implementation Pros Cons
Cloud (vendor-specific) Application eWeLink For Sonoff Easy setup, remote access from anywhere in the world Dependence on the manufacturer's servers, delays up to 1-2 seconds
HTTP API Sending GET/POST requests to IP relays (for example, http://192.168.1.100/cm?cmnd=Power%20Toggle) Doesn't require a cloud, works in a local network You need to know the IP address of the device, there is no encryption
MQTT Connecting to a broker (eg. Mosquitto) with topics like sonoff/bedroom_lamp/command Minimal delays, support for automation scenarios More difficult to set up, requires a separate server
Voice assistants Integration with Alice, Google Home, Alexa Convenient voice control Limited functionality, cloud dependency

For advanced users, the most flexible option is MQTTIt allows you to:

  • 🔄 Create complex scenarios (for example, "if the temperature drops below 18°C, turn on the heater for 30 minutes").
  • 📊 Log all events (when and by whom the command was issued).
  • 🔒 Encrypt traffic (via TLS).

Example command to turn on a relay via MQTT:

Topic: sonoff/kitchen_light/command

Payload: {"power":"on"}

Common mistakes and how to avoid them

Even experienced users sometimes encounter problems when working with Wi-Fi relays. Here are the most common errors and solutions:

  1. The relay does not connect to Wi-Fi

    Check:

    • 📶 Router signal at the relay installation location (use an app like WiFi Analyzer to check the signal level).
    • 🔒 Network password (relays are sensitive to special characters - try changing the password to a simple Latin one).
    • 🔄 Router operating mode (some relays do not support 5 GHz or WPA3 networks).
  2. The relay clicks, but the load does not turn on.

    Possible reasons:

    • 🔌 Incorrect connection (phase and neutral are reversed).
    • 💡 The load is too small (for example, a 3W LED lamp may not light due to relay leakage current).
    • 🔧 The relay contacts are burnt (check visually or test with a multimeter).
  • The relay is overheating or smells like burning.

    This is a critical situation! Turn off the power immediately and check:

    • 🔥 Load power (if it exceeds the relay rating, replace the relay with a more powerful one).
    • 🔌 Quality of contacts (poorly tightened terminals lead to heating).
    • 🌡️ Ambient temperature (many relays are designed to operate up to 40°C).
    ⚠️ Attention: If your relay starts turn on/off automatically without commands, this may be a sign of:
    • Interference in the electrical network (check grounding).
    • Unstable power supply (use an uninterruptible power supply for critical loads).
    • Hacking the device (update the firmware and change the passwords for Wi-Fi and cloud account).

    Practical examples of application

    Theory is good, but let's look at it real cases, where Wi-Fi relays solve specific problems.

    1. Smart lighting with motion sensor

    Task: Turn on the light in the hallway only when someone passes by, and turn it off after 2 minutes.

    Equipment:

    • 🔌 Sonoff Basic + motion sensor HC-SR501.
    • 💡 LED strip 12V.

    Work scheme:

    1. The motion sensor sends a signal to the GPIO port of the relay (for example, GPIO14).
    2. The relay turns on the light and starts a timer for 120 seconds.
    3. If no movement is detected, the light turns off.

    2. Automation of greenhouse watering

    Task: Water the plants 3 times a day for 5 minutes, but only if the soil moisture is below 40%.

    Equipment:

    • 🌱 Shelly 2.5 (controls the pump).
    • 💧 Soil moisture sensor XL6108.
    • ⏰ Smart home server (Home Assistant or Node-RED).

    Operation logic:

    
    

    IF (time = 08:00 OR 14:00 OR 20:00) AND (soil moisture < 40%)

    Then turn on the pump for 5 minutes.

    3. Remote boiler control

    Task: Turn on the boiler 1 hour before you return home so that the hot water is ready.

    Equipment:

    • 🔥 Aqara Smart Plug (with power measurement).
    • 📱 Application Mi Home or Apple HomeKit.

    Solution: Set up a geofence in the app—when you approach the house within a specified distance, the relay will turn on the boiler automatically.

    FAQ: Answers to Frequently Asked Questions

    Is it possible to control a Wi-Fi relay without the Internet?

    Yes, but with some reservations:

    • 🔄 If the relay supports local control (for example, via HTTP API or MQTT), it will work on your home network without internet access.
    • ☁️ If the relay depends on the manufacturer's cloud (e.g. Tuya firmware), then without the Internet you can only control it through a physical button (if there is one).

    Solution: Flash the relay with alternative firmware (Tasmota, ESPHome), which supports local management.

    What is the maximum power that can be controlled via a Wi-Fi relay?

    It depends on the relay model:

    • 🔌 10A (2200W) - most household relays (Sonoff Basic, Shelly 1).
    • 🔥 16A (3500W) — relay for heaters (Shelly 2.5, Sonoff TH16).
    • 30A+ (6600W+) — industrial relays or contactors with a Wi-Fi module.

    Important: Consider not only the rated power, but also starting current (for example, in a refrigerator it can be 3–5 times higher than the operating temperature).

    Is it possible to use a Wi-Fi relay to control a gas boiler?

    Absolutely not! Wi-Fi relays are not certified for controlling gas equipment. These are:

    • 🚫 Violates safety regulations (risk of gas leakage in case of failure).
    • ⚖️ May result in warranty and insurance claims being denied.

    Alternative: Use certified thermostats with Wi-Fi (for example, Netatmo or Honeywell), which are designed to work with gas boilers.

    How to protect a Wi-Fi relay from hacking?

    Wi-Fi relays are a potential gateway for hackers. Minimum security measures:

    • 🔒 Change the default password of the relay admin panel (for example, in Sonoff by default it is often admin/admin).
    • 🌐 Disable access to the relay from the Internet (close ports 80, 8080, 1883 in the router).
    • 🔄 Update your firmware to the latest version (vulnerabilities are often found in older versions).
    • 🛡️ Use a separate network for smart devices (guest Wi-Fi or VLAN).

    For maximum protection, flash the relay Tasmota and set up control via local MQTT broker with authentication.

    What to do if the Wi-Fi relay does not respond to commands?

    Diagnostic algorithm:

    1. Check the relay power supply (the indicator should be on).
    2. Make sure the relay is connected to Wi-Fi (check the IP address in the router or through the app).
    3. Try controlling the relay through a different method (for example, if the application doesn't work, try the HTTP API).
    4. Reset the relay to factory settings (usually the button Reset held for 5-10 seconds).
    5. If nothing helps, reflash the relay (the firmware may have crashed).