Comments (12)
Mmm, I know how you get h = 0 & h = -50, but I don't know why this is happening.
My first assumption is that the sensor is not ready after startup and needs more time to initialize. I made a few changes to the library. Could you download and test the changes?
Thank you.
from aht10.
Tested, problem still there.
from aht10.
Hmm. Ok, could provide your myAHT10.begin() part of the program?
Also add Wire.setClockStretchLimit(10000); at the end of void setup() and run the code without checking h2 == 0 t2 == -50?
Thank you.
from aht10.
myAHT10.begin() was last thing to start in setup.
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
delay(5000);
ESP.restart();
}
ArduinoOTA.setHostname("AHT10_temp_test");
ArduinoOTA.onStart([]() {
Serial.println("Start");
});
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.begin();
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
client.setServer(mqtt_server, 1883);
dht.begin();
myAHT10.begin();
Wire.setClockStretchLimit(10000);
}
Same results..
anyway -50°C is outside of AHT10/AHT15 sensor measuring range and i don´t think its possible to achieve 0% humidity in normal conditions, just make library to ignore these readings?
from aht10.
As far as I understand datasheet, sensor cannot work properly without calibration coefficents. MyAHT10.begin() tries to load calibration coefficents into the sensor and returns true if the operation was successful. Could you change you code and provide MyAHT10.begin() serial print from the code below:
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
delay(5000);
ESP.restart();
}
ArduinoOTA.setHostname("AHT10_temp_test");
ArduinoOTA.onStart([]() {
Serial.println("Start");
});
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.begin();
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
client.setServer(mqtt_server, 1883);
dht.begin();
if (myAHT10.begin() != true)
{
Serial.println("Warning: AHT10 fail to to load calibration coefficient");
}
else
{
Serial.println("AHT10 OK");
}
Wire.setClockStretchLimit(10000);
}
from aht10.
Serial output:
16:17:07.822 -> AHT10 OK
16:17:07.822 -> Attempting MQTT connection...connected
16:17:20.007 -> temp: -50.00
16:17:20.007 -> humidity: 0.00
16:17:34.997 -> temp: 27.38
16:17:34.997 -> humidity: 35.84
from aht10.
Ha, I'll take a look on weekend.
Thank you.
from aht10.
16:32:17.965 -> temp: 27.58
16:32:17.965 -> humidity: 35.48
disconnected sensor while esp running:
16:32:32.827 -> temp: 255.00
16:32:32.827 -> humidity: 255.00
connected sensor while esp running:
16:32:47.977 -> temp: -50.00
16:32:47.977 -> humidity: 0.00
16:33:02.970 -> temp: 29.57
16:33:02.970 -> humidity: 41.21
it does actually does that ONLY when sensor starts, i do not have physical reset button on this board so i first tested with power cutoff.. but it will still be problem when using ESP.deepSleep() and sensor powered from gpio
from aht10.
I think I found mistake in the library. Stay tuned...
UDP: I've done changes, will test it today and upload.
from aht10.
I made changes to the library again. Could you download and test the changes?
Thank you.
from aht10.
Hello, Ragnarre. Are you here? I made changes to the library.
from aht10.
Tested 3 min ago, short test looks ok.
from aht10.
Related Issues (5)
- readHumidity HOT 2
- Custom i2c pins for ESP32 HOT 1
- Complete datasheet HOT 1
- Compile warnings ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aht10.