logo elektroda
logo elektroda
X
logo elektroda

[BL602/BL0937] Yet another Smart Socket 20A (but 16A)

flobuljeedom  117 18693 Cool? (+5)
📢 Listen (AI):

TL;DR

  • An Aubess smart plug from AliExpress uses an SM-028_V1.3 board with a BL602L02 chip and BL0937 power-monitoring IC.
  • The module was flashed with Bouffalo Lab Dev Cube through soldered FTDI232L connections on RX, TX, 3V3, and GND, with BT tied to VCC through 10 kΩ.
  • BL0937 CF1 connects to GPIO3, CF to GPIO14, SEL to GPIO21, LED to GPIO20, relay to GPIO2, and button to GPIO17.
  • Wi‑Fi setup succeeded after flashing, but the web app still shows zero power values, suggesting the BL0937 driver or HAL interrupt handling is still incomplete.
Generated by the language model.
I bought a Smart Plug from Aliexpress: https://fr.aliexpress.com/item/1005005790622741
They are named Aubess on the website, but not on the packaging or on the socket.

Smart plug and its packaging from AliExpress. Smart plug and its packaging on a dark surface.

Easy to open with pliers.
Dismantled Smart Plug with visible circuit board.

Contains an SM-028_V1.3 with a BL602L02 chip.
Close-up of SM-028_V1.3 circuit board in a smart plug with two metal prongs.
And BL0937.
Close-up of the interior of a smart plug showing the circuit board and electronic components.

I soldered cables in the back of the SM-028_V1.3 between:
SM-028_V1.3 RX -> FTDI232L TX
SM-028_V1.3 TX -> FTDI232L RX
SM-028_V1.3 3V3 -> FTDI232L VCC (on 3V3)
SM-028_V1.3 GND -> FTDI232L GND
SM-028_V1.3 BT -> to a 10Kohm to VCC

And flashed it with Bouffalo Lab Dev Cube
Firmware flashing interface of Bouffalo Lab Dev Cube software

Then I disconnected all wires, remounted the socket, and put it on the plug.
And TADA! I entered my SSID and password and rebooted it.

Smart plug application interface on computer screen

I checked the circuit wiring on the PCB between BL0937 and BL602:
BL0937 CF1 -> BL602 GPIO3
BL0937 CF -> BL602 GPIO14
BL0937 SEL -> BL602 GPIO21
LED -> BL602 GPIO20
Relay -> BL602 GPIO2
Button -> BL602 GPIO17

(don't bother yet to check the LED and button) => TODO

But once configured, nothing showed up in the Web app (all values are zero)
Screenshot of OpenBL602 user interface displaying power data.

Current working template :
Code: JSON
Log in, to see the code

I saw some discussions about the BL0937 driver on BL602 not working because of HAL interrupt falling edge counter.
Is it already implemented?

About Author
flobuljeedom wrote 17 posts with rating 116 , helped 1 times. Live in city Paris. Been with us since 2023 year.

Comments

p.kaczmarek2 12 Dec 2023 18:27

Sadly the interrupt counter for BL0937 is still missing. I think there is an unfinished version: https://github.com/openshwprojects/OpenBK7231T_App/pull/862 Btw, can you also post a template for this... [Read more]

flobuljeedom 12 Dec 2023 18:35

I just updated the post with template and finals BL602 GPIO. [Read more]

flobuljeedom 28 Dec 2023 09:41

Thanks for the info. I tried correcting it, but I am not competent enough in C to include those changes. [Read more]

miegapele 20 Jan 2024 13:59

Got what looks like very similar socket, only button is on other pin, managed to solder and flash ( only destroyed one). Trying to add bl0937 support [Read more]

p.kaczmarek2 20 Jan 2024 14:08

I saw a PR, but is it working? I don't even have that kind of socket to check. Hmm [Read more]

miegapele 20 Jan 2024 14:10

No it's not, doesn't even compile, but I got builds working on my fork, so trying to make it work [Read more]

p.kaczmarek2 20 Jan 2024 15:13

It seems you are getting errors like: /home/runner/work/OpenBK7231T_App/OpenBK7231T_App/sdk/OpenBL602/customer_app/bl602_sharedApp/bl602_sharedApp/shared/src/driver/drv_bl0937.c:155:9:... [Read more]

miegapele 20 Jan 2024 16:20

Yes added that to try, but nothing happens, values always zero. No sure what else to try, could it be that some pin mapping is required like in W600? [Read more]

p.kaczmarek2 20 Jan 2024 16:37

Here is pins code for BL602: https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/hal/bl602/hal_pins_bl602.c From what I can see, there are no pin mappings there. So, are you sure that... [Read more]

miegapele 20 Jan 2024 16:48

bl_gpio_enable_input should already be called from the driver via HAL_PIN_Setup_Input_Pullup (GPIO_HLW_CF1); [Read more]

p.kaczmarek2 20 Jan 2024 17:23

Wait a minute. I had a report that during last few updates OTA has broken. Is BL602 OTA working for you? It would mean that we need to reduce BL602 binary again. [Read more]

miegapele 20 Jan 2024 17:31

It is working, but seems not 100% reliably. Sometimes I got starting OTA... and nothing happened, but after few retries it worked. This is with builds from my branch. [Read more]

p.kaczmarek2 20 Jan 2024 17:46

Can you print the values of variables increased in the interrupt? Are they really not changing? Have you set correct GPIO for the CF and CFI pins? Are variables set as volatile? [Read more]

miegapele 20 Jan 2024 18:32

Actually made some progress with latest try. Now getting some values at least :) https://obrazki.elektroda.pl/6884445200_1705771798_thumb.jpg So hopefully it's now just wrong pins somewhere. Will... [Read more]

p.kaczmarek2 20 Jan 2024 18:43

I suspect it;'s caused by too large flash binary, but I am not sure. I will try to reduce the size by stripping features that are not useful on BL602: https://github.com/openshwprojects/OpenBK7231T_App/pull/1044 Can... [Read more]

miegapele 20 Jan 2024 21:31

Good news, got it working. Now there is two things to solve here, I think these long sdk includes should not be here, it should be moved to HAL layer I think. However, not sure how interrupt stuff for... [Read more]

p.kaczmarek2 21 Jan 2024 09:21

That's very good news, nice job. We have source for register function, it seems to be using a linked list: static gpio_ctx_t *pstgpio_head = NULL; int hal_gpio_register_handler(void *func, int... [Read more]

miegapele 21 Jan 2024 10:31

Is the binary size really the issue here, seems little bit strange, because it should never work if there is not enough space. Now it works sometimes, so maybe actual ram use is the issue? Also, is there... [Read more]

p.kaczmarek2 21 Jan 2024 10:58

I'm just speaking from experience. We had OTA issue back then: https://github.com/openshwprojects/OpenBK7231T_App/issues/745 It was solved by reducing binary size. Do you think the cause may be different... [Read more]

FAQ

TL;DR: "All 5 devices are still available" after BL602 software-watchdog support. This FAQ is for BL602/BL0937 smart-plug owners who need one practical answer set for UART flashing, GPIO mapping, zero readings, OTA failures, and freeze recovery on SM-028_V1.3-class sockets. [#21032468]

Why it matters: These plugs can look identical outside but differ in button GPIO, OTA behavior, and crash recovery, so one wrong assumption can leave power metering at 0 or make the socket freeze.

Variant MCU/module Common button GPIO Best flashing path Typical issue in thread
SM-028_V1.3 smart plug BL602L02 17 UART + Bouffalo Dev Cube BL0937 stayed at 0 before interrupt support
RMC021 / similar BL602 plug BL602 / SM-028_V1.3 22 UART + OpenBeken/OpenBL602 Random freezes after minutes or hours
CB2S plug BK7231N Varies Use BK7231N firmware, not BL602 Wrong-thread / wrong-firmware risk
ESP8266 Tuya plug ESP8266 Varies OTA only if exploit works; otherwise UART Tuya-convert patched on older units

Key insight: The turning point was not the pin template alone. BL602 plugs started reporting BL0937 values reliably only after BL602-specific interrupt handling worked, and long-term usability improved further once chunked OTA erase and the software watchdog were added.

Quick Facts

  • The first confirmed SM-028_V1.3 wiring mapped BL0937 CF1 to GPIO3, CF to GPIO14, SEL to GPIO21, relay to GPIO2, LED to GPIO20, and button to GPIO17. [#20856171]
  • A later RMC021 template kept relay on GPIO2, CF1 on GPIO3, CF on GPIO14, LED_n on GPIO20, and SEL on GPIO21, but moved the button to GPIO22. [#21025378]
  • One BL602 OTA log showed the firmware partition at offset 0x000d8000 with size 0x00088000 or 544 Kbytes, while the incoming OTA size shown was 557056 bytes. [#20921739]
  • One power-stage repair check measured about 365 V on the BP2525 input, 5.2 V on its output, then only 1.8 V into LM1117 and 0.8 V out, indicating a board-side power problem rather than firmware alone. [#21026208]

How do I flash an SM-028_V1.3 smart plug with a BL602L02 over UART using an FTDI adapter and Bouffalo Lab Dev Cube?

Wire it as a 3.3 V UART job and boot the BL602 with BT pulled high through 10 kΩ. 1. Solder RX↔TX, TX↔RX, 3V3↔VCC, and GND↔GND between SM-028_V1.3 and the FTDI232L. 2. Connect BT to VCC through a 10 kΩ resistor. 3. Flash with Bouffalo Lab Dev Cube, then disconnect the wires, reassemble the plug, and enter Wi-Fi credentials in the web interface after reboot. [#20856171]

What GPIO template works for the BL602/BL0937 Smart Socket 20A or RMC021 plug, including relay, LED, button, CF, CF1, and SEL pins?

A working RMC021 template uses relay on GPIO2, BL0937 CF1 on GPIO3, CF on GPIO14, LED_n on GPIO20, SEL on GPIO21, and button on GPIO22. The startup command shown was startDriver BL0937; startDriver NTP; startDriver SSDP. That mapping produced working switching and metering on a BL602 socket sold as an eWeLink Smart WiFi Socket 20A with SM-028_V1.3 hardware. [#21025378]

Why do BL0937 readings stay at 0 on a BL602 smart socket even after flashing OpenBeken and setting the pin mapping?

They stay at 0 when BL602 does not count the BL0937 pulse interrupts yet. The thread explicitly states that the BL0937 interrupt counter on BL602 was still missing, so the web app showed only zeroes even after a correct-looking pin map and driver startup. In short, the template alone was not enough before BL602-side interrupt support existed. [#20858308]

What is the BL0937 energy metering chip, and how do its CF, CF1, and SEL pins interact with a BL602 in OpenBeken?

"BL0937" is an energy-metering IC that outputs pulse signals for electrical measurements, using separate logic pins instead of a digital bus. In this plug, CF1 went to GPIO3, CF to GPIO14, and SEL to GPIO21 on the BL602. OpenBeken then used those pulse lines plus the selector line to derive voltage, current, and power data from the socket hardware. [#20856171]

Why was BL0937 support on BL602 initially not working, and what interrupt-related changes were needed to make it report values?

It initially failed because the BL602 driver path was not actually counting incoming BL0937 pulses. The key change was to make the BL602 interrupt handlers fire for CF and CF1 so g_vc_pulses and g_p_pulses increased. The thread also points to BL602 GPIO interrupt setup, including hal_gpio_register_handler(...), and questions whether those handlers were being called at all. [#20919426]

Which button GPIO should I use on these BL602/BL0937 plugs when one board uses GPIO17 and another uses GPIO22?

Use the GPIO that matches your exact PCB revision, and switch to GPIO22 if GPIO17 leaves the button dead. A later user confirmed that after updating to OpenBL602_1.17.756_OTA.bin.xz.ota, the metering values were correct but the physical button still failed until Btn;1 was moved from GPIO17 to GPIO22. That makes GPIO22 the right fix for at least one later Tuya variant. [#21274357]

What is a software watchdog on BL602, and how does it help recover a smart plug that freezes and stops responding to web, ping, and MQTT?

"Software watchdog" is a recovery mechanism that reboots the MCU when normal code stops servicing a timer, giving a frozen device a chance to return without manual power cycling. In the thread, BL602 plugs later restarted with reboot reason BL_RST_SOFTWARE_WATCHDOG, and users reported that this kept previously freezing devices available. It does not cure the root bug, but it changes a hard freeze into an automatic reboot. [#21030199]

How can I make a BL602 smart plug restore the relay state after reboot or power loss using OpenBeken startup settings?

Set the relay start state to -1 in the OpenBeken Startup tab. That is the thread’s recommended retain-style setting for restoring the previous relay state after a reboot. It does not force permanent ON, but it tells the plug to come back in the last known state instead of always defaulting OFF. [#21064535]

Why does a BL602 plug still briefly cut power during a watchdog reboot even when the relay start state is retained?

It cuts power because the relay physically drops during the reboot window. One user measured the interruption as about half a second, and the reply was direct: there is no way to avoid that power interruption during this kind of restart. Retaining the start state restores the relay afterward, but it cannot keep mains continuous while the MCU reboots. [#21065227]

What caused unreliable OTA updates on BL602, and how did chunked flash erase improve OpenBeken OTA flashing stability?

The main OTA problem was slow flash erase blocking the HTTP update flow. A developer reported that once erase changed to chunks, OTA "now works very well." Earlier failures often stalled after receiving and writing a 253-byte chunk, which matched the theory that long erase operations were starving the connection rather than the image simply being too large. [#20944841]

Why does SetupEnergyStats make some BL602 smart sockets freeze exactly after the configured interval, and what should I check to debug it?

It points to a repeatable timer-triggered fault, not a random network issue. One user showed that SetupEnergyStats 1 60 60 froze the device after 59 seconds, while SetupEnergyStats 1 70 60 froze it after 69 seconds. First remove the command from Startup, then run it once manually, and capture the last serial or web log before the exact freeze time. [#20944817]

How can I troubleshoot a BL602 socket that freezes after minutes or hours even with only basic drivers like BL0937, NTP, or SSDP enabled?

Start by changing one variable at a time and watching whether the physical button still works. 1. Check free heap over time. 2. Note whether HTTP dies while the button still toggles the relay. 3. Test with fewer network-facing features to isolate the trigger. The thread suggests a possible TCP/HTTP allocation problem on BL602 when button control still works but the web server no longer answers. [#21026582]

BL602 vs BK7231N or ESP8266 in smart plugs — what differences matter for flashing method, stability, and firmware choice?

The chip family decides the firmware and often the flashing path. A CB2S module is BK7231N, not BL602, so BL602 firmware is the wrong choice for that hardware. ESP8266 plugs are different again; in the same discussion family, patched OTA routes left users needing soldered UART access. Verify the module name first, because identical-looking plugs can belong to completely different firmware ecosystems. [#21026358]

What is SSDP in OpenBeken, and how could SSDP-related traffic contribute to crashes or responsiveness issues on BL602 devices?

"SSDP" is a network discovery protocol that advertises devices on the local LAN, generating repeated multicast traffic during normal operation. In the thread, a developer recommended disabling the SSDP driver first because it "generates quite a lot of traffic," and that traffic was considered a plausible stress point for BL602 stability testing. It was not the only suspected cause, but it was an early isolation step. [#21025388]

What’s the safest way to open Aubess, Elivco, or LSPA9-style smart plugs without destroying the plastic housing before UART flashing?

Use a clamp-style twist method, or a pipe wrench if you do not have clamps. The thread explicitly recommends that approach as simpler and less destructive than random prying. It also notes that LSPA9-family plugs vary a lot in glue strength, so some units open easily while others feel almost plastic-welded. Slow, even force is safer than screwdriver levering. [#21139347]
Generated by the language model.
%}