logo elektroda
logo elektroda
X
logo elektroda

Qiachip Smart Switch - BK7231N / CB2S - interior, programming

p.kaczmarek2 81819 310

TL;DR LABEL_AI_GENERATED

  • Qiachip Smart Switch contains a CB2S Wi‑Fi/Bluetooth module based on the BK7231N, not the BK7231T, inside a simple relay board with BP2525 supply and AMS1117 regulator.
  • OpenBK7231N required porting SDK files, fixing Cygwin toolchain use, correcting file names, and resolving a partition conflict caused by RL_SUPPORT_FAST_CONNECT.
  • BKwriter 1.60 failed with CRC verification and unprotect bugs, so flashing used Tuya's hid_download_py with --unprotect, --startaddr 0x0, and a reset on CEN.
  • The QIO firmware uploaded successfully, the configuration AP appeared, and the device can then be managed through 192.168.4.1, MQTT, and Home Assistant.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
Listen:
  • #301 21703356
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14768
    Help: 659
    Rate: 12909
    Tuya uses cheap components and without OpenBeken Power Save, your capacitors may degrade quickly: https://www.elektroda.com/rtvforum/topic3898805.html
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • Damaged capacitor and power-save warning for Qiachip switches

    #302 21703437
    Tilator
    Level 12  
    Posts: 139
    Help: 2
    Rate: 13
    p.kaczmarek2 wrote:
    uya uses cheap components and without OpenBeken Power Save, your capacitors may degrade quickly


    Thanks. That was important and I did not know it.

    I have bought more than 10 of these devices. One of them did litteraly blow in my hands after just some minutes use. It was not even flashed with any other but original FW.

    Afterwards I found out, the capacitor was damaged. It had flattened places both sides of it and I assume this was made by assembly robot. It was sqeezed slightly too much and broken already.

    So - it's definitely not a witch hunt to warn people about these chinese devices.

    B.T.W: Since it is this important, would it even be good idea to add this setting in Configure General/Flags?
  • ADVERTISEMENT
  • #303 21706375
    Tilator
    Level 12  
    Posts: 139
    Help: 2
    Rate: 13
    One more thing about this chip temperature and device health:

    Should internal temp also be reported in status query json as well as other important values?
  • #304 21707382
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14768
    Help: 659
    Rate: 12909
    We've been considering enabling powersave by default but there were some reports (in the early years) saying that it causes problems....

    We can add temperature in tasmota json, isn't it currently included there? @max4elektroda
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #305 21707775
    max4elektroda
    Level 24  
    Posts: 758
    Help: 49
    Rate: 189
    The Chip temperature is in fact only shown in MQTT and not as a "sensor" in JSON "SSN" status.
    We might add it there, but it would not be following Tasmota then ;-).
    Just kidding - what would you propose as sensor name? "Chip" - "MCU" - "internal" ... ???
  • #306 21707925
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14768
    Help: 659
    Rate: 12909
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #308 21707986
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14768
    Help: 659
    Rate: 12909
    This is good question. Should we... fake it and use ESP32 so Tasmota apps can read it?
    Helpful post? Buy me a coffee.
  • #309 21707993
    max4elektroda
    Level 24  
    Posts: 758
    Help: 49
    Rate: 189
    I would not. In the end it's just the "sensors" name. But you decide :-)
    And: shall it be present in any case, or make it configurable?
  • #310 21707997
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14768
    Help: 659
    Rate: 12909
    Always show it, we don't have flash space to add configuration option, and I don't think it can hurt to show it. So probably use ESP32 name, so apps working with Tasmota can work
    Helpful post? Buy me a coffee.
  • #311 21709766
    max4elektroda
    Level 24  
    Posts: 758
    Help: 49
    Rate: 189
    PR changed, will always use "ESP32" as "sensor":

    E.G. on an BL602:
    
    max@max-PC:~$ curl  -w '\n' "http://192.168.0.68/cm?cmnd=STATUS%208"
    {"StatusSNS":{"Time":"1970-01-01T00:00:00","ESP32":{"Temperature": 27.3},"TempUnit":"C"}}
    max@max-PC:~$ 
    
Listen:

Topic summary

LABEL_AI_GENERATED
Discussion about teardown, flashing, and troubleshooting of Tuya smart switches and sensors based on BK7231N/CB2S modules using OpenBK7231/OpenBeken firmware. The thread covers beginner-friendly UART flashing with hid_download_py and BekenWriter, full 2 MB flash backups, correct TX/RX wiring, 3.3 V levels, CEN reset, and the need to flash QIO images at offset 0 on BK7231N devices. Several users report issues such as “cannot get bus,” CRC mismatches, missing AP after flashing, unstable boot, corrupted configuration, and MAC address problems; fixes include using the latest firmware, clearing config, restoring full flash images, and moving MAC storage into the config structure. The discussion also identifies hardware variants like CB2S/WB2S/CB3S, TuyaMCU-based devices, BL0937 metering chips, and notes that some devices require desoldering the module or isolating RX/TX lines because of onboard peripherals interfering with programming. OpenBeken REST API usage, MQTT/Home Assistant integration, and device control via HTTP GET/POST are also demonstrated.
AI summary based on the discussion. May contain errors.

FAQ LABEL_AI_GENERATED

TL;DR: Most CB2S/BK7231N smart-switches draw just 60-80 mA at 5 V (“0.4 W in active mode” [Elektroda, p.kaczmarek2, post #20255222]) and can be locally flashed in ≤3 min; “PowerSave fixes random reboots on weak PSUs” [Elektroda, p.kaczmarek2, post #20359114] Why it matters: correct pin-mapping and reset timing end 90 % of “WriteSector 1 Failed” errors.

Quick Facts

• Default flash layout: 0x0 offset, 2 MB total [Elektroda, piratee, post #20546731] • Stable current draw: 60–80 mA @5 V, 0.4 W [Elektroda, p.kaczmarek2, post #20255222] • Safe reset pulse: CEN→GND for 200–300 ms [Elektroda, p.kaczmarek2, post #21368818] • Working baud rates: 115 200–921 600 bps; start with 115 200 for long wires [Elektroda, gowthaml, post #20253678] • PowerSave lowers Wi-Fi duty-cycle to ≈30 mA average [Elektroda, p.kaczmarek2, post #20359114]

How do I put a CB2S/BK7231N into flash mode?

  1. Solder RX1 (P11), TX1 (P10), 3.3 V and GND; leave RX2/TX2 empty. 2. Run uartprogram, wait for “Getting bus…”. 3. Short CEN to GND for ~250 ms, then release. The tool shows “Gotten bus” when the chip is ready [Elektroda, piratee, post #20546731]

Which firmware type should I flash?

• BK7231 N → QIO binary at 0x0. • BK7231 T → UA binary at factory offset. Flashing the wrong type overwrites bootloader and bricks the module [Elektroda, p.kaczmarek2, post #20200373]

Can I power the module from the USB-TTL adapter?

Only for reading. Writes peak above 150 mA; most adapters sag and corrupt transfers. Feed 5 V to the board’s AMS1117 VIN or 3.3 V from a 300 mA LDO instead [Elektroda, p.kaczmarek2, post #20202405]

Device reboots after a minute—why?

Low-cost PSUs overheat at 0.4 W continuous. Add PowerSave to Short Startup and current falls to ≈30 mA, eliminating thermal resets [Elektroda, Lesnoi, #20359179; p.kaczmarek2, #20359114].

How do I map pins on a MK601 relay board?

Typical mapping: P26 → LED, P6 → Relay, P7 → Btn, P10 → Btn_n (S2). For a latch switch use role TglChanOnTgl on P10 [Elektroda, spin55, post #20357749]

How can I read Tuya-MCU sensors like DHT11 with OpenBeken?

Set the pin role to DHT11 or DHT22. OBK exposes temperature on Channel 1 and humidity on Channel 2. Example: linkTuyaMCUOutputToChannel 1 val 1, then setChannelType 1 ReadOnly [Elektroda, p.kaczmarek2, post #20359448]

Edge case: two devices share the same MAC and vanish from LAN.

Router drops duplicate MACs, causing OBK memory exhaustion (<5 kB free) and HTTP lock-ups. Run Restore RF Config to generate a new unique MAC [Elektroda, p.kaczmarek2, post #20334753]

Quick 3-step OTA recovery after bad flash?

  1. Power-cycle the unit 5 times to enter Safe Mode. 2. Connect to the temporary AP, open 192.168.4.1/app, press “Exit Safe Mode”. 3. Upload a known-good QIO binary via Web Upgrader [Elektroda, p.kaczmarek2, post #20334576]

Does OpenBeken support DS18B20?

Not yet. Current sensor driver set covers DHT11/21/22 and CHT8305. DS18B20 is on the roadmap; subscribe to GitHub issue #622 for progress (OpenBekenIOT).

Where can I download original Tuya firmware?

There is no public archive. You must read a full 2 MB dump from a still-working unit with bkWriter or hid_download_py and save it for yourself [Elektroda, piratee, post #20546731]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT