logo elektroda
logo elektroda
X
logo elektroda

[BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?

Hostermen 126 2
ADVERTISEMENT
  • Need pin mapping for CHT8310 on BK7238

    #1 21934270
    Hostermen
    Level 2  
    Posts: 2
    [BK7238] [T1-S3] [CHT8310] TH01 WiFi Temperature & Humidity Sensor

    Hi,

    i sucessfully flashed openBeken onto these TH01 temperature sensors which uses a T1-S3 Module.

    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?
    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?
    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?
    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?
    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?

    It is a battery powered device and the flashing steps were rather difficult because it goes back to its sleep mode quickly and terminats it's connections.

    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?

    I found out that the button on this device keeps the chip from falling "asleep".
    So I had to set the baudrate up (9600 -> 1500000) so the transfer got done faster and during the flashing process (read or write) keep clicking the physical button every secound or so to keep the device from falling asleep.

    The connection was setup with my USB2TTL - CH340 adapter and i put 3.3VCC, GND, TX1 and RX1 according to the pinlayout.

    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?

    I had to switch RX, TX vice versa, so to say i switched it a couple of times so it matches correctly to give me a correct output signal.
    Then i reset it while powered on with everything connected with the CEN/RST pin with GND to bring it into "download/flashing mode"
    BK7231GUIFlashTool-build-378 - BK73123Flasher for Windows was used for that which worked fine for chiptype BK7238 (T1).

    Breadboard with a small circuit board and jumper wires on a desk; device with LED lights in the background.

    This way it sucessfully flashed the openBK firmware on the device and it opened its Hotspot.
    --
    Now i face the issue that i have no clue about the pin configuration on the webinterface.

    I made a firmware dump of the device before and tried to extract the Config from it but it only says:
    Sorry, no meaningful pins data found. This device may be TuyaMCU or a custom one with no Tuya config data.
    Baud keyword found, this device may be TuyaMCU or BL0942. Baud value is 9600
    No module information found.
    Device internal platform - T1, equals BK7238.
    And the Tuya section starts at 2052096 (0x1F5000), which is a default T1/XR806 and some T34/BK7231N offset.


    It is printed CH8310_SCL and CHT8310_SDA on the PCB of the board so i assume its using the CHT83XX driver.

    I want the device to display the Temperature, Humidity, Battery Level readings and maybe have the Button as well as the LED of the device working.

    Can someone with more knowledge help me figure out the Pin configuration for these devices?

    Screenshot of OpenBeken page showing pins P0–P28 with dropdowns, value fields, and a “Save” button.

    --
    Datasheet T1-S3:
    https://developer.tuya.com/en/docs/iot/T1-3S-Module-Datasheet?id=Keesax53r0r2d

    I do have another device with its original firmware
    If someone has an idea or can help me figure out the pin configuration mybe with TuyaMCUAnalyzer-v0.5 would be greatly appreciated.

    Can you upload clear photos of both sides of the PCB, especially the traces/labels from CHT8310_SCL, CHT8310_SDA, the button, LED and battery measurement circuit to the T1-S3 module pins?
    I've attached photos of both sides of the PCB.

    Which OpenBeken build/version did you flash, and did you already try any pin roles in the webinterface, for example CHT83XX SCL/SDA, Button, LED or ADC/Battery?
    I did try these two firmwares:
    OpenBK7238_QIO_1.18.297.bin
    OpenBK7238_QIO_1.18.297_battery.bin
    Attachments:
    • extractConfig.json.txt (5.63 KB) You must be logged in to download this attachment.
    • firmwareDumpBeforeOpenBKflashing.bin (2 MB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • TuyaMCU setup yields no sensor values

    #3 21934387
    Hostermen
    Level 2  
    Posts: 2
    Okay, since the T1-S3 is a tuyaMCU the pin configuration is not needed i guess? I left them all blank for now.

    I tried with the startup commands that i found in the comments and matched them against the dpID's and baud rate i got from the config extract of the firmware dump.

    loglevel 6
    logfeature 12 1
    
    startDriver tmSensor
    startDriver TuyaMCU
    
    tuyaMcu_setBaudRate 9600
    tuyaMcu_defWiFiState 4
    
    // dpID 102 is temperature div 10
    setChannelType 102 temperature_div10
    linkTuyaMCUOutputToChannel 102 val 102
    
    // dpID 103 is % humidity
    setChannelType 103 Humidity
    linkTuyaMCUOutputToChannel 103 val 103
    
    // dpID 104 is battery state - low(0), mid(1) and high(2)
    setChannelType 104 ReadOnly
    linkTuyaMCUOutputToChannel 104 enum 10
    setChannelLabel 10 Battery


    But no values show up.
    Can you point me into the direction of how to go about this?


    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?

    Screenshot of OpenBeken startup command editor with a code-like text box and a “Submit” button.

    Added after 2 [hours] 56 [minutes]:

    #######################################################################################################

    yeah, for anyone reading this i found i way to do the last mile.
    First i set these commands up:
    //Verbose logging
    loglevel 6
    //Logging Features
    logfeature 12 1
    //starting the tuyaMCU driver
    startDriver TuyaMCU
    //setting the device so it assumes its cloud connected
    tuyaMcu_defWiFiState 4

    Then i mapped the dpID's I have extracted from the firware to this:

    //Temperature type Channel 1 with divider by 10
    setChannelType 1 Temperature_div10
    //since there are 64 channels the dpID is mapped to val 1
    linkTuyaMCUOutputToChannel 102 val 1
    //apply a label to the channel
    setChannelLabel 1 Temperature

    //Humidity type Channel 2
    setChannelType 2 Humidity
    //since there are 64 channels the dpID is mapped to val 2
    linkTuyaMCUOutputToChannel 103 val 2
    //apply a label to the channel
    setChannelLabel 2 Humidity

    //Battery type Channel 3
    setChannelType 3 ReadOnly
    //since there are 64 channels the dpID is enumerated to 3
    linkTuyaMCUOutputToChannel 104 enum 3
    //apply a label to the channel
    setChannelLabel 3 Battery

    (dont use the // comments in your config)

    loglevel 6
    logfeature 12 1
    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    setChannelType 1 Temperature_div10
    linkTuyaMCUOutputToChannel 102 val 1
    setChannelLabel 1 Temperature
    setChannelType 2 Humidity
    linkTuyaMCUOutputToChannel 103 val 2
    setChannelLabel 2 Humidity
    setChannelType 3 ReadOnly
    linkTuyaMCUOutputToChannel 104 enum 3
    setChannelLabel 3 Battery


    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?

    Next i did launch the Web Application and reviewed the logs tab.
    I first started seening this:

    Info:TuyaMCU:Received: 55 AA 03 01 00 37 7B 22 70 22 3A 22 78 65 61 67 69 6D 61 6E 74 62 37 64 37 61 70 62 22 2C 22 76 22 3A 22 31 2E 30 2E 30 22 2C 22 6D 22 3A 30 2C 22 6E 22 3A 31 2C 22 73 6D 22 3A 30 7D 24
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 1 (QueryProductInformation) len 62
    Info:TuyaMCU:ParseQueryProductInformation: received {"p":"xeagimantb7d7apb","v":"1.0.0","m":0,"n":1,"sm":0}


    This made made me assure that tuyaMCU driver was running and serial was connected between openBK and tuyaMCU, which means things are going in the right direction.
    I've had to press the physical button to make this message apprear, if i did not set the baud rate explicitly (tuyaMCU_setBaudRate 9600 OR tuyaMCU_setBaudRate 115200)

    It does show this TODO message from time to time.
    Info:TuyaMCU:Received: 55 AA 03 02 00 00 04
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 2 (MCUconf) len 7
    Info:TuyaMCU:ProcessIncoming: TUYA_CMD_MCU_CONF, TODO!


    but after i applied the correct config to the startup commands, i got

    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:Will send TUYA_CMD_QUERY_STATE (state_updated==false, try 0).
    Info:MAIN:Time 32, idle 405516/s, free 114832, MQTT 0(2), bWifi 1, secondsWithNoPing -1, socks 2/24 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 33, idle 392900/s, free 114920, MQTT 0(2), bWifi 1, secondsWithNoPing -1, socks 2/24 
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:Will send TUYA_CMD_QUERY_STATE (state_updated==false, try 1).
    Info:MAIN:Time 34, idle 405465/s, free 114712, MQTT 0(2), bWifi 1, secondsWithNoPing -1, socks 3/24 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    ExtraDebug:TuyaMCU:Will send SetWiFiState 4.
    Info:MAIN:Time 35, idle 397966/s, free 114920, MQTT 0(2), bWifi 1, secondsWithNoPing -1, socks 2/24 
    Info:TuyaMCU:Received: 55 AA 03 03 00 00 05 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 3 (WiFiState) len 7
    Info:TuyaMCU:Received: 55 AA 03 22 00 08 66 02 00 04 00 00 01 25 BE 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 34 (Unknown) len 15
    Info:TuyaMCU:ParseState: id 102 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 293
    Info:GEN:CHANNEL_Set channel 1 has changed to 293 (flags 0)
    Info:MQTT:Channel has changed! Publishing 293 to channel 1
    Info:TuyaMCU:ProcessIncoming: 0x22 replying
    Info:TuyaMCU:Received: 55 AA 03 22 00 08 67 02 00 04 00 00 00 21 BA 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 34 (Unknown) len 15
    Info:TuyaMCU:ParseState: id 103 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 33
    Info:GEN:CHANNEL_Set channel 2 has changed to 33 (flags 0)
    Info:MQTT:Channel has changed! Publishing 33 to channel 2
    Info:TuyaMCU:ProcessIncoming: 0x22 replying
    Info:TuyaMCU:Received: 55 AA 03 22 00 05 68 04 00 01 02 98 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 34 (Unknown) len 12
    Info:TuyaMCU:ParseState: id 104 type 4-enum len 1
    Info:TuyaMCU:ParseState: byte 2
    Info:GEN:CHANNEL_Set channel 3 has changed to 2 (flags 0)
    Info:MQTT:Channel has changed! Publishing 2 to channel 3
    Info:TuyaMCU:ProcessIncoming: 0x22 replying

    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?

    After that, the values appeard on the webinterface.
    [BK7238] [T1-S3] [CHT8310] How to configure pins on TH01 T & H sensor after OpenBeken flash?

    So thankfully i did not have to set any pin configuration after all.
    idk, silly me!
ADVERTISEMENT