# I2C SHT21 Calibration

**URL:** <https://klipper.discourse.group/t/i2c-sht21-calibration/21102>\
**Category:** General Discussion\
**Created:** [January 3, 2025, 4:40pm UTC](https://klipper.discourse.group/t/i2c-sht21-calibration/21102 "2025-01-03T16:40:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandman\_51](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@sandman\_51](https://klipper.discourse.group/u/sandman_51)\
**Post date:** [January 3, 2025, 4:40pm UTC](https://klipper.discourse.group/t/i2c-sht21-calibration/21102/1 "2025-01-03T16:40:11Z")

</div>

### Basic Information:

Printer Model: 2.4  
 MCU / Printerboard: Manta M8P  
 Host / SBC: CM4

### Describe your issue:

A currently working i2c SHT21 sensor. Wired into a Sunlu S4 drybox.

The issue is that the humidity in Mainsail displays at 0% - it should be around 16%. The temperature is accurate. (I have two other temp/humid sensors in the dry box.

Question: Is there a way to apply a calibration curve or bias?

```auto
[temperature_sensor Filament_Dryer]
sensor_type: SHT21
i2c_mcu: host
i2c_bus: i2c.1
htu21d_resolution: TEMP11_HUM11
htu21d_report_time: 20

[gcode_macro QUERY_TEMP]
gcode:
    {% set sensor = printer['htu21d Filament_Dryer'] %}
    M117 Temp:{sensor.temperature} Humidity:{sensor.humidity}
        {action_respond_info(
        "Temperature: %.2f C\n"
        "Humidity: %.2f%%" % (
            sensor.temperature,
            sensor.humidity))}

```

…

---

<div class="post-metadata">

**Author:** ![nefelim4ag](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/nefelim4ag/32/2387_2.png) [@nefelim4ag](https://klipper.discourse.group/u/nefelim4ag)\
**Post date:** [January 3, 2025, 8:18pm UTC](https://klipper.discourse.group/t/i2c-sht21-calibration/21102/2 "2025-01-03T20:18:18Z")

</div>

No way, aside from code modification.  
If you use your macro to monitor humidity - then you can apply that logic there.

Thats it.

* * *

FWIW, I think just use the better sensor, I do not see a way to compensate bad humidity values as high as you mention.

---

<div class="post-metadata">

**Author:** ![sandman\_51](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@sandman\_51](https://klipper.discourse.group/u/sandman_51)\
**Post date:** [January 3, 2025, 10:24pm UTC](https://klipper.discourse.group/t/i2c-sht21-calibration/21102/3 "2025-01-03T22:24:57Z")

</div>

Yeah, that’s what I thought. $3 sensor, so what else would I get\> 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/klipper/original/1X/64419bf2aac6639e6ef5cef200dcd456b0a01ac3.png) [@system](https://klipper.discourse.group/u/system)\
**Post date:** [March 4, 2025, 10:25pm UTC](https://klipper.discourse.group/t/i2c-sht21-calibration/21102/4 "2025-03-04T22:25:22Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
