Wiring Diagram: How Is a Sonoff Smart Switch Connected?
A Sonoff smart switch differs from a regular switch in one fundamental point: it needs three electrical terminals instead of two — the incoming live (L-in), the outgoing live (L-out), and a neutral (N) to power the internal WiFi chip. The diagram below shows the complete connection from the distribution panel to the load, including the wireless control path.
By the Ases Kahraba team — Last updated: March 2026
Quick Answer
Step-by-step Sonoff relay wiring diagram: L-in, L-out, N terminal, MCB, ESP8266 WiFi chip. Works with Google Home, Alexa & Tuya. Egypt smart home installation guide.
Engineering Description of Each Component
MCB — Circuit Breaker
Protects the circuit from overcurrent and short circuits. Use a 10A breaker for lighting and 16A for general use. Installed in the main distribution panel.
L-in Terminal (Live Input)
The live wire from the MCB enters here. This is the module's main power input. Use 1.5mm² cable for lighting or 2.5mm² for general use.
Electromagnetic Relay (inside Sonoff)
Acts as an automated electrical switch that opens and closes. When an ON command is received, the relay connects L-in to L-out so current flows to the load. On an OFF command, they disconnect.
L-out Terminal (Switched Live Output)
The switched live exits here toward the load (lamp/fan/appliance). Only energized when the relay is closed (current flowing). No voltage here when switched off.
N Terminal (Neutral) — Critical
Sonoff needs neutral to power the WiFi chip internally (3.3V DC after internal conversion). Without it, the module won't operate even if live is present. Many older Egyptian homes don't run neutral to switch boxes — this must be solved during rough-in.
ESP8266 — WiFi Chip
The brain of Sonoff. Connects to home WiFi (2.4GHz only — does not support 5GHz). Receives commands from eWeLink cloud servers or locally. Sends control signal to the relay.
Control Path: Cloud → App → Voice
Voice command (Google/Alexa) → Google/Amazon servers → eWeLink Cloud → ESP8266 WiFi → Relay → Load. In Local Mode, the command goes directly from the local network to the ESP without cloud dependency.
Important Engineering Notes
- Verify a neutral wire exists in the switch box before purchasing — without it, no Sonoff or Tuya switch will work.
- Use a dedicated MCB for the circuit, not shared with heavy appliances.
- Do not exceed the module's maximum current — Sonoff Basic: 10A, Sonoff POW: 16A, Sonoff Mini: 10A.
- WiFi network must be 2.4GHz. If your router is dual-band, create a separate SSID for 2.4GHz.
- In old wiring without N at the switch box: the solution is to run a neutral wire with new rough-in, or use a no-neutral variant (Sonoff ZBMINIL2 with Zigbee).
Frequently Asked Questions
Why does Sonoff need a neutral (N) terminal when a regular switch doesn't?
A regular switch only interrupts the live wire — it consumes no power. Sonoff contains an ESP8266 chip that runs continuously to receive WiFi commands, requiring a constant power supply (L + N = 220V AC) converted internally to 3.3V DC. Without N, the chip has no power source.
Can Sonoff be wired without an MCB?
Technically yes, but it should never be done in engineering practice. The circuit breaker protects the cable, module, and load from overcurrent and short circuits. Without one, any fault can cause a fire or permanently damage the module.
What happens if the internet cuts out — does Sonoff stop working?
By default, app and voice commands stop when internet is lost. However, Local Mode can be enabled in the eWeLink app for direct local network control without internet. The relay's last state is preserved regardless.
What is the difference between Sonoff Basic, Mini, and POW?
Basic: easy to install, 10A, for walls and ceilings. Mini: very compact for tight switch boxes, 10A, supports 3-way (two-switch) mode. POW: accurately measures power consumption (watts, amps, volts), 16A, suited for large appliances.
Can Sonoff be used with 3-speed ceiling fans?
Sonoff Basic only controls on/off for fans. To control fan speed you need the Sonoff IFAN04 designed specifically for ceiling fans — it controls 3 speeds and the fan light via WiFi and RF radio commands.
