logo elektroda
logo elektroda
X
logo elektroda

[BK7321N] Generic USB powered thermostat and humidity sensor with LED display - CBU module

DeDaMrAz 8079 57
ADVERTISEMENT
  • #31 20553549
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14756
    Help: 659
    Rate: 12883
    We've been looking into TM1638 recently and it seems very, very similar to GN6932.
    Attachments:
    • tm1638-driver-pro-ovladaci-panel.pdf (5.07 MB) You must be logged in to download this attachment.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 20629042
    hakimmuhiddin
    Level 5  
    Posts: 4

    I wanted to ask.. I am having trouble getting the IP address of the device.. Each time I connect to an access point, I don't have the privilege to access the router webpage.. I am planning to set a static IP address on the device during OpenAP mode.. And then set the main WiFi SSID and password by using the previously set IP address..

    Is that possible?
  • #33 20629101
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14756
    Help: 659
    Rate: 12883
    Hello, you can easily set the static address for OpenBeken device. You can do this in AP mode. Make sure the IP address you are using is unique. I am attaching a config page screenshot below:
    [BK7321N] Generic USB powered thermostat and humidity sensor with LED display - CBU module [BK7321N] Generic USB powered thermostat and humidity sensor with LED display - CBU module
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • GN6932 driver missing from build

    #34 20979685
    divadiow
    Level 38  
    Posts: 5214
    Help: 448
    Rate: 916
    I assume everyone else's config is still working?

    Mine doesn't seem to like starting the GN6932 driver. I've tried CLK/DAT/STB on different channels and the same.

    Screenshot of pin configuration settings for driver GN6932.
    Info:MAIN:Driver GN6932 is not known in this build.
    Info:MAIN:Available drivers: 


    my autoexec
    backlog startDriver GN6932; startDriver NTP
    ntp_timeZoneOfs  +00:00
    TMGN_Clear
    //check the reading of you sensor against a good known and calibrate in this case -2
    CHT_Calibrate -2 10 
    TMGN_Clear
    //adjust brightness if needed (0-7) - default is 7 max
    TMGN_Brightness 7
    TMGN_SetBit 9 1 1
    TMGN_SetBit 9 2 1
    TMGN_SetBit 9 3 1
    TMGN_SetBit 9 7 1
    TMGN_SetBit 9 0 1
    TMGN_SetBit 10 2 1
    TMGN_SetBit 10 3 1
    
    again:
    // TMGN_Print  offset len value bPadToLenWithZeros
    //TMGN_Print 0 2 $second 1
    TMGN_Print 7 2 $minute 1
    TMGN_Print 5 2 $hour 1
    TMGN_Print 2 3 $CH1 1
    TMGN_Print 0 2 $CH0 1
    delay_s 0.1
    //blinking : on the clock
    TMGN_SetBit 10 0 0
    TMGN_SetBit 10 1 0
    delay_s 1
    TMGN_SetBit 10 0 1
    TMGN_SetBit 10 1 1
    delay_s 1
    goto again
    
    
  • ADVERTISEMENT
  • Enable TMGN driver in obk_config.h

    #35 20979746
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14756
    Help: 659
    Rate: 12883
    The answer is here OpenBeken online building system - compiling firmware for all platforms (BK7231, BL602, W800, etc)
    The GN6932 is so rarely used that's disabled in latest builds. You need to enable it. Alternatively, I can make a build for you in Pull Requests.
    See:
    Code snippet showing driver configuration for TM1637, GN6932, TM1638 with a highlighted line for activation

    You need to add
    
    #define ENABLE_DRIVER_TMGN 1
    

    in obk_config.h
    Helpful post? Buy me a coffee.
  • #36 20979755
    divadiow
    Level 38  
    Posts: 5214
    Help: 448
    Rate: 916
    Ah. That explains it! Maybe it's time I had a go at my own fork and building. I'll try your guide, thanks

    Added after 1 [minutes]:

    Unless you think it should go back into live...
  • Helpful post

    CHT8310 driver needs older version and channel swap

    #37 20980349
    divadiow
    Level 38  
    Posts: 5214
    Help: 448
    Rate: 916
    Just for testing I went back to 1.17.295 and the driver of course works now. Because the newer units have a CHT8310 temp/hum sensor (mine does anyway), as opposed to the CHT8305, the driver for the CHT is the old version before CHT8310 support was added. As such, the readings are incorrect. No matter. Just testing.

    I also had to set the CHT_SDA channels as 1:0 way round or the display would show the temp in the humidity line and humidity in the temp line. The temp though is showing the div10 figure in LED and -265 in GUI.

    Screenshot showing temperature readings from the CHT8305 sensor with a value of -26.585489 and three active drivers: NTP, CHT8305, GN6932. Digital display showing time, temperature, and humidity.

    Some random pics for the library

    Close-up of an electronic component on a blue printed circuit board with the markings B8310 CBET2H. GN6932 integrated circuit on a circuit board.
    Electronic circuit board with a series of LEDs marked with a QC label
    A blue circuit board with various electronic components.
    Message indicating no updates available for the device.
    Image of an LED WIFI T&H Sensor display showing temperature and humidity.
    Advertisement for a digital WiFi temperature and humidity sensor.
    Label with barcode and product information for the WiFi Smart Thermostat LED Display Electri Temperature and Humidity Sensor model TH03.
    Packaging of a smart Wi-Fi temperature and humidity sensor with Tuya logo.

    1.0.6 is not in the known patched firmware list, so could be cloudcutter compatible, if not already in there.

    Also, I've updated the OBK template a little. Still not 100% sure on the GN6932 channels
    https://github.com/OpenBekenIOT/webapp/pull/80
    Attachments:
    • readResult_BK7231N_QIO_cbu_temp_led_2024-26-2-16-08-23.bin (2 MB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • GN6932 channel indices are not used

    #38 20980392
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14756
    Help: 659
    Rate: 12883
    divadiow wrote:

    Unless you think it should go back into live...

    Growing flash size usage causes the "LittleFS is being removed by OTA" issue which pops up periodically on Github. That's why rarely used drivers are disabled.

    divadiow wrote:
    As such, the readings are incorrect.

    That's the old version without temperature/humidity probe driver. Can you check if it's working with new build with LED display driver enabled?

    divadiow wrote:

    Also, I've updated the OBK template a little. Still not 100% sure on the GN6932 channels
    https://github.com/OpenBekenIOT/webapp/pull/80

    Thank you. The channel indices of GN6932 pins are not used.
    Helpful post? Buy me a coffee.
  • #39 20980403
    divadiow
    Level 38  
    Posts: 5214
    Help: 448
    Rate: 916
    p.kaczmarek2 wrote:
    That's the old version without temperature/humidity probe driver. Can you check if it's working with new build with LED display driver enabled?


    that's my next step when I have setup github build to bin
  • #40 20980421
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14756
    Help: 659
    Rate: 12883
    I saw you've got already a bin in the PR.
    Helpful post? Buy me a coffee.
  • #41 20981282
    divadiow
    Level 38  
    Posts: 5214
    Help: 448
    Rate: 916
    oh. I see I see. and yay

    User interface screen of the OpenBK application showing temperature and humidity data along with other technical details.

    Digital thermometer with a display showing the current time, temperature, and humidity.

    so cool
  • #42 20981879
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14756
    Help: 659
    Rate: 12883
    I am glad to see it's working, good job.

    So, to sum up, the newer models come with CHT8310 instead of CHT8305? I wonder what are the differences between those two CHT sensors.
    Helpful post? Buy me a coffee.
  • CHT8310 replaces CHT8305 with minor differences

    #43 20981912
    divadiow
    Level 38  
    Posts: 5214
    Help: 448
    Rate: 916
    p.kaczmarek2 wrote:
    So, to sum up, the newer models come with CHT8310 instead of CHT8305? I wonder what are the differences between those two CHT sensors.


    yes. otherwise they seem identical.

    who knows what the deciding factors were in changing to CHT8310 though. chip shortage? discontinuation? :shrug:

    differences in Sensylink summary:

    Product list with technical specifications of sensors.

    about which chatgpt says

    Quote:
    Interface: Both the CHT8305 and CHT8310 use I2C and SMBus interfaces.

    Temperature Accuracy: Both have the same typical temperature accuracy of ±0.2°C.

    Humidity Accuracy:

    The CHT8305 has a humidity accuracy of ±2.0%RH at 50%RH.
    The CHT8310 has a wider humidity accuracy range of ±2.0%RH at 20%RH to 80%RH.
    Current Consumption at 1Hz (I_AOC/1Hz):

    The CHT8305 consumes 1.5µA.
    The CHT8310 consumes 2.0µA.
    Shutdown Current (I_SD):

    The CHT8305 has a shutdown current of 0.05µA.
    The CHT8310 has a slightly higher shutdown current of 0.055µA.
    Analog-Digital Converter Resolution (ADD): Both have an ADC resolution of 4.

    Package: Both use the same package type, DFN-3x3-6.
  • #44 20981971
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14756
    Help: 659
    Rate: 12883
    Take care, LLMs like ChatGPT may be unreliable in many cases. It's always better to check the datasheets and/or manufacturer's page.
    Helpful post? Buy me a coffee.
  • #45 20982322
    divadiow
    Level 38  
    Posts: 5214
    Help: 448
    Rate: 916
    I know, I know! I only fed it the Sensylink image to interpret and summarise 👍🏼
  • #46 21205039
    yuretskor
    Level 7  
    Posts: 52
    Help: 1
    Rate: 1
    Hi. Can you explain how the command works TMGN_SetBit? I'm trying to display the time on the display TM1637 and I can't do anything (I need help. Thank you
  • Example autoexec for GN6932 display control

    #47 21205129
    DeDaMrAz
    Level 23  
    Posts: 620
    Help: 34
    Rate: 130
    @yuretskor

    Here is an autoexec example I am using in my device that is based on a similar device (GN6932) so you can maybe have some idea about it

    startDriver GN6932
    startDriver NTP
    ntp_timeZoneOfs  +2:00
    
    //clear screen on boot
    TMGN_Clear
    
    //adjust brightness if needed (0-7) - default is 7 max
    TMGN_Brightness 7
    
    //static bits for displaying state, connection and various constant characters (like 'C or'F, AM/PM...)
    TMGN_SetBit 9 1 1
    TMGN_SetBit 9 2 1
    TMGN_SetBit 9 3 1
    TMGN_SetBit 9 7 1
    TMGN_SetBit 9 0 1
    TMGN_SetBit 10 2 1
    TMGN_SetBit 10 3 1
    
    //main loop to display clock and values from a CHT sensor
    again:
    TMGN_Print 7 2 $minute 1
    TMGN_Print 5 2 $hour 1
    TMGN_Print 2 3 $CH1 1
    TMGN_Print 0 2 $CH0 1
    delay_s 0.1
    //blinking : on the clock
    TMGN_SetBit 10 0 0
    TMGN_SetBit 10 1 0
    delay_s 1
    TMGN_SetBit 10 0 1
    TMGN_SetBit 10 1 1
    delay_s 1
    goto again


    I would suggest to you to use setbit to figure out which characters are available and can be used, then you can play around with print options form various channels.
  • #48 21205192
    yuretskor
    Level 7  
    Posts: 52
    Help: 1
    Rate: 1
    @DeDaMrAz thank you. But I would like to clarify what to write in the setbit command.
    Why 9 1 1 what do these numbers mean? Where to look and read?
  • TMGN_SetBit syntax for 7-segment displays

    #49 21205196
    DeDaMrAz
    Level 23  
    Posts: 620
    Help: 34
    Rate: 130
    @yuretskor

    In general those drivers can support multiple 7-segment display (some of them even keyboard matrixes) so it the particular example:

    TMGN_SetBit 9 1 1

    9 is index number for the display. remember multiple displays so 0-15 (I think, check the datasheet about the actual number it supports), next 1 is bit number of that display (all of them have 7 segments + a dot, so you are choosing what to control from 0-7) and last 1 is the actual value of that bit, so is that segment on or off = 1 or 0.

    Here is a picture for visual reference that I took some time ago while TMGN driver was created. Picture may not be 100% accurate but it'll do for reference (order may be reversed or segments starting from 0-7 etc.) It is from a TM1638 LED driver but you should get a good idea overall.

    Four 7-segment LED displays on a blue circuit board, with index and bit number labels.

    Also check the projects GitHub docs section and search for TMGN in there - https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md

    Hope it helps.
  • #50 21205197
    yuretskor
    Level 7  
    Posts: 52
    Help: 1
    Rate: 1
    And also what does it mean in a team TMGN_Print 7 2 The numbers 7 2 ?
  • #51 21205199
    DeDaMrAz
    Level 23  
    Posts: 620
    Help: 34
    Rate: 130
    @yuretskor

    Feel free to read tis topic from the beginning, everything should be cleared.
  • #52 21205343
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14756
    Help: 659
    Rate: 12883
    @yuretskor I recognize your issue from this topic:
    https://www.elektroda.com/rtvforum/topic3959243-90.html#21204872
    Your bit map is okay. Don't use TMGN_SetBit. I think you need to use TMGN_Map.
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    Helpful post? Buy me a coffee.
  • #53 21210107
    yuretskor
    Level 7  
    Posts: 52
    Help: 1
    Rate: 1
    please explain for the dumb that in the TMGN_Print command 7 2 means 7 and 2 if possible with an example. thanks
  • #54 21210176
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14756
    Help: 659
    Rate: 12883
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    Fragment of documentation showing the syntax and description of the TMGN_Print function.
    TMGN_Print [StartOffset] [MaxLenOr0] [Text]
    So, if you want to display on the, let's say, position 3, you do: TMGN_Print 3 0 XY
    If you want to display at start position (first digit), you do: TMGN_Print 0 0 XYZW
    Etc etc
    Helpful post? Buy me a coffee.
  • #55 21350125
    LeMaxime
    Level 7  
    Posts: 16
    Rate: 2
    Can someone provide a build with GN6932 driver? Compiling is so hard for me
    or provide esphome configuration
  • #56 21350238
    divadiow
    Level 38  
    Posts: 5214
    Help: 448
    Rate: 916
    attached. tested with mine. OTA success straight from last PR build which was still Feb 2024 dated
    Attachments:
    • OpenBK7231T_App_1469_merge_fc40b9f69f85.zip (1.35 MB) You must be logged in to download this attachment.
  • #58 21350840
    LeMaxime
    Level 7  
    Posts: 16
    Rate: 2
    >>21350238 thank you!

Topic summary

LABEL_AI_GENERATED
The discussion focuses on a generic USB-powered thermostat and humidity sensor device based on the Tuya CBU module, featuring a CHT8305 sensor and a GN6932 multi 7-segment LED display driver. Detailed hardware pin mappings were established: CHT8305 SDA to CBU P22, SCL to CBU P20; GN6932 DIN to CBU P15, CLK to P17, and STB to P28. The GN6932 driver was reverse-engineered, revealing it as a serial interface LED driver with 8-level brightness control and SPI-like communication, similar to TM1637 but with an added STB pin and no ACK. A test driver and example scripts were developed and integrated into the OpenBK7231T firmware, enabling display of temperature, humidity, and time with brightness adjustment and segment control via commands like TMGN_Print and TMGN_SetBit. Calibration for the CHT8305 sensor was initially missing but later implemented, allowing temperature offset correction. Newer device models reportedly use the CHT8310 sensor, which is similar but requires updated drivers. Firmware builds sometimes disable the GN6932 driver due to flash size constraints, requiring manual enabling in the configuration. Users shared scripts for clock display and sensor data visualization, including temperature unit conversion between Celsius and Fahrenheit. Additional support and clarifications on command usage (e.g., TMGN_SetBit parameters) were provided, along with links to source code and documentation. The community also addressed static IP configuration during OpenAP mode for device network setup. Overall, the device is now well-supported in OpenBeken firmware with active development on display drivers and sensor calibration.
AI summary based on the discussion. May contain errors.

FAQ LABEL_AI_GENERATED

TL;DR: For this BK7231N/CBU USB thermostat, 3 GN6932 lines and “bit order is swapped” are the key clues: use CHT on P22/P20, GN6932 on P15/P17/P28, then script TMGN for temperature, humidity, and time in OpenBeken. [#20535970] Why it matters: This turns a generic Tuya LED thermostat into a locally controlled OpenBeken sensor-display device without relying on Tuya cloud firmware.

Alternative Sensor or driver Thread-specific status Key command or setting
CHT8305 I2C temperature/humidity Original teardown sensor SDA P22, SCL P20
CHT8310 I2C temperature/humidity Seen in newer units Needs newer OpenBeken support
GN6932 8×16 LED driver Disabled in some newer builds #define ENABLE_DRIVER_TMGN 1
TM1637/TM1638 Related LED drivers Similar TMGN command family TMGN_Print, TMGN_SetBit

Key insight: The display is not TuyaMCU-driven. OpenBeken can drive it directly when the GN6932/TMGN driver is enabled and the three display pins are mapped correctly.

Quick Facts

  • CHT8305 wiring found in the device: SDA uses CBU pin 4/P22, SCL uses CBU pin 3/P20, and the alert pin was not connected. [#20535581]
  • GN6932 wiring found in the device: DIN uses CBU pin 21/P15, CLK uses CBU pin 20/P17, and STB uses CBU pin 17/P28. [#20535534]
  • GN6932 supports an 8-segment × 16-bit display mode, 8 brightness duty-cycle levels, an RC oscillator at 450 kHz ±5%, and an SOP32 package. [#20535551]
  • A working display command sequence used LSB-first bytes: 40, then C0 ..., then 8F; decoding it MSB-first made the packet look wrong. [#20536000]
  • Build 701 added working CHT_Calibrate; the example CHT_Calibrate -2 10 applies −2 °C temperature and +10 %RH humidity offsets. [#20539841]

How do I configure the CHT8305 sensor pins on a Tuya CBU BK7321N/BK7231N USB thermostat in OpenBeken?

Configure CHT8305 as I2C on CBU P22 and P20. Set CHT pin 1, SDA, to CBU pin 4/P22. Set CHT pin 6, SCL, to CBU pin 3/P20. The alert pin was reported as not connected. The thread confirmed the CHT sensor worked after this wiring map. [#20535581]

What is the GN6932 LED display driver and how does it communicate with the CBU module?

GN6932 is the multi-segment LED driver used by this thermostat display. "GN6932 is a display-driver IC that controls multi-segment LED displays, using a serial CLK, STB, and DIN interface with 8-segment × 16-bit output and 8 brightness levels." It receives low-bit-first serial data on CLK rising edges. [#20535551]

How do I start and test the GN6932 display driver in OpenBeken using TMGN commands?

Start the GN6932 driver, then send a TMGN test or print command. Use this 3-step check:
  1. Run startDriver GN6932.
  2. Run GN6932_TestAddressIncreaseMode to light random segments.
  3. Run TMGN_Brightness 7 and TMGN_Print 0 0 123456 to test output. Build 680 already showed changing patterns with the test command. [#20536357]

Why does OpenBeken say “Driver GN6932 is not known in this build” and how do I enable it?

OpenBeken says this when the build excludes the rarely used GN6932/TMGN driver. Newer builds disabled it to reduce flash usage and avoid LittleFS OTA problems. Enable it by compiling with #define ENABLE_DRIVER_TMGN 1 in obk_config.h. A custom build or pull-request build can also include it. [#20979746]

How can I create an autoexec.bat script to show temperature, humidity, and time on the GN6932 LED display?

Create autoexec.bat with GN6932, NTP, brightness, static bits, and a loop. The working example starts GN6932, starts NTP, sets timezone +2:00, prints minutes at offset 7, hours at offset 5, temperature at offset 2, and humidity at offset 0. It also blinks the clock colon by toggling bits 10:0 and 10:1 every 1 second. [#20537716]

What do the numbers mean in the OpenBeken command TMGN_Print 7 2 $minute 1?

7 is the start offset, and 2 is the maximum length. TMGN_Print uses the format TMGN_Print [StartOffset] [MaxLenOr0] [Text]. So TMGN_Print 7 2 $minute 1 prints the two-digit minute value starting at display position 7, with zero padding enabled by the final 1. [#21210176]

How does TMGN_SetBit work for controlling individual LED display segments on TM1637, TM1638, or GN6932 displays?

TMGN_SetBit 9 1 1 means display index 9, bit 1, value on. The first number selects a display byte or digit index, usually within 0–15. The second number selects one of 8 bits, matching 7 segments plus dot. The third number sets that segment off or on, using 0 or 1. [#21205196]

How do I calibrate CHT8305 temperature and humidity readings in OpenBeken with CHT_Calibrate?

Use CHT_Calibrate [temperature offset] [humidity offset] after starting the sensor driver. Build 701 confirmed CHT_Calibrate -2 10 worked. That example subtracts 2 °C from temperature and adds 10 %RH to humidity. Earlier SHT_Calibrate and SHT3X_Calibrate commands failed on CHT8305 because they targeted other drivers. [#20539841]

CHT8305 vs CHT8310: what are the differences and which sensor is used in newer versions of this USB thermostat?

Original units used CHT8305, while newer tested units used CHT8310. The newer board otherwise looked identical in the thread. An older OpenBeken build with GN6932 support lacked newer CHT8310 support, so readings became incorrect. The reported GUI value reached −265 while the LED showed a divided-by-10 temperature figure. [#20980349]

How can I set a static IP address for an OpenBeken device while it is still in AP mode?

Set the static IP from the OpenBeken configuration page while the device runs in AP mode. Choose an address that is unique on your target network. This solves the case where you can join Wi-Fi but cannot access the router page to discover the DHCP address. [#20629101]

What is OpenBeken and why is it used instead of the original Tuya firmware on BK7231N/CBU devices?

OpenBeken is alternative firmware for BK7231N/CBU devices that gives local control, scripting, sensor drivers, and display drivers. In this thermostat, users replaced Tuya firmware to read CHT8305 or CHT8310 data, drive GN6932 LEDs, run NTP time, and restore a working clock-temperature-humidity display without the Tuya cloud. [#20537716]

What is PulseView/Sigrok and how can it help decode DIN, CLK, and STB signals from a GN6932 display?

PulseView/Sigrok captures logic-analyzer traces from GN6932 DIN, CLK, and STB lines. "PulseView/Sigrok is a logic-analysis toolchain that records and decodes digital bus signals, letting users inspect byte order, chip-select timing, and serial display commands." In this case, it revealed LSB-first data and the sequence 40, C0 ..., 8F. [#20536000]

How can I restore the original 2 MB firmware backup to a Tuya CBU device after flashing OpenBeken?

Restore the original 2 MB backup by renaming it for the flasher and placing it in the firmware directory. One user renamed the backup to OpenBK7231N_QIO_1.15.xxx, flashed it, and confirmed the device returned to its original state. This gives a recovery path after OpenBeken testing. [#20535581]

What ESPHome configuration could be used for a BK7231N thermostat with CHT8305 or CHT8310 sensor and GN6932 LED display?

The thread did not provide a working ESPHome configuration for this thermostat. It only requested one in December 2024. The tested path used OpenBeken, a custom build with GN6932 enabled, CHT sensor support, and TMGN scripts. For ESPHome, the missing piece is GN6932 display support equivalent to OpenBeken TMGN commands. [#21350125]

Why might a GN6932 display show humidity and temperature in the wrong positions, and how can channel mapping or TMGN_Map fix it?

The display can show values in wrong positions when channel order or digit mapping does not match the physical grid. One user had to set CHT SDA channels as 1:0 because temperature appeared on the humidity line. For TM1637 mapping issues, the maintainer advised using TMGN_Map instead of TMGN_SetBit. [#20980349]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT