Component guide · Beginner · 4 min read
Sonoff BASIC R3, BASICR4 and MINI R4

Wiring, eWeLink, DIY Mode and ESPHome
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
Sonoff BASIC and MINI switches are small Wi-Fi relays that make any light or socket smart. The BASIC R3 and BASICR4 sit inline in the cable (10 A); the MINI R4, MINIR4M and MINI-D fit behind a wall switch and keep the switch working. Set them up in the eWeLink app for Alexa and Google, or use DIY mode, ESPHome or Tasmota for local control in Home Assistant.
Key specs at a glance
- Load
- 10 A at 100 to 240 V AC (BASIC, MINI R4, RFR3); MINI-D dry contact
- Chip
- ESP8285 (BASIC R3, RFR3), ESP32 (BASICR4, MINI R4, MINIR4M)
- Wireless
- 2.4 GHz Wi-Fi; RFR2 and RFR3 also 433 MHz RF remote; MINI-D Matter over Wi-Fi
- Wall switch input
- S1/S2 terminals on MINI R4 and MINIR4M
- Apps
- eWeLink, Alexa, Google Home; Matter on MINI-D and MINIR4M
- Size
- BASIC about 88 x 38 mm; MINI R4 about 40 x 33 mm
This part is often wired to 230 V mains. Do all wiring with the plug pulled out, keep mains wires inside a closed box with strain relief, add a fuse, and never touch the board while it is plugged in. If you are new to mains wiring, have an electrician check it before you switch on.
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1Sonoff BASIC R3 Smart ON/OFF WiFi Switch₹672
Option 2Sonoff BASICR4 WiFi ESP32 Chip Smart Switch₹779
Option 3Sonoff MINI R4 Extreme Wi-Fi Smart Switch₹1,491
Option 4Sonoff MINIR4M MINI Extreme WiFi Smart Home Switch₹2,038
Option 5Sonoff MINI-D Dry WiFi Smart Switch with Matter₹2,049
Option 6Sonoff RFR2 Smart Home WiFi Remote Control Switch 433MHz 10A₹1,119
What the Sonoff BASIC and MINI is
The BASIC goes between a plug and an appliance or in a ceiling light feed. The MINI R4 sits in the switch box behind an existing switch, so the wall switch still works and the app adds remote and timer control.
The ESP32-based R4 models support eWeLink-Remote and local control features; the older R3 is ESP8285 and the easiest to flash with Tasmota.
Sonoff BASIC and MINI pinout
The pins on the Sonoff BASIC and MINI and what each one does.
| Pin | Function |
|---|---|
| L in / N in | Mains live and neutral in |
| L out / N out | To the load |
| S1 / S2 | Wall switch terminals (MINI R4, MINIR4M) |
| Button | Hold 5 s to pair; quick presses toggle the relay |
| LED | Wi-Fi and pairing status |
- L in / N in
- Mains live and neutral in
- L out / N out
- To the load
- S1 / S2
- Wall switch terminals (MINI R4, MINIR4M)
- Button
- Hold 5 s to pair; quick presses toggle the relay
- LED
- Wi-Fi and pairing status
Wiring the Sonoff BASIC and MINI
Mains wiring must be done with the power off, in a proper enclosure, with cable and a fuse or MCB rated for the load. If you are not sure, have a qualified electrician install it. These switches need a neutral wire; many Indian switch boxes have only live, so check before buying a MINI.
| Sonoff BASIC and MINI pin | BASIC R3 / BASICR4 | MINI R4 / MINIR4M |
|---|---|---|
| L in / N in | Supply live and neutral | Supply live and neutral |
| L out / N out | Light or appliance | Light (live through relay) |
| S1 / S2 | - | Existing wall switch (two wires) |
- L in / N in
- BASIC R3 / BASICR4:
- Supply live and neutral
- MINI R4 / MINIR4M:
- Supply live and neutral
- L out / N out
- BASIC R3 / BASICR4:
- Light or appliance
- MINI R4 / MINIR4M:
- Light (live through relay)
- S1 / S2
- BASIC R3 / BASICR4:
- -
- MINI R4 / MINIR4M:
- Existing wall switch (two wires)
Example code
The BASICR4 and MINI R4 use different pins; copy the ESPHome device page for your exact model. Flash over a USB to TTL adapter with the device off mains, or use DIY mode OTA where supported.
esphome:
name: sonoff-basic
esp8266:
board: esp8285
wifi:
ssid: "your-wifi"
password: "your-password"
api:
ota:
- platform: esphome
binary_sensor:
- platform: gpio
pin: {number: GPIO0, mode: INPUT_PULLUP, inverted: true}
name: "Button"
on_press: {then: [switch.toggle: relay]}
switch:
- platform: gpio
id: relay
name: "Sonoff Relay"
pin: GPIO12
status_led:
pin: {number: GPIO13, inverted: true}Setup and tuning
hold the button 5 s until the LED blinks fast, then add the device in the app on 2.4 GHz Wi-Fi.
gives a local HTTP API (port 8081) without cloud, on models that support it.
solder headers to the 3V3, RX, TX, GND pads and hold the button while powering from the adapter; never connect mains while flashing.
derate for motors and LED drivers with high inrush.
What you need
Shop this list10 of 11 found in our store · ₹32,457
Sonoff BASIC R3 Smart ON/OFF WiFi Switch: the part this guide coversSonoff BASIC R3 Smart ON/OFF WiFi Switch₹672
Sonoff BASICR4 WiFi ESP32 Chip Smart Switch: another version this guide coversSonoff BASICR4 WiFi ESP32 Chip Smart Switch₹779
Sonoff MINI R4 Extreme Wi-Fi Smart Switch: another version this guide coversSonoff MINI R4 Extreme Wi-Fi Smart Switch₹1,491
Sonoff MINIR4M MINI Extreme WiFi Smart Home Switch: another version this guide coversSonoff MINIR4M MINI Extreme WiFi Smart Home Switch₹2,038
Sonoff MINI-D Dry WiFi Smart Switch with Matter: another version this guide coversSonoff MINI-D Dry WiFi Smart Switch with Matter₹2,049
Sonoff RFR2 Smart Home WiFi Remote Control Switch 433MHz 10A: another version this guide coversSonoff RFR2 Smart Home WiFi Remote Control Switch 433MHz 10A₹1,119
Sonoff RFR3 Intelligent Wi-Fi Smart Switch w/ Alexa & 433MHz RF: another version this guide coversSonoff RFR3 Intelligent Wi-Fi Smart Switch w/ Alexa & 433MHz RF₹898
Home Assistant Green smart home hub: to control the switches locallyHome Assistant Green Smart Home Hub₹23,149
USB to TTL serial converter: to talk to the module from a PCUSB to TTL Serial Converter (CH340G / CP2102 / FT232RL / PL2303)₹85Closest match, check the specs- Fuse holder: to fuse the switched circuitFind this part
Digital multimeter: to check supply and signal voltagesDigital Multimeter₹177
Alternatives and when to choose them
- Sonoff, Tasmota and ESPHome: smart switches and open firmware.
- Sonoff POW energy switches: with power monitoring.
- MQTT and Home Assistant: local control and automations.
Common mistakes to avoid
- Installing a MINI where there is no neutral wire.
- Connecting mains while the USB adapter is attached.
- Loading the 10 A relay with a motor's start current.
- Using a 5 GHz Wi-Fi network for pairing.
Frequently asked questions
Does it work with Alexa and Google?
Yes, through the eWeLink skill and action.
Can it work without internet?
Yes, with DIY mode, ESPHome or Tasmota and a local hub like Home Assistant.
Do I need a neutral wire?
Yes, for all these models.
BASIC R3 or MINI R4?
BASIC for inline cables and plugs; MINI R4 to keep a wall switch working.
Can it control a fan?
On and off only; use an iFan or fan controller for speed.
Parts for this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

