# Aht21 sensor support

**URL:** <https://klipper.discourse.group/t/aht21-sensor-support/20265>\
**Category:** Developers\
**Created:** [November 26, 2024, 4:18am UTC](https://klipper.discourse.group/t/aht21-sensor-support/20265 "2024-11-26T04:18:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shom](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@shom](https://klipper.discourse.group/u/shom)\
**Post date:** [November 26, 2024, 4:18am UTC](https://klipper.discourse.group/t/aht21-sensor-support/20265/1 "2024-11-26T04:18:25Z")

</div>

### Basic Information:

Printer Model: voron2.4r2  
 MCU / Printerboard: btt octopus pro  
 MCU / toolhead: btt ebb36  
 Host / SBC: rpi5b

### Describe your issue:

Hi everyone, I bought an aht21 module, its initialization command is 0xBE, but the code in klipper is 0xE1, it only supports aht10, and the humidity does not display decimals.

Is there a developer who can reprogram it?  
I have tested it and it can run successfully.

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/3/319d55858348eab309d169a0763adf20ae021677.png)

This c++ code supports multiple aht sensors.

> <https://github.com/enjoyneering/AHTxx/blob/main/src/AHTxx.h>

---

<div class="post-metadata">

**Author:** ![shom](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@shom](https://klipper.discourse.group/u/shom)\
**Post date:** [November 26, 2024, 4:21am UTC](https://klipper.discourse.group/t/aht21-sensor-support/20265/2 "2024-11-26T04:21:13Z")

</div>

![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/7/79d1f1fe0d3e0f54dfa1a6cfb74dab1c725eeb20.png)

---

<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:** [November 27, 2024, 2:31pm UTC](https://klipper.discourse.group/t/aht21-sensor-support/20265/3 "2024-11-27T14:31:19Z")

</div>

If I understood correctly, it works right now, you just do not see humidity decimals  
I’m not sure it is worth adding additional specifics to aht21 behavior to increase resolution, just because it is around internal error.

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/c/c0e66d80ed09418513433a01eae36c6b8397a607.png)

FWIW, to alter behavior, it is enough to look to htu21.py and do something similar

---

<div class="post-metadata">

**Author:** ![shom](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@shom](https://klipper.discourse.group/u/shom)\
**Post date:** [November 28, 2024, 4:36am UTC](https://klipper.discourse.group/t/aht21-sensor-support/20265/4 "2024-11-28T04:36:05Z")

</div>

yes，the premise is to change the initialization parameter 0x1E to 0xBE.

---

<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:** [January 27, 2025, 4:36am UTC](https://klipper.discourse.group/t/aht21-sensor-support/20265/5 "2025-01-27T04:36:21Z")

</div>

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