logo elektroda
logo elektroda
X
logo elektroda

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

p.kaczmarek2 
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.

About Author
p.kaczmarek2
p.kaczmarek2 wrote 11960 posts with rating 9995 , helped 572 times. Been with us since 2014 year.

Comments

mack23 26 Nov 2023 12:15

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 ... [Read more]

p.kaczmarek2 26 Nov 2023 12:26

Thanks for the information, I thought you were writing about tuya-convert, but this is something new. Valuable post. [Read more]

prosiak_wej 28 Dec 2023 17:01

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... [Read more]

SlaWasII 30 Dec 2023 07:38

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... [Read more]

%}