logo elektroda
logo elektroda
X
logo elektroda

[BK7231N - CB3S] AVATTO Tuya US Wifi Wall Switch 1 Gang

Jomsha 1950 6

TL;DR

  • AVATTO US-TS02 1-gang Tuya Wi-Fi wall switch uses a BK7231N [CB3S] module and a local AliExpress vendor link is listed.
  • UART wiring maps TXD1 to UART RX, RXD1 to UART TX, 3.3 to UART 3.3V, and GND to UART GND.
  • GPIO mapping includes P7 for Btn 1, P9 for LED 1, P23 for WifiLED 0, and P26 for Rel 1.
  • To flash the BK7231N, either remove the 16-pin chip and solder it back, or cut and later repair the RXD1/TXD1 trace, then use BK7231GUIFlashTool.
Generated by the language model.
ADVERTISEMENT
📢 Listen (AI):
  • [BK7231N - CB3S] AVATTO Tuya US Wifi Wall Switch 1 Gang

    Basic information:
    Brand: AVATTO
    Chip: BK7231N [CB3S]
    Model: US-TS02
    Local Vendor: https://www.aliexpress.com/item/4000615022697.html

    Connections:
    TXD1 <---> UART RX
    RXD1 <---> UART TX
    3.3 <---> UART 3.3V
    GND <---> UART GND

    GPIO:
    P7 (PWM1)Btn 1
    P9 (PWM3)LED 1
    P23 (ADC3)WifiLED 0
    P26 (PWM5)Rel 1


    Code: JSON
    Log in, to see the code


    [BK7231N - CB3S] AVATTO Tuya US Wifi Wall Switch 1 Gang [BK7231N - CB3S] AVATTO Tuya US Wifi Wall Switch 1 Gang
    [BK7231N - CB3S] AVATTO Tuya US Wifi Wall Switch 1 Gang




    You have to remove this 16-pin chip > Flash > Solder the chip back.
    -OR-
    Find the correct trace between the RXD1/TXD1 to the 16-pin chip and break it > Flash > Solder (repair) the trace.

    [BK7231N - CB3S] AVATTO Tuya US Wifi Wall Switch 1 Gang

    Finally use BK7231GUIFlashTool to flash the BK7231N chip.

    Cool? Ranking DIY
    About Author
    Jomsha
    Level 3  
    Offline 
    Jomsha wrote 11 posts with rating 2. Been with us since 2023 year.
  • ADVERTISEMENT
  • #2 20616531
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14612
    Help: 655
    Rate: 12630

    It looks like the issue that we had with a switch on our YouTube channel. We also had to break the RXD connection temporarily.
    https://www.youtube.com/watch?v=Yb3zXtBdSnE&t=1s&ab_channel=Elektrodacom
    Can you also attach the JSON template from the Web App?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20616589
    Jomsha
    Level 3  
    Posts: 11
    Rate: 2

    Of course, I edited the post.

    Yes, this thing with the RX pin is a known "complicator". I met this situation even 3-4 years ago with the ESP8266 Tuya switches...
  • ADVERTISEMENT
  • #4 20616605
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14612
    Help: 655
    Rate: 12630

    At least your device wasn't TuyaMCU. There are also TuyaMCU switches where you have to configure it in TuyaMCU mode, which complicates things even more.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20616620
    Jomsha
    Level 3  
    Posts: 11
    Rate: 2
    Yes, you're right .
  • #7 21284985
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14612
    Help: 655
    Rate: 12630
    Merged, thank you, device should be soon live at:
    https://openbekeniot.github.io/webapp/devicesList.html
    Helpful post? Buy me a coffee.
📢 Listen (AI):

Topic summary

✨ The discussion revolves around the AVATTO Tuya US Wifi Wall Switch 1 Gang (Model: US-TS02) utilizing the BK7231N chip. Users share experiences regarding issues with the RXD connection, which has been a known complication in similar devices, including those using the ESP8266 chip. One user references a YouTube video demonstrating a related issue and requests a JSON template from the Web App. The conversation also touches on the complexities of configuring TuyaMCU switches, which require specific settings that can complicate the setup process. Additionally, a GitHub link is shared, indicating ongoing development related to the device, with a confirmation that the device will soon be listed on the OpenBeken IOT web app.
Generated by the language model.

FAQ

TL;DR: For 1 AVATTO US-TS02 switch, the expert takeaway is "break RXD temporarily": flash the BK7231N CB3S over UART at 3.3 V, then restore the trace or resolder the 16-pin chip. This FAQ helps OpenBeken users solve flashing and GPIO setup. [#20616408] Why it matters: The AVATTO US-TS02 can run OpenBeken, but the onboard 16-pin chip can block UART flashing unless isolated first.

Option Action When used
Remove 16-pin chip Desolder, flash, solder back When the chip interferes with UART
Break RXD/TXD trace Cut trace, flash, repair trace When you can identify the correct UART trace

Key insight: The switch is a direct GPIO BK7231N device, not a TuyaMCU case in this thread. Configure P7, P9, P23, and P26 after flashing.

Quick Facts

  • Device data: AVATTO brand, US-TS02 model, Tuya vendor, BK7231N chip, CB3S module, and 1-gang US wall-switch format. [#20616408]
  • UART wiring uses 4 connections: TXD1 to UART RX, RXD1 to UART TX, 3.3 V to UART 3.3 V, and GND to UART GND. [#20616408]
  • OpenBeken GPIO mapping uses P7 for Btn 1, P9 for LED 1, P23 for WifiLED 0, and P26 for Rel 1. [#20616408]
  • Flashing requires either removing the 16-pin chip or breaking the RXD/TXD trace before using BK7231GUIFlashTool. [#20616408]
  • The Web App device entry was added through GitHub pull request 157 and marked merged on 2024-11-01. [#21284985]

How do I flash OpenBeken on an AVATTO Tuya US-TS02 1-gang WiFi wall switch with a BK7231N CB3S module?

Flash it with BK7231GUIFlashTool after isolating the UART path from the 16-pin chip.
  1. Connect TXD1, RXD1, 3.3 V, and GND to a UART adapter.
  2. Remove the 16-pin chip, or break the correct RXD/TXD trace.
  3. Flash the BK7231N, then solder the chip or trace back. Use the template with P7, P9, P23, and P26 after flashing. [#20616408]

What UART connections are needed to flash the AVATTO Tuya US Wifi Wall Switch 1 Gang using BK7231GUIFlashTool?

Use four UART connections: TXD1 to UART RX, RXD1 to UART TX, 3.3 V to UART 3.3 V, and GND to UART GND. The thread names TXD1 and RXD1 as the serial flashing pins. Keep the logic supply at 3.3 V, as listed in the connection table. [#20616408]

Which GPIO pins should be configured for the button, relay, LED, and WiFi LED on the AVATTO US-TS02 BK7231N switch?

Configure P7 as Btn 1, P26 as Rel 1, P9 as LED 1, and P23 as WifiLED 0. The posted JSON maps pin 7 to Btn;1, pin 9 to LED;1, pin 23 to WifiLED;0, and pin 26 to Rel;1. This mapping matches the AVATTO US-TS02 BK7231N profile. [#20616408]

Why do some Tuya wall switches require breaking the RXD or TXD trace before flashing the BK7231N chip?

Some Tuya wall switches route RXD or TXD through another 16-pin chip, which can block flashing access. The thread calls the RX pin issue a known "complicator" also seen on ESP8266 Tuya switches 3–4 years earlier. Temporarily breaking the trace isolates the BK7231N UART for flashing. [#20616589]

What is the purpose of removing the 16-pin chip before flashing the AVATTO US-TS02 switch?

Removing the 16-pin chip isolates the BK7231N UART so BK7231GUIFlashTool can communicate cleanly. The thread gives two options: remove the 16-pin chip, flash, then solder it back; or break the RXD/TXD trace, flash, then repair it. Both methods target the same UART conflict. [#20616408]

How can I repair the RXD or TXD trace after flashing a Tuya BK7231N wall switch?

Repair the trace by soldering the broken RXD or TXD connection after flashing finishes. The thread states the process as: find the correct trace, break it, flash, then solder and repair the trace. This restores the original connection to the 16-pin chip. [#20616408]

What is BK7231GUIFlashTool and how is it used with BK7231N Tuya devices?

BK7231GUIFlashTool is the flashing tool named for programming the BK7231N chip over UART. In this switch, use it after connecting TXD1, RXD1, 3.3 V, and GND. The post says to finally use BK7231GUIFlashTool to flash the BK7231N chip. [#20616408]

What is a CB3S module in Tuya smart switches?

"CB3S is the Tuya module category used here that carries the BK7231N chip for WiFi switch control, identified in the thread by the chip field BK7231N [CB3S] and the AVATTO US-TS02 device template." The device profile lists chip BK7231N and names CB3S in the title. [#20616408]

What is TuyaMCU mode and why does it make flashing or configuring smart switches more complicated?

"TuyaMCU mode is a smart-switch configuration mode that uses a separate Tuya MCU for device functions, requiring OpenBeken to communicate through that MCU instead of simple direct GPIO pin roles." One expert noted this switch was easier because it was not TuyaMCU. TuyaMCU switches need extra mode configuration. [#20616605]

BK7231N vs ESP8266 Tuya switches: what is different when flashing custom firmware?

BK7231N uses BK7231GUIFlashTool in this thread, while the RX-pin complication also existed on ESP8266 Tuya switches. The author had seen the same RX issue 3–4 years earlier on ESP8266 Tuya switches. For this AVATTO switch, the chip is BK7231N [CB3S], not ESP8266. [#20616589]

What should I do if BK7231GUIFlashTool cannot connect to the BK7231N chip in an AVATTO wall switch?

Check the UART wiring first, then isolate the interfering 16-pin chip or RXD/TXD trace. The required wiring is TXD1 to UART RX, RXD1 to UART TX, 3.3 V to 3.3 V, and GND to GND. If connection still fails, remove the 16-pin chip or break the correct trace before flashing. [#20616408]

How do I create or import a JSON template for the AVATTO Tuya US-TS02 switch in the OpenBeken Web App?

Use the posted JSON template with vendor Tuya, name AVATTO Tuya US Wifi Wall Switch 1 Gang, model US-TS02, and chip BK7231N. Add pins 7, 9, 23, and 26 with Btn, LED, WifiLED, and Rel roles. The Web App JSON was requested and then added to the edited post. [#20616531]

Where can I find the AVATTO US-TS02 device profile in the OpenBeken devices list after the GitHub pull request was merged?

Find it in the OpenBeken Web App devices list after pull request 157 was merged. The maintainer replied on 2024-11-01 that the device should be soon live at the devices list page. The profile came from the GitHub pull request posted on 2024-10-31. [#21284985]

What safety precautions should I follow when opening and flashing a mains-powered AVATTO Tuya wall switch?

Disconnect mains power before opening, desoldering, cutting traces, or attaching a 3.3 V UART adapter. The thread concerns a US WiFi wall switch, so it is a mains-powered device even though flashing uses 3.3 V UART. Do not work on the PCB while it is connected to wall power. [#20616408]

How can I identify whether my Tuya wall switch is a direct GPIO device or a TuyaMCU-based switch before configuring OpenBeken?

Check whether the template maps functions directly to BK7231N GPIO pins or requires TuyaMCU mode. This AVATTO profile maps four direct pins: P7 Btn 1, P9 LED 1, P23 WifiLED 0, and P26 Rel 1. A maintainer noted this device was not TuyaMCU, which avoided extra configuration. [#20616605]
Generated by the language model.
ADVERTISEMENT