Opens in a new tab

Tuya CB3S Pinout (BK7231N)

CB3S is a Tuya Wi-Fi and Bluetooth module with the Beken BK7231N chip. You’ll find it in smart plugs, switches and bulbs that used to have the ESP8266.

Tasmota won’t run on it, but the device can be flashed with OpenBeken, LibreTiny or ESPHome and controlled locally without the cloud. The pinout focuses on what you need for that – the UART for flashing, reset and the PWM channels.

Specifications

  • BK7231N: 32-bit Arm, Wi-Fi 4 (2.4 GHz) and Bluetooth LE
  • 2 MB flash
  • 22 pads in the ESP-12 format (16 × 24 mm), 6 of them on the bottom edge
  • 6 PWM channels, 1 analog input (P23), UART1 and TX2 for log output, I2C
  • 3.3 V power

Flashing goes through UART1 (P10 RX, P11 TX) and the CEN reset – with bk7231tools, ltchiptool or BK7231GUIFlashTool. The log is output by UART2 on P0 (TX2) – the CB3S doesn’t break out RX2 (P1). The pad assignment matches the LibreTiny database.

Pinout and pin table

Hover over a pin in the diagram or a table row; use the filter to highlight a bus. You can download the pinout as PNG or SVG.

Tuya CB3S (BK7231N) – pinoutTuya CB3S (BK7231N) – pinoutchiptron.eu · CC BY 4.0CB3SBK7231N 1 CEN → Reset – connecting to GND restarts the chip 2 P23 ADC3 TDO 3 CEN → 4 P14 SCK 5 P26 PWM5 6 P24 PWM4 7 P6 PWM0 8 3V3 → Power 3.3 V 16 P11 TX1 15 P10 RX1 14 P7 PWM1 13 P8 PWM2 12 P21 SDA1 TMS 11 P0 TX2 10 P9 PWM3 9 GND 17 P23 ADC3 TDO 18 P22 TDI 19 P21 SDA1 TMS 22 NC 21 NC 20 P20 SCL1 TCK GPIO UART I2C SPI ADC (analog) PWM Power Ground (GND) Control / reset Not connected
Download:PNGSVG
Pin table – Tuya CB3S (BK7231N)
PinNameDirectionUARTI2CSPIPWMADCNote
1CENinputReset (CEN, active low) – connecting to GND restarts the chip; when uploading via UART1 it is used to enter the bootloader
2P23input/outputADC3ADC3 – the only analog input; JTAG TDO; flash programming (FSO)
3CENinputReset (CEN, active low) – connecting to GND restarts the chip; when uploading via UART1 it is used to enter the bootloader
4P14input/outputSCK
5P26input/outputPWM5
6P24input/outputPWM4
7P6input/outputPWM0
83V3inputPower 3.3 V
9GND–
10P9input/outputPWM3
11P0input/outputTX2SCL2UART2 TX – log output; I2C2 SCL
12P21input/outputSDA1I2C1 SDA; JTAG TMS; flash programming via SPI (FCS). Must not be at logic 0 at power-up (test mode)
13P8input/outputPWM2
14P7input/outputPWM1
15P10input/outputRX1UART1 RX – firmware upload (bk7231tools, ltchiptool, OpenBeken)
16P11input/outputTX1UART1 TX – firmware upload
17P23input/outputADC3ADC3 – the only analog input; JTAG TDO; flash programming (FSO)
18P22input/outputJTAG TDI; flash programming via SPI (FSI)
19P21input/outputSDA1I2C1 SDA; JTAG TMS; flash programming via SPI (FCS). Must not be at logic 0 at power-up (test mode)
20P20input/outputSCL1I2C1 SCL; JTAG TCK; flash programming via SPI (FSCK)
21NC–
22NC–

What to watch out for

  • Disconnect the device from the 230 V mains before opening it. Program the module only from a 3.3 V USB-serial converter, never while it is inside a device plugged into mains.
  • Before overwriting the firmware, back up the original flash contents – they also contain the Tuya keys.
  • When flashing, briefly connect CEN to GND (reset) and connect the converter to UART1: converter RX to P11 (TX), TX to P10 (RX).
  • Power the module from a supply with enough headroom – the 3.3 V from a cheap converter is often not enough during writing.
  • Pins 1 and 3 are both CEN; P23 is on pins 2 and 17.

More pinouts

See all pinouts on the Pinouts page.

Related Articles