logo elektroda
logo elektroda
X
logo elektroda

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

elbuit 
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:


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.




It is based on a WB2S with BK7231T and a BL0937 to monitor electrical parameters such as voltage, intensity and power consumption.



Unfortunatelly there is not brand or label on the outside or even on the PCB.





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



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.

About Author
elbuit wrote 10 posts with rating 6 . Been with us since 2020 year.

Comments

p.kaczmarek2 01 Feb 2023 06:31

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. Configuration looks 100%... [Read more]

elbuit 01 Feb 2023 10:01

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

p.kaczmarek2 01 Feb 2023 10:06

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

elbuit 01 Feb 2023 20:07

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. https://obrazki.elektroda.pl/4349331600_1675278090_thumb.jpg... [Read more]

%}