Hello my dear. Today we are looking inside another WiFi-controlled transmitter compatible with the Tuya application, confusingly similar to the well-known Sonoff, available for purchase for about PLN 20. We will check on what system it is implemented and whether it can be uploaded with its own batch. Finally, I will also draw its full (hopefully) diagram. The topic will be interesting because the heart of this product will turn out to be the Realtek system, which most people associate with the subject of computing rather than IoT.
Purchase of a smart 10A On / Off relay I found the product under the slogan "NEW Tuya Smart Switch 10A 2200W Wifi Basic Diy Switch Module App Control Support Off-line Operation Compatible Alexa Smart Life", although it is also known as NF101-A. Here is one of the offers to sell it: It is worth paying attention to the large selection of the country from which the shipment will be sent, Poland is also on the list. It is probably the result of the recent changes in the customs duty for shipments from abroad. The product price is PLN 23 with free shipping, which is one of the cheapest WiFi-controlled transmitters I know. The characteristic yellow / orange box attracts attention. After receiving the parcel: Instruction: First connection: I also noticed that I think I got a newer version. Different shade of the box and the inscription "Tuya Smart Switch" instead of "Wi-Fi Smart Switch".
Pairing with the Tuya application I've covered pairing in detail in previous topics in this series. Here, too, it went flawlessly, it was enough to put the device into the reset state (press the button for more than 5 seconds) and then via the Tuya application (after creating the account and confirming the email) select its type, enter information about our WiFi network and confirm the pairing. Everything in the application is standard, you can do scenarios, automations, etc.
Interior You can get inside by simply levering the casing: The housing is so matched to the board that you do not need screws: Plate: Varistor protecting the system against overvoltage (07D471K): A filter with two 4.7uF 400V capacitors and a choke (pi type filter), in the background a fuse resistor: The bottom of the board, the whole system is transformerless powered by On-Bright OB2222MCP (OB2222) which gives about 5V at the output, for the 3.3V WiFi module it provides AMS1117 3.3: Transistor J6 switching the relay on and the necessary diode parallel to the relay coil (so-called freewheeling diode): Relay itself, Yuanze Electronic, Y3F-SS-105DM: And most importantly - the WiFi module (it was already with the cover removed, sometimes I meet with something like that, e.g. in the case of two XR809 door sensors that I had, one was without a screen and the other with): Unfortunately, ESP8266 is not here. There is a Realtek IC, RTL8710BN:
RTL8710BN AMEBA Z SERIES, IOT LOW-ENERGY SOC The Realtek RTL8710BN is a highly integrated single chip with a low-power-consumption mechanism ideal for IoT (Internet of Things) applications. It combines an ARM(R)Cortex (TM) -M4 MCU, Wireless MAC / Baseband / RF, and configurable GPIOs that can function as digital peripherals for various product applications and control usage. The RTL8710BN's embedded memory configuration enables simpler and faster application development.
CPU - ARM(R)Cortex (TM) -M4 (up to 125MHz) Memory - 512KB embedded ROM - 256KB embedded SRAM - XIP (eXecut In Place) - Provides external Flash interface Wi-Fi - 2.4GHz 1T1R 802.11b / g / n up to 150Mbps; 20MHz and 40MHz
Peripheral Interface - SDIO Slave - UART x 2 - SPI interface (Master / Slave) - I2C interface x 2 - ADC for voltage management - PWM x 5 - Maximum 17 GPIOs
Package - Type: QFN-32 - Size: 5 x 5 mm
RTL8710BN comes with Flash on SPI (similar to ESP), let's take a closer look at how: Boya Micro, 25Q16BSTIG as far as I can see, similar to 25Q16BVSIG (BY25Q16BS family). NOR Flash memory with SPI interface, 16M BIT or 2MB.
T102_V1.1 module (such a different WR2?) From inside I desoldered the WiFi module from the inside to be able to read the pin names. Leads are signed. there is also a catalog note on the network under the entry T102_V1.1: Its parameters: Pinouts and roles of pins: There are also UART pins: In addition, I noticed that the Tuya, WR2 module (also implemented on RTL8710BN) is very similar to it: Pin 29 in the photo is EN in the schematic and 30 is ADC. The information about the 40MHz resonator is also correct, the module from the topic has it visible on the board: Pinout WR2: Additionally, the pinout is compatible with TYWE2S (which is already based on ESP): and TYWE3S can already be bought sometimes (and there are different prices, the one in the screenshot is not very attractive, actually it is more than the cost of the entire relay): There are some of these modules, so much good that they match as they come out.
Diagram Based on the photos and catalog notes of the elements, I have prepared a full diagram of this relay. NOTE: The scheme uses markings such as on the board, in addition, the resistor values are in the SMD code (e.g. 152 means 1.5 k? . In a nutshell: we have a few simple protections (at least there is a fuse, etc.), then a transformerless power supply (buck) on OB2222 giving 5V, a 5V relay controlled by a transistor and a 3.3V LDO powering the WiFi module, button, diode and that's it. You can see some differences from the scheme proposed in the catalog note OB2222. The manufacturer of the relay resigned from the rectifier bridge in favor of one diode, but added an additional filter (two electrolytic capacitors and a choke forming the PI filter). The rest is in line with the note (R1 and R2 are the power supply for OB2222, together with the C2 electrolytic capacitor), RS1 (S in the name is from Current Sense) is a low resistance resistor, a shunt to control the inverter current, further downstream elements D3 and L2s are already characteristic of every buck converter. General diagram of a buck converter: (source: wikipedia, https://en.wikipedia.org/wiki/Buck_converter) OB2222 obviously has the transistor integrated with the rest of the controller in its housing. This additional D2 diode connected to the FB (Feedback) pin is a feedback for current control via OB2222. OB2222 provides 5V which is used to turn on the relay and supplies the 3.3V LDO stabilizer AMS1117. Only this 3.3V supplies the T102_V1.1 module with RTL8710. Pin IO14 is connected to the transistor with the J6 code (I suspect it is S9014) through the R6 resistor limiting the base current and the R7 resistor acting as a pull down. The IO0 pin is just for the LED (informs about the relay status and the pairing status). Pin IO5 is a button with a pull up resistor R5 and surprisingly with a capacitor C8 which probably reduces the problem of contact vibration.
Summary The product is quite cheap, but from what I can see it does not match the price of the classic Sonoff (I can see it even for PLN 20) and there are basically no reasons to choose it specifically. The module used inside does not rely on ESP and seems to be quite difficult to program and basically offers us nothing more than ESP. Theoretically, the module inside could be replaced with another one, but it is completely unprofitable. So by buying it, we won't play much, we won't play Tasmota, etc. It's better to buy Sonoff. Of course, this does not mean that this purchase was in vain - as for me, on the contrary - I am going to be interested in the current RTL8710 / T102_V1.1 soon and still try to program it / compile a batch for it, and if something comes out of it, the results will be I will also describe it on the forum. You can always learn something interesting from such modules, I, for example, did not expect that such a module would barely print the SSID and password of my WiFi network on UART ... in the garbage, connects and already has access to our WiFi. For those interested: I am enclosing materials related to the relay from the topic.
@gwozdowskipl such a modification is very easy, just cut the paths appropriately (and make appropriate, large gaps between the live side and the switched side, not that you just cut and there is a 0.5mm gap in the path and you think you're done). You have my diagram and the paths show what and how.
Track where the 230V goes, where are the relay feet (where are the two that it short-circuits), etc ...
Nevertheless, I would advise you to be very careful and think about whether you want to change it, because if you had experience, you would not ask about it, and there is no joke with the systems directly connected to the network.
@ p.kaczmarek2 - thanks, but I haven't found the answer but, I looked for the manual. I paired the application without any problems (I held the button on the relay for 5 seconds. the LED started blinking blue, in SmartLife I found the device and paired it. EDIT: Pairing the remote