logo elektroda
logo elektroda
X
logo elektroda

Tuya power sensor BK7231N HLW8112 OpenBeken HLW8112SPI driver setup

User question

I have a Tuya Power sensor with clamp (CT). The chipset is CBU/BK7231N and the measure chip is HLW8112 2404R1D.
I installed the specific OpenBeken firmware: OpenBK7231N_QIO_1.18.287.bin
I can access the sensors' OpenBK7231T_App (version 1.18.287): Web Interface and Web Application.
Please help me configure and start the HLW8112 driver, because I can't read anything and I can't find the HWL8112 specific pin settings

Artificial Intelligence Response

Direct answer to the question

Your problem is most likely not a pin-setting mistake first; it is that you flashed the generic OpenBeken build, while your meter needs the dedicated HLW8112SPI driver build. In current OpenBeken, HLW8112SPI is a separate driver, while BL0937 is the one that uses CF/CF1/SEL pins. That is why you cannot find the expected HLW8112 pin settings in your present firmware. The official 1.18.287 release includes a dedicated image named OpenBK7231N_1.18.287_hlw8112.rbl. For the PM01_A002-style BK7231N clamp meter family, a reported working configuration is GPIO9 = HLW_8112_SCSN, then start the driver with startDriver HLW8112SPI. (raw.githubusercontent.com)

Key points


Detailed problem analysis

The main confusion here is that OpenBeken supports multiple energy-metering chips with different interfaces, and the web UI options depend on the firmware build. The official drivers list distinguishes:

  • BL0937: custom protocol, requires CF / CF1 / SEL pin assignment.
  • HLW8112SPI: separate driver, enabled only when compiled with ENABLE_DRIVER_HLW8112SPI. (raw.githubusercontent.com)

So the offline advice that treats your HLW8112 like a UART meter or like a BL0937-style pulse meter is not the right path for this device family. For your BK7231N + HLW8112 clamp meter, community testing around the PM01_A002-type hardware indicates that the metering IC is connected directly over SPI, and OpenBeken expects the HLW8112SPI driver, not TuyaMCU and not BL0937-style pin roles. (elektroda.com)

That also explains your exact symptom:

  • You flashed OpenBK7231N_QIO_1.18.287.bin.
  • In the release set for 1.18.287 there is a separate asset named OpenBK7231N_1.18.287_hlw8112.rbl.
  • Therefore, the generic image you installed is very likely missing the HLW8112 driver and its related pin role(s). (github.com)

For this family of boards, the commonly reported working template is minimal and uses:

"9": "HLW_8112_SCSN;0",
"24": "WifiLED_n;0",
"26": "Btn;0"

and then:

startDriver HLW8112SPI

This is important because it suggests that, on this board variant, the pin you need to expose in module config is the chip-select/SCSN pin, not a BL0937-style CF/CF1/SEL triplet. (elektroda.com)

Practical interpretation

For your device, the correct sequence is:

  1. Keep your device on OpenBeken, since you already have network access.
  2. Use the OTA update function in OpenBeken Web App.
  3. Flash the official asset:
    OpenBK7231N_1.18.287_hlw8112.rbl
  4. After reboot, go to Config → Pins.
  5. Set:
    P9 = HLW_8112_SCSN

    and, if your board matches the known template:

    P24 = WifiLED_n
    P26 = Btn
  6. Open the console and run:
    startDriver HLW8112SPI
  7. If it works, put the same line into startup / autoexec.bat so it starts automatically on boot. (github.com)

What to expect after that

If the driver is present and the pin is correct:

  • the console should no longer say “Driver HLW8112SPI is not known in this build”;
  • readings for voltage/current/power-related channels should start appearing. Community testing reported voltage, frequency, current A/B, power A/B, energy import/export, active power, power factor, and Home Assistant discovery on working builds. (elektroda.com)

If you still get the message:

Driver HLW8112SPI is not known in this build

then the firmware image is still the wrong one. That message is explicitly associated with builds where the HLW8112 driver is not compiled in. (elektroda.com)


Current information and trends

As of the official OpenBeken release 1.18.287 published on April 11, 2026, the BK7231N release page includes both:

  • generic OpenBK7231N_1.18.287.rbl
  • dedicated OpenBK7231N_1.18.287_hlw8112.rbl
  • and also a powerMetering variant. (github.com)

That means HLW8112 support is no longer only a private branch/community artifact situation; there is now an official release asset specifically for it. The official commands list also includes HLW8112-specific console commands such as HLW8112_read_reg and HLW8112_SetResistorGain, which indicates active integration of the driver into current OpenBeken builds that include it. (github.com)


Supporting explanations and details

Why you could not find the “HLW8112 specific pin settings”

Because in your current build:

  • the driver is probably absent, so the special role does not appear;
  • and even in the correct setup, this chip is not configured with BL0937-style CF/CF1/SEL roles. (raw.githubusercontent.com)

Exact configuration to try

Use this as your first test configuration:

Firmware:
OpenBK7231N_1.18.287_hlw8112.rbl
Pins:
P9 = HLW_8112_SCSN
P24 = WifiLED_n ; only if your board matches the known template
P26 = Btn ; only if your board matches the known template
Startup command:
startDriver HLW8112SPI

(github.com)

Useful test commands

After the driver starts, try:

GetReadings

and, if needed later, the documented HLW8112-specific commands such as:

HLW8112_read_reg
HLW8112_SetResistorGain

The command names are present in the official commands list. (github.com)

If readings are off by a factor

A report on this device family mentions a 5× current/power-related scaling issue, and one user corrected it with:

HLW8112_SetResistorGain 0 1000 1

They also noted that using 1 as the first argument caused voltage to jump incorrectly, so that parameter matters. I would treat this as a device-family-specific tuning step, not the first configuration step. Get communication working first. (elektroda.com)

If A/B channels look swapped

One report says the physical clamp/channel labeling can appear swapped relative to what the firmware reports. So if values appear on the “wrong” current channel, do not immediately assume the driver is broken. (elektroda.com)


Ethical and legal aspects

  • This is a mains-connected measurement device. Make configuration changes from the web UI where possible and avoid probing a live PCB unless you are fully equipped and experienced.
  • If you open the enclosure, maintain insulation distances and CT wiring integrity.
  • If this device is used for any billing, compliance, or safety-critical purpose, treat OpenBeken readings as non-certified unless you independently validate calibration.

Practical guidelines

Recommended implementation method

  1. OTA flash the official HLW8112 image:
    OpenBK7231N_1.18.287_hlw8112.rbl

    (github.com)

  2. Set:
    P9 = HLW_8112_SCSN

    (elektroda.com)

  3. Start:
    startDriver HLW8112SPI

    (elektroda.com)

  4. Verify that the console does not show:
    Driver HLW8112SPI is not known in this build

    (elektroda.com)

  5. If readings appear, add the startup command permanently.

Best practices

  • Change only one variable at a time: firmware first, then pin role, then calibration.
  • Save a screenshot of your current pin map before changing anything.
  • If your board is not exactly the PM01_A002-style variant, treat P9 as a strong starting point, not an absolute guarantee. (elektroda.com)

Common failure modes

  • Wrong build: no HLW8112 driver/pin role visible. (elektroda.com)
  • Wrong SCSN pin: driver starts but no valid readings.
  • Calibration/scaling issue: readings present but numerically wrong. (elektroda.com)

Possible disclaimers or additional notes

  • The P9 = HLW_8112_SCSN mapping is confirmed for a specific family of Tuya BK7231N + HLW8112 clamp meters, not necessarily every HLW8112 board ever made. (elektroda.com)
  • The official driver documentation still marks HLW8112SPI as “TODO” in description, so some behavior may still be less polished than older power-meter drivers. (raw.githubusercontent.com)
  • Community testing has been good, but some calibration behavior remains under refinement. (elektroda.com)

Suggestions for further research

If the above does not work, the next most useful items are:

  • a photo of the PCB front and back,
  • your current Config → Pins screenshot,
  • the console log after running:
    startDriver HLW8112SPI
  • confirmation whether your board matches the PM01_A002-style layout with button on P26 and Wi-Fi LED on P24. (elektroda.com)

Brief summary

You are very close. The main issue is that you flashed the generic OpenBeken build, but your sensor needs the HLW8112-specific SPI build. For current OpenBeken, the correct path is:

Flash: OpenBK7231N_1.18.287_hlw8112.rbl
Set: P9 = HLW_8112_SCSN
Run: startDriver HLW8112SPI

Do not look for BL0937-style CF/CF1/SEL settings for this device. Those belong to a different driver. (github.com)

If you want, I can next give you a click-by-click procedure for the OpenBeken web UI, or help you build an exact autoexec.bat and pin template JSON for your unit.

Ask additional question

Wait...(2min)
Disclaimer: The responses provided by artificial intelligence (language model) may be inaccurate and misleading. Elektroda is not responsible for the accuracy, reliability, or completeness of the presented information. All responses should be verified by the user.