logo elektroda
logo elektroda
X
logo elektroda

[Solved] How to Configure BK7231N CB3S for All 5 Values with TuyaMCU?

babaganesh 1038 7
ADVERTISEMENT
  • Helpful post
    #1 20964751
    babaganesh
    Level 3  
    Hi

    This usb powered sensor should give 5 values.
    I was able to flash cb3s via bkn app, but no config available

    >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}e
    >No module information found.
    >And the Tuya section starts, as usual, at 2023424

    White WiFi-enabled air sensor displaying its functions.
    Circuit board with pin and component markings.
    Two white air sensors on a purple background with Russian text describing 5 in 1 features.


    so I set this autoexec.bat

    startDriver tuyaMCU
    startDriver tmSensor
    linkTuyaMCUOutputToChannel 1 val 1
    setChannelType 1 Temperature
    linkTuyaMCUOutputToChannel 2 val 2
    setChannelType 2 Humidity

    and get
    Temperature 0.0C (1)
    Humidity 63.0% (2)

    (real humidity is 1/2 of this value).

    So what and where should I look next to get all 5 values ?

    It's my first time with tuyaMCU, I guess if I choose right mcu channels
    there would be values. But what about tuyaMCU pins, are they being set automatically ?

    Added after 23 [minutes]:

    logs contain

    Info:TuyaMCU:Received: 55 AA 03 07 00 08 15 02 00 04 00 00 00 96 C2
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 21 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 150
    Info:TuyaMCU:Received: 55 AA 03 07 00 08 16 02 00 04 00 00 05 29 5B
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 7 (State) len 15
    Info:TuyaMCU:ParseState: id 22 type 2-val len 4
    Info:TuyaMCU:ParseState: int32 1321
  • ADVERTISEMENT
  • Helpful post
    #2 20965031
    p.kaczmarek2
    Moderator Smart Home
    TuyaMCU is always using UART1 port, so there is nothing to set.

    Good job on configuration so far, you have the basics covered.

    Your log indicates that there is a dpID 22 with value "1321", do you have any ideas what it might be?

    You can add it to your autoexec like:
    
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 22 val 3
    setChannelType 3 ReadOnly
    

    then, later, you can change "ReadOnly" to a proper channel type, depending on the variable meaning.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20973883
    babaganesh
    Level 3  

    I've connected usb2ttl rx on cb3s rx and used TuyaMCUAnalyzer
    while checking data from same unflashed sensor.

    Here is what I got

    dpid sensor
    19 humidity*10 %
    18 temp*10 centigrade
    22 co2 ppm
    21 voc*100 ppm
    2 hcho*100 mg/m^3

    voc - Volatile organic compounds
    hcho – Formaldehyde
  • ADVERTISEMENT
  • Helpful post
    #4 20973993
    p.kaczmarek2
    Moderator Smart Home
    Are now all the required datapoints discovered?
    Helpful post? Buy me a coffee.
  • #5 20974000
    babaganesh
    Level 3  
    Only 3 channels on web

    Screenshot of diagnostic information from OpenBK7231N.

    with config

    startDriver tuyaMCU
    startDriver tmSensor
    linkTuyaMCUOutputToChannel 18 val 1
    setChannelType 1 Temperature_div10
    linkTuyaMCUOutputToChannel 19 val 2
    setChannelType 2 Humidity_div10
    linkTuyaMCUOutputToChannel 22 val 3
    setChannelType 3 Custom
    SetChannelLabel 3 CO2 ppm
    setChannelVisible 3 1
    linkTuyaMCUOutputToChannel 2 val 4
    setChannelType 4 Custom_div100
    SetChannelLabel 4 HCHO mg/m^3
    setChannelVisible 4 1
    linkTuyaMCUOutputToChannel 21 val 5
    setChannelType 5 Custom_div100
    SetChannelLabel 5 VOC ppm
    setChannelVisible 5 1


    How to make Custom channels with div ?

    upd.
    with just Custom as type all values available

    Channel 1 = 334.00, Channel 2 = 252.00, Channel 3 = 594.00, Channel 4 = 3.00, Channel 5 = 6.00

    Added after 23 [minutes]:

    The other thing is led control via MCU,
    original firmware send this on start vix cb3s tx (it is connected to wifi).
    With last msg led is off

    //R 2024-02-22 22:32:07 WiFi received:
    55AA00000000FF
    //R 2024-02-22 22:32:07 WiFi received:
    55AA0001000000
    //R 2024-02-22 22:32:07 WiFi received:
    55AA0002000001
    //R 2024-02-22 22:32:07 WiFi received:
    55AA0025000024
    //R 2024-02-22 22:32:11 WiFi received:
    55AA0008000007


    Added after 46 [minutes]:

    It's just blue led controlled via MCU.
    Can't turn it on, tried:

    tuyaMcu_setupLED 24 0 - will show menu on index, and nothing change on clicking anything.

    uartSendASCII 55AA00000000FF
    uartSendASCII 55AA0001000000
    uartSendASCII 55AA0002000001
    uartSendASCII 55AA0025000024


    this also won't lightup the led

    Added after 3 [minutes]:

    I reset original firmware, so the led start flashing every 2 sec.
    But on cb3s tx there is only:

    //R 2024-02-22 23:22:05 WiFi received:
    55AA00000000FF
    //R 2024-02-22 23:22:05 WiFi received:
    55AA0001000000
    //R 2024-02-22 23:22:06 WiFi received:
    55AA0002000001
    //R 2024-02-22 23:22:06 WiFi received:
    55AA0025000024
  • ADVERTISEMENT
  • Helpful post
    #6 20974516
    p.kaczmarek2
    Moderator Smart Home
    There is currently no Custom_div100 in a codebase, but it sounds like a good idea. Would you like me to add that for you?

    For now, you could use ReadOnly type instead and set a label.
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md

    If WiFi LED is blinking, add the following to the script:
    
    // set TuyaMCU default wifi state 0x04, which means "paired",
    // because some TuyaMCU MCUs will not report all data
    // unless they think they are connected to cloud
    tuyaMcu_defWiFiState 4
    
    Helpful post? Buy me a coffee.
  • #7 20974636
    babaganesh
    Level 3  

    Custom_div100 - I mean "type cast" either be on openbeken or somewhere else along the "pipe".
    I would like it in the beginning on openbeken to not think about it later, so please add it, thank you.

    >If WiFi LED is blinking

    vice versa, led don't work at all. I tried:

    tuyaMcu_defWiFiState 1
    tuyaMcu_defWiFiState 2
    tuyaMcu_defWiFiState 3
    tuyaMcu_defWiFiState 4
    tuyaMcu_defWiFiState 5

    but that don't make any difference.
    I guess I don't need it, just was curious how
    to tinker with it via MCU.
  • #8 20974638
    babaganesh
    Level 3  

    startDriver tuyaMCU
    startDriver tmSensor
    linkTuyaMCUOutputToChannel 18 val 1
    setChannelType 1 Temperature_div10
    linkTuyaMCUOutputToChannel 19 val 2
    setChannelType 2 Humidity_div10
    linkTuyaMCUOutputToChannel 22 val 3
    setChannelType 3 Custom
    SetChannelLabel 3 CO2 ppm
    linkTuyaMCUOutputToChannel 2 val 4
    setChannelType 4 Custom
    SetChannelLabel 4 HCHO mg/m^3
    linkTuyaMCUOutputToChannel 21 val 5
    setChannelType 5 Custom
    SetChannelLabel 5 VOC ppm

Topic summary

The discussion revolves around configuring the BK7231N CB3S device to read five sensor values using TuyaMCU. The user successfully flashed the device but encountered issues with configuration, specifically with retrieving all sensor data. Initial configurations provided temperature and humidity readings, but additional values such as CO2, VOC, and HCHO were not accessible. Users suggested linking additional data points (dpID 22 for CO2, dpID 21 for VOC, and dpID 2 for HCHO) to channels and setting appropriate channel types. There were discussions about the absence of a "Custom_div100" type in the codebase, with suggestions to use "ReadOnly" instead. The user also explored controlling the WiFi LED state via MCU commands but found no effect. The final configuration included linking all five values with their respective types and labels.
Summary generated by the language model.
ADVERTISEMENT