Hello! I have followed the course ESP32 MQTT – Publish and Subscribe with Arduino IDE and everything works. But randomly I get values ex temp, +22 C and then suddenly -140 C to then give correct values again. All 3, temp, humidity and air pressure jump away and then read correct values again. I also use Node-Red and if you then use charts, the chart will be useless with such a reading. I’m using I2C and I haven’t tested the SPI protocol if it gets a more stable result. I have read that you should put the SD0 pin to ground and that helps a bit but not completely. I use the computer’s usb for the voltage and also tested with a voltage-fed hub but no difference. Does anyone have a solution to this?
So the obvious answer would be to remove the spurious readings in software. Obviously it isn’t going to be -140C any time soon, so have your code simply ignore any readings where the temperature is below -100C and you’ll be fine. I’m going to assume the corrupt readings all occur at the same time, and if I’m right, then you can just ignore all the corrupt readings by looking at the temperature value.
What’s the root cause? Good question. How long is the lead between the temperature sensor and the ESP? Is there an e.g. wifi connection jamming it every so often? Are any wires loose? I’d check the obvious stuff like that, and try it, and then add that line of code (actually, an IF statement between taking the reading and doing any updating) anyway!
Hello Nigel! Yes, all error readings occur at the same time. The wires are about 0.05m and I have also soldered them. And I get these misreadings in the serial moitor. I have also searched for this error and people seem to be having problems with the BME280 sensor and I didn’t get any answers for a solution. I have ordered 2 new ones and then chose the 5V the one I have is 3.3V I have also tested a BMP280 sensor and I have not received any error like this. But you have given me a way around the problem but if anyone has found a solution I’m interested.
Many times readings like that are caused by long cables (which doesn’t seem the case) or unstable power sources.
It can also be the case of a fault in the sensor.
That never happened to me. I’m not really sure that might be the issue for your case.
Hello Sara! Thank`s for your answer! I will test with another power supply, but the BMP280 has not any fault readings so it`s pointing that somethingis is wrong with the sensor. I will get 2 new in a week so I will test with them.
Hello! I have now tested with a new BME280 for nearly 24 hours and no fault readings. I use the same usb as before so the problem is the sensor. This new sensor is 5V so it`s not thes ame as the old one was 3.3V I will give it another 24 hours before I am sure.
Ok. Thanks for letting us know.
It definitely seems it was a hardware problem,
I have now tested the new BME280 sensor for more than 48 hours and have not received any errors, so I can probably state that it was a sensor error. I can use the old sensor in applications that do not contain charts.