I am trying to expand the DHT web sensor project by adding a rain gage. It is a tilting bucket type gage that ouputs a pulse at each tilt of the bucket ( 0.01 inches of water). I added an interrupt triggered by the pulse. The interrupt routine sets a flag only and a function in the loop counts the events and clears the flag. I have duplicated the HTML, CSS, and JAVA code you used for the temperature function to build a rainfall function. My problem is that the resulting web page will not update automatically at the interval. It will update if the page is reloaded. Do you think the interrupt might be conflicting with the Set Interval function in the JAVA code.
Thanks
Rick Hodges
Hi Rick.
i don’t think that’s the problem.
Can you share your code with us? Maybe if I take a look at the code I can find out what might be wrong.
Regards,
Sara
Hi Sara;
I have posted may modified code to pastebin.com with the paste name Rain Add
Thanks for taking a look.
Rick
Hi Richard.
Please share a link to the code because I can’t find it that way.
You can see these instructions: https://rntlab.com/question/need-help-using-pastebin/
Regards,
Sara
OK, sorry; I have not used this before. Here is the link.
https://pastebin.com/hnrq5LuE
Rick
Hi Rick.
I tested your code and it is working fine. I used Google Chrome to access the web server.
Which web browser are you using?
Regards,
Sara
Well Sara, that is interesting. So far I have tried accessing the server with my PC running Google Chrome 64 bit and the Silk browser on my Kindle Fire tablet. The behavior is the same on both. No automatic update but the page loads and refreshes without a problem.
Any ideas on what area to look at? Would anything in my wifi router settings affect this? Maybe I should try it on a different AP.
Thanks again. I am learning so much from the tutorials. I have been playing with computers and micros for many years but I am a total novice with the HTML and JAVA coding.
Rick
Hi Richard.
I don’t know what might be wrong. The code was working perfectly fine for me and it is well written.
What about the original code from the project? Didn’t it work?
Regards,
Sara
Hi Sara.
Yes, the original code works just fine. In my code, if I comment out the interrupt call and function it also works. I can initialize the rain variable in the setup and it will be updated on the page along with the Temp and Humidity. So, I guess I am still lost. In your test run, which version of the 8266 did you use? I am using the NODEMCU-12E. from china.
I think I will leave this alone for awhile. If I figure anything out I will post back.
Thanks again.
Rick
Hi Richard.
I’m sorry, but I don’t know why, I thought you were using an ESP32.
I tested now with the ESP8266 and I get the same problem as you. None of the readings update. It’s so weird. The code is well implemented. I don’t know why it doesn’t work as expected.
On the ESP32, the code works just fine. Do you have an ESP32 to experiment with?
I do have an ESP32 and also a couple of different 8266 versions. I will try them all in the next couple of days and report back. Thanks again.
Rick
Hi Sara
I have been unable to test my code on an ESP32 board. I am having trouble installing the ESP32 system into the Arduino IDE. Attempts to download with the boards manager suffers a fatal error. “corrupt file”. I attempted to download the Zip file from GIT HUB but WinZip says that file is corrupt also. Is there another way to install it.
Thanks
Rick
Hi Richard.
What file are you talking about?
Are you talking about installing the ESP32 boards?
You can follow our video, it’s super simple:
Let me know if you were able to do it.
Regards,
Sara
Hi again;
Yes I finally managed to succeed installing boards after 3 days. The install kept resulting in a corrupted file. Unfortunately I haven’t had much time to work on this this week. I am now having issues with uploading sketches to the board. com port timeouts etc. I will get back to you when I can return to the original question.
Rick
Hi again;
Yes I finally managed to succeed installing boards after 3 days. The install kept resulting in a corrupted file. Unfortunately I haven’t had much time to work on this this week. I am now having issues with uploading sketches to the board. com port timeouts etc. I will get back to you when I can return to the original question.
Rick
The timeout issue might be because it is not in flashing mode.
You need to press the BOOT button when you start seeing the dots.
Learn more here: https://randomnerdtutorials.com/solved-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header/
Regards,
Sara
Thanks for the link Sara. I can now confirm that the code does run fine for me on the esp32 board. So far, I have not had a success with an 8266. There must be some conflict with the ESPAsyncWebServer libraries for the 8266. For now I am going to move on and hope someone can contribute an answer.
Rick