logo elektroda
logo elektroda
X
logo elektroda

[BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)

elbuit 2781 4
ADVERTISEMENT
  • Hi everyone.
    I would like to add a teardow of a generic tuya smartplug based on a wb2s.
    I have bought this device some time ago from aliexpress:
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)

    It came with tuya 1.3.5 and I installed OpenBeken using tuya cutter for a BK7231T and selected the Generic Tuya NAS WR07W 16A smart plug.
    Seems quite similar to LSPA7 https://www.elektroda.com/rtvforum/topic3932742.html#20300613 or Model: PE-01E IP44 https://www.elektroda.com/rtvforum/topic3927458.html
    From outside is identical to LSPA9, but the led is blue instead of purple such as LSPA9.
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)

    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)
    It is based on a WB2S with BK7231T and a BL0937 to monitor electrical parameters such as voltage, intensity and power consumption.
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)

    Unfortunatelly there is not brand or label on the outside or even on the PCB.
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937) [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)

    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937) [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)

    Button is connected to PIN 1TX
    LED(negative) is connected to PIN PWM0

    I've used configuration from Model: LSPA7 and modified button pin to 11
    Pin 6: WifiLED_n on channel 0
    Pin 7: BL0937CF on channel 0
    Pin 8: BL0937CF1 on channel 0
    Pin 11: Button on channel 0
    Pin 24: BL0937SEL on channel 1
    Pin 26: Relay on channel 0

    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)

    I followed this guide: https://www.elektroda.com/rtvforum/topic3887748.html to calibrate the device.
    I didn't have a power meter close so I'll use my multimeter as an approach to calibrate this with a 100W bulb as a load.
    Without load it measures:
    Quote:
    BL0937 Voltage=194.169738, Current=0.000000, Power=0.000000

    But multimeter shows 227V, so in the log tab of the app I entered this value:
    Quote:
    VoltageSet 227

    And got Voltage correction:
    Quote:
    Info:EnergyMeter:VoltageSet: you gave 227.000000, set ref to 0.145886

    So, I went on and turned on the bulb
    Quote:
    BL0937 Voltage=227.583541, Current=0.358631, Power=72.000000

    Voltage is corrected but not power and current
    Power should be 100W so in the log tab I did the same with power:
    Quote:
    PowerSet 100
    Info:EnergyMeter:PowerSet: you gave 100.000000, set ref to 1.666666

    If we consider P=V*I, current should be 100/228=0.44A
    Quote:
    CurrentSet 0.44
    Info:EnergyMeter:CurrentSet: you gave 0.439999, set ref to 0.012941



    Theese corrections will be added automatically, so you won't need the following steps.
    Thanks to p.kaczmarek2 for the help.

    Spoiler:

    So I got 3 corrections for BL0937 chip:
    Quote:
    VREF 0.145886
    IREF 0.012941
    PREF 1.666666


    It's time to make these values permanent, so in app page filesystem tab I created a autoexec.bat file and added these lines:

    startDriver BL0937
    VREF 0.145886
    IREF 0.012941
    PREF 1.666666


    The only thing that I couldn't make work is enable or disable relay when I push the button.
    But I think that I missed something because I am a OpenBeken newbie.

    Cool? Ranking DIY
    About Author
    elbuit
    Level 6  
    Offline 
    elbuit wrote 10 posts with rating 6. Been with us since 2020 year.
  • ADVERTISEMENT
  • Helpful post
    #2 20416077
    p.kaczmarek2
    Moderator Smart Home
    Hello, thank you for the teardown. Here are my hints:
    elbuit wrote:

    startDriver BL0937
    VREF 0.145886
    IREF 0.012941
    PREF 1.666666


    Hmm since several months it's no longer required to save REFs by hand, they are saved automatically like in Tasmota.

    elbuit wrote:

    The only thing that I couldn't make work is enable or disable relay when I push the button.
    But I think that I missed something because I am a OpenBeken newbie.

    Configuration looks 100% correct. I'd rather say that your button is not on P10 in reality. Maybe just try brute-forcing all pins and see which reacts?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20416310
    elbuit
    Level 6  
    p.kaczmarek2 wrote:
    Hello, thank you for the teardown. Here are my hints:
    Hmm since several months it's no longer required to save REFs by hand, they are saved automatically like in Tasmota.

    Edited.

    p.kaczmarek2 wrote:
    Configuration looks 100% correct. I'd rather say that your button is not on P10 in reality. Maybe just try brute-forcing all pins and see which reacts?


    Brrr, I followed the wires and the button went to 1TX instead of 1RX.
    Edited and corrected in the main post.

    Thanks for your help.
  • ADVERTISEMENT
  • #4 20416322
    p.kaczmarek2
    Moderator Smart Home
    Okay, so it has different pin for button.

    Now, we already have a LSPA9-like looking plug in our templates list. Are you able to give me some specific info how to tell between old LSPA and that plug? Maybe there was some kind of model name on case, or on packaging, etc? Or are they virtually the same from outside?
    Helpful post? Buy me a coffee.
  • #5 20417417
    elbuit
    Level 6  
    p.kaczmarek2 wrote:
    Okay, so it has a different pin for the button.

    Now, we already have a LSPA9-like looking plug in our templates list. Are you able to give me some specific info on how to tell between the old LSPA and that plug? Maybe there was some kind of model name on the case, or on packaging, etc? Or are they virtually the same from outside?

    I bought this from aliexpress, but now it is not available:
    https://es.aliexpress.com/item/1005001845474874.html

    Unfortunately, there is no brand or label on the outside or even on the PCB.
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937) [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)
    From outside it is identical to LSPA9, but the led is blue instead of purple such as LSPA9.
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)
    But this device is a WB2S with a BL0937 meter.

    I've tested with the parameters of the first post and it works really fine
    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)
    If I cut off wifi from my AP, the led starts blinking but when it reconnects the led stays on without blinking.

    Button OK
    Wifi led OK
    relay OK
    energy meter OK

    [BK7231T / WB2S] Teardown generic tuya Smart Plug with Energy Meter (BL0937)



    @p.kaczmarek2 thanks for your help and for OpenBeken.
ADVERTISEMENT