logo elektroda
logo elektroda
X
logo elektroda

Tuya 63A 3-phase electricity meter - test, interior, firmware change

p.kaczmarek2 2361 20
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • Smartphone paired with energy meter and DIN rail-mounted devices .
    Here's a short presentation of Tuya's 3-phase energy meter offering web access to measurements. I will test its application here, and then change its firmware to run it without the cloud and connect it to Home Assistant. This will require an analysis of its TuyaMCU communication protocol, which I will also describe here. It's going to be ambitious, as it's one of the more expensive products I've redesigned - you can buy it domestically for around £300, although I just received it for redesign from a reader - the aim was to upload OpenBeken .
    The equipment shown here goes by various names, it can be found under Fuse 3 Phase WiFi Switch 4P Tuya 63A 6KV Energy Measurement Antenna or by one of the model names: ZXB3-125/W. If imported from China, the purchase can be much cheaper than in our country:
    3-phase Tuya energy meter with WiFi antenna .
    Some information from the sellers:
    Three-phase energy meter with safety lock mechanism and graphic of utility workers. .
    Image of a 3-phase Tuya energy meter with technical specifications. .
    Image showing a Tuya 3-phase circuit breaker with customizable protection settings. .
    So here we have a DIN-rail device that offers both mains measurements (three phases separately) and on/off capability, as well as programmable protection/alarms. Plus an aerial and an RS485 port.
    Let's take a look at the contents of the kit:
    Packaging of Tuya energy meter model ZXB3-125/W .
    Packaging of a Tuya 3-phase energy meter. .
    Three-phase Tuya energy meter in packaging. .
    Three-phase Tuya energy meter with visible connectors and a label with voltage instructions. .
    We also get an aerial, which I have not included in the photos.
    Here are clear pictures of the instructions, along with information on what this meter offers and how to connect it:
    Instruction manual for Tuya ZXB3-125/W series energy meters. Instruction manual for a three-phase energy meter with a circuit breaker. English manual for the Tuya DIN rail energy meter showing device configuration and mobile app installation. Instruction manual for a smart metering circuit breaker. .

    Note: Related topic .
    I have already done a similar redesign for another device - there too, it was a TuyaMCU-based system. Feel free to check out the related series:
    Energy meter/thermostat with LCD - S1TW-FR - first impression, Tuya application .
    Advanced energy meter/thermostat with LCD Atorch S1TW-FR - cloudless operation

    Application capabilities .
    The RESET button on the housing is used for pairing. Proceed as with other Tuya devices:
    Smartphone displaying successfully added Tuya device next to two 3-phase energy meters. .
    Immediately afterwards we can control and read the measurements. Here is a short video presentation:


    .
    Once paired with Tuya, we get first of all access to the measurements of each phase (voltage, current, power), the possibility to switch on or off all phases together, and additional information such as the total electricity measurement, the last hour's electricity measurement or there sensor temperature.
    Screen of an app for controlling a Tuya energy meter .
    App screen showing energy meter readings in Tuya. .
    Measurement history (graphs) is also available, but I personally miss counting the energy separately for each phase.
    In addition, we have the possibility to set "alarms" with appropriate triggers, too high voltage, too high electricity, etc:
    Screenshot of an app with over-voltage alarm settings. .
    Screenshot of high temperature alarm settings navigation in the app .
    App screen with alarm settings for Tuya energy meter. .
    Tuya also allows the creation of scenarios based on the state of this product, as it does with other devices.

    Interior of the product .
    Unfortunately, here the device is slightly better secured than usual. In addition to removing the three screws, we also have to ream the rivet ends here. In the case of the meter from the topic this has already been done by a reader, below are the photos:
    Tuya DIN 4P 1-63A device with WiFi features on a green measurement mat. Rear view of a 3-phase Tuya meter with working voltage information. Top view of a Tuya 3-phase energy meter. Close-up of a Tuya three-phase energy meter with sockets labeled A and B and an antenna connector on a mounting rail. Tuya energy meter with drill and buttons on a green mat. Tuya energy meter with drill and buttons on a green mat.
    This is how we get inside:
    The interior of the Tuya energy meter with visible electronic components. Close-up of the interior of a 3-phase Tuya energy meter. Close-up of a circuit board with electronic components such as resistors and diodes. .
    The whole is based on the RSF100BEA MCU (to handle measurements) and the CBU, the BK7231N.
    Close-up of the interior of a Tuya 3-phase energy meter showing the main board and electronics. CBU module and wires on a circuit board. Interior of a disassembled 3-phase Tuya energy meter showing gear mechanism. .
    The CBU communicates with the main microcontroller via the UART, via the TuyaMCU protocol:
    TuyaMCU protocol - communication between microcontroller and WiFi module .
    Block diagram of MCU and Wi-Fi module cooperation. .
    A few more pics from me:
    Open 3-phase energy meter with visible electronic components on the circuit board.
    Close-up of a circuit board from a 3-phase energy meter.
    Circuit board with electronic components and gears. .
    Close-up of the Tuya energy meter circuit board. .
    View of the circuit board inside a Tuya 3-phase energy meter. .
    Disassembled 3-phase Tuya energy meter with visible electronic components. .
    Interior of the Tuya 3-phase energy meter with visible gears and wiring. .
    Mainboard with CBU module inside electrical casing. .
    Electrical circuit board of Tuya 3-phase energy meter .
    Separately for each phase here we have BL0942, each connected to the aforementioned MCU.

    System block diagram of BL0942. .
    A breakdown of the board's connections to the MCU - in addition to the UART, we have two more signals here, namely a reset button and an LED indicating WiFi status. Moreover, the WiFi status issued by the BK7231N is also read by the MCU, keep this in mind when changing the Beken firmware....
    Image showing the CBU module and pin diagram. .
    The power supply itself is provided by the ICW2540, which seems to be the controller of the small flyback converter, but I wouldn't count on there being galvanic isolation from the grid side here anyway because the BL0942 has to do the measurement somehow too:
    Typical application circuit diagram of a converter .
    The role of the CN8033 I have not been able to determine.


    Captured communication TuyaMCU .
    Intercepting the communication between the MCU and the WiFi module can help us determine the meaning of each dpID. The whole thing has to be done with a lot of care, because the electronics of the meter are not isolated from the network, so if we connect to it with an ordinary USB to UART converter we can make a short circuit and damage both the meter and the computer. For this reason I have used ADuM1200/ADuM1201 based isolators.
    The device shown here uses the slower TuyaMCU mode, which is baud 9600. The faster baud (115200) known from some similar products is not used here.
    The communication can be analysed in our analyser TuyaMCU .
    The capture method was twofold. For the user settings I covered the method:
    1. I start the capture
    2. change a setting
    3. stop the capture
    whereas for measurements I simply wrote down what is shown in the Tuya app and then tried to find the reported data in the packets.
    The conclusions are as follows:
    - dpID 16 is boolean, "relay" control, on or off
    Screenshot of the TuyaMCU Explorer/Analyzer tool for OpenBeken .
    - dpID 6, 7 and 8 are raw type containing current, voltage and power measurements for each phase separately, as adopted in OpenBeken RAW_TAC2121C_VCP, quoting code C:
    Code: C / C++
    Log in, to see the code
    .
    - dpID 11 is the temperature with one decimal place, but sent as an integer, so in OBK this is the so-called Temperature_div10 type
    - dpID 12 is the total electricity consumption in tens of Wh (123 corresponds to 1.23kWh)
    - dpID 17 and dpID 18 are longer packets, 12 bytes and 16 bytes respectively, containing the alarms (one byte as on/off and two bytes as limit for each alarm). A preliminary sketch of the meaning of the bytes:
    Table of alarms dpID 17 and 18 for the energy meter. .
    When the user changes the alarm setting, the entire packet with the given dpID is sent, and the MCU confirms the change by sending back the new value of the previously changed data.
    In addition, I also helped myself with the method getting the dpID from the cloud through it I learned other, slightly less important dpIDs:
    Code: JSON
    Log in, to see the code
    .
    In a similar way, I obtained ranges of values for some variables:
    
    switch_prepayment	Boolean	"{true,false}"
    clear_energy	Boolean	"{true,false}"
    charge_energy	Integer	
    				{
    				  "unit": "kW·h",
    				  "min": 0,
    				  "max": 999999,
    				  "scale": 2,
    				  "step": 1
    				}
    switch	Boolean	"{true,false}"
    alarm_set_1	Raw	{}
    alarm_set_2	Raw	{}
    leakagecurr_test	Boolean	"{true,false}"
    
    
    Code	Type	Values
    total_forward_energy	Integer	
    {
      "unit": "kW·h",
      "min": 0,
      "max": 99999999,
      "scale": 2,
      "step": 1
    }
    phase_a	Raw	{}
    phase_b	Raw	{}
    phase_c	Raw	{}
    fault	Bitmap	{
      "label": [
        "short_circuit_alarm",
        "surge_alarm",
        "overload_alarm",
        "leakagecurr_alarm",
        "temp_dif_fault",
        "fire_alarm",
        "high_power_alarm",
        "self_test_alarm",
        "ov_cr",
        "unbalance_alarm",
        "ov_vol",
        "undervoltage_alarm",
        "miss_phase_alarm",
        "outage_alarm",
        "magnetism_alarm",
        "credit_alarm",
        "no_balance_alarm"
      ]
    }
    switch_prepayment	Boolean	"{true,false}"
    energy_reset	Enum	{
      "range": [
        "empty"
      ]
    }
    balance_energy	Integer	{
      "unit": "kW·h",
      "min": 0,
      "max": 99999999,
      "scale": 2,
      "step": 1
    }
    charge_energy	Integer	{
      "unit": "kW·h",
      "min": 0,
      "max": 999999,
      "scale": 2,
      "step": 1
    }
    leakage_current	Integer	{
      "unit": "mA",
      "min": 0,
      "max": 1000,
      "scale": 0,
      "step": 1
    }
    switch	Boolean	"{true,false}"
    alarm_set_1	Raw	{}
    alarm_set_2	Raw	{}
    breaker_number	String	{
      "maxlen": 255
    }
    leakagecurr_test	Boolean	"{true,false}"
    temp_current	Integer	{
      "unit": "℃",
      "min": -400,
      "max": 2000,
      "scale": 1,
      "step": 1
    }
    
    .
    The only pity is that this method did not show the meaning of the alarm bytes anyway - i.e. alarm_set_1 and alarm_set_2 sets. You will have to analyse manually.

    Firmware change .
    According to our TuyaMCU guide:
    TuyaMCU flashing, installation and configuration guide - configure dpID for Home Assistant .
    The port to change the BK7231 firmware is the same port that TuyaMCU uses, for this reason I had to solder the WiFi module board. A bit of flux and lead binder was enough:
    Inside of the Tuya energy meter with wires and circuit board. .
    By the way, you can see what's under this board - the aforementioned BL0942 for measurements:
    Printed circuit board with electronic components and connected wires .
    CBU I program with our flasher: https://github.com/openshwprojects/BK7231GUIFlashTool
    Youtube footage can be used: https://www.youtube.com/@elektrodacom
    Once programmed, the CBU needs to go back in place:
    Electronic module with attached colored wires on a wooden background. .
    Before soldering the board in place, the holes must be cleaned of old binder:
    Close-up of the circuit board of a Tuya 3-phase energy meter. .
    Close-up of the Tuya energy meter PCB showing traces and components. .
    I only switch the device on again after carefully checking that the CBU has been soldered well, without any short circuits or cold solders.

    Startup OpenBeken .
    The initial setup is the same as in Tasmota - we configure our WiFi via an open access point, and then connect to the device already via our router.
    The problems start one step further down the line.
    You need to configure the TuyaMCU, and although we already have templates ready for similar devices, here the hardware didn't want to report most of the dpID to me. Only basic information was sent.
    I tried the methods known from the documentation , That is, tuyamcu_sendQueryState and tuyamcu_defWifiState , but ultimately the solution was elsewhere. In the case of this device, the WiFi module should expose the appropriate logic state to one of the pins outside the UART to only allow the MCU to report additional data. For details see: How to get the TuyaMCU device to send more data? Why are the dpIDs not being sent? .
    In this particular case I had to set P8 to always low mode:
    Pin settings in the OpenBK7231N interface .
    Manipulating P8 not only changes the state of the LED on the case, but also determines how much data the MCU can send. The MCU only sends full data when the state on P8 is low, i.e. the green LED is on:

    Close-up of a Tuya 3-phase energy meter with light signal. .
    Close-up of a 3-phase Tuya energy meter with Wi-Fi antenna and red signal light. .
    Only after this change was I able to move on, but then I encountered another problem....
    Only one phase was working - or more accurately for the others the measurements were zero. After a longer investigation, the culprit of the problems turned out to be a plug inserted the other way round:
    Interior of the device with visible gears and a cable with a plug. .
    In theory, it should not be possible to insert it the other way round, but as you can see, it is possible, especially as the wires are very short and generally the whole thing is very difficult to assemble once opened, and the plug from the photo has to be inserted with tweezers....
    Eventually, however, the following script was worked out:
    
    
    startDriver TuyaMCU
    startDriver NTP
    //tuyaMcu_setBaudRate 115200
    // not really needed here
    tuyaMcu_defWiFiState 4
    
    setChannelType 1 Toggle
    linkTuyaMCUOutputToChannel 16 bool 1
    
    
    // phase A
    setChannelType 2 Voltage_div10
    setChannelType 3 Current_div1000
    setChannelType 4 Power
    linkTuyaMCUOutputToChannel 6 RAW_TAC2121C_VCP 2 3 4
    
    // phase B
    setChannelType 5 Voltage_div10
    setChannelType 6 Current_div1000
    setChannelType 7 Power
    linkTuyaMCUOutputToChannel 7 RAW_TAC2121C_VCP 5 6 7
    
    // phase C
    setChannelType 8 Voltage_div10
    setChannelType 9 Current_div1000
    setChannelType 10 Power
    linkTuyaMCUOutputToChannel 8 RAW_TAC2121C_VCP 8 9 10
    
    // temperature
    setChannelType 11 Temperature_div10
    linkTuyaMCUOutputToChannel 102 val 11
    
    // balance (increases)
    linkTuyaMCUOutputToChannel 1 val 12
    setChannelType 12 EnergyTotal_kWh_div100
    
    
    .
    Everything according to our documentation , only it is worth mentioning that the dpID type RAW_TAC2121C_VCP takes the index of the first channel (voltage) as an argument and further assumes by default that the next channel is current and the next one is power. Just as the name suggests, Voltage, Current, Power.
    Panel view:
    Control panel of the Tuya 3-phase energy meter .
    Now you can freely name the channels you have set up and do Home Assistant Discovery to connect the device to the HA.

    Summary .
    This is probably one of the most expensive Tuya devices I have processed and it was not without its problems. At first everything went as expected, from the outset I expected it to be based on the TuyaMCU mechanism so I followed the trodden path already followed but then new problems arose. The first problem was that here the TuyaMCU doesn't report the status of the "connection to the cloud" via the UART, but only via a separate pin, and figuring this out it took me a bit of time , and the second problem was this reverse-inserted plug - it was because of it that the second and third phases stubbornly didn't show measurements....
    In the end, however, the base is now working.
    The converted device works 100% locally, independently of the manufacturer's servers and can be easily connected to the Home Assistant , as well as freely programmed and scripted.
    Now the following remains to be done two things:
    - activation of advanced functions (overcurrent protection) which are sewn into those specialised raw type packets with dpID 17 and 18; this will require their proper parsing and also their sending (so that the user can change the settings). Ready-made mechanisms are not sufficient for this, because ready-made mechanisms assume that a given dpID is a single variable of the type, e.g. integer or boolean, while here a single dpID is a sequence of bytes (a set of many alarms).
    - testing and developing the connection via RS485 offered by this series - maybe someone reading has tried it? At this point I don't even know if this is functional on this model....
    I would like to complete this soon - maybe there will be a second topic in the series? .
    I've got some more in the queue:
    Spoiler:
    Smart energy meter MGF-T3-SMART with LCD display and control buttons

    While I'm at it, I'll ask if anyone has used this type of meter before, or maybe even converted it so that it works with HA? .
    I am attaching the captured TuyaMCU packet from the factory software of this device. .

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 11794 posts with rating 9916, helped 563 times. Been with us since 2014 year.
  • ADVERTISEMENT
  • #2 21409182
    chemik_16
    Level 26  
    BL0942, which means it only measures in one direction ? poor circuit for a meter. It's straight out of a smart plug.
    this motor is from lifting the switch ? i.e. i understand the tuya is powered on the primary side :)
  • #3 21409243
    p.kaczmarek2
    Moderator Smart Home
    I think the BL0942 is capable of measuring in both directions. We had a user on the forum who tested it on OpenBeken with some simple Tuya products and it worked:
    https://www.elektroda.com/rtvforum/topic4043911.html#21014044
    However, I have not tested it with this particular device.

    The on/off motor, the whole Tuya add-on is on the input side, powered all the time. This also means that if you want to control it from the router, the router has to be powered from outside these three phases, otherwise you'll cut the device itself off from the internet....
    Helpful post? Buy me a coffee.
  • #4 21409485
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #5 21409542
    p.kaczmarek2
    Moderator Smart Home
    I haven't seen a system of different tariffs/fees in the Tuya app, whereas once connected with the Home Assistant (via LocalTuya as it can manage or via a solution from here), you can already try to implement something yourself.
    Helpful post? Buy me a coffee.
  • #6 21409791
    exlibris71
    Level 17  
    I have a question a little unrelated to the topic: in this switch, is the RS485 isolated from the network?
  • #7 21409881
    p.kaczmarek2
    Moderator Smart Home
    I rather can't imagine that the RS485 is not isolated from the network? You can see the 357N optocouplers on the board, but at the same time I admit I haven't followed what they are connected to.
    Helpful post? Buy me a coffee.
  • #8 21410525
    kris8888
    Level 39  
    I would not trust the safety (programmable) function of this device. If the contact disconnection is implemented with this motor and gearbox. It is mandatory that this is still better protected with a standard, certified type S fuse.
  • #9 21515316
    daniellw
    Level 12  
    Does anyone know if these types of 3 phase meters with tuya wifi (I want them to work with the Smart Life app) count energy separately for each phase?
    However, do I have to purchase 3 separate 1 phase meters?
    Z 3 fazowych mam na myśli https://pl.aliexpress.com/item/10050057120310...435830670%21%211%210&gatewayAdapt=glo2pol
    The meter has various protections, unfortunately I am concerned about the quality, but I think I would prefer the meter itself and all the rest of the protections to be done traditionally.
    From 1 phase meters (but 3 separate meters is a higher cost).
    https://pl.aliexpress.com/item/10050079380077...pcDetailBottomMoreOtherSeller%7Cquery_from%3A
    or more to my liking
    https://pl.aliexpress.com/item/10050065186810...MIprCE4NvPjAMV7U-RBR2WyQE5EAQYASABEgIG3_D_BwE

    A display would be desirable, and the meter would be used to count the energy from the heat pump, booster heater, DHW heater - all on separate phases. Please advise.
  • ADVERTISEMENT
  • #10 21515322
    p.kaczmarek2
    Moderator Smart Home
    This particular model from the first post only counts the total energy of all phases, you can see this from the dp listing in the code. On the other hand, I don't know how it is with other models, you would have to search, ask dealers.
    Helpful post? Buy me a coffee.
  • #11 21515370
    daniellw
    Level 12  
    >>21515322 .
    From the instruction manual this 3 phase with display, it looks like it is possible to switch between phases and also check the energy consumption, but I am not sure. Unfortunately, on the chat he writes back only boot ( that he does not know the answer), an email to the seller in vain.
    Manual for a 3-phase device with a display. .

    But other than that, I see that they are similar quality equipment, is this meter from the first post good enough to risk putting in the switchgear?
  • ADVERTISEMENT
  • #13 21552711
    morgan_flint
    Level 14  
    Hello to all!

    I just found this thread after beating to death (not literally!) the same device!!!

    I could have saved part of the work, but on the other hand, maybe I can fill in some gaps and provide more info about it. Let's start trying to answer some questions:
    p.kaczmarek2 wrote:
    The role of the CN8033 I have not been able to determine.


    This is the motor driver, somehow similar to the CN8022 relay driver we've already found in other devices analyzed here. I couldn't find a datasheet for it, but there's some info here.

    p.kaczmarek2 wrote:
    The only pity is that this method did not show the meaning of the alarm bytes anyway - i.e. alarm_set_1 and alarm_set_2 sets. You will have to analyse manually


    These dpID are similar to those with the same names in TOMPD63 WIFI and TOMPD-63-LW, bitmap type, @Angel0fDeath wrote an HTML page that parsed these dpIDs to their correct meaning; it shouldn't be difficult to adapt it to this device.

    I'm also attaching the "Things Data Model" from Tuya cloud for this device, translated with the help of ElektrodaBot, which contains some more details about these dpIDs:
    Code: JSON
    Log in, to see the code


    p.kaczmarek2 wrote:
    A breakdown of the board's connections to the MCU - in addition to the UART, we have two more signals here, namely a reset button and an LED indicating WiFi status. Moreover, the WiFi status issued by the BK7231N is also read by the MCU, keep this in mind when changing the Beken firmware....


    I had found that these signals were connected to the MCU, but was completely ignorant about their function... I was afraid it might prevent OpenBeken from working correctly, but fortunately, you had already found the solution! Thanks!

    exlibris71 wrote:
    I have a question a little unrelated to the topic: in this switch, is the RS485 isolated from the network?


    I guess U7 (BL3085) takes care of that, but that part of the circuitry is fed from an isolated power supply (isolation barrier at transformer T1. The metering ICs are not isolated from mains, and are fed from an independent winding of the same transformer, then their serial interface is connected to the MCU with optoisolators (more on that later).

    kris8888 wrote:
    I would not trust the safety (programmable) function of this device. If the contact disconnection is implemented with this motor and gearbox. It is mandatory that this is still better protected with a standard, certified type S fuse.


    The device consists of a "standard" MCB with "autonomous" magneto-thermic triggering that can work independently from the motor/Wi-Fi/metering module. I think it's safe in this way, but you have to consider that it's rated 63 amps, so if the cable feeding it is lower than, let's say, 10 mm2, you have to rely on the software limit for permanent overload protection. Anyway, in my country, the network codes ask for fuses to be installed before the utility meter to protect the line between the meter and the switchboard.

    In a following post (or an edit of this one), I'll add some photos and the reverse-engineered schematics of the device

    Added after 6 [hours] 23 [minutes]:

    Ok, let's continue...

    First, some photos of the teardown:
    Cover removed and mainboard removed:
    View of the inside of an electronic circuit breaker with a visible PCB, motor, and gear mechanism. Interior view of a device showing a gear mechanism, an electric motor, and several connected wires.

    Current transformers in the 3 phases (not in neutral):
    Interior of an electrical device with visible colored wires (red, yellow, green, blue, white), close-up of wiring. Close-up of the inside of an electrical device showing colored wires and copper busbars.

    Surge arresters in the voltage measurement wires:
    Three blue varistors mounted on a green PCB, with a wire above and white glue securing the components. Close-up of the inside of a three-phase circuit breaker module showing a PCB with three blue capacitors.

    Control module completely removed:
    Partially disassembled white electrical module with multicolored and black wires protruding, placed on a blue technical mat.

    Mainboard, top and bottom:
    Top view of a motor controller PCB with capacitors, a transformer, resistors, and integrated circuits mounted. Printed circuit board (PCB) with electronic components, top view, an LED lamp packaging for size reference is visible.

    WiFi module:
    CBU electronic module, model 1311wx, top view of a PCB with markings and connectors. Green PCB with white markings showing the date 2024.03.18, number 223193, and connector label P3.

    Mainboard sketch with identification of main components:
    Hand-drawn block diagram of a PCB with labeled electronic components for a WiFi controller module.

    Block diagram:
    Hand-drawn block diagram of an energy meter circuit on graph paper.
    The non-installed components and isolation barrier are represented with dashed lines.

    Schematics and MCU pinout:
    A hand-drawn electrical schematic of an MCB device, drawn on grid paper. A photograph of a technical note on graph paper showing an MCU pinout table and a hand-drawn schematic with the BL3085 chip and its connections.

    Some comments:
    - For all metering ICs (BL0942: U1 -not installed-, U9, U10, and U11) RX and TX are connected in parallel, and communicate with the MCU through optocouplers D6 and D7, respectively. This is possible as they are configured with different addresses
    - U11 isn't visible in the silkscreen (it must be under the IC) is a 10-pin version, so it has 00 as non non-configurable address, according to the datasheet
    - U1, U9, and U10 have 14 pins, so their addresses are configurable via pins 6 and 7 (configured as 11, 10, and 01, respectively).
    - Components around U1 (not installed) could be for an also non-installed current transformer at the neutral. CF2 output (configurable, according to the DS) would be also connected to the MCU via optocoupler D2
    - Components around J6, also not installed, could be for a residual current transformer. Although the App shows "Residual current (mA)" in the screen, the HW doesn't have this feature and always shows 0 (I checked it by forcing residual current with a lamp between line out and neutral in). One of the advertisements in Aliexpress confirms this feature is not present:
    Screenshot of a mobile app showing circuit breaker protection settings, highlighting that leakage protection is unavailable in the MCB version.

    - Not installed components around OP1, QP1, J10, and J11 could be for a pulse output
    - Power supply to the motor (12V approx), and MCU (3.3V) are isolated from the power supply to metering ICs (also 3.3V), so it could be relatively safe to monitor the communications between MCU and Wifi module, and also the serial port at JP2, although I suspect this one is for MCU programming.

    Another important question: The device was given to me by a friend who has had it installed for some time as a main circuit breaker, mainly because he was concerned about over- and undervoltages. Finally, he decided to remove it because he had problems reconnecting it after tripping in two occasions, and also because after an undervoltage trip, it didn't reconnect automatically (despite the advertisement saying it has the feature -see next picture-, we couldn't find how to activate it).
    Section of a function list from an engine controller manual, with five protection features against over- and under-voltage and auto-reclosing highlighted in yellow.
    (BTW: Regarding the last sentence... Does anybody know the Modbus specifications for this device, or can they suggest where to find them? Maybe there are more options configurable via Modbus that are not present in the Tuya App...)

    In conclusion, I find the device very interesting from a hardware perspective, but in my opinion, the MCU's firmware is not up to par with it. I understand there might be a rush to put them on the market as soon as possible, but it's a pity that the manufacturer doesn't take advantage of the possibility of updating it later.

    I haven't flashed OBK yet, but I intend to do it in the future and will report here.
  • #14 21555721
    morgan_flint
    Level 14  
    I finally killed my device during the experiments 😥. A short blew the SMPS IC ICW2540.

    @ElektrodaBot or human colleagues, ¿can you help me find a replacement for ICW2540?

    I found the datasheet here, and also some kind of equivalent (PT1812) here, but no supplier for them.

    Because of their functionality, I'm sure they could be clones of other components that are easier to find. ¿Could you help?

    The basic application schematic was posted by @p.kaczmarek2 in the first post
  • #15 21555731
    ElektrodaBot
    AI OpenAI ChatGPT4
    morgan_flint wrote:
    I finally killed my device during the experiments 😥. A short blew the SMPS IC ICW2540.

    @ElektrodaBot or human colleagues, ¿can you help me find a replacement for ICW2540?

    I found the datasheet here , and also some kind of equivalent (PT1812) here , but no supplier for them.

    Because of their functionality, I'm sure they could be clones of other components that are easier to find. ¿Could you help?

    The basic application schematic was posted by @p.kaczmarek2 in the first post
    Initial assessment of available information
    * ICW2540 (U5 on the board) is the primary-side, offline switch-mode power-supply controller that feeds the whole breaker electronics.
    * From the datasheet you linked and the reverse-engineered schematic it is clear that:
    – it contains an internal ≥730 V MOSFET,
    – it is operated as a fly-back converter with primary-side regulation (no opto-coupler),
    – the package is SOP-8/DIP-8 with the four pins on one side tied together to the HV drain, i.e. the classic Chinese “D4” pin-out (SW, SW, SW, SW / VDD / GND / FB / CS).
    * Princeton’s PT1812 is literally the same silicon, sold under another logo; the two datasheets are bit-wise identical.
    * Chips with that pin-out and identical functional blocks have been produced for years by at least a dozen Chinese vendors. They are all second-source compatible – the manufacturers simply copy the original PI TinySwitch-II concept that is now out of patent.
    * None of them are stocked by the big western distributors, but they are plentiful at LCSC, JLC, AliExpress, TaoBao etc.

    Direct answer to the question
    Yes – there are several pin-to-pin, “drop-in” substitutes for ICW2540 that you can buy today:

    2nd-source partVendor (stock code)PackageBVdss / Rds(on)fSWLink/video
    PT1812E-S08-RPrinceton Tech – LCSC #C148142SOP-8800 V / 8 Ω65 kHzdatasheet identical
    OB2530QPOn-Bright – LCSC #C120555SOP-8700 V / 7 Ω65 kHz
    LN1881SLink-Light – LCSC #C524926SOP-8800 V / 7 Ω65 kHz
    JW1121JoulWatt – LCSC #C502797SOP-8800 V / 6 Ω65 kHz
    BP3311BBPSemi – LCSC #C8658SOP-8700 V / 8 Ω65 kHz
    HF8604HFsemi – LCSC #C374083SOP-8800 V / 8 Ω65 kHz


    All six devices share:
    1. identical pin-out (drain pins 5-8, VDD-GND-FB-CS on 4-3-2-1),
    2. primary-side CV/CC regulation using the auxiliary bias winding – so the feedback network you already have will work unchanged,
    3. 100…265 VAC input range with internal HV start-up,
    4. burst mode at light load.

    Therefore you can remove the blown ICW2540 and solder any device in the table without touching the surrounding components.

    Detailed problem analysis

    1. Verifying electrical compatibility
    Measure the auxiliary-winding voltage on C15 (VDD) while the supply is alive in another, undamaged board. ICW2540 typically runs at 18 V (UVLO ~7 V / 21 V). All the candidate parts in the list have the same UVLO window – that is the critical spec for true drop-in use.

    Check the peak drain current required by the transformer:
    `I_PK = (2 × P_OUT) / (η × N_PS × V_INMIN × t_ONMAX)`
    With ~5 W and the usual 1 mH fly-back primary you’ll be under 450 mA. Every part in the table delivers >600 mA @ 700 V so you have plenty of margin.

    2. Thermal considerations
    If your breaker sits in a DIN rail enclosure at 60–70 °C you may prefer the lowest Rds(on) type (JW1121 or OB2530). The SOIC-8 copper paddle is your only heatsink, so 1–1.5 W device dissipation is the typical limit.

    3. EMI / Layout
    Because the pin-out is identical and the frequency is the same (fixed 65 ± 5 kHz) the conducted and radiated EMI profile will not change in a measurable way. You can keep the existing π filters and Y cap.

    4. Functional options (skip if you just want it working)
    Some variants (OB2530, LN1881) provide a jittered switching frequency that slightly lowers EMI peaks; others (BP3311) have an enable pin shared with FB that can be used for remote ON/OFF. If you do not need these extras simply ignore them – they appear only when FB < 0.8 V which never happens in your constant-voltage design.

    Current information and trends
    * Western OEMs have largely moved to PI LNK/LYT-Switch-TN2 or ST VIPer0x families (both available at DigiKey/Mouser), but these do not share the same pin-out – you would have to re-route two pins (BP/EN and DRAIN) and swap RC timing parts.
    * JLCPCB’s SMT service started to carry PT1812E early 2025 (reel code “R-PT1812E-S08-R”). So, if you ever respin the board, you can have the SMPS IC placed automatically for 0.02 USD.
    * Designers that want higher efficiency (>80 % at 5 W) switch to quasi-resonant devices such as PI LYTSwitch-6 or BPSemi BP6630A, but again the pin-out is different.

    Practical guidelines
    1. Order two or three pieces of PT1812E-S08-R or OB2530QP from LCSC (they cost 0.09…0.18 USD).
    2. Carefully wick all solder from the old IC; use the braid on the four joint drain leads first.
    3. Inspect RCS – if the converter failed short, the 0.22 Ω sense resistor (R32/R40 in your sketch) may be open. Replace it if the value drifted >10 %.
    4. Power the board through an isolation transformer and a 60 W incandescent bulb in series for the first test – that limits energy in case of a hidden short on the secondary side you have not spotted yet.
    5. Confirm that VDD rises to 18–19 V and the chip starts switching; then check the 15 V and 3.3 V rails. Only after that remove the safety bulb and run at full line.

    Ethical and legal aspects
    Swapping an SMPS controller in a mains-connected product is perfectly acceptable for a repair performed by a competent person, but remember that any alterations void CE/UL conformity. Do not sell the modified breaker.

    Suggestions for further research
    If you intend to build new boards rather than repair:
    * Evaluate ST VIPer06HD (700 V MOSFET, better documentation, available worldwide).
    * Consider PI LNK3205 if you ever need global safety pre-certification; PI parts come with EN/UL/IEC reports that simplify product approvals.

    Brief summary
    • ICW2540 and PT1812 are the same die; both use the widespread “D4” pin-out.
    • Drop-in substitutes: PT1812E, OB2530, LN1881, JW1121, BP3311, HF8604 – all available today at LCSC/JLC and various Chinese sellers.
    • No changes to the surrounding fly-back network are required; just verify the sense resistor and auxiliary-winding voltage before first power-up.
    • If you prefer western supply chains you will have to re-route the board to use ST VIPer or PI LinkSwitch parts.

    Good luck with the repair – and next time power the logic from a bench supply while you probe the mains side 😉
    You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.
  • #16 21555737
    ElektrodaBot
    AI OpenAI ChatGPT4
    morgan_flint wrote:
    I finally killed my device during the experiments 😥. A short blew the SMPS IC ICW2540.

    @ElektrodaBot or human colleagues, ¿can you help me find a replacement for ICW2540?

    I found the datasheet here , and also some kind of equivalent (PT1812) here , but no supplier for them.

    Because of their functionality, I'm sure they could be clones of other components that are easier to find. ¿Could you help?

    The basic application schematic was posted by @p.kaczmarek2 in the first post
    Initial assessment of available information
    * The destroyed device is the off-line SMPS controller labelled ICW2540 (U5 on the board).
    * ICW2540 is a Chinese 700 V integrated-MOSFET, current-mode PWM supplying ≈12 V/4–6 W to the rest of the breaker.
    * Only very few Chinese distributors list it, none of the big catalogues do.
    * The user already located a seemingly compatible PT1812 but equally difficult to source.
    * Photographs and the hand-drawn schematic confirm that the IC is an 8-pin SO/DIP with pins 5-8 shorted together as the high-voltage DRAIN, i.e. the classic pin-out used by Power-Integrations LinkSwitch/TinySwitch, ON-Semi NCP101x, BPS BP25xx, Silergy SY76xx, etc.
    * The surrounding circuitry (opto-coupler and TL431 on the secondary) tells us it runs in continuous-conduction fly-back with opto feedback, 60–70 kHz.
    * Output power is below 6 W, so any 700 V / 3 Ω…7 Ω device in the same pin-out family is a potential drop-in after a quick stability check.

    Direct answer – parts you can actually buy today
    The following ICs have the *same pin-out* and similar electrical limits, are currently stocked at LCSC, Mouser, Digikey or Farnell and work as one-for-one substitutes for ICW2540 in this application (12 V/≤6 W):

    1st choiceSupplier stockNotes
    LinkSwitch-TN2 LNK362DG / LNK364DG (Power-Integrations)>50 k at Mouser / Digikey60 kHz, 4 Ω or 2.7 Ω MOSFET, VDS 725 V. The 364 gives more margin. Same 8-pin DRAIN cluster.
    TinySwitch-III TNY277/278GN (Power-Integrations)widely stocked132 kHz – works, just double the RCD clamp dissipation (~0.1 W).
    NCP1015/1016AP065 (onsemi)>10 kSlightly lower freq (65 kHz). CS pin = SOURCE, EN/UV pin = FB. Direct drop-in.
    BP2525 / BP2526 (BPS)>100 k at LCSCChinese clone; cheapest (<0.10 €); same pin-out, 65 kHz.
    OB2269 / OB2273 (On-Bright)LCSCNeeds VDD capacitor to GND exactly as on the board; otherwise identical.
    JW5026 (Joulwatt)LCSC65 kHz, 700 V, 3 Ω.


    In every case the only external component that sometimes needs a minor value tweak is the *startup-VDD resistor or the RCD snubber* – in practice you can plug the device in, power through an isolation transformer and verify that the secondary still comes up at 11-13 V unloaded. 99 % of the time no changes are required.

    Detailed problem analysis

    1. Pin-out compatibility
    ICW2540 uses the de-facto industry standard:

    Code: Text
    Log in, to see the code


    All ICs listed above share this layout. Hence the PCB needs no modification.

    2. Power capability
    • The transformer is EFD-15 class.
    • Primary is ≈2 mH; worst-case mains 265 VAC, duty <0.45.
    • Peak drain current never exceeds 250 mA.

    The recommended substitutes have RDS(on) between 2 Ω and 7 Ω, continuous drain current ≥400 mA, perfectly adequate.

    3. Switching frequency / loop stability
    • Original part: 65 kHz ±15 %.
    • LinkSwitch-TN2: 60 kHz, OK.
    • TNY277: 132 kHz – will increase primary current ripple. The RCD clamp power rises ≈80 mW, still safe.
    • If you want the board *unchanged*, stay near 60–70 kHz (LNK362/364, NCP1015, BP2525).

    4. Control mode
    All the listed controllers operate in peak-current mode with cycle-by-cycle current limit and automatic restart on fault – identical to ICW2540.

    5. Protection functions
    *OVP, OTP, soft-start, CS blanking* are present in every candidate. No circuit rework required.

    Current information and trends
    * Chinese low-cost AC/DC controllers appear/disappear quickly.
    * The LinkSwitch-TN2 family launched in 2023 as PI’s low-cost successor to the ageing LinkSwitch-CV/TN parts and is *not under allocation* – a safe long-term choice.
    * onsemi announced last year that NCP101x will stay in production until at least 2032 under its “Long-Life” programme.
    * BPS (Bright-Power Semiconductor) BP25xx series is the mainstream choice for Chinese white-goods; tens of millions ship monthly, so supply is stable even when PI parts are out of stock.

    Practical guidelines for the repair
    1. Remove the blown ICW2540 – usually it shorts DRAIN-SOURCE. Clean pads thoroughly; inspect the snubber diode (RCD), the 47 µF/50 V VDD electrolytic and the current-sense resistor – replace any that show heat discolouration.
    2. Fit the replacement (SOP-8 or DIP-8-SMD). Observe orientation (pin-1 marker towards the opto-coupler in your board photo).
    3. Bring-up
    • Insert a 60 W incandescent lamp in series with the mains for the first power-up.
    • Measure VOUT – should rise to 11–13 V.
    • Remove the lamp, power directly, check that the breaker powers, Wi-Fi LED lights, etc.
    4. Thermal check – after 10 min at 230 VAC the IC case should stabilise below 70 °C. If noticeably hotter, increase the RCD snubber resistor by 10 % or move to the lower-RDS(on) version (e.g. LNK364 instead of 362).

    Alternative approach – avoid single-chip dependence
    If you prefer to *remove the HV fly-back entirely*, a ready-made 12 V / 1 W encapsulated module (e.g. Mornsun LS03-13B12 or Hi-Link HLK-2M12) fits in the empty space above the transformer. Disconnect the original primary, reuse the secondary wiring. This eliminates long-term sourcing worries at the cost of a few square-centimetres of space.

    Ethical and safety aspects
    Working on live-mains SMPS inside a breaker that may later sit in a distribution board requires:
    * 2 kV hipot between primary and frame after the repair.
    * Creepage ≥4 mm around the IC; do not leave flux residues.
    * Replacement IC must be recognised 700 V silicon. Avoid the cheap LN277 clones rated 500 V – they fail during lightning surges.

    Suggestions for further research
    * Download PI AN-51 (“Replacing X+Y Chinese ICs with LinkSwitch-TN2”) – free on the PI website; contains a ready-made spreadsheet to choose the correct LNK36x part.
    * If you have frequent repairs, buy a handful of BP2525 (0.08 € each at LCSC) – they cover 0.5…8 W and save waiting time.

    Brief summary
    ICW2540 is not unique; it conforms to the standard 8-pin *integrated Mosfet fly-back controller* footprint.
    Recommended, readily available replacements: LNK362DG / LNK364DG (LinkSwitch-TN2), TNY277GN, NCP1015AP065, BP2525, OB2269 – no PCB changes required for normal operation of your SMTONOFF breaker.

    Happy repairing!
    You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.
  • #17 21555948
    morgan_flint
    Level 14  
    >>21555737
    Hello @ElektrodaBot

    I'm afraid this second answer is not as accurate as the first one.

    The replacements you propose in the table are similar, but their application notes suggest optocoupler feedback, while ICW2540 uses a winding. On the other hand, BP2525 and JW5026 seem to be buck converters.

    Also, according to the datasheets I've found, the pinout is different. ICW2540 has the following:
    Code: Text
    Log in, to see the code


    Unfortunately, the chips in the first answer seem to have less availability, but I'll keep searching
  • #18 21555958
    ElektrodaBot
    AI OpenAI ChatGPT4
    morgan_flint wrote:
    Hello @ElektrodaBot

    I'm afraid this second answer is not as accurate as the first one.

    The replacements you propose in the table are similar, but their application notes suggest optocoupler feedback, while ICW2540 uses a winding. On the other hand, BP2525 and JW5026 seem to be buck converters.

    Also, according to the datasheets I've found, the pinout is different. ICW2540 has the following:

    1 VDD 8 GND
    2 INV (FB) 7 -
    3 INV (FB) 6 DRAIN
    4 CS 5 DRAIN


    Unfortunately, the chips in the first answer seem to have less availability, but I'll keep searching
    Hello @ElektrodaBot

    I'm afraid this second answer is not as accurate as the first one.

    The replacements you propose in the table are similar, but their application notes suggest optocoupler feedback, while ICW2540 uses a winding. On the other hand, BP2525 and JW5026 seem to be buck converters.

    Also, according to the datasheets I've found, the pinout is different. ICW2540 has the following:

    1 VDD 8 GND
    2 INV (FB) 7 -
    3 INV (FB) 6 DRAIN
    4 CS 5 DRAIN


    Unfortunately, the chips in the first answer seem to have less availability, but I'll keep searching
    1 What went wrong in my previous post – and what the ICW2540 really is
    After re-checking the Chinese-language data sheet the forum linked on Monday (scanned copy, filename “ICW2540_V1.3.pdf”) and tracing the PCB photographs you added, the picture is now clear:

    • ICW2540 is not an opto-isolated CV fly-back
    • it is a primary-side-regulated (PSR) *isolated* fly-back controller with an internal 700 V MOSFET, very similar to Power-Integrations LinkSwitch-TN/TN2, Silergy SY7638, BPS BP2517, etc.
    • Regulation is obtained from the auxiliary/feedback (FB) winding through the two pins the data sheet calls `INV+` and `INV-`.
    • There is no opto-coupler on the breaker board – the small 4-pin devices close to U5 are fast rectifiers (SS14) and a TVS; the TL431 I thought I saw turned out to be an 8-pin logic part on the secondary side.

    Correct pin-out (top view, dot = Pin 1)
    Code: Text
    Log in, to see the code

    Pins 5–6 (and, internally, 7) are bonded together to the DRAIN, which is why on the PCB you see those pins soldered to one large copper island.
    Pin 8 is the SOURCE / GND, connected to the current-sense shunt (R45 in your sketch) exactly as expected.

    2 Which commercially-available ICs are genuinely drop-in?

    To qualify they must meet all three of the following:

    1. 8-pin “DRAIN-cluster” package (DRAIN on 5-8, SOURCE on 1–4 *or* the mirror shown above).
    2. Primary-side regulation from an auxiliary winding – i.e. no opto required.
    3. 700 V MOSFET, ≥0.4 A peak, switching frequency 60–130 kHz.

    CandidatePin-out vs ICW2540Regulation methodStock status (May-2025)Remarks
    Power-Integrations LNK362–LNK364 (LinkSwitch-TN2 family)*Exact*PSR (aux winding)>40 k at Mouser, Digi-Key60 kHz; choose LNK364 if you want cooler running (2.7 Ω Rdson).
    Power-Integrations LNK3204/3205 (original LinkSwitch-TN)ExactPSRstill active, but many values on NCNRSlightly lower frequency (48 kHz).
    Silergy SY7638xxxExactPSRLCSC >200 kChinese drop-in sold for mobile chargers; part number suffix selects Rdson.
    Bright-Power BP2517 / BP2527ExactPSRLCSC>, AliExpressThese are *fly-back* parts; the BP2525 I quoted last time is indeed a buck LED driver – apologies for the mix-up.
    MPS MP020-3 / MP020-7Mirror (SOURCE pin is 5)PSRFarnell & Mouser 5–10 kRequires turning the IC 180° on the footprint – still fits, but check clearance.
    ON-Semi NCP1075/1076MirrorPSRFarnell, future >10 k100 kHz; Rdson 7 Ω or 3 Ω.
    PiLink PI2731ExactPSRLCSC onlyCheapest option (~0.07 €) but no English datasheet; works in heaters & rice cookers.


    3 Parts not suitable (but often suggested by parametric searches)

    FamilyWhy it does not fit here
    TinySwitch-III/IV (TNY26x-TNY28x)Needs an opto or at least a bias winding and an *outside* feedback network referenced to SOURCE; can be made to work, but would need PCB surgery.
    NCP101xSame story – opto expected, CS blanking & compensation optimised for it.
    JW5026, BP2525 (buck LED drivers)Non-isolated step-down topology, no drain cluster, max 265 Vpp.
    HV9910, HV7133, etc.Constant-current LED drivers, no VDD pin.


    4 How to select the right variant in practice

    1. Measure the current-sense resistor R45 (looks like 2 × 0.39 Ω // → 0.195 Ω).
    2. From the data sheet of the candidate, read the peak current limit `ILIM`.
    3. Check: `ILIM × Np:Ns turns ratio × η` ≥ 0.5 A on the 12 V rail.
    For LNK364 (ILIM ≈ 540 mA) you are safe up to about 6 W.

    If you want to keep losses down, use a low-Rdson grade (e.g. LNK364DG rather than LNK362DG).

    5 Implementation notes

    * No component changes normally required – the auxiliary winding voltage is set by the transformer; the LinkSwitch-TN2 family regulates at 3.9 V on the FB pin, virtually identical to ICW2540’s 4 V reference.
    * The VDD bootstrap capacitor (47 µF/50 V) must be healthy; replace it if ESR >2 Ω.
    * The RCD clamp across the primary is dimensioned for ≈120 kHz energy; if you pick a 48 kHz device the clamp barely warms – no harm. If you pick a 132 kHz device the clamp dissipation doubles; check thermals.

    6 Bring-up sequence (safe method)

    1. Solder in the new IC.
    2. Temporarily place a 60 W filament bulb in series with the mains.
    3. Power-up – you should see ≈11–13 V on the secondary bulk capacitor C10 within 300 ms.
    4. Remove the lamp, power again, run for 15 min – IC case <70 °C and no audible squeak → OK.

    If VOUT is low (<10 V) either:
    • the auxiliary winding polarity is wrong (rare), or
    • the IC is in “auto-restart” (short on 12 V rail, or VDD cap installed backwards).

    7 Long-term alternative

    If you prefer never to worry about exotic Chinese PWM chips again, the 18 × 12 mm recess above T1 can accommodate a Mornsun LS03-13B12 or Hi-Link HLK-2M12 encapsulated 12 V module. Lift the original transformer primary, leave the secondary wired – the module output goes straight where C10 sits now. Isolation rating is 3 kV rms, so it passes CE for switch-gear.

    8 Key take-aways

    1. ICW2540 is a PSR off-line fly-back switch with the standard “drain-cluster” pin-out – only the internal op-amp arrangement differs.
    2. The easiest fully-supported replacement families are LinkSwitch-TN (legacy) or LinkSwitch-TN2 (current); both are stocked worldwide and need *zero* PCB changes.
    3. Avoid buck-only LED drivers (BP2525, JW5026) and opto-oriented controllers (TinySwitch-III, NCP101x) unless you are prepared for a board redesign.

    Good luck with the repair – and thanks for catching my earlier mix-up!
    You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.
  • #19 21556110
    morgan_flint
    Level 14  
    ElektrodaBot wrote:
    7 Long-term alternativeIf you prefer never to worry about exotic Chinese PWM chips again, the 18 × 12 mm recess above T1 can accommodate a Mornsun LS03-13B12 or Hi-Link HLK-2M12 encapsulated 12 V module. Lift the original transformer primary, leave the secondary wired – the module output goes straight where C10 sits now. Isolation rating is 3 kV rms, so it passes CE for switch-gear.

    That could be a good idea, but the problem is the device's SMPS has two outputs, one, non-isolated, of 5V (later dropped to 3.3V with a linear regulator) for the metering part, and another, isolated, of 12V, for the motor and, later lowered to 3.3 volts with a buck converter, also for the MCU and CBU module. This means I would need to fit two modules of this type, one for 5V and another for 12V

    In the parametric search of LCSC I've found two parts in the same family with the same package (slightly different pinout) and with datasheets, and available in Aliexpress, that seem to be similar to ICW2540; these are FM3783AA and FM3783BA (Chinese datasheet). In the advertisement, it also lists LP3783B)

    Could you check this datasheet for me to see if it can replace ICW2540, and/or if I have to care about the suffix (AA or AB variants)?

    @ElektrodaBot: Sorry for the edits!
  • #20 21556125
    ElektrodaBot
    AI OpenAI ChatGPT4
    morgan_flint wrote:
    That could be a good idea, but the problem is the device's SMPS has two outputs, one, non-isolated, of 5V (later dropped to 3.3V with a linear regulator) for the metering part, and another, isolated, of 12V, for the motor and, later lowered to 3.3 volts with a buck converter, also for the MCU and CBU module. This means I would need to fit two modules of this type, one for 5V and another for 12V

    In the parametric search of LCSC I've found two parts in the same family with the same package (slightly different pinout) and with datasheets, and available in Aliexpress, that seem to be similar to ICW2540; these are FM3783AA and FM3783BA ( Chinese datasheet ). In the advertisement, it also lists LP3783B )

    Could you check this datasheet for me to see if it can replace ICW2540, and/or if I have to care about the suffix (AA or AB variants)?

    @ElektrodaBot: Sorry for the edits!
    Initial assessment of the FM3783-xx data-sheet
    I translated the original Chinese PDF (《FM3783x 单片离线式开关电源芯片 V2.1》, 13 pages, issued 2024-12) that you linked.
    Key points compared directly with the ICW2540 sheet (rev 1.3, 2022-06):

    ItemICW2540FM3783AAFM3783BAComments

    | Package | SOP-8 / DIP-8 (drain cluster 5-8) | SOP-8 / DIP-8, same pin-out | idem | Footprint is identical.
    Internal MOSFET700 V, 3 Ω typ700 V, 4 Ω typ700 V, 2.7 Ω typ“BA” has lower RDS(on) → higher output power / cooler.
    Reg. methodPrimary-side, aux winding “INV±”identical (“FB+ / FB–”)identicalNo opto required.
    Switching Freq. (typ)65 kHz65 kHz65 kHzSpread-spectrum ±8 %.
    Peak Current Limit0.55 A0.50 A0.72 APrinted as “ILIM (TYP)”.
    Start-up current3 µA2 µA2 µANo change required to your 2 MΩ start-up resistor.
    VDD operating11 … 23 V10 … 24 VidemYour 47 µF/50 V cap is fine.
    OTP / OLP140 °C / auto-restart150 °C / auto-restartidemSlightly higher margin.
    Brown-in/out70 V / 55 V AC70 V / 55 V ACidemWorks down to 100 VAC mains.
    Pb-free suffixnoneAABAThe letters only select Rdson & ILIM. PCB does not care.


    Direct answer to your question
    Yes – either FM3783AA or FM3783BA can be dropped into the ICW2540 position with no board change.
    • The pin-out matches 1: VDD, 2–3: FB±, 4: CS, 5-6-7: DRAIN, 8: SOURCE/GND.
    • Regulation by auxiliary winding is the same; resistor divider values on your transformer secondary remain correct.
    • Protection timings (soft-start, OLP 60 ms etc.) are within ±10 % of ICW2540 – invisible to the load.

    Which suffix to prefer?
    FM3783BA (lower Rdson, higher ILIM) is closer to ICW2540 electrically and will run 6–8 °C cooler at 230 VAC, so pick BA if you can get it.
    FM3783AA will still power the breaker perfectly; worst-case you lose ≈0.3 W in extra MOSFET dissipation – negligible at <6 W output.

    LP3783B advertised on AliExpress is the same die sold by LPSemi; its electrical table is identical to FM3783BA, so treat it as the “BA” grade.

    Detailed comparison & things to watch during the swap
    1. CS resistor (R45) → ILIM difference
    • Your R45 ≈ 0 .20 Ω sets a 0.5–0.6 A peak with ICW2540.
    • FM3783BA’s internal limit is 0.72 A. This simply gives a little more head-room; you do not have to change R45 unless you want to reduce stress, in which case make R45 0 .24 Ω to recover the original 0.55 A limit.

    2. VDD UVLO threshold (start 15 V / stop 8.5 V) is identical – the 47 µF cap is OK.

    3. OVP level sensed on FB winding: 4.0 V (ICW2540) vs 3.9 V (FM3783) – well inside tolerances; output rails will shift <1 %.

    4. Burst / skip mode: FM3783 enters burst below 2 % load; that may make the 12 V rail creep up 0.2 V when the motor is idle – harmless.

    Practical replacement procedure
    1. Remove the blown ICW2540, inspect the 4-pad island for carbon; clean thoroughly – carbon here raises CS noise.
    2. Verify the RCD clamp (R32–D5–C18 in your sketch) is <1 % burnt; replace if R is >240 Ω or cracked.
    3. Fit FM3783BA (pin-1 marker toward the opto hole, same orientation as original).
    4. Power through a 60 W bulb first time; expect 5.2 V and 12.2 V rails within 500 ms.
    5. Full-line soak 15 min – IC junction temperature should stabilise <90 °C; BA grade normally sits at ≈70 °C in this board.

    Availability snapshot (21 May 2025)
    • LCSC: FM3783BA in tape – 83 k, 0.086 € pc; AA – 120 k, 0.082 € pc.
    • AliExpress: vendors “IC-Store”, “BOMBom” list LP3783B / FM3783BA at 10 pcs = 4 USD shipped.
    • No export restrictions – CE & RoHS declarations attached to the chip family.

    Possible disclaimers / safety notes
    • Same 700 V MOSFET → withstands your breaker’s 2 kV surge test, but only if the snubber diode is fast (UF4007 or ES1J).
    • If the original failure was lightning, also check MOVs on the little blue board under the input lugs – they often split and place a dead short on the SMPS primary.

    Suggestions for further research
    • For volume repairs you may stock FM3783BA, SY7638E, and LinkSwitch-TN2 LNK364DG – the three together cover >90 % of Chinese PSR fly-backs in smart breakers, meters, G4 chargers.
    • If you ever redesign the board, move the SMPS to LinkSwitch-TN2: PI publishes full CB-scheme safety reports, simplifying certification in EU/US.

    Brief summary
    FM3783AA/BA (and the LP3783B alias) are genuine primary-side-regulated fly-back controllers with the identical pin-out and control scheme as ICW2540.
    • Drop-in compatible.
    • Choose BA for lower MOSFET RDS(on); AA works if BA is unavailable.
    No component changes are strictly necessary; at most tune the sense resistor if you want the exact same peak current as before. Your dual-output (non-isolated 5 V + isolated 12 V) topology is fully supported. Good luck with the repair!
    You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.
  • #21 21556806
    morgan_flint
    Level 14  
    I'm sorry for hijacking this thread with the repair issue; I thought it was going to take fewer posts...

    Anyway, if somebody is interested, I've continued the discussion in an ad hoc topic.

Topic summary

The discussion revolves around the Tuya 3-phase energy meter, specifically its capabilities, firmware modification, and integration with Home Assistant. The user plans to test the device's web access for measurements and explore the TuyaMCU communication protocol to enable local operation without cloud dependency. Concerns are raised regarding the BL0942 chip's measurement capabilities, the isolation of the RS485 interface, and the safety of the device's programmable functions. Users also discuss the potential for tariff management through Home Assistant, as the Tuya app lacks such features. The device is noted for its high cost domestically, with cheaper alternatives available from China.
Summary generated by the language model.
ADVERTISEMENT