Hey am fairly new to programming and having trouble with the AHT10 sensor.
I am just trying to up load to a ESP32 WROOM 32 and have it present readings on the serial monitor for now.
I finally found some sample code which seemed to work however the Humidity and Temp readings are always around 2.8% and -50C which seems slightly off being a nice spring morning in the UK...
The readings do change slightly if I warm it up or breath on it to increase humidity it just seems wildy uncalibrated.
my code is:
#include <Wire.h>
#define SHT10_ADDRESS 0x38
void setup() {
Wire.begin(); // Initialize I2C
Serial.begin(9600);
}
void loop() {
// Start measurement
Wire.beginTransmission(SHT10_ADDRESS);
Wire.write(0xAC);
Wire.write(0x33);
Wire.write(0x00);
Wire.endTransmission();
// Wait for measurement to complete (e.g., 80ms)
delay(80);
// Request data
Wire.requestFrom(SHT10_ADDRESS, 7);
// Read data
if (Wire.available()) {
byte status = Wire.read(); // Status byte (not used here)
byte humidity_msb = Wire.read();
byte humidity_lsb = Wire.read();
byte temp_msb = Wire.read();
byte temp_lsb = Wire.read();
byte checksum = Wire.read();
// Process humidity and temperature data (example)
float humidity = ((humidity_msb << 8) | humidity_lsb) * 100.0 / 1048576.0;
float temperature = (((temp_msb << 8) | temp_lsb) * 200.0 / 1048576.0) - 50.0;
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println("%");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println("C");
}
delay(2000); // Wait for next reading
}
Any pointers would be most welcome, I have tried with a second AHT10 I have to the same avail.