Hi All, I am new member to RNT forum have been inspired by Rui’s web site and some of the projects, which I have built and learn’t lots and look forward to working through the courses in the members area.
Any how I have built the ESP8266 Plot Sensor Readings in Real Time Charts – Web Server from the RNT web site using 8266 Wemos D1 mini which initially worked where by the Real Time Charts worked for a couple of minutes and then I received a ‘Stack’ error.
The error message was:
"user exception (panic/abort/assert) Panic core_esp8266_main.cpp:122 __yield"
And then a couple of hundred lines of what appear a stack dump information.
Now when I run the program I have endless loop of ‘stack errors’ as described above. I had done a google search of the error messages although advice provided little information about what I needed to do to get the project running.
Has anyone had a similar ‘stack dump’ problem that could advise where I need to go to solve this issue.
Any assistance is appreciated.
Regards
Garry
Hi Garry.
Do those errors appear now when you try to run the code initially, or always after a few minutes?
Can you try re-upload the same code and see what happens?
Regards,
Sara
Hi Sara,
Thanks for you reply. Much appreciated.
I have certainly been going through a process of elimination to identify the cause of the endless crash/restart.
I find that with the readDHTTemperature or the readDHTHumidity (my renaming) functions, when I comment out the code within those functions and just include a single line of code that returns a string e.g. return “23.23”, the plotting of Highcharts Temperature and Humidity works fine, although with fixed string data, not using sensor data. If I include a single DHT library function call within one of those function, software crashes.
I hope the above makes sense. If not let me know.
Hi Garry.
I think that has to do with the functions that read the DHT. The DHT is a slow sensor, so it may cause that issue when including that the asynchronous web server function.
So, I think to solve that issue, you need to read the DHT sensor in the loop and then, return the value to the web server – like it’s done in this tutorial: https://randomnerdtutorials.com/esp8266-dht11dht22-temperature-and-humidity-web-server-with-arduino-ide/
Tell me if you were able to do it and if that solves the issue.
Regards,
Sara
Hi Sara,
Thanks for supporting with me on this challenge. As you suggested I reviewed the code from the https://randomnerdtutorials.com/esp8266-dht11dht22-temperature-and-humidity-web-server-with-arduino-ide tutorial and placed the code in my program ‘loop’, no problem, project worked fine.
I also tried the following code only in the ‘loop’.
void loop() {
float newT = 0.0;
newT = dht.readTemperature();
}
This also works fine.
It would appear the DHT11 sensor requires some form of constant reading (polling) perhaps due to its slow responsiveness as you suggested.
A quick note, I was keen not to add additional timed loop code (as per DHT11-DHT-temperature-and-humidity-web-server tutorial) into the main function, as the 30 second HTTP requests from client html/javascript/Ajax code to the server readtemperature and readHumidity functions provide a timed action rather than adding an additional 10 second loop code in the main ‘loop’.
Anyhow for now, with the constant reading of the sensor in the main loop enable things work ok.
Can I ask, if I were to acquire a more robust temperature/humidity sensor would the original tutorial code work without code in the main ‘loop’.
Regards
Garry
Hi Garry.
I’m glad that everything is working fine now.
In case of the DHT sensor, you need to do that because it is a slow sensor. It takes time to get the readings. So, it will mess up with the asynchronous functions of the AsyncWebServer library.
When using the BME280 sensor, there’s no need to do that. It works perfectly as in the original code.
It will depend on the temperature sensor you’re using and how the library to read the sensor works.
Regards,
Sara
Hi Sara,
I needed to revert to the your recommended code from DHT11-DHT-temperature-and-humidity-web-server tutorial in my ‘loop’ function. The minimal code I referred to in my last post had a stack dump/restart problem after about 90 minutes. Your solution is what’s needed with the DHT11 until I procure a BME280 Sensor.
So I will procure a BME280 sensor and return to this project for my own learning wrt to implemention of different sensor. In the mean time I’m looking forward to my next challenging project of RNT.
Thanks for you support.
Kind Regards
Garry
Ok Garry.
Then, let us know if you were able to make it with the BME280.
We have lots of projects with the ESP32. You can check all our free projects here: https://randomnerdtutorials.com/projects-esp32/
Regards,
Sara