logo elektroda
logo elektroda
X
logo elektroda

Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter

p.kaczmarek2 2316 8

TL;DR LABEL_AI_GENERATED

  • The GBDQA 63VA 16A DIN-rail relay/energy meter combines Tuya Wi-Fi control, programmable over/under voltage/current/power protection, and a bistable relay.
  • Inside, a BP2525 step-down converter, a separate Wi-Fi supply, and a BL0942 measurement chip feed a T1-U-HL module based on the BK7238.
  • The module was flashed with OpenBeken using a USB-to-UART adapter and BK7231GUIFlashTool, then GPIOs were mapped from a flash dump for relay and LED control.
  • After importing the JSON configuration and enabling measurement, the meter joined Wi-Fi, exposed an open AP at 192.168.4.1, and could pair with Home Assistant.
  • Calibration was still needed for accurate readings, and powering up during flashing can overload USB current because of an onboard capacitor.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
This content has been translated flag-pl » flag-en View the original version here
Listen:
  • Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Today I’m taking a look at a device that arrived from Slovenia – a reader sent it to me, along with a few other gadgets. The GBDQA is a Wi-Fi-controlled, Tuya-compatible module offering programmable protection against over- or undervoltage, over- or under-current, or excessive power, as well as a built-in bistable relay. Here, I’ll show you its innards and modify it so that it works without the cloud, 100% locally, and can be connected to Home Assistant.
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    The reader has already drilled out the rivets; unfortunately, there are no screws here. It will be trickier to put it back together later, but it’s still no more difficult than programming LED lights, for example.
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Let’s take a look inside. The circuit board is surprisingly small. How did they manage to fit the communication circuitry and the power supply in there? We’ll find out in a moment.
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    You can also see a bistable relay – it only requires power to switch states and, by its very nature, retains its state after power is lost – as well as a current transformer used to measure current.
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    The other side of the PCB reveals further details – power is supplied by a BP2525 step-down converter; just behind it is a separate small converter to power the Wi-Fi module, whilst the BL0942 handles the measurement. It probably communicates with the main controller via UART, as usual.
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    That leaves the Wi-Fi module – the T1-U-HL, which is a newer version of the CBU. It’s no longer the BK7231N, but the BK7238! However, this chip also supports OpenBeken , which is the recommended solution for freeing this type of device from the cloud.
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    The pads are in the same places; you can flash the firmware.
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    You’ll need a USB-to-UART converter and our flasher:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    Solder the power supply and the RX and TX pads. Connect TX to RX, and RX to TX. The Wi-Fi module operates at 3.3 V; the USB supply is 5 V, but you can solder a capacitor in series before the second converter. Even based on its rated voltage (10 V), it’s clear that the first converter likely outputs 5 V and the second 3.3 V.
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Of course, we carry out all this with the device disconnected from the mains. The flasher will now require the device to be restarted to begin the flashing process. However, there is a problem here, as there is a capacitor on the board, so restoring the power supply causes the current surge drawn through it to overload the USB port. For this reason, I used a second cable for the power supply:
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    First, you need to make a flash copy. This will allow you to discover the GPIO configuration.
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Tuya JSON:
    Code: JSON
    Log in, to see the code

    Verbal interpretation:
    
    Device seems to be using T1-U module.
    - WiFi LED on P15
    - LED (channel 1) on P21
    - Button (channel 1) on P17
    - Bridge Relay On on P8
    - Bridge Relay Off on P6
    

    This will help us with the configuration. You can now flash the OBK:
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Once uploaded, an open AP will be created – you can configure your network settings via the IP address 192.168.4.1:
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    The device will join your Wi-Fi network:
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Then, in the Web App You can import the JSON file downloaded by Flasher:
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    This should allow us to control the relay:
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    All that remains is to enable the measurement system – enter the command in ‘short startup command’ and reboot:
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    We now have measurements, but they are not perfect:
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Calibration is required – just as in Tasmota. A second meter is needed; connect it before the one being calibrated, then apply a sample resistive load, e.g. a light bulb, and enter the readings from it into the Web App:
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    You might also consider subtracting the power consumption of the gadget itself here, but these are negligible values. From this point onwards, the values displayed on the panel will be similar to those shown by the meter used as a reference.

    You can now pair the device with Home Assistant, but we’ve already shown how to do this on our channel:




    To sum up, the device is tiny and compact, yet it can carry out automations. Normally via the Tuya cloud – but following my intervention, it now operates entirely locally. Thank you for providing me with this equipment for testing; I’ll be testing the remaining devices from the package, after which the whole lot will be returned to the reader. Do you use modules of this type? Please feel free to comment.
    PS: A copy of the original post: https://github.com/openshwprojects/FlashDumps/commit/5d9b9c30284a0d2120ee75f4412199667a231b04

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 14771 posts with rating 12914, helped 659 times. Been with us since 2014 year.
  • ADVERTISEMENT
  • #2 21936321
    zbyszekkr
    Level 17  
    Posts: 231
    Help: 9
    Rate: 74
    I bought a similar EARU EAWCBT-J 63A relay. The current measurement is designed differently. It doesn’t have a current transformer, just a shunt.
    I’ll get round to removing the cloud this morning. It will be used to switch on the charger for the electric dumper truck.
  • BK7238 flash erase failure causing soft brick

    #3 21936360
    LinearBridge1
    Level 2  
    Posts: 3
    I’m having a persistent problem when trying to flash OpenBeken onto a Tuya smart prepayment switch fitted with a BK7238 (T1) chip. I’ve spent many hours on this and tried almost every troubleshooting method available, but I’ve completely hit a dead end. I would be very grateful for any advice from the experts on this forum.

    Below is a detailed description of my hardware, the nature of the problem and all the diagnostic steps I have taken so far:

    1. Hardware and configuration



    **Target device:** Tuya smart prepaid switch (based on TuyaMCU, 9600 baud transmission speed).

    **Wi-Fi module:** BK7238 (internal T1 platform).

    **Power supply:** External laboratory power supply set to a stable 3.3 V (capable of delivering high current), monitored using an ammeter.

    **UART adapter:** Initially an FT232RL (which later failed the loopback test); I am currently using an Arduino Uno as a USB-TTL adapter (the RESET pin connected to GND).

    **Wiring:** The common ground (GND) is 100% connected between the laboratory power supply, the chip and the UART adapter.

    2. Timeline (how the problem began)



    Phase 1 (Complete success)



    I successfully connected to the chip and flashed the original firmware using the BK7231 GUI Flash Tool. The backup was created correctly, and the tool read the Tuya configuration without any issues (Platform: T1, Baud: 9600, TuyaMCU presence confirmed).

    Phase 2 (Failure)



    I clicked the flash button to upload the OpenBeken firmware. The process began but ended in an error precisely at the first stage of memory erasure, with the following message:

    failed, will retry! Erasing block 0x00...failed with serial.BytesToRead 0 (expected 16)


    Phase 3 (Current status)



    Since this error occurred during erasure, the chip appears to be in a state of partial software failure (‘soft brick’). Every time I try to reprogram it, I get an endless loop of errors:

    Getting bus failed, will try again - 0/100!


    until:

    99/100


    and then:

    Failed to get bus!


    3. Diagnostic steps I have already carried out (over 100 attempts!)



    To save you time, below is a list of all the tests I have already carried out:

    * **Power cycle synchronisation:** I disconnected the 3.3 V cable, clicked ‘Flash’ in the GUI, and – precisely when the message
    Getting bus... 0/100
    appeared, I reconnected the 3.3 V cable to create a sharp rising edge on the power supply. No response.

    * **Resetting the CEN pin:** I left the power on, started the flashing process and, for about 0.5 seconds, shorted the CEN pin to GND during the
    Getting bus
    loop. I also tried the ‘Woodpecker’ method (rapid, repeated shorting to GND). No result.

    * **Diagnostics with an ammeter:** The chip draws a normal current in the range of 30 mA to 80 mA when powered, indicating that it has not been physically damaged. When I short-circuit CEN to GND, the current draw drops to around 0 mA, which confirms that the internal reset circuit is functioning correctly.

    * **Baud rates:** I tried changing the flasher’s baud rate to 115200 baud, and then back to 921600 baud.

    * **Changing the UART adapter:** After the loopback test on my FTDI adapter failed, I switched to using an Arduino Uno (RESET to GND) as a serial bridge. (Note: in this configuration, I connected TX to TX and RX to RX in accordance with the requirements for this workaround).

    Attempting to recover the device



    Is there a specific ‘hard recovery’ method or an alternative tool (such as
    hid_download_py
    or
    Beken Writer 1.60
    ) for the BK7238 chip, which failed precisely during the
    Erasing block 0x00
    operation?

    I have a safely stored backup of the original firmware, but I simply need to get the communication bus to respond again. Thank you in advance for your time and any help!

    **BK7238 (T1) is stuck on the message “Getting bus failed” following a memory erase error — is the chip in a soft-bricked state?**




    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter Internal components and firmware update for the GBDQA 63VA 16A DIN-rail relay/energy meter
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #4 21936592
    Blisk
    Level 9  
    Posts: 51
    >>21935788 This is great now I can flash some more I have 6A, 10A and 16A fuses. I will let you know how is going.
    Did you try to make short circuit to see if it will turn off and how much it takes?
  • #5 21936601
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14771
    Help: 659
    Rate: 12914
    This device does not have a "true" overcurrent protection. The protection must be done programmatically. Either via BL0942 directly (if supported - we need to check in datasheet) or via OpenBeken script - just one single line will handle it, we have "addChangeHandler" command.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #6 21936608
    Blisk
    Level 9  
    Posts: 51
    >>21936601 ok. In real this is a house fuse which is connected to cloud and you can turn it on and off remotelly and also is fuse for protect devices.
  • ADVERTISEMENT
  • Software-only overcurrent protection lacks hardware cutoff

    #7 21937549
    CosteC
    Level 39  
    Posts: 5378
    Help: 401
    Rate: 1669
    p.kaczmarek2 wrote:
    programmable protection against excessively high or low voltage, current or power

    A marvellous invention.
    Perfect for fires and electric shocks, because all that stands between an overload or accidental activation is ‘some software’. Plus, it’s remotely controlled by a server somewhere out there. Or locally.

    Tests? Don’t bother, it’s cheap.
    Measurement accuracy? Don’t bother, it’s cheap.
    Cybersecurity? Don’t bother, it’s cheap.
    Ability to cut off overloads and short circuits? Don’t bother, it’s cheap.
    Resistance to interference? Don’t worry about it, it’s cheap.

    p.kaczmarek2 wrote:
    This device does not have ‘proper’ overcurrent protection. Protection must be implemented via software. This can be done either directly using the BL0942 (provided this is supported – check the datasheet) or using an OpenBeken script – a single line of code is all it takes; the ‘addChangeHandler’ command is available.

    Note: This is code that may or may not execute; it is not code executed within a specific time frame, nor is it written securely. It controls a relay that may or may not disconnect.

    And now you can start complaining that I’m exaggerating.
  • #8 21937609
    Blisk
    Level 9  
    Posts: 51
    Yes it is possible, like everything else. But modern houses use there fuses.
  • Recommend DHCP reservation and 2.4 GHz Wi-Fi check

    #9 21937657
    herman434
    Level 2  
    Posts: 2
    Help: 1
    Rate: 1
    Nice teardown and guide. The GPIO mapping and OpenBeken configuration will definitely save others some time. One thing I would also recommend is checking that your router assigns a DHCP reservation after flashing, so the device always keeps the same IP and is easier to manage in Home Assistant. If anyone has trouble connecting the device to Wi-Fi after flashing, reviewing the router 2.4 GHz settings can also help.
Listen:
ADVERTISEMENT