logo elektroda
logo elektroda
X
logo elektroda

[BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?

yuretskor 6693 97
ADVERTISEMENT
  • #1 20450321
    yuretskor
    Level 6  
    Good afternoon. I have a led lamp with a bk7321 processor and a sht30 sensor on my hands. I don't need it as a lamp, but I need it as a temperature and humidity meter. What firmware do I need to upload to it? To implement this. Sorry for my english, I'm from Ukraine. Thank you
  • ADVERTISEMENT
  • #2 20450395
    p.kaczmarek2
    Moderator Smart Home
    @yuretskor , flash it with OpenBeken, I can help you and guide step by step, but it would be very helpful if you posted detailed photos and model number of your device.
    Helpful post? Buy me a coffee.
  • #3 20450513
    yuretskor
    Level 6  
    I have such a module with a lamp. I did not take pictures of the module with LEDs. Thank you for reaching out to help. Tell me how to determine where to connect for the firmware,
    also the module needs to be soldered?
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED? [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED? [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
  • #4 20450565
    p.kaczmarek2
    Moderator Smart Home
    I have split your posts from here:
    [BK7231N CBU] Generic Temperature and Humidity Sensor
    as they deserve a separate topic.
    Ok, so please consult this topic:
    BK7231 datasheet, pinout, programming, specification, wiki (BK7231T, BK7231N)
    You have WBLC5 module:
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
    You don't have much choice when it comes to IO pins:
    Pin No.SymbolI/O typeFunction
    1ANTOExternal antenna pad pin
    2GNDPGround pin
    3PWM4I/OHardware PWM pin, which is connected to the P24 pin on the internal IC
    4PWM5I/OHardware PWM pin, which is connected to the P26 pin on the internal IC
    5PWM0I/OHardware PWM pin, which is connected to the P6 pin on the internal IC
    6VCCPPower supply pin (3.3 V)

    P6, P24, P26... you will need to use one of those pins.
    The programming port is UART1:
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
    You can use method like here:



    The flasher is here:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    Make sure to first read firmware and provide us a backup for analysis (it always helps).

    To make it simpler for you, I will write here a short brief description what you need to do:
    1. read and consult materials here
    2. get USB to uart converter
    3. get BK7231 easy flasher as linked here
    4. get 3.3V power supply (do not power bulb from mains!)
    5. solder GND, 3.3V, RX and TX for wifi module
    6. in flasher, start "Backup firmware (read)"
    7. while flasher is waiting for "getting bus", reattach 3.3V (power off/on cycle module)
    8. get firmware backup, send it to us
    9. then do firmware write with OpenBeken for BK7231T (the Easy Flasher can download proper firmware automatically)
    10. then make sure AP appears, make sure that OBK works, etc, open page at 192.168.4.1 etc just like Tasmota, configure your SSID
    11. finally, connect SHT sensor to available pins and set the pin roles on OBK web page

    It may sound complicated at first, but really, it's very easy, it's like 15 minutes job if you have all parts, but of course you will have to solder wires, etc...
    You can watch also this video:



    but it's for BK7231N and not BK7231T

    Your module can work outside the LED PCB if you want, it just needs GND and 3.3V, but you can keep it on LED board and power it from there but of course not during programming from PC!

    Do you want to keep LED function or totally convert it to SHT30 sensor?
    Helpful post? Buy me a coffee.
  • #5 20451573
    dheenhasty
    Level 13  
    if you don't want to bother with the led module i agree with @p.kaczmarek2 you can totally desolder the beken module and take example of the cbu schema to rely on a different alimentation (battery or usb) .... as 220 to 3,3V alim can impact measurement of SHT :

    https://obrazki.elektroda.pl/9879827700_1673859980.png

    with p24/P26 for sda and scl the alert is not necessary if you don't want to use it.
  • ADVERTISEMENT
  • #6 20452608
    yuretskor
    Level 6  
    Kind. I did everything according to the instructions. And I managed to flash it, I saw the access point, went into the settings, registered my point and password. Reloaded the module and now I can't find it. I did the firmware on a new one and now the access point does not appear. The first time was like that. After that, the whole module was lost. [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
  • #7 20452636
    dheenhasty
    Level 13  
    >>20452608

    After you configure your wifi endpoint the ip of your device changed. You need to check on your routeur which ip is assigned to your device (hostname will begin with opk.....)
  • #8 20452644
    p.kaczmarek2
    Moderator Smart Home
    You can also use the IP scanner tool and just let it iterate over your network. And if you want a static IP, you can do MAC reservation on your router.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #9 20452681
    yuretskor
    Level 6  
    The module is working. It did not work because there is no antenna and the access point is far away. Brought closer and everything is ok.
    Now tell me where to connect sht30 and if it is possible for the led backlight control to work? Thank you
  • #10 20452701
    p.kaczmarek2
    Moderator Smart Home
    Led backlight? So you want to keep LED functionality working?

    Well, in that case, you might be able to reuse the TX1 and RX1 port as a software I2C port for SH30. Maybe... I haven't tried that. You'd have to try.
    Helpful post? Buy me a coffee.
  • #11 20452963
    yuretskor
    Level 6  
    Now I need to solder the module back. How to understand on which contacts the LED module works?

    Added after 2 [hours] 15 [minutes]:

    Achieved stable operation of the module. I connect the sht30 sensor to vdd-vdd, grn-grn, sda-sda(pin rx uart1), scl-scl (pin tx uart1) . I make pin settings via the web. No data. Is there anything else you need to do to get the job done?
  • #12 20453219
    dheenhasty
    Level 13  
    >>20452963

    Yes starting the driver, and launch a measurement on a script of thru logs panel on webapp

    You can find how to do all that in tutorial section.
  • #13 20453678
    yuretskor
    Level 6  
    As I understand it, I need to register the following command, where to register it?

    PowerSave
    echo "activate SHT3X Sensor"
    startDriver SHT3X

    :loop
    SHT_Measure
    delay_s 300
    goto loop

    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED? [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
  • #15 20453730
    yuretskor
    Level 6  
    I can not find and understand what I need to read and enter. Maybe there is a video on setting up sht30 or maybe someone can do it. Thank you It's a pity the module broke and the led does not work and there is no temperature (
  • Helpful post
    #16 20453748
    p.kaczmarek2
    Moderator Smart Home
    @yuretskor you can easily configure LED first, I don't think anything is broken. Have you tried configuring PWM roles for IO of the WiFi module?

    Set PWM with channel 0 for P6, with channel 1 for P24, and with channel 2 for P26.
    Helpful post? Buy me a coffee.
  • #17 20453752
    yuretskor
    Level 6  
    For input output I use pins Rx1, Tx1 for sht30. Well, I’ll deal with the ice module right away.
  • ADVERTISEMENT
  • Helpful post
    #18 20453785
    dheenhasty
    Level 13  
    >>20453752


    For the SHT you got a correct script.

    You just need to write this script in white webapp/littlefs tab.

    You can access the white webapp from the main menu of the device. There's a button

    In this mode you can test command in panel "logs" and write script in "filesystem" tab

    Once you are satisfied with your script you can put it as start command.
  • #19 20453801
    yuretskor
    Level 6  
    Will it work on Rx Tx?

    Added after 2 [hours] 43 [minutes]:

    With the help of the script, below came out to get the readings. Only it works while I send the command. How can I make measurements automatically every 1 second when power is applied?

    PowerSave
    echo "activate SHT3X Sensor"
    startDriver SHT3X
    
    :loop
    SHT_Measure
    delay_s 1
    goto loop


    Added after 22 [minutes]:


    This is how it is now displayed, while I press "save, run file as ... " then the data is updated, no further.
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED? [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
  • #20 20454144
    p.kaczmarek2
    Moderator Smart Home
    Maybe just use addRepeatingEvent instead of trying to write loop? Your syntax of label seems incorrect, and furthermore autoexec is run in place and not executed as script, hmm.... but you can peek here:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/selftest/selftest_script.c
    Repeating event is simpler...
    https://github.com/openshwprojects/OpenBK7231.../main/src/selftest/selftest_repeatingEvents.c

    Btw, @dheenhasty , wouldn't it be easier for future users to just enable automatic measure per default? I think current approach is wrong, it costs nothing to do a measurement...
    Helpful post? Buy me a coffee.
  • #21 20454171
    yuretskor
    Level 6  
    My programming knowledge is "0". Thanks for the links, but I don't understand them. I agree with you that the readings should be measured automatically, and not program another code. Since it was done on hard firmware. I'll wait for a normal firmware, and I'll throw it all in the box, since my knowledge is not enough. And I just wanted to measure the temperature and send it via MQTT. Thank you all, hands down, it's very difficult for me
  • #22 20454182
    p.kaczmarek2
    Moderator Smart Home
    Well, all you need to do is:
    
    PowerSave
    echo "activate SHT3X Sensor"
    startDriver SHT3X
    
    addRepeatingEvent 10 -1 SHT_Measure
    

    And this should work, repeating measurement every 10 seconds, forever.

    I think that we will soon change the logic to do a SHT_Measure automatically (make automatic measurement enabled by default, @dheenhasty , and let user override it and set manual mode? So it works without any scripting?)
    Helpful post? Buy me a coffee.
  • #23 20454228
    yuretskor
    Level 6  
    Thanks It works. A little more and I will leave you behind, and you will forget me like a bad dream.
    Now how can I get this data via MQTT if I have the following settings and the part with Log
    Info:GEN:No change in channel 0 (still set to 222) - ignoring
    
    Info:GEN:No change in channel 1 (still set to 58) - ignoring
    
    Info:SENSOR:SHT3X_Measure: Temperature:22.289615C Humidity:58.985275%
    Info:MAIN:Time 60, idle 51296/s, free 88560, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:GEN:dhcp=0 ip=192.168.0.104 gate=192.168.0.1 mask=255.255.255.0 mac=c8:47:8c:00:00:00 
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-75,ssid=K.Y.A,bssid=e8:94:f6:3a:e5:b4 ,channel=4,cipher_type:CCMP
    Info:MAIN:Time 61, idle 59074/s, free 88560, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:Time 62, idle 56458/s, free 88560, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:Time 63, idle 56747/s, free 88560, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:Time 64, idle 54615/s, free 79936, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 POWERSAVE
    Info:GEN:No change in channel 0 (still set to 222) - ignoring 

    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
  • #24 20454237
    p.kaczmarek2
    Moderator Smart Home
    Better stay with us on the forum, we are happy to help.

    So, maybe let's start with it - what is your status here, has the MQTT connection succeed?
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?

    Btw you have 00000s in MAC, you might want to fix it in Open Web Application -> Flash -> restore RF partition..
    Helpful post? Buy me a coffee.
  • #25 20454243
    yuretskor
    Level 6  
    >>20454237 @p.kaczmarek2 Yes, there is a connection. What does 00000 in a MAC address do?
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
  • #26 20454271
    p.kaczmarek2
    Moderator Smart Home
    You might have accidentally erased your MAC, this is why here is 00:00:00:
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
    Not a problem, it's easy to fix as I said.

    Is your MQTT server a Home Assistant?
    Helpful post? Buy me a coffee.
  • #27 20454302
    yuretskor
    Level 6  
    No, this is not Home Assistant. I need to get data separately 22.2 is one topic 58.7 is another topic. Is it possible? I need a direct link to a topic like
    rule1ds1egor/tasmota_fd09d1/SENSOR

    Added after 1 [hours]:

    I understand the topic should be obc8C000000/channel1/get
    ? But there's nothing there
  • #28 20454488
    dheenhasty
    Level 13  
    p.kaczmarek2 wrote:
    I think that we will soon change the logic to do a SHT_Measure automatically (make automatic measurement enabled by default, @dheenhasty , and let user override it and set manual mode? So it works without any scripting?)


    Yes was thinking of it. I need to detect if per is activated
  • Helpful post
    #29 20454498
    p.kaczmarek2
    Moderator Smart Home
    @yuretskor enable that in flags:
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
    then, assuming you have latest version, in Launch Web Application set channel types; for temperature (channel 0) set Temperature_Div10, for humidity (1) set humidity:
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?
    Helpful post? Buy me a coffee.
  • #30 20454637
    yuretskor
    Level 6  
    @p.kaczmarek2 thanks, it worked. But there is a BIG BUT:
    1. data via mqtt can only be received until the module is rebooted, after rebooting it is necessary to enter the channel type again, for some reason they are not saved.
    2. if the data on the channels does not change and has one value, then mqtt displays an error, this is very visible in humidity, since there is rounding to an integer and it does not change so quickly, it is less in temperature, there is rounding to hundredths of 0.1 and there are fewer errors, although they also exist.
    How can these problems be solved?
    Thanks to everyone for the help, to be honest, I don’t understand how someone can think of what needs to be changed in the flag settings, only the developer

    Added after 38 [minutes]:

    A quick solution to the problem is to make the same bit depth for humidity as for temperature. How to do?
    Or maybe there is a flag for such purposes?
    I am close to solving my problems

    Added after 9 [minutes]:

    in Log writes
    Info:GEN:No change in channel 1 (still set to 58) - ignoring

    How to remove this function that always published the value?

    Added after 43 [minutes]:

    I need the data every 5 minutes to send to the server. Below is a screen on which the red line sends data without gaps (temperature from another module), the white temperature with bk7231t sht30 sometimes has a gap every 10 minutes, and the blue line is humidity, it can be seen that the data came very few times due to the fact that humidity changes much less frequently than temperature and rounding to the nearest whole number. The temperature rounds up to 0.001 everything is fine. Also, after all, the type of flags was preserved, perhaps there was some kind of glitch. Like this (
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?

    Added after 11 [hours] 25 [minutes]:

    The guys are really bad with the data. There is a module on esp8266 with Tasmota firmware that works on the same server, only sends data to the mqtt topic according to the rule. And there is no problem with passes.
    [BK7231T/WBLC5] How to attach SHT30 sensor to smart Tuya LED?

Topic summary

The discussion focuses on integrating an SHT30 temperature and humidity sensor with a smart Tuya LED lamp module based on the BK7231T processor, specifically the WBLC5 module. The user seeks firmware and configuration guidance to repurpose the lamp as a temperature and humidity meter. The OpenBeken firmware is recommended, with detailed instructions on flashing, pin assignments (notably PWM0/P6, PWM4/P24, PWM5/P26 for I2C and LED control), and UART1 usage for programming. The SHT30 sensor is connected via software I2C on UART1 pins (Rx1/Tx1), requiring driver activation and scripting in the device's web interface (autoexec.bat or LittleFS scripts) to initiate periodic measurements. MQTT integration is addressed, including channel type settings, data publishing intervals, and troubleshooting MAC address issues. LED control uses the SM2135 LED driver with RGBCW channels over I2C (SDA on PWM4/P24, SCL on PWM5/P26), with commands for color mapping and brightness adjustment. Conflicts between LED and sensor I2C usage due to shared global variables were identified and resolved in firmware updates. The TM1637 4-digit display support was developed and integrated, allowing cyclic display of time, temperature, and humidity via scripting. Challenges with channel persistence after reboot, MQTT data resolution, and Android browser compatibility for color control were discussed and addressed through firmware updates. The conversation includes advanced scripting examples for event handling, channel mapping, and MQTT broadcast tuning. The user also encountered difficulties with TM1637 digit order and firmware compilation, receiving guidance and precompiled firmware with TM1637 support. Overall, the thread provides a comprehensive technical roadmap for customizing BK7231T-based Tuya LED modules with SHT30 sensors, LED color control, MQTT telemetry, and TM1637 display integration using OpenBeken firmware and scripting.
Summary generated by the language model.
ADVERTISEMENT