logo elektroda
logo elektroda
X
logo elektroda

[BK7231N CBU] Generic Temperature and Humidity Sensor

Chasbrot 54129 359
ADVERTISEMENT
  • #211 20751568
    zdenekphilipp
    Level 4  
    Your RX and TX is connected correctly. Your orange connected to 18 it is a reset pin ... ok but you will need male connector.
    Next you need to connect 13 GND and 14 VCC and connect to USB dongle for powering.

    Here is a simple picture

    Close-up of a circuit board with markings for TX1, RX1, GND, 3.3V, and RST connections.
  • ADVERTISEMENT
  • #212 20751809
    p.kaczmarek2
    Moderator Smart Home
    It's worth noting that almost the same board is used for door sensors, but in case of the door sensors, the H1 or H2 fields are populated with a hall sensor. The flashing procedure still is similiar.
    Helpful post? Buy me a coffee.
  • #214 20757334
    p.kaczmarek2
    Moderator Smart Home
    Hello, it should be possible to first use:
    
    setChannel 10 0
    

    to set, for example, channel 10 to 0, and then:
    
    addChannel 10 $CH11
    

    to add value from channel 11 (for example) to 10
    and then:
    
    publishFloat myAverageResult $CH10/5
    

    to publish average over MQTT.

    I've tested it in self test system for Simulator and it works:
    https://github.com/openshwprojects/OpenBK7231...mmit/0e0ed935a8e5e11d65f59c0b6a2e1687a9c6efd7
    Helpful post? Buy me a coffee.
  • #215 20758541
    zdenekphilipp
    Level 4  
    I have no idea if it works or not :)

    setChannel 10 0
    
    startDriver SHT3X
    SHT_Calibrate 0 0
    
    addEventHandler OnHold 20 SafeMode 3
    waitFor WiFiState 4
    waitFor MQTTState 1
    
    SHT_Measure
    delay_s 1
    
    addChannel 10 $CH2
    
    publishFloat "temperature" $CH10/10
    delay_s 1
    
    publishInt "humidity" $CH3
    delay_s 1
    
    SendGET http://192.168.0.222:80/sensorTemp?id=10178502&t=$CH2&h=$CH3&p=1000&v=1
    delay_s 5
    
    DeepSleep 120
  • #216 20758705
    p.kaczmarek2
    Moderator Smart Home
    The following code looks incorrect. If you want to divide by 10 to get the measurement, you're supposed to first sum 10 measurements, maybe within some kind of a loop. Currently you're taking just one measurement and then divide it by 10...
    Helpful post? Buy me a coffee.
  • #217 20766261
    jokubek1
    Level 3  
    Hello, what is the maximum voltage without changing on the PCB I can power the device ? 5V?
  • #218 20769811
    davidhuenig
    Level 1  
    I guess 3,6 v as the bk7231n mcu is limited to this voltage...
    So it might even fry your device if you run out from a single lipo battery.
  • #219 20769820
    p.kaczmarek2
    Moderator Smart Home
    Isn't U1 a step up converter?
    There are two 1.5V batteries in this device, so at max you get 3V, which gets converted to 3.3V. When batteries discharge, their voltage drops, so probably a safe margin to run is 2V-3V or so
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #220 20770221
    jokubek1
    Level 3  
    I checked, up to 4.5V it works above it dies.
  • #221 20772179
    erdeidominik1999
    Level 8  
    Hello!
    Is there any way to round the temp value to 2 decimals? (not in HA with template sensor) I get 15 decimals in HA a lot of times. How to edit the autoexec file if I boot to safe mode to not going to deepsleep, because in safe mode the web app not load only a white page.
  • #222 20776710
    DeDaMrAz
    Level 19  
    @erdeidominik1999

    Can you update you device to 1.17.280 and test how temp reading is behaving and report here? After the update you'll have to delete the device from HA and run auto-discovery again btw.

    Thanks.
  • #223 20776712
    p.kaczmarek2
    Moderator Smart Home
    Hello @erdeidominik1999 , it seems there was a rounding error in the template side.

    Please update OBK, then remove device from HA, and then redo hass discovery and let us know if it works better for you now.
    Helpful post? Buy me a coffee.
  • #224 20776917
    Rafael22
    Level 21  
    Hello Gentlemen I need to swap the sensor so that it has an external probe, does it only fit sth30 or will another one come up without flashing the prock later. ??
  • #225 20777183
    p.kaczmarek2
    Moderator Smart Home
    Without changing the firmware, you will not connect another sensor.
    Helpful post? Buy me a coffee.
  • #226 20777201
    Rafael22
    Level 21  
    That is, I have to search by sth30 cable
  • #227 20777526
    p.kaczmarek2
    Moderator Smart Home
    SHT30, not STH30. In addition, remember that this sensor has a selectable address, so you need to use the same as on the PCB.... it seems to me.
    Helpful post? Buy me a coffee.
  • #228 20777558
    Rafael22
    Level 21  
    p.kaczmarek2 wrote:
    SHT30, not STH30. In addition, remember that this sensor has a selectable address, so you need to use the same as on the PCB.... I think so.

    This is my understanding. Yesterday on FB in the Tuya group someone presented that he swapped to an external probe and it works, but he does not want to provide a link or the name of the probe.

    I found on allegro Soil Temperature and Humidity Sensor FS304-SHT30 (shipping from china)
    Digital output, I2C interface

    FS304-SHT3x soil temperature and humidity sensor with cable.


    and in those temp sensors TH01 or whatever it is called there are different sensors not only SHT30 ?

    photo from Facebook of this guy

    The image shows a white temperature sensor with a cable and an app screen displaying temperature and humidity data. .
  • ADVERTISEMENT
  • #229 20777705
    p.kaczmarek2
    Moderator Smart Home
    If you manage to swap then let us know. You can even to the Guides write a topic then.

    To the best of my knowledge, this series of sensors uses only this SHT30. These sensors come in two versions, one has the WiFi module alone, which falls into deep sleep, and the SHT30, and the other has the WiFi module + MCU that controls its power supply (TuyaMCU) and the same SHT30.
    Helpful post? Buy me a coffee.
  • #230 20777819
    Rafael22
    Level 21  
    I will let you know when the probes and sensors arrive from aliexpress.
  • #231 20792033
    erdeidominik1999
    Level 8  
    Hello!
    Is there any way to use waitFor with a timeout? I want to wait for MQTTState 1, but if the server is offline the sensor waits forewer, which drains the battery.
  • #232 20792042
    p.kaczmarek2
    Moderator Smart Home
    Hello @erdeidominik1999 ! I am usually using repeating event with 1 repeats for that, but now that you speak about it, maybe it would make sense to extend the waitFor somehow... do you have any ideas?
    Maybe add a second parameter which is a maximum allowed wait in seconds? And third parameter which would be a command to run in that case? Hmmm
    Helpful post? Buy me a coffee.
  • #233 20792052
    erdeidominik1999
    Level 8  
    That's a wonderful idea @p.kaczmarek2 !
    With that for example I can set it to 30-45 seconds, and if it reaches the timeout it goes to a longer deep sleep. Can you make it?
    Also can you make the wifi signal report in percent which we spoke about in the another topic?
    And can you set the retain flag for the rssi topic? Because it gets unavail when using a deep sleep device.
    Thank you!
  • #234 20798468
    Rafael22
    Level 21  
    Hello. The SHT30 transplant was successful, although I have a slight problem.
    I desoldered the original SHT30 using a plastic welder.

    Attempts to solder the probe cables to the PCB pins in place of the original sensor ended in failure for me, the pads were too small for me.
    I soldered the wires in other places according to the photo.
    The probe reads the temperature, a slight correction would be useful, but that's not the problem.
    The problem is that it doesn't refresh the temperature. I waited over 45 minutes and no change, the change occurs when I press Reset.
    I don't know if I did something wrong or what.
    Close-up view of a PCB with probe wires soldered to different points. SHT30 probe connected to a PCB with soldered wires. Sensor with SHT wires and a label.


    ##########
    Edition

    The temperature updated after an hour. It's strange because it seemed to me that this sensor updates every 15-20 minutes
  • ADVERTISEMENT
  • #235 20798868
    p.kaczmarek2
    Moderator Smart Home
    @erdeidominik1999 Do you know the retain syntax that I would need to add for RSSI?

    I will look into that percentage soon.

    For now, if you want to do something to prevent hanging forever on waitfor, try:
    
    // addRepeatingEvent	[IntervalSeconds][RepeatsOr-1][CommandToRun]
    addRepeatingEvent 10 1 setChannel 1 0
    

    If you do this before waitFor, it will still execute with specified delay, it will not be blocked by waitfor.

    @Rafael22 it's hard for me to tell what's the default behaviour of Tuya firmware here, but here is only the WiFi module, you may need to check whether it reboots or not within those 1 hour of delay. You could do that by listening to UART on TX2 (debug log output)
    Helpful post? Buy me a coffee.
  • #236 20799090
    erdeidominik1999
    Level 8  
    @p.kaczmarek2 I think it is the same as retain with another payload, if the retain flag is set you should add the retain to the publish.

    So if the repeating event is clear to me, if I add this before the wait for mqtt state 1 for example, if it fails to connect in 30 seconds it will go to sleep for 15 mins?
    addRepeatingEvent 30 1 DeepSleep 900
  • #237 20799626
    p.kaczmarek2
    Moderator Smart Home
    erdeidominik1999 wrote:
    @p.kaczmarek2 I think it is the same as retain with another payload, if the retain flag is set you should add the retain to the publish.]

    Well, but if I were to add retain to RSSI, wouldn't it confuse users for non-battery powered devices? Maybe it would be better for you to set "always retain" flag in flags?

    erdeidominik1999 wrote:

    So if the repeating event is clear to me, if I add this before the wait for mqtt state 1 for example, if it fails to connect in 30 seconds it will go to sleep for 15 mins?
    addRepeatingEvent 30 1 DeepSleep 900

    This should work as you described.
    Helpful post? Buy me a coffee.
  • #238 20800233
    erdeidominik1999
    Level 8  
    I already set the flag 7, always retain, but it not works for rssi, for every other it works.
  • #239 20859230
    kuba4321234
    Level 1  
    Hello, can you help me identify this sensor? I don't think it is STH30



    Image of a circuit board section with a component labeled 8310 CBRT2A. Electronic sensor disassembled into parts, showing PCB and casing. .
  • #240 20860069
    p.kaczmarek2
    Moderator Smart Home
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around the BK7231N CBU temperature and humidity sensor, particularly focusing on its integration with OpenBeken firmware. Users share experiences regarding the sensor's performance, battery life, and configuration challenges. Key topics include the effectiveness of deep sleep modes for power saving, the calibration of the SHT30 sensor, and the impact of various configurations on battery consumption. Users also discuss issues with incorrect temperature readings, the need for proper GPIO assignments, and the potential for using alternative sensors. Several users report successful modifications and share their autoexec.bat scripts for optimal operation. The conversation highlights the importance of correct pin configurations and the challenges faced when using low-quality batteries.
Summary generated by the language model.
ADVERTISEMENT