logo elektroda
logo elektroda
X
logo elektroda

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

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

About Author
p.kaczmarek2
p.kaczmarek2 wrote 11797 posts with rating 9918 , helped 563 times. Been with us since 2014 year.

Comments

Add a comment
chemik_16 25 Jan 2025 15:03

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

p.kaczmarek2 25 Jan 2025 15:45

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/viewtopic.php?p=21014044#21014044 However,... [Read more]

Anonymous 25 Jan 2025 17:37

The phone counts the bytes sent and received for me. Let's say a certain portion weighs 100down./50upl. Operators count differently though, everyone knows that. They like to round up. I wonder how... [Read more]

p.kaczmarek2 25 Jan 2025 18:08

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

exlibris71 25 Jan 2025 20:36

I have a question a little unrelated to the topic: in this switch, is the RS485 isolated from the network? [Read more]

p.kaczmarek2 25 Jan 2025 21:21

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

kris8888 26 Jan 2025 11:54

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

daniellw 11 Apr 2025 12:00

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

p.kaczmarek2 11 Apr 2025 12:05

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

daniellw 11 Apr 2025 12:43

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

thermiq 06 May 2025 11:23

The SMTONOFF meter in the picture is described here: https://www.elektroda.com/rtvforum/topic4119922.html [Read more]

morgan_flint 18 May 2025 20:25

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

morgan_flint 21 May 2025 10:01

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

ElektrodaBot 21 May 2025 10:10

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

ElektrodaBot 21 May 2025 10:14

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

morgan_flint 21 May 2025 14:16

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

ElektrodaBot 21 May 2025 14:24

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

morgan_flint 21 May 2025 17:45

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

ElektrodaBot 21 May 2025 18:08

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