logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CB3S] Tuya Smart Air Box Air Quality Monitor, 5 sensors

lars4 2409 26
ADVERTISEMENT
  • #1 21169769
    lars4
    Level 5  
    I have problems getting the values ​​out after switching to OpenBeken

    Printed circuit board with electronic components viewed from above.

    White circular device labeled Tuya Smart Air Box with Tuya, Wi-Fi, and Smart Life logos on top.

    With original firmware this is read out:
    Table with sensor values read after switching to OpenBeken.

    2 = CH2O mg/m^3, div 100
    18 = Temperature, div 10
    19 = Humidity, div 10
    21 = VOC ppm, div 10
    22 = CO2 ppm


    Autoexec.bat

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


    After I switch to OpenBeken, this is read out
    Screenshot of a WiFi data decoding tool showing raw packets.

    Screenshot of AirBox interface showing all sensor readings at 0.00.

    Anyone have any suggestions what I have missed?
  • ADVERTISEMENT
  • #2 21169772
    divadiow
    Level 34  
    >>21169769

    at what baud did you capture original comms?

    if 115200, add tuyaMcu_setBaudRate 115200 to your autoexec
  • #3 21169777
    lars4
    Level 5  
    >>21169772

    unfortunately it doesn't help. Used 9600 as default
  • ADVERTISEMENT
  • #4 21169786
    divadiow
    Level 34  
    was the CB3S removed from the PCB for flashing?

    Is there definitely continuity between the module and the pad, between the very edge of the gold contact on the module and the silver pad on PCB, eg between these dots

    CB3S module on a PCB with marked solder points.

    and then continuity onwards to the legs of the MCU it's talking to?
  • #5 21169787
    lars4
    Level 5  
    >>21169786

    No, it was not removed. No resistors had to be unsoldered either, it was still possible to flash. I have tried to flash back the original firmware and then everything works as it did before
  • #6 21169789
    divadiow
    Level 34  
    oh. what if you get rid of startDriver tmSensor
  • #7 21169796
    lars4
    Level 5  
    >>21169789

    I've tried it, it came up with different information in the serial log; unfortunately, I don't have a screenshot of it, but I can get that if needed.
  • #8 21169812
    divadiow
    Level 34  
    could do? im not sure what to suggest next.
  • ADVERTISEMENT
  • #9 21169825
    lars4
    Level 5  
    >>21169812
    without startDriver tmSensor

    Screenshot of a data packet analysis tool in hexadecimal format.
  • #10 21169837
    divadiow
    Level 34  
    oh hang on. add tuyaMcu_defWiFiState 4 under startDriver TuyaMCU
  • #11 21169842
    lars4
    Level 5  
    >>21169837

    Still no values :-(

    Screenshot of a packet decoder tool for WiFi communication.

    Autoexec.bat
    startDriver TuyaMCU
    //startDriver tmSensor
    
    tuyaMcu_defWiFiState 4
    tuyaMcu_setBaudRate 9600
    
    
    setChannelType 1 Temperature_div10
    linkTuyaMCUOutputToChannel 18 val 1
    
    setChannelType 2 Humidity_div10
    linkTuyaMCUOutputToChannel 19 val 2
    
    setChannelType 3 Custom
    SetChannelLabel 3 CH2O mg/m^3
    linkTuyaMCUOutputToChannel 2 val 3
    
    setChannelType 4 Custom
    SetChannelLabel 4 VOC ppm
    linkTuyaMCUOutputToChannel 21 val 4
    
    setChannelType 5 Custom
    SetChannelLabel 5 CO2 ppm
    linkTuyaMCUOutputToChannel 22 val 5
  • Helpful post
    #12 21169855
    divadiow
    Level 34  
    I'm probably forgettng something obvious

    and if you enter command tuyaMcu_sendQueryState do you get all the current dpID statuses returned to the log?
  • #13 21169864
    lars4
    Level 5  
    >>21169855

    Now I got the values after entering the command tuyaMcu_sendQueryState Thanks!!!

    After restarting, I need to send the command again for it to display the values
  • #15 21169869
    lars4
    Level 5  
    >>21169866

    Working autoexec.bat

    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    tuyaMcu_setBaudRate 9600
    setChannelType 1 Temperature_div10
    linkTuyaMCUOutputToChannel 18 val 1
    setChannelType 2 Humidity_div10
    linkTuyaMCUOutputToChannel 19 val 2
    setChannelType 3 Custom
    SetChannelLabel 3 CH2O mg/m^3
    linkTuyaMCUOutputToChannel 2 val 3
    setChannelType 4 Custom
    SetChannelLabel 4 VOC ppm
    linkTuyaMCUOutputToChannel 21 val 4
    setChannelType 5 Custom
    SetChannelLabel 5 CO2 ppm
    linkTuyaMCUOutputToChannel 22 val 5
    tuyaMcu_sendQueryState
    

    Thanks so much for your help!
  • #16 21169896
    divadiow
    Level 34  
    no worries. is your firmware backup in credential-free state and would you mind sharing it?
  • #17 21169914
    lars4
    Level 5  
    >>21169896
    it's not in that mode, but do you still have use for it? It doesn't matter to me
  • Helpful post
    #18 21169916
    divadiow
    Level 34  
    template for device list

    Code: JSON
    Log in, to see the code


    https://github.com/OpenBekenIOT/webapp/pull/136

    Added after 1 [minutes]:

    lars4 wrote:
    it's not in that mode, but do you still have use for it? It doesn't matter to me


    only to post here and to see if there's anything else of interest from it. I would flash to my own device to see what boot log is. if you'd rather DM it me I can attempt factory reset and put fake credentials into it

    Added after 34 [minutes]:

    boot log. known patched v2.1.17 so cloudcutter no good

    Code: Text
    Log in, to see the code
  • ADVERTISEMENT
  • #19 21171036
    p.kaczmarek2
    Moderator Smart Home
    Thank you @divadiow for you activity.

    Some hints from me:
    - tmSensor is only for battery powered devices
    - tuyaMcu_sendQueryState can be send in repeating event (like every 15 seconds etc)
    - TuyaMCU baud rate can be detected from 2MB flash so there is no need to guess
    - it may be useful to enable PowerSave on this device (as on many others)

    Extra question: Is this DHT sensor of some kind? On device photo?
    Helpful post? Buy me a coffee.
  • #20 21173494
    divadiow
    Level 34  
    I wonder if it's a DHT20.

    DHT20 humidity and temperature sensor with four metal pins.

    Added after 8 [minutes]:

    How could the poster confirm apart from desoldering and trying the sensor with one of the DHT sensor driver option or just an Arduino setup?

    https://github.com/search?q=repo%3Aopenshwprojects%2FOpenBK7231T_App+dht&type=code&p=2

    DHT20 isn't mentioned but does the driver support it anyway?

    I guess if a dump of the MCU flash could be had there might be mention in there of the exact sensor
  • #21 21173538
    lars4
    Level 5  
    >>21173494

    I'll see what I can figure out. I haven't been home for a couple of days

    Added after 1 [hours] 44 [minutes]:

    >>21173494

    Yes it is a DHT20
    Close-up of an ASAIR DHT20 sensor on an electronic board.

    I can't find any information about the second sensor

    Image of a circuit board with several electronic components, including a sensor labeled BP0315-01# HMNST.

    Guess it says BP0315-01# HMNST
  • #24 21174799
    lars4
    Level 5  
    >>21174757

    Perfect, good work!
  • #26 21177061
    p.kaczmarek2
    Moderator Smart Home
    So it's DHT20 indeed. It should work well with OBK directly, without MCU:



    HGS1000, on the other hand, is not currently supported. I've checked @divadiow 's documents but I can't see any details about the communication protocol used by HGS1000 family. Maybe we would need to hook up a 10$ logic analyzer for that, like I did in some other topics: https://www.elektroda.com/rtvforum/topic4035491.html

    Added after 1 [minutes]:

    EDIT: It's UART:
    Diagram showing DHT20 and a table with pin descriptions. Fragment of technical documentation for a UART communication protocol, including a data packet structure and example code in a programming language.
    Helpful post? Buy me a coffee.
  • #27 21180371
    lars4
    Level 5  
    >>21177061

    In this case, there is no need for directly connected sensors. The values are reported correctly after the "tuyaMcu_sendQueryState" command is sent.

Topic summary

The discussion revolves around issues faced by a user after switching the firmware of a Tuya Smart Air Box Air Quality Monitor (model CB3S with BK7231N chip) to OpenBeken. The user initially struggled to retrieve sensor values, which were correctly displayed with the original firmware. Various troubleshooting steps were suggested, including adjusting baud rates, removing specific drivers, and sending commands to query the state of the device. Ultimately, the user successfully retrieved the values by using the command `tuyaMcu_sendQueryState`, although it required re-sending the command after each restart. The conversation also touched on the sensors used in the device, identifying one as a DHT20 and another as an HGS1000, with discussions on their compatibility and communication protocols.
Summary generated by the language model.
ADVERTISEMENT