logo elektroda
logo elektroda
X
logo elektroda

Door Sensor D06 (BK7231N/CB3S) with TuyaMCU (DeepSleep)

CMY  52 9450 Cool? (+3)
📢 Listen (AI):

TL;DR

  • Teardowns the Door Sensor D06 with a BK7231N/CB3S Wi‑Fi module and TuyaMCU, including its magnet sensor, battery reporting, and deep-sleep behavior.
  • The BK7231N talks only to TuyaMCU over serial, and even the LED and Wi‑Fi power are controlled by TuyaMCU.
  • Active current reaches ~75..80mA, sensor sleep is 13uA, and BK7231N DeepSleep still leaves the unit at ~20uA.
  • OpenBK firmware was uploaded via serial and worked well, with RX1/TX1 connected to TuyaMCU and channels mapped for door state and battery.
  • Tuya-cloudcutter failed because the binary appears patched, and firmware updates otherwise require desoldering the chipset since TX/RX are already tied to TuyaMCU.
Generated by the language model.
One more Door Sensor
PCB with CB3S module and component markings View of door sensor board with slots for AAA batteries.

Door and window sensor set with manual and packaging. Photo of an open door sensor casing showing the circuit board. Disassembled DS06 door sensor with visible interior. Disassembled door sensor showing circuit board and casing.

First Look
WiFi Chipset BK7231N/CB3S connected only to TuyaMCU via serial interface. Even LED connected to TuyaMCU.
TuyaMCU has power control for WiFi module.

There are two pins on the bottom of the board P3 and P2. Seems like this is for external sensor like a water leak sensor. To use it need Q2, R10, R9. But it use the same TuyaMCU pin that used for Magnetic Field Sensor now. So U3 needs to be dismounted in this case. (??? maybe they have a HighZ output and can work at the same time)


Firmware update
Firmware update possible only by desoldering chipset because TX-RX already connected to TuyaMCU .

Or maybe OTA? :)
OTA is probably possible via tuya-cloudcutter project https://github.com/tuya-cloudcutter/tuya-cloudcutter/tree/main
I found 2 similar sensors there:
- https://github.com/tuya-cloudcutter/tuya-clou...es/tuya-generic-cb3s-door-sensor-v1.0.10.json
- https://github.com/tuya-cloudcutter/tuya-clou...b/master/devices/avatto-ds06-door-sensor.json
Last one looks better.

Unfortunately, my unit has a new firmware version, so tuya-cloudcutter doen't work for it. No OTA update for today.
I conected it via serial inteface, and download original firmware. (You don't need to desolder WiFi chip, easy way to take of TuyaMCU. I has only 8 pins)

tuya-cloudcutter/profile-building/build_profile.py gaves me this:
[+] Processing file='Tuya-Generic_DoorSensor-D06.bin' as Tuya-Generic_DoorSensor-D06
RBL containers:
        0x10f9a: bootloader - [encoding_algorithm=NONE, size=0xea20]
                extracted to Tuya-Generic_DoorSensor-D06
        0x129f0a: app - [encoding_algorithm=NONE, size=0xe0820]
                extracted to Tuya-Generic_DoorSensor-D06
Storage partition:
        0x1ee000: 60 KiB - 7 keys
        - 'gw_bi'
        - 'gw_di'
        - 'wf_start_md'
        - 'gw_wsm'
        - 'gw_ai'
        - 'record_head'
        - 'baud_cfg'
                extracted all keys to Tuya-Generic_DoorSensor-D06/Tuya-Generic_DoorSensor-D06_storage.json
App code `user_param_key`:
        - not found!
[+] Searching for known exploit patterns
[+] Matched pattern for BK7231N version SDK 2.3.1, payload type ssid
[!] The binary supplied appears to be patched and no longer vulnerable to the tuya-cloudcutter exploit.


OpenBK firmware was uploded via serial inteface and working good.

Draft config
Code: JSON
Log in, to see the code


Pins:
RX1 and TX1 connected to TuyaMCU.

TuyaMCU channels
#1 - Door Sensor (0-Closed, 1-Open)
#3 - Battery ( 2 -> 3V, 1-> ???, 0->??? )

Everything exactly like here Energy-saving (?) Battery-operated door / window sensor for WiFi DS06

Just a log of TuyaMCU communication:
Info:CMD:[WebApp Cmd 'uartSendHex 55 AA 00 01 00 00 00' Result] OK
Info:TuyaMCU:TUYAMCU received: 55 AA 00 01 00 24 7B 22 70 22 3A 22 6E 79 77 72 76 67 68 7A 30 6F 32 74 71 32 67 34 22 2C 22 76 22 3A 22 31 2E 30 2E 30 22 7D B1 
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 1 (QueryProductInformation) with 43 bytes
Info:TuyaMCU:TuyaMCU_ParseQueryProductInformation: received {"p":"nywrvghz0o2tq2g4","v":"1.0.0"}

Info:CMD:[WebApp Cmd 'uartSendHex 55 AA 00 02 00 01 04 06' Result] OK
Info:TuyaMCU:TUYAMCU received: 55 AA 00 02 00 00 01 
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 2 (MCUconf) with 7 bytes
Info:TuyaMCU:TuyaMCU_ProcessIncoming: TUYA_CMD_MCU_CONF, TODO!
Info:TuyaMCU:TUYAMCU received: 55 AA 00 08 00 0C 00 02 02 02 02 02 02 01 01 00 01 00 22 
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 8 (QueryState) with 19 bytes
Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: processing dpId 1, dataType 1-bool and 1 data bytes
Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: raw data 1 byte: 0
Info:TuyaMCU:TUYAMCU received: 55 AA 00 08 00 0C 00 02 02 02 02 02 02 01 01 00 01 01 23 
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 8 (QueryState) with 19 bytes
Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: processing dpId 1, dataType 1-bool and 1 data bytes
Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: raw data 1 byte: 1
Info:TuyaMCU:TUYAMCU received: 55 AA 00 08 00 0C 00 01 01 01 01 01 01 03 04 00 01 02 23 
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 8 (QueryState) with 19 bytes
Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: processing dpId 3, dataType 4-enum and 1 data bytes
Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: raw data 1 byte: 2


Power consumption
~75..80mA - WiFi on and sending data to MQTT server
13uA - Sensor sleeping

For a test, I put BK7231N in to DeepSleep mode and all unit has ~20uA. So, It not so good as I was expected, and cutting power from WiFi chip is saving only ecreasing curent from 20uA to 13uA.
Cons of using TuyaMCU:
- no way to control main loop via BK7231N firmware (it will be power on only when TuyaMCU will do)
Pros:
- less power consumption
- TuyaMCU collect data (sensor status) while WiFi is booting. For example: door was opened, and closed several times during WiFi was booting. Tuya MCU will remember this, and will send this information to BK7231N.

Links
Aliexpress: https://www.aliexpress.us/item/3256805832136366.html

https://fccid.io/2ANK8-D06/Internal-Photos/09-D06-IntPho-4574559

https://www.elektroda.com/rtvforum/topic3866123-420.html#19982243

Energy-saving (?) Battery-operated door / window sensor for WiFi DS06

Door Sensor 19JWT-B (BK7231N)

More information to come...

About Author
CMY wrote 6 posts with rating 5 . Been with us since 2024 year.

Comments

CMY 14 Jan 2024 19:15

I can't understand, what "startDriver tmSensor" for? Seems like it's in "src/driver/drv_tuyaMCUSensor.c" But it's doing nothing. All actions are commented now. [Read more]

p.kaczmarek2 20 Jan 2024 11:15

@cmy I know this is unfortunate, but tmSensor code is now integrated with TuyaMCU driver, so it is still required to run , it's just the functions are in the other file. Everything should be okay once... [Read more]

CMY 21 Jan 2024 22:30

Sure. But in this case better get this one "Door Sensor 19JWT-B (BK7231N)" https://www.elektroda.com/rtvforum/viewtopic.php?p=20906219 Or you can - remove power controll Triac, - connect WiFi... [Read more]

p.kaczmarek2 22 Jan 2024 08:27

Your concept is very interesting, @cmy , but wouldn't that reduce battery life, with both MCU and BK draining current slowly? [Read more]

CMY 22 Jan 2024 23:35

I alredy cheked it. So. Yes, 13uA vs 20uA. About +50% in deep sleep mode. It is all depends. But if i wanna do this, i will wakeup WiFi module like a every 5 min. And this will be more effected... [Read more]

divadiow 18 Aug 2024 07:59

https://github.com/OpenBekenIOT/webapp/pull/141/commits/879c3d9f8c0413b874174c440eacd1a73da4c7da [Read more]

divadiow 07 Nov 2024 22:38

backup from my own exact device + boot log V:BK7231N_1.0.1 REG:cpsr spsr r13 r14 SVC:000000D3 00401C1C 000033AC IRQ:000000d2 00000010 00401e0c de717d4f FIR:000000d1 00000010... [Read more]

hojnikb 09 Nov 2024 10:48

Would it be possible to remove tuyamcu entirely and use magnetic chip directly? And magentic chip would serve as a wakeup from deepsleep for wifi chip? I find that on my device, it's not working very... [Read more]

divadiow 09 Nov 2024 16:07

I believe so. @pkaczmarek2 has suggested such a step with other devices before though I've never actually progressed to trying. Is it basically trace the legs from TuyaMCU to each main component, button,... [Read more]

p.kaczmarek2 09 Nov 2024 21:29

We've been planning to make such tutorial with @DeDaMrAz . It should be possible to convert TuyaMCU devices to Beken-only DeepSleep. The magned sensor could be dinput as @divadiow says, but you can also... [Read more]

divadiow 11 Nov 2024 21:29

my hacky TuyaMCUless prototype. not 100% sure of the LED/GND situation. And I don't know if there's a BAT_ADC/BAT_REL - could the MCU have done this measurement internally? https://obrazki.elektroda.pl/1093702600_1731356814_thumb.jpg... [Read more]

p.kaczmarek2 12 Nov 2024 00:43

Nice, does deep sleep work as well? Also... your MCU was in SO8 case? That seems unusual for me. I saw many devices with SO16-etc MCUs. [Read more]

divadiow 12 Nov 2024 08:14

yes. with: "7": "DoorSnsrWSleep;1", "8": "Btn;2", "14": "WifiLED;2" same wake with button. no additional DSEdge config. Closed/magnet = channel 1 value 0, open/no magnet = channel... [Read more]

p.kaczmarek2 13 Nov 2024 09:21

So it's easier than I expected. Please consider making a separate guide for Smart Home Tutorials section. I see you also labeled pins on the MCU - so there is not BAT_ADC pin? I guess you may need to... [Read more]

divadiow 13 Nov 2024 10:08

could.do. I also have the solder-less flashing thing to do. I didn't want to distract from you and @dedamraz's upcoming guide and I didn't document what I did in infinite detail ;) I don't *think*... [Read more]

hojnikb 03 Dec 2024 13:25

Could you provide schematic or some sort of tuturial on how to make it tuyaless ? Or at least which connections to bridge, so it would work without the MCU. [Read more]

divadiow 03 Dec 2024 16:33

I didn't do any more, but the steps to date can be boiled down to: -remove TuyaMCU with solder sausage method (demonstrated here https://www.youtube.com/watch?v=fSbeKwCCMHM) -solder wires between these... [Read more]

hojnikb 03 Dec 2024 17:34

Thank you! [Read more]

divadiow 03 Dec 2024 20:32

bit more info. The P558K component is a hall-effect sensor. This is what the magnet needs to get close to https://obrazki.elektroda.pl/2642279600_1733254347_thumb.jpg [Read more]

FAQ

TL;DR: Deep-sleep current drops to just 13 µA, yet Wi-Fi bursts need 75-80 mA [Elektroda, CMY, post #20906465] “Everything should be okay once you run it” [Elektroda, p.kaczmarek2, post #20918886] OTA fails on new firmware builds.

Why it matters: ultra-low standby keeps AAA batteries alive for months while still giving instant MQTT door alerts.

Quick Facts

• MCU combo: CB3S (BK7231N Wi-Fi SoC) + 8-pin TuyaMCU, UART-linked [Elektroda, CMY, post #20906465] • Sleep currents: 13 µA (TuyaMCU power-cuts Wi-Fi) or 20 µA (BK7231N deep-sleep) [Elektroda, CMY, post #20906465] • Active burst: 75–80 mA during MQTT publish [Elektroda, CMY, post #20906465] • Supported firmware: OpenBeken ≥ 1.18.127; OTA via Cloudcutter only if build ≤ v1.0.10 [Cloudcutter JSON]

What hardware is inside the DS06/D06 door sensor?

The PCB carries a Tuya CB3S module with a BK7231N Wi-Fi SoC and an 8-pin TuyaMCU that controls power, LED and hall sensor over a 9600 baud UART link [Elektroda, CMY, post #20906465]

Can I flash OpenBeken without desoldering the CB3S?

Yes. Lift the TuyaMCU (only 8 pins) to expose TX/RX, then use 3.3 V UART to flash OpenBeken in situ [Elektroda, CMY, post #20906465]

Does Cloudcutter OTA still work?

Only for early firmware (e.g., v1.0.10). Newer images are patched; the exploit returns “no longer vulnerable” [Elektroda, CMY, post #20906465]

How do I map datapoints in OpenBeken?

Place in autoexec.bat:
  1. startDriver TuyaMCU; startDriver tmSensor
  2. linkTuyaMCUOutputToChannel 1 val 1 (door state)
  3. linkTuyaMCUOutputToChannel 3 val 3 (battery enum) [Elektroda, CMY, post #20906465]

Why does Home Assistant discovery sometimes fail?

MQTT topics containing non-ASCII characters (e.g., Polish letters) block discovery. Rename the device to ASCII-only and HA sees it [Elektroda, GAAD, post #21593286]

What battery life can I expect?

At 13 µA standby and ~80 mA 1-second bursts, two AAA cells (1 000 mAh each) last roughly 8–12 months with 50 door events per day [Calc; data from CMY, #20906465].

Is removing the TuyaMCU worth it?

Removing it lets BK7231N control deep-sleep directly, cutting wiring to three jumpers and reaching 20 µA standby. Power savings are modest (≈ 7 µA) but you gain full firmware control [Elektroda, CMY, #20906465; divadiow, #21299423].

3-step how-to: convert to TuyaMCU-less Deep-Sleep

  1. Desolder TuyaMCU with hot-air "solder-sausage" method.
  2. Bridge hall-sensor output to CB3S P7 (DoorSnsrWSleep) and LED to P14.
  3. Wire CB3S GND permanently; connect Q1 gate to P26 for BAT_Relay [Elektroda, divadiow, #21331027; spin55, #21353072].

How do I read battery voltage after the mod?

Use the existing R3/R23 divider (1 kΩ/10 kΩ). Link CB3S P23 as BAT_ADC role and add Battery_Setup 2000 3300 1.1 2400 4096 in autoexec.bat [Elektroda, daherbst85, post #21354059]

Edge case: sensor stops publishing after reboot—why?

If DSTime is set below the Wi-Fi connect time, the module may sleep before MQTT handshake. Increase DSTime (e.g., 2400 ms) [Elektroda, spin55, post #21353072]

Which hall sensor is used and can I replace it?

Board versions show P558K or 2063P omnipolar hall ICs. Output is push-pull. You can replace it with a NO switch tied through 5–10 kΩ pull-up to BAT+; MCU reads open/closed correctly [Elektroda, ssllaawweekk, post #21392216]

What happens if voltage drops below 2.0 V?

Configure BAT_Relay to pull Q1 gate low; this disconnects CB3S ground and forces a safe shutdown, preventing flash corruption [Elektroda, spin55, post #21353072]

Expert tip for debugging UART traffic?

Use uartSendHex 55 AA 00 08 00 to query TuyaMCU state; observe dpId 1 and 3 replies in real time [Elektroda, CMY, post #20906465]
Generated by the language model.
%}