logo elektroda
logo elektroda
X
logo elektroda

[Solved] Calibrating Temperature & Humidity Sensor on TuyaMCU with OpenBeken

geocristi 5073 9
Best answers

Can I set a calibration offset for the temperature and humidity readings on a TuyaMCU device in OpenBeken?

You cannot calibrate the sensor directly on this TuyaMCU device in OpenBeken, because OBK does not know or run the underlying AHT sensor driver there [#21274797] The practical workaround is to apply a software offset with an event handler, for example `addEventHandler OnChannelChange 1 setChannel 2 $CH1+1.23`, so one channel stays raw and another becomes the calibrated value [#21274797] Make sure you use the correct channel number for your setup: in the referenced config, channel 2 is humidity, so temperature may be on channel 3 instead [#21277218] This only changes the value seen by OpenBeken and Home Assistant; it does not change the display on the device screen because that screen is connected directly to the MCU [#21277218] In the end, the thread concludes there is no direct way to calibrate the sensor itself [#21297264]
Summary generated by AI based on the discussion content.
ADVERTISEMENT
This content has been translated flag-pl » flag-en View the original version here
  • #1 21274484
    geocristi
    Level 3  
    Posts: 5
    Hi,
    Is there any possibility to set an offset or calibration of the temperature and humidity sensor?
    I tried, but without success: AHT2X_Calibrate -2 5, CHT_Calibrate -2 5
    thx
    Moderated By p.kaczmarek2:


    I've split this post from https://www.elektroda.com/rtvforum/topic3942730.html

  • ADVERTISEMENT
  • #2 21274572
    divadiow
    Level 38  
    Posts: 5153
    Help: 442
    Rate: 906
    geocristi wrote:
    AHT2X_Calibrate -2 5

    this should work I believe
  • ADVERTISEMENT
  • #3 21274593
    geocristi
    Level 3  
    Posts: 5
    >>21274572
    The T&H sensor is indeed AHT10, but unfortunately "AHT2X_Calibrate" has no effect
    I also tried to load a driver startDriver AHT10, still no effect
  • ADVERTISEMENT
  • AHT2X driver missing from default build

    #4 21274608
    divadiow
    Level 38  
    Posts: 5153
    Help: 442
    Rate: 906
    oh. what build firmware are you using? what platform is your device? AHT2X driver is not included in the build by default. If Beken, the firmware in here would have included the driver:
    https://github.com/openshwprojects/OpenBK7231T_App/actions/runs/8769670483
    but the download link has expired, so attached.

    AHT2X experiments here https://www.elektroda.com/rtvforum/topic4052685.html and information on adding the driver to the latest code and making your own custom OpenBeken firmware:

    https://www.elektroda.com/rtvforum/topic4081556.html
    https://www.elektroda.com/rtvforum/topic4082682.html
    Attachments:
    • OpenBK7231T_App_1187_merge_4738dd2d9ba2.rar (1.3 MB) You must be logged in to download this attachment.
  • Driver-agnostic calibration via channel change handler

    #5 21274797
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14699
    Help: 656
    Rate: 12734
    @geocristi are you referring to the device from the original first post? It's a TuyaMCU device, so OpenBeken "doesn't know" what sensor is used, you can't calibrate it directly. AHT driver is not even run on OBK.

    The best you can do is:
    
    addEventHandler OnChannelChange 1 setChannel 2 $CH1+1.23
    

    This assumes that channel 1 is not calibrated value and channel 2 is calibrated. This is an universal, driver-agnostic approach.
    Helpful post? Buy me a coffee.
  • WB3S OTA update bricked TH06 device

    #6 21276546
    geocristi
    Level 3  
    Posts: 5
    @divadiow - I did not build a firmware specially for this. I removed the WiFi chip from the device and burned it with the default.
    Then I follow the instructions for creating the autoexec.bat, nothing more.
    The firmware: Built on Oct 25 2024 06:03:18 version 1.17.757
    The device: TH06 with WB3S wifi chipset
    Regarding the archive posted by you above, I tried to make an OTA update, after which it became a brick. I had to desolder the WB3S and write it again.

    @p.kaczmarek2 - Yes, it is the same device for which you put in so much work, and I thank you for that!
    addEventHandler OnChannelChange 1 setChannel 2 $CH1+1.23 - has no effect!

    Thank you both!
  • #7 21276590
    divadiow
    Level 38  
    Posts: 5153
    Help: 442
    Rate: 906
    geocristi wrote:
    I did not build a firmware specially for this.

    Yeh, my bad. I didn't check device in first post. No need for driver if TuyaMCU
  • #8 21276605
    geocristi
    Level 3  
    Posts: 5
    >>21276590 No problem! Still search for a way of calibration.
  • Channel mapping and screen calibration limitations

    #9 21277218
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14699
    Help: 656
    Rate: 12734
    geocristi wrote:

    @p.kaczmarek2 - Yes, it is the same device for which you put in so much work, and I thank you for that!
    addEventHandler OnChannelChange 1 setChannel 2 $CH1+1.23 - has no effect!

    Are you sure? Remember that:
    - if you are using config from the first post, then channel 2 is humidity, then you should rather use channel 3
    - if you are using HA or anything else, note that old raw temperature will still be in channel 1 and calibrated will be in channel 3....
    - futhermore, this only calibrates the temperature seen by OpenBeken and Home Assistant, there is no known way to change it for screen because screen is connected directly to the MCU in your device. So unless there is a calibration dpID (but I don't remember seeing this in app), there is no way to change screen temperature...
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #10 21297264
    geocristi
    Level 3  
    Posts: 5
    There is no way to calibrate the sensor
    The topic may be closed

Topic summary

✨ The discussion revolves around the calibration of temperature and humidity sensors, specifically the AHT10 model, using TuyaMCU with OpenBeken firmware. The original poster inquires about setting an offset for calibration but encounters issues with the commands AHT2X_Calibrate and CHT_Calibrate. Responses indicate that the AHT2X driver is not included by default in the firmware build, and calibration may not be directly possible due to the limitations of TuyaMCU. Suggestions include using event handlers to adjust channel values, but it is noted that this only affects readings in OpenBeken and Home Assistant, not the display connected to the MCU. Ultimately, it is concluded that there is no known method to calibrate the sensor effectively.
Summary generated by AI based on the discussion content.
ADVERTISEMENT