logo elektroda
logo elektroda
X
logo elektroda

[BK7231N] [CB3S] [AHT20] TH01 Generic Temperature and Humidity Sensor Teardown

anthonythomas 50436 180
Best answers

How do I finish the OpenBK autoexec setup for a TH01 temperature and humidity sensor with TuyaMCU?

Add the TuyaMCU-to-channel mappings, not just the two drivers: `startDriver TuyaMCU; startDriver tmSensor; setChannelType 1 temperature_div10; linkTuyaMCUOutputToChannel 1 val 1; setChannelType 2 Humidity; linkTuyaMCUOutputToChannel 2 val 2; setChannelType 3 ReadOnlyLowMidHigh; linkTuyaMCUOutputToChannel 3 enum 3; setChannelLabel 3 Battery` [#20516557][#20516646][#20845707] dpID 1 is temperature in tenths of a degree, dpID 2 is humidity, and dpID 3 is the battery state (low/mid/high) [#20516557][#20516646] For battery-powered operation, the Wi‑Fi module is controlled by the MCU, so initial setup often needs external 3.3 V to the Wi‑Fi module; for no-MQTT use, OBK can either use `tuyaMcu_defWiFiState 0x04` or an empty MQTT host field in newer builds [#20642216][#20931402]
Generated by the language model.
ADVERTISEMENT

Topic summary

✨ The discussion centers on the teardown, firmware flashing, and configuration of the TH01 generic temperature and humidity sensor, which uses a BK7231N WiFi module and a TuyaMCU microcontroller (MCU) managing sensor data and power. Users report challenges flashing the device due to the MCU controlling power to the WiFi module and UART lines being connected between MCU and WiFi module, requiring either cutting UART traces, desoldering the MCU or WiFi module, or powering the WiFi module externally during flashing. The TuyaMCU driver in OpenBK7231N firmware is essential for communication, with dpIDs 1 and 2 corresponding to temperature (divided by 10) and humidity, and dpID 3 likely representing battery state (low, mid, high). Proper autoexec.bat configuration involves starting TuyaMCU and tmSensor drivers, linking dpIDs to OBK channels, and setting channel types accordingly. MQTT integration is commonly used for data reporting, with some users noting duplicate MQTT messages and template adjustments needed for value formatting. Battery-powered operation requires the MCU to cycle power to the WiFi module to conserve energy, so powering the WiFi module externally can prevent data reporting. Flags such as WiFi quick connect and static IP improve connection stability. Some users successfully flash without desoldering by cutting UART traces and powering the WiFi module directly. The community shares detailed pinout photos, flashing procedures, and configuration scripts. Variations in PCB versions and sensor chips (AHT20, AHT30, CHT8315) affect driver selection and configuration. Deep sleep and wakeup configurations are discussed for battery life optimization. Tools like TuyaMCUAnalyzer assist in decoding UART communication. Issues with MQTT hostname configuration can prevent MQTT startup, and firmware updates have improved battery device support. The thread also covers troubleshooting WiFi connectivity, log inspection via WebUI, and Home Assistant integration challenges.
Generated by the language model.

FAQ

TL;DR: “Latest OBK builds extend battery life by up to 60 %” [Elektroda, p.kaczmarek2, post #20588135] “You flash it as usual” [Elektroda, p.kaczmarek2, post #20582789] Flash success rises when RX/TX lines to the Tuya MCU are isolated. Why it matters: you can turn a €6 TH01 into a cloud-free, Home-Assistant-ready sensor in under 10 minutes.

Quick Facts

• MCU type: BK7231N-QFN32 on CB3S module; 2 MB flash [Elektroda, Wen2024, post #20931316] • Default Tuya baud: 115 200 bps (some boards use 9 600 bps) [Elektroda, BAGZZlash, post #21552797] • Typical dpIDs: 1 = Temp×10, 2 = RH%, 3/101 = Battery enum [Elektroda, anthonythomas, #20516557; doudouni100, #21441634] • Max OBK channels per build: 64 [Elektroda, doudouni100, post #21441842] • Cost of TH01 board: €5–8 retail (2025 AliExpress listings)

1. Which TH01 hardware variants are confirmed?

A. AHT20 + TuyaMCU + BK7231N (earliest batch). B. AHT30 or CHT8310 directly on I²C and no TuyaMCU. C. Shield-less CB3S with 115 200 bps TuyaMCU [Elektroda, divadiow, #20873676; vinibali, #21398650].

2. Do I need to cut anything before flashing?

Yes, if a TuyaMCU is present you must sever its RX1/TX1 to stop it driving the bus. Options: 1) cut two thin traces and later bridge, 2) lift or desolder the CB3S, 3) lift the SOIC-8 MCU [Elektroda, p.kaczmarek2, post #20626343] Boards without TuyaMCU flash directly.

3. What baud rate should I select in BK flasher?

Most TuyaMCU revisions answer only at 115 200 bps; older ones use 9 600 bps. If logs show no “55 AA” packets switch rates accordingly [Elektroda, BAGZZlash, post #21552797]

4. What is the minimal working autoexec.bat for classic TH01?

backlog startDriver TuyaMCU; startDriver tmSensor; tuyaMCU_setBaudRate 115200; setChannelType 1 temperature_div10; linkTuyaMCUOutputToChannel 1 val 1; setChannelType 2 Humidity; linkTuyaMCUOutputToChannel 2 val 2; setChannelType 3 LowMidHigh; linkTuyaMCUOutputToChannel 3 enum 3
This publishes temperature, humidity and battery level [Elektroda, anthonythomas, post #20516646]

5. How do I map battery when the dpID is 101?

Use a lower OBK channel number, e.g. linkTuyaMCUOutputToChannel 101 enum 10 then setChannelType 10 LowMidHigh to stay within the 64-channel limit [Elektroda, doudouni100, post #21442987]

7. Can I run without any MQTT broker?

Yes. Leave the MQTT host field blank or add tuyaMcu_defWiFiState 0x04; OBK then skips the MQTT-wait state and still logs locally [Elektroda, p.kaczmarek2, post #20931402]

9. Why do I only get zeros on channels?

Causes: a) wrong dpIDs for your PCB; capture UART with TuyaMCUAnalyzer to confirm [Elektroda, Wen2024, post #20922691] b) Baud mismatch—see Q3. c) Device waiting for MQTT—see Q7. A faulty trace gives the same symptom; verify continuity.

10. Flashing stops at 75 % with “buffer contains data”. Fix?

Lower speed to 460 800 bps or swap USB-UART; some hosts drop at 921 600 bps [Elektroda, vinibali, post #21398650] Disconnect MCU lines before retrying.

11. How can I change the reporting interval?

For direct-I²C builds run AHT2X_Cycle <seconds> (1-255 sec). Battery-powered TuyaMCU boards expose dpIDs 17/18 (intervals); link them to TextField channels and set desired value, then send with linkTuyaMCUOutputToChannel 17 val 5 60 [Elektroda, grericht, post #20628188]

12. Edge case: device doesn’t wake after deep discharge.

Below 1.8 V the BK7231 may brown-out and corrupt flash; keep a 2 × AAA pack above 2 V or recharge Li-coin cells promptly. Full 2 MB backup allows recovery with full-erase reflashing [Elektroda, insmod, post #21552919]

13. Quick 3-step flashing guide (TuyaMCU boards)

  1. Cut RX1/TX1 between MCU and CB3S; solder four wires to 3 V3, GND, RX, TX. 2. Hold CEN low, flash OBK at 115 200 bps, then restore traces. 3. Power CB3S from bench 3 V3, configure Wi-Fi + autoexec, fit batteries, close case [Elektroda, auntlydia, post #20684096]
Generated by the language model.
ADVERTISEMENT