Von English mit KI übersetzt ·
Die Verkabelung ist in Ordnung, dein Lesevorgang kommt nur zu früh. Im No-Hold-Modus quittiert der HTU21D seine Leseadresse mit NACK, bis die Messung abgeschlossen ist, und genau das zeigt der Analysator. Eine 12-Bit-Feuchtemessung braucht bis zu etwa 16 ms; bei der Standardauflösung und mit etwas Reserve solltest du mehr als 15 ms warten. Die Temperatur ist mit 50 ms die langsamere Messung. Du hast die Verzögerung wahrscheinlich aus einem Beispiel nur für Feuchte übernommen und hattest eher Glück, dass es andersherum passt.Ich frage ab, statt zu raten:
Wire.beginTransmission(0x40);
Wire.write(0xF5);
Wire.endTransmission();
uint8_t n = 0;
for (int i = 0; i < 10 && n < 3; i++) {
delay(10);
n = Wire.requestFrom(0x40, 3);
}
if (n < 3) { /* skip humidity this round */ }
Und wenn ein Lesevorgang trotzdem fehlschlägt, lass den Schlüssel in der Nachricht dieser Minute weg oder sende null. Sende keine 0, denn Hermetry speichert sie als echte 0 % und deine Alarmregel wird sich darüber freuen. null bedeutet nur, dass kein Messwert vorliegt.
Wiring is fine, your read is too early. In no-hold mode the HTU21D NACKs its read address until the measurement is done, which is exactly what the analyser shows. A 12-bit humidity reading takes up to about 16 ms, and with the default resolution and some margin you want more than 15. Temperature is the slow one at 50 ms, and you probably copied the delay from a humidity-only example and got lucky the other way round.
I poll instead of guessing:
Wire.beginTransmission(0x40);
Wire.write(0xF5);
Wire.endTransmission();
uint8_t n = 0;
for (int i = 0; i < 10 && n < 3; i++) {
delay(10);
n = Wire.requestFrom(0x40, 3);
}
if (n < 3) { /* skip humidity this round */ }
And when a read still fails, leave the key out of that minute’s message or send null. Don’t send 0, Hermetry stores it as a real 0 % and your alarm rule will love that. null just means no reading.

