Zry.IO

返回

背景

之前有好友推荐了一款支持 Tasmota 的智能插座 Athom PG01EU16A,从 AliExpress 以 €15.26 包邮购入两个,到货却发现虽然外观一模一样,但印着的型号却是 ELIVCO LSPA9

plugs

插座外部没有螺丝,根据这篇帖子 [存档],可以通过挤压顶部两侧来拆开它。

disassembled

硬件

拆开后看到 Wi-Fi 模块印着 CB2S,搜索可知这又是 Tuya 基于 Beken BK7231 系列 ARM SoC 的模块,第三次踩雷。

pcb-1

而且 CB2S 规格特殊,没有引脚排布与其相似的常见 ESP 模块:

cb2s

esp-modules

Source: https://www.iot-experiments.com/esp8266/

拆下模块后开始逆向电路,左下角的 IC 是 “AMS1117-3.3” 稳压器,用于提供 +3.3 V 电源;在它右侧的是 “BL0937” 交流电能监控 IC,用于测量插座的电压、电流及功率。

pcb-2

主要电路整理如下,元件标识按照 PCB 上的实际丝印,其余元件已略去:

schematic

可以换上一片常见的 ESP 模块,连接必要的引脚。

done

这里使用了一片 ESP-12F,选用的对应引脚为:

CB2SESP-12F
3V3VCC
GNDGND
P6GPIO5
P7GPIO4
P8GPIO2
RX1GPIO13
P24GPIO12
P26GPIO14

另外上拉 EN、 下拉 GPIO15 即可。

软件

ESPHome 配置示例:

BL0937 分压电阻计算

其中 hlw8012 组件的 voltage_divider 参数需要根据实际分压电阻计算得出,否则电压信息不准确:

voltage_divider (Optional, float): The value of the voltage divider on the board as (R_upstream + R_downstream) / R_downstream. Defaults to the Sonoff POW’s value 2351.

来源:https://esphome.io/components/sensor/hlw8012.html#configuration-variables

根据实际电路,这款智能插座中使用的分压电阻如下:

voltage-divider

其理论值应该为 (680×1000×3+1000)÷1000=2041,但实际结果并不准确;进行测试之后可以得到 1600 作为较准确的值,原因尚且不明。

之后即可在 Home Assistant 中直接接入:

hass

ELIVCO LSPA9 智能插座
https://zry.io/zh/smart-home/elivco-lspa9-smart-plug
作者 zry98
发布于 2022年2月11日
18 条评论
AE

Hello. I need to replace the IC which is located near C1. It is AC/DC converter, but I cannot see the maker/model/numbers on it.

zry98
@AE :

Hi, I see the marking is "BP2525" on the IC above C1 on my end. It seems to be a BP2525X from Bright Power Semiconductor, used for converting 220V AC to 5V DC.

AE
@AE :

OK. Thank you. My smart plug is one of the oldest. On my it says BP2902, but I could not find anything about it. The problem is that I have only about 4V DC, instead of 5V. And because of that the AMS1117 is not working properly, so the plug is faulty now. I checked the plug through connecting the AMS1117 to 5V externally, and the plug started to work properly with no issues whatsoever. So I figured it is this AC/DC converter that is faulty, because everything else on the board seems to be fine.

Anyway, I found BP2525F on Aliexpress, so I will replace it now and it should solve my problem.

riogrande75

In the meantime you can flash OpenBeken on this device witout changing the microcontroller.

Waschtl

Your analysis of the schematic is very helpful.
Thanks a lot for that.
There are ESP32C3 replacement boards available as well. They are called ESP8685 WROOM 03. I have not tried it yet but in very recent future. Using these Boards together with Tasmota even Matter support should be possible.

Yousaf

You can use tuya cutter on these Plugs or flash it via BK7321 GUI flash tool tool to esphome.

Oli

serch ESP-02S

Axel

Have you ever heard about OpenBeken ? it might be a better way, althougth i don't know if it's compatible with this model
https://github.com/openshwprojects/OpenBK7231T_App

Alex

Hello. I came here by accident, and I want to share good news. You do not need to change CB2S! This chip can be flashed to ESPHome (like almost all chips from TUYA). And you don’t even need to open it, it is patched on the air! See LibreTuya, CloudCutter.

Original comment:


Привет. Случайно сюда попал, и хочу поделиться хорошими новостями. Можно не менять CB2S! Этот чип можно прошивать в ESPHOME (как почти все чипы от TUYA). Причем не нужно даже вскрывать, прошивается по воздуху! Поищите - LibreTuya, CloudCutter.
Простите за мой английский :)

zry98
@Alex :

Hi Alex, thanks for your comment! I have been following LibreTuya's development since they started the project, but because it's a large and slow project, and it was barely usable at the time when I got my two plugs (early February 2022), I didn't choose it. If I buy any other devices using BK723X SoC in the future, I will definitely give it a try!


Привет, Алекс! Спасибо за комментарий! Я следил за развитием LibreTuya с самого начала проекта, но поскольку это большой и медленный проект, и к тому же он едва работал в то время, когда я купил две розетки (в начале февраля 2022 года), я не выбрал его. Если в будущем я куплю еще какие-либо устройства с SoC BK723X, то обязательно попробую LibreTuya!

Oscar P

Hi zry98, it is like this: https://templates.blakadder.com/ESP-02S.html
Many thanks again for your fast answer!!!

zry98

I had no idea that modules like this existed! it will make replacing CB2S modules with Beken SoC so much easier. However you will have to change the ESPHome config to match the GPIOs.

Oscar P

Hi Zry.io,
I'm thinking about replacing the old CB2S with an ESP02, do you think I could?
Apart from that I don't know how to flash it, I didn't even google it I'll find it out!!
thanks a lot!

zry98

Hi, if by ESP02 you mean those tiny ones with only 8 pins (5 usable IO pins), I think it's still possible to do the job by giving up the blue LED indicator (connected on P8).

Oscar P

Ok, I'll give a try tomorrow, thaks a lot for such a very quick answer!!!!

Oscar P

Hi again Zry.io, I'm afraid i need some help. Yesterday I tried with ESP02 replacing the old CB2S but for some reason the relay doesn't work. According to your schema, the pin that goes to the relay is P26 which corresponds to GPIO14 in my ESP02, I have tested it with and without inverted but it still doesn't work. Any hints? Could it be that the relay is somehow broken?
Many thanks
Oscar

zry98

Hi Oscar, are you sure it's an ESP02 with 8 pins like this? Since I've never used one of these, and couldn't find any other official docs other than this, it says that GPIO14 (although I only see GPIO15 in its photo) is also connected to CH_PD (CHIP_EN in datasheet) so it won't work as a GPIO. Can you confirm the model and pins?

dima

thank so much for your research! I'v redone successfully 3 plugs according to your method