When wiring a Sonoff with switch configurations, the physical wall switch acts as a dry-contact logic input or a direct line interrupt, while the Sonoff's internal electromechanical relay handles the actual load switching. The governing rating for your load is the contact breaking capacity, not just the continuous amp rating printed on the plastic enclosure. Misinterpreting these ratings is the primary cause of welded relay contacts and melted terminal blocks in smart home retrofits.

Mains Voltage Hazard: Any procedure involving the contact side of a Sonoff relay involves line voltage (120V/230V AC). De-energize the circuit at the breaker, lock out the panel, and verify dead with a tested multimeter before touching any screw terminals. Local AHJ regulations may require a licensed electrician for permanent in-wall smart switch installations.

Internal Relay Specs & Load Decision Path

The plastic shell of a Sonoff device displays a single maximum amperage (e.g., '10A' or '16A'). However, the internal electromechanical relay—typically a Hongfa or Omron sealed PCB relay—has distinct ratings based on the physics of the load it is switching. Below is the spec-sheet data for the most common 2026 Sonoff relay modules.

Table 1: Sonoff Internal Electromechanical Relay Specifications
Model Internal Coil Voltage (DC) Continuous Resistive Rating Inductive/Motor Breaking Capacity Terminal Wire Range
Sonoff Basic R4 5V DC 10A @ 250VAC 3A (1/3 derate) 14-20 AWG
Sonoff Mini R4 Extreme 5V DC 16A @ 250VAC 5A (1/3 derate) 14-22 AWG
Sonoff POW Elite 20A 12V DC 20A @ 250VAC 6A (approx 1/3 derate) 12-20 AWG
Sonoff S31 Lite (US) 5V DC 15A @ 120VAC 1/2 HP (approx 6A) N/A (Plug-in)

Which Rating Column Governs Your Load?

The Continuous Resistive Rating only applies to loads where current draw remains perfectly stable after the initial switch-on, such as incandescent bulbs, resistive space heaters, or pure heating elements. If your load contains a transformer, an LED driver, or an electric motor, you must use the Inductive/Motor Breaking Capacity.

Inductive loads suffer from two extremes: inrush current (which can be 6x to 10x the running current for motors) and inductive kickback (voltage spikes when the magnetic field collapses upon switch-off). If you connect a 5A compressor motor to a Sonoff Basic R4, the 10A resistive rating is irrelevant; the 30A inrush will pit the contacts, and the kickback will arc across the opening gap, eventually welding the contacts shut.

Table 2: Load Type Selection Decision Path
Load Type Examples Governing Column Required Protection
Pure Resistive Heaters, Incandescent, Toasters Continuous Resistive Rating None (Standard wiring)
Capacitive / Electronic LED Drivers, PC Power Supplies Continuous Rating (Watch Inrush) NTC Thermistor or Zero-Cross SSR
Inductive (Low) Small fans, Solenoids, Contactors Inductive Breaking Capacity Snubber circuit or Flyback diode
Motor (High Inrush) Compressors, Sump pumps, HVAC Motor HP / Locked Rotor Amps Use Sonoff to trigger a heavy contactor

Coil vs. Contact Side Wiring & Switch Integration

A Sonoff module contains two electrically isolated circuits: the low-voltage logic/coil side and the mains contact side. Understanding this isolation is critical when integrating a physical wall switch.

The Contact Side (Mains Wiring)

The contact side consists of the Line In (L-in), Line Out (L-out), and Neutral (N) terminals. The internal relay acts as a single-pole, single-throw (SPST) switch bridging L-in and L-out. When wiring 14 AWG THHN or solid copper NM-B wire into the screw terminals, torque them firmly. The PCB traces and the relay's internal copper stampings are the thermal bottleneck; loose screw terminals will cause localized arcing and melt the plastic enclosure long before the wire insulation fails. Assume the terminal block is rated for the 60°C ampacity column, regardless of your wire's 75°C or 90°C rating.

Integrating the Physical Wall Switch

There are two primary ways to wire a physical switch to control a Sonoff module, depending on the model and your desired behavior:

  1. Dry Contact Logic Input (S1/S2): Models like the Sonoff Mini R4 feature S1 and S2 terminals. These are optically isolated or low-voltage logic pins connected to the ESP32 GPIO. You wire a standard physical wall switch (toggle or momentary) between S1 and S2. The physical switch sends a logic signal to the microcontroller, which then energizes the relay coil. This keeps mains voltage entirely out of the wall switch box.
  2. Mains Line Interrupt (Retrofit Toggle): In older Sonoff Basic models lacking dry contacts, the physical switch must interrupt the mains Line wire feeding the Sonoff's L-in. When the wall switch is turned off, the Sonoff loses power entirely. When turned on, the Sonoff boots up and defaults to its programmed 'Power-on State' (e.g., always ON, always OFF, or last state). This method is less elegant and causes a 2-3 second Wi-Fi reconnection delay every time you use the physical switch.

The Coil Side & Flyback Protection

Internally, the ESP32 microcontroller cannot supply the 50mA-80mA required to energize the 5V DC relay coil directly. It drives an NPN transistor (like a 2N7000 or similar MOSFET/BJT) that switches the coil ground.

Flyback Diode Requirement: Because the relay coil is an inductor, collapsing the magnetic field when the transistor switches off generates a massive reverse voltage spike (often >50V) that will instantly destroy the ESP32 GPIO pin or the driving transistor. The Sonoff PCB includes a reverse-biased flyback diode (usually a 1N4148 or 1N4007) soldered directly across the relay coil pins. If you are modifying the PCB, desoldering the relay, or hacking the coil circuit for external use, never remove or bypass this flyback diode.

Testing, Diagnostics, and Replacement Rules

When a Sonoff with switch setup fails to actuate the load, the fault lies either in the Wi-Fi/logic layer, the physical switch wiring, or the electromechanical relay itself. Follow this diagnostic sequence to isolate the failure.

How to Test Dead (De-energized)

Remove the Sonoff from the circuit and ensure all mains power is disconnected. Set your multimeter to continuity or resistance (Ohms) mode.

  1. Test the Switch Input: Place probes across the S1 and S2 terminals (or the physical wall switch wires). Actuate the switch. You should read < 1 ohm when closed, and OL (Open Loop) when open. If you read high resistance when closed, the physical switch contacts are pitted or the wire nut connection is loose.
  2. Test the Relay Contacts: Place probes across L-in and L-out. With the Sonoff unpowered, the relay is normally open (NO); you should read OL. Use a 5V DC bench supply to briefly touch the VCC and GND pads on the ESP32 module (or manually press the tactile button on the PCB if equipped). You should hear an audible 'click' and the multimeter should drop to < 0.5 ohms. If it remains OL after the click, the internal relay contacts are carbon-fouled or mechanically jammed.

How to Test Live (Energized)

Restore power and use a non-contact voltage tester (NCVT) and a multimeter set to AC Voltage.

  1. Verify Input Power: Measure between L-in and Neutral. You must read nominal line voltage (114V-126V in North America, 220V-240V in EU/UK). If 0V, the upstream breaker or physical wall switch is open.
  2. Verify Output Switching: Measure between L-out and Neutral. Trigger the Sonoff via the eWeLink app or physical switch. When ON, L-out should read identical voltage to L-in. When OFF, it should read 0V. If L-out reads line voltage even when the relay audibly clicks to the OFF position, the relay contacts have welded shut due to inductive arcing. Immediately cut power at the breaker; the device is a fire hazard.

When to Repair vs. Replace

Because Sonoff modules are mass-produced consumer IoT devices, the economic and safety threshold for repair is very low.

  • Replace the Unit When: The relay contacts are welded, the PCB shows scorch marks near the terminal block, or the ESP32 fails to boot (indicating a blown voltage regulator from a coil spike). A replacement Sonoff Basic R4 costs roughly $6 to $9. Desoldering a through-hole relay from a 2-layer PCB without lifting the copper pads requires a high-wattage soldering station and flux core solder, and reassembling the plastic enclosure compromises its dielectric isolation.
  • Repair/Modify When: You are building a custom high-amperage enclosure and are using the Sonoff purely as a low-voltage logic trigger. In this case, you can desolder the internal relay and wire the ESP32's transistor output to an external, heavy-duty contactor coil. This bypasses the weak internal PCB traces entirely, allowing the Sonoff to safely control 30A+ loads like EV chargers or large compressor strings.

For authoritative wiring standards regarding smart switch retrofits and branch circuit integration, always cross-reference your local adoption of NFPA 70 (National Electrical Code), specifically Article 404 regarding switch placement and neutral requirements in switch boxes. For exact module specifications and firmware updates, consult the official Itead/Sonoff hardware documentation.