logo elektroda
logo elektroda
X
logo elektroda

[ESP8266] Sonoff Mini R2 - classic WiFi-controlled relay

p.kaczmarek2 4230 4

TL;DR

  • Sonoff Mini R2 is a compact WiFi relay module for a standard electrical box, opened here to inspect its ESP8285-based interior.
  • Its power section uses a BP2525 step-down converter and an AMS1117-3.3V line, with input protection from a fuse, varistor, and capacitor.
  • The module costs PLN 30 and uses GPIO0 on the housing button, so holding that button while powering the ESP8285 enters flashing mode.
  • Tasmota mapping assigns GPIO12 to Relay1, GPIO04 to Switch1, GPIO13 to LedLink, and GPIO00 to Button1.
  • Flashing worked smoothly once the button trick was known, but the hidden GPIO0 could waste time during setup.
Generated by the language model.
ADVERTISEMENT
This content has been translated flag-pl » flag-en View the original version here
📢 Listen (AI):
  • Sonoff Mini R2 package lying on a wooden table.
    It's time to take a look at the interior of the quite popular, classic Sonoff module with dimensions that fit a typical electrical box. Sonoff Mini R2 is quite cheap - you can buy it for only PLN 30 in our country. Additionally, you can easily change the firmware, although you need to know where GPIO0 is "hidden", which is necessary to put the ESP into flashing mode - but I will explain everything in this topic. So here we go.

    Purchase Sonoff MiniR2
    The module was purchased by one of my readers. Several units were purchased and I uploaded the firmware to them:
    Front of the Sonoff Mini R2 module on a white background.
    PLN 30 per item. Here are the specifications:
    Specifications of Sonoff Mini R2 with technical parameters.
    Let's see what we get in the set:
    Sonoff Mini R2 box on a wooden table. Sonoff Mini R2 box with information on the back. Sonoff Mini R2 module packaging on a wooden surface. Sonoff Mini R2 packaging on wooden background
    Box contents:
    Open box with a Sonoff Mini R2 module and manual inside. Image of the Sonoff Mini R2 module on a wooden background.
    This time they did not provide mounting screws. Unfortunately.

    Sonoff Mini R2 interior
    We pry the cover and uncover the plate:
    Interior of the Sonoff Mini R2 module with the PCB exposed.
    The module is based on ESP8285:
    Close-up of the circuit board from the Sonoff Mini R2 module. Sonoff Mini R2 circuit board with electronic components. View of the interior of the Sonoff Mini R2 module with visible PCB. Sonoff Mini R2 module's electronic board with ESP8285 chip on a wooden background.
    The BP2525 step down converter serves as the power supply, it powers the relay, while the ESP also has an AMS1117-3.3V power supply line on the way:
    Close-up of a circuit board section with electronic components of a Sonoff Mini R2.
    On the top we only have a button, a relay and power supply components (there is even a fuse, varistor and capacitor at the input):
    Interior of the Sonoff Mini R2 module with visible capacitors, relay, and other electronic components. Close-up of the Sonoff Mini R2 circuit board with visible electronic components. Interior of the Sonoff Mini R2 module with visible electronic components.

    Firmware change
    The device is based on ESP8285, so you can load Tasmota via esptool.py . I have discussed this many times, including: here:
    SmartLife switch - test, interior and programming of a WiFi light switch
    However, in the case of this device, the situation is slightly simplified. because GPIO0 is located on the button .
    So we solder the power supply (3.3V):
    Sonoff Mini R2 circuit board with visible traces and components.
    Close-up of a circuit board with an ESP8285 chip.
    Then RX and TX:
    Close-up of the Sonoff Mini R2 circuit board with soldered colored wires.
    As in previous topics, I have prepared a USB to UART converter, but this time when connecting it to USB, you need to hold the button on the housing so that GPIO0 is shorted to ground while booting ESP. The button can then be released. You can then start programming via esptool.
    Sonoff Mini R2 module connected to a breadboard and USB to UART converter.
    Tasmota template:
    {"NAME":"Sonoff MINIR2","GPIO":[17,0,0,0,9,0,0,0,21,157,0,0,0],"FLAG":0,"BASE":1}

    GPIO roles:
    - GPIO00 - Button1 (the one on the housing)
    - GPIO04 - Switch1 (external, connect the switch)
    - GPIO12 - Relay1
    - GPIO13 - LedLink
    What deserves special mention here is the fact that we have a separate LED on a separate GPIO. Sometimes in such devices the LED is only together with the relay and cannot be used separately, e.g. to show the WiFi status.


    Summary
    Flashing was trouble-free, although without knowing that there was a button on GPIO0, you could have wasted some time figuring out how to put the ESP into programming mode. Apart from that - everything is very good. The price is also really good, combined with free shipping on the website where we bought it, it is a really tempting offer, especially since we receive the products after two days at the parcel locker, and not after 2 weeks from China...
    Has anyone built home automation using such Sonoffs? Feel free to comment.

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 14559 posts with rating 12571, helped 654 times. Been with us since 2014 year.
  • ADVERTISEMENT
  • #2 20833716
    mack23
    Level 17  
    Posts: 300
    Help: 1
    Rate: 32
    Information: there is a much simpler way to upload the tape to this device, which does not require opening the case and manual flashing via UART. The instructions are presented in the video:
    https://www.youtube.com/watch?v=Xn1PmBLFHIM

    Verified, it works
  • ADVERTISEMENT
  • #3 20833737
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14559
    Help: 654
    Rate: 12571
    Thanks for the information, I thought you were writing about tuya-convert, but this is something new. Valuable post.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #4 20880024
    prosiak_wej
    Level 39  
    Posts: 5273
    Help: 501
    Rate: 1459
    I have two such devices, bought for PLN 1 in a second-hand textile store. At home, however, I use a Tuya-based ecosystem that does not connect to these switches. Is it possible to install software in ESP that will connect to Tuya? Or maybe the described Tasmota will merge with Tuya?
  • #5 20882583
    SlaWasII
    Level 12  
    Posts: 17
    Rate: 14
    I bought 6 of these switches. They fly great, but they have one problem. When connected to light bulbs or LEDs, you can hear the relay clicking and the light flashing from time to time. I can`t figure out what is the reason.
    Interestingly. A device installed near the monitor, when the relay ticks, sometimes, but not always, causes the LED monitor to flash. The monitor is powered from the same 230V socket, but apart from eWeLink... Does eWeLink cause any interference?
📢 Listen (AI):

FAQ

TL;DR: At about PLN 30, the Sonoff Mini R2 is a compact wall-box relay that is “trouble-free” to flash with Tasmota if you know the housing button doubles as GPIO0. This FAQ helps installers and tinkerers wire it correctly, enter flashing mode, and troubleshoot relay clicks, LED flashes, and ecosystem compatibility. [#20767896]

Why it matters: The thread answers the two biggest real-world questions: how to reflash the Mini R2 safely and why it may misbehave on a live 230V lighting circuit.

Method / option Open case Main tool or platform Thread-backed result
Manual flashing Yes USB-to-UART + esptool.py Described step by step and reported as trouble-free
No-open-case method No YouTube guide Reported as verified working
Original ecosystem use No reflashing mentioned eWeLink One user reports good operation, but also relay clicking and lamp flashing issues

Key insight: The most important practical detail is that the Sonoff Mini R2 puts GPIO0 on the housing button. Hold that button during boot and the ESP enters flashing mode without hunting for a hidden pad. [#20767896]

Quick Facts

  • The thread reports a street price of PLN 30 per unit, with delivery in about 2 days instead of roughly 2 weeks from China. [#20767896]
  • The Mini R2 uses an ESP8285 and is flashed from a 3.3V serial setup with RX and TX connected manually. [#20767896]
  • Its power section includes a fuse, varistor, input capacitor, BP2525 step-down converter, and AMS1117-3.3V rail for the ESP side. [#20767896]
  • Thread-mapped GPIO roles are GPIO00 button, GPIO04 external switch, GPIO12 relay, and GPIO13 status LED. [#20767896]
  • One user reports buying 2 units for PLN 1 each second-hand, while another says 6 switches worked well apart from intermittent clicking and lamp flashing. [#20880024]

How do I flash a Sonoff Mini R2 with Tasmota using esptool.py and a USB-to-UART adapter?

You flash it by wiring a 3.3V USB-to-UART adapter to the board and booting the ESP into flashing mode. 1. Solder the 3.3V, RX, and TX connections. 2. Hold the housing button while plugging the adapter into USB so GPIO0 is grounded at boot. 3. Release the button and start flashing with esptool.py, then load the Mini R2 template in Tasmota. [#20767896]

Where is GPIO0 on the Sonoff Mini R2, and how do I use the housing button to enter flashing mode?

GPIO0 is on the housing button. Hold that button while the USB-to-UART adapter powers the board from USB, so GPIO0 is shorted to ground during ESP boot, then release it after startup. That sequence puts the Sonoff Mini R2 into programming mode without needing to hunt for a separate GPIO0 pad. [#20767896]

What is ESP8285, and how is it different from the ESP8266 in devices like the Sonoff Mini R2?

In this thread, ESP8285 is the Wi-Fi microcontroller used inside the Sonoff Mini R2, and the practical takeaway is that it can be flashed with Tasmota through esptool.py. The posts do not describe silicon-level differences versus ESP8266; they only show that the Mini R2 uses ESP8285 and behaves like an ESP-family device during manual flashing. [#20767896]

What is esptool.py, and what role does it play when changing firmware on a Sonoff Mini R2?

"esptool.py is a flashing utility that writes firmware to the ESP chip over a serial link, which makes manual Tasmota installation possible through a USB-to-UART adapter." In this thread, it is the tool used after wiring 3.3V, RX, and TX and booting the Mini R2 with GPIO0 held low via the housing button. [#20767896]

Which GPIO pins are used for the relay, external wall switch, status LED, and button in the Sonoff Mini R2?

The thread maps the pins as follows: GPIO00 = Button1, GPIO04 = Switch1 for the external wall switch, GPIO12 = Relay1, and GPIO13 = LedLink. A useful detail is that the LED has its own GPIO, so it can show Wi-Fi status instead of being tied only to relay state. [#20767896]

What is the Tasmota template for Sonoff Mini R2, and how do I configure it correctly after flashing?

Use this Tasmota template after flashing: {“NAME”:“Sonoff MINIR2”,“GPIO”:[17,0,0,0,9,0,0,0,21,157,0,0,0],“FLAG”:0,“BASE”:1}. Then verify the functional mapping matches the thread: GPIO00 button, GPIO04 external switch, GPIO12 relay, and GPIO13 LED. That check matters because the Mini R2 has a separate status LED GPIO. [#20767896]

How does the no-open-case flashing method from the YouTube guide compare with manual UART flashing for Sonoff Mini R2?

The no-open-case method is simpler because it avoids opening the enclosure and avoids manual UART soldering. Manual flashing in the thread requires opening the case, soldering 3.3V, RX, and TX, and using esptool.py. The later post says the YouTube method was tested and “Verified, it works,” but the thread gives no step-by-step details beyond that confirmation. [#20833716]

Why does a Sonoff Mini R2 relay click and connected LED bulbs flash from time to time even when I am not switching them?

The thread confirms this symptom, but it does not identify a single proven cause. One user reports that with light bulbs or LEDs connected, the relay clicks and the light flashes “from time to time” even without intentional switching. In the thread, that remains an unresolved fault report rather than a solved diagnosis, so wiring noise, supply issues, and control-platform behavior still need testing. [#20882583]

What could cause a nearby LED monitor to flicker when a Sonoff Mini R2 relay switches on the same 230V circuit?

A likely thread-consistent cause is interference on the shared 230V supply path when the relay switches. The user reports that a nearby LED monitor, powered from the same 230V socket, sometimes flashes when the Mini R2 relay ticks. The thread does not prove whether the source is the relay event itself, the wiring, or software control, but it clearly ties the monitor flicker to switching on the same mains circuit. [#20882583]

How can I diagnose whether eWeLink, the power supply, or wiring noise is causing interference with a Sonoff Mini R2?

Use isolation testing because the thread reports the symptom but not the root cause. 1. Check whether clicking and flicker happen only on the affected 230V branch. 2. Observe whether the monitor flashes exactly when the relay ticks. 3. Compare behavior under the current eWeLink setup versus a different firmware path already discussed in the thread, such as Tasmota. This separates control-side behavior from power-path interference. [#20882583]

How do Tasmota, Tuya, and eWeLink compare for Sonoff Mini R2 in terms of compatibility and home automation integration?

In this thread, Tasmota is the documented replacement firmware, Tuya is the ecosystem one user wants to join, and eWeLink is the stock-style platform another user is already using. The thread shows confirmed manual Tasmota flashing, a request for Tuya compatibility, and an eWeLink setup that works but reportedly shows intermittent clicking and flashing. It does not provide a full feature-by-feature integration matrix. [#20882583]

What firmware options let a Sonoff Mini R2 work inside a Tuya-based ecosystem after replacing the original software?

The thread does not provide a confirmed Tuya-ready replacement firmware for the Sonoff Mini R2. One user asks whether software can be installed on the ESP to connect to Tuya, or whether the described Tasmota can merge with Tuya, but no answer is posted in the supplied discussion. The only replacement firmware explicitly described in the thread is Tasmota. [#20880024]

How safe is the Sonoff Mini R2 power section, and what do parts like the fuse, varistor, capacitor, BP2525, and AMS1117-3.3V do?

The thread presents the power section as well equipped for a small relay module, but it does not publish lab safety measurements. It explicitly notes a fuse, varistor, and capacitor at the input, plus a BP2525 step-down supply and an AMS1117-3.3V rail for the ESP. That means the design includes mains-input protection parts and a separate 3.3V logic supply path. [#20767896]

What is BP2525 in the Sonoff Mini R2, and how does it work together with the AMS1117-3.3V regulator?

"BP2525 is a step-down power-supply IC that feeds the relay side from mains-derived power, while AMS1117-3.3V is a linear regulator that creates the 3.3V rail for the ESP section." The thread states that BP2525 serves as the power supply and that the ESP also has an AMS1117-3.3V supply line in the path. [#20767896]

What should I check before installing a Sonoff Mini R2 in a wall box, including dimensions, missing accessories, and external switch wiring?

Check box fit, included hardware, and the external switch connection before installation. The opening post says the module dimensions fit a typical electrical box, but this package version did not include mounting screws. It also maps the external wall switch to GPIO04, so confirm that wiring path before closing the box, especially if you plan to reflash first using a 3.3V serial adapter. [#20767896]
Generated by the language model.
ADVERTISEMENT