Smartconnect product from the dollar store

It is almost Christmas and it is darker outside, so I added some lights in the loft. The chosen lights are the crappy ‘LSC smart connect’ light. Personally, I do not like a product where you need to connect it to a mobile application before you could manually enable disable the lights. As the website of describes, it would be fairly easy to enable but it quit cheap and they use a general chip (BK7231T), sort of ESP32 device with a bit more ADCs.

beun design I do not think they actually designed the PCB, because a reference website [tuya]( shows exactly the desired design.

Chip BK7231T

The chip BK7231T, has some nice features tuya

Communications Wi-Fi standard Rate Transmitted/received power Typical value
Transmit 802.11b 11 Mbit/s +17 dBm 220 mA
Transmit 802.11g 54 Mbit/s +14 dBm 200 mA
Receive 802.11g 54 Mbit/s -10 dBm 104 mA
Receive 802.11n MCS 7 -10 dBm 124 mA

The following infromation is not yet verified Embedded low-power 32-bit CPU, which can also function as an application processor:

  • Clock rate: 120 MHz
  • Working voltage: 3.0 V to 3.6 V
  • Peripherals: 9 GPIOs, one universal asynchronous receiver/transmitter (UART), and Xanalog-to-digital converter (ADC)
  • Wi-Fi connectivity
  • 802.11b/g/n
  • Channels 1 to 14 at 2.4 GHz
  • Support WEP, WPA/WPA2, WPA/WPA2 PSK (AES) security modes
  • Up to +16 dBm output power in 802.11b mode (losses due PCB design)
  • On-board PCB antenna with a gain of -1.0 dBi (actually different :/)
  • Working temperature: -40°C to +85°C
  • Bluetooth LE
    • Support Bluetooth (V4.2)
    • Maximum output power + 6dBm
    • Onboard PCB antenna

The following figure shows the reference design for the chip. original design

Reading logs

There are two types of serial: device updating (U1, 3M baud), and logging (U2, 115200 baud). In the following figure, the U2 is connected with a random FTDI 3.3V. However, all my pico probe debuggers where at my companies desk :(.

serial monitor

The device that I have laying around, was already connected to a random WiFi hotspot, and is disabled. The following was the output of the serial logging output U2. I removed the timestamp with ~, for the looks. The ~00:00 means minuts:seconds.

## Commands:
# Windows terminal
plink -serial COM15 -sercfg 115200,8,1,n,n

# linux
screen /dev/ttyUSB0 115200

Software versions and pinout

From the terimal output the log shows the TUYA IOT SDK:

  • Version: 1.0.8
  • BS:40.00_PT:2.2_LAN:3.3_CAD:1.0.2_CD:1.0.0

From the code committed in the repo from Tuya github:

1: Project Information 5-way pwm bulb light
Chip platform: bk7231T 2M
Module: WB3S
**2: Hardware configuration information: **
Drive mode: PWM
G IO24
B IO26
**3: PWM configuration information: **
Frequency: 1K
Configurable range of duty cycle: 10%-100%
**4: Production test: ** V1 version production test/V2 version production test
Production test version: V2 version production test
Number of production test routers: 2
Production test router SSID tuya_mdev_test1 tuya_mdev_test2
**5: Network distribution function: **
Power-on status: Power-on always on
Distribution network reset method: Switch 3 times distribution network configurable
Matching mode indication mode: The light flashes quickly for 250ms EZ flashes slowly for 1500ms AP
The color and brightness of the lamp during network distribution: Pure white light 50%
The color and brightness of the lamp after the distribution network Pure white light 100%


The Tuya SDK that can be used for the code. However, weirdly they have added an .exe to the repo for uploads. In the apps/ folder the bk7231t_light_pwm_demo is the projects folder being used for this project. The main goal was to find the communication part, how it communicates with the Tuya platform and remove it from the code. After this has being done the raspberry pi Smarthome opensource tool was the next application to focus on.

In the following paraghaps the structure of the application code is showed and the places that are of interest.

The anoying thing about the code is the chinese text:

serial monitor

The weird product number is given here:

#define PRODECT_ID "rg2urjcogbu14wci"