# Htu21d on raspberry pi

**URL:** <https://klipper.discourse.group/t/htu21d-on-raspberry-pi/1257>\
**Category:** General Discussion\
**Created:** [November 6, 2021, 12:06pm UTC](https://klipper.discourse.group/t/htu21d-on-raspberry-pi/1257 "2021-11-06T12:06:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prophetmaster](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/prophetmaster/32/472_2.png) [@prophetmaster](https://klipper.discourse.group/u/prophetmaster)\
**Post date:** [November 6, 2021, 12:06pm UTC](https://klipper.discourse.group/t/htu21d-on-raspberry-pi/1257/1 "2021-11-06T12:06:18Z")

</div>

hello, i want to configure htu21d on raspberry pi second mcu

my config :

```auto
[mcu host]
serial: /tmp/klipper_host_mcu

[temperature_sensor enclosure_temp]
sensor_type: HTU21D
i2c_mcu: host
htu21d_resolution: TEMP14_HUM12

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

[adxl345]
cs_pin: host:None
# Raspberry pi host config

[resonance_tester]
accel_chip: adxl345
probe_points:
    0,0,20 # an example

```

i get error :

MCU ‘host’ error during config: Unable to open i2c device  
Once the underlying issue is corrected, use the  
“FIRMWARE\_RESTART” command to reset the firmware, reload the  
config, and restart the host software.  
Error configuring printer

---

<div class="post-metadata">

**Author:** ![cacalot93](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@cacalot93](https://klipper.discourse.group/u/cacalot93)\
**Post date:** [April 27, 2022, 7:56am UTC](https://klipper.discourse.group/t/htu21d-on-raspberry-pi/1257/2 "2022-04-27T07:56:04Z")

</div>

Just missed!  
sensor\_type: HTU21D  
i2c\_mcu: rpi  
i2c\_bus: i2c.1

---

<div class="post-metadata">

**Author:** ![madorax251](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@madorax251](https://klipper.discourse.group/u/madorax251)\
**Post date:** [May 18, 2022, 1:43am UTC](https://klipper.discourse.group/t/htu21d-on-raspberry-pi/1257/3 "2022-05-18T01:43:30Z")

</div>

i use fluidd does the temperature and humidity show up on the dashboard like mcu hotend tempertature and heatbed temperature?

---

<div class="post-metadata">

**Author:** ![sifago](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@sifago](https://klipper.discourse.group/u/sifago)\
**Post date:** [March 29, 2023, 4:30pm UTC](https://klipper.discourse.group/t/htu21d-on-raspberry-pi/1257/4 "2023-03-29T16:30:03Z")

</div>

This is how it works with a Raspberry Pico 2040  
at GPIO 16 (SDA PIN 21) and GPIO 17 (SCL PIN 22)

So funktioniert es mit einem Raspberry Pico 2040  
am GPIO 16 (SDA PIN 21) und GPIO 17 (SCL PIN 22)

````auto
[temperature_sensor Raumklima]
sensor_type: HTU21D
i2c_mcu: pico
i2c_bus: i2c0e
htu21d_resolution: TEMP14_HUM12

[gcode_macro QUERY_HTU21D]
gcode:
    {% set sensor = printer["htu21d Raumklima_temp"] %}
    {action_respond_info(
        "Temperature: %.2f C\n"
        "Humidity: %.2f%%" % (
            sensor.temperature,
            sensor.humidity))}```

````
