• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP8266 DHT web sensor project and interrupt

Q&A Forum › ESP8266 DHT web sensor project and interrupt
0 Vote Up Vote Down
RICHARD HODGES asked 3 years ago

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

18 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
RICHARD HODGES answered 3 years ago

Hi Sara;
I have posted may modified code to pastebin.com with the paste name Rain Add  
Thanks for taking a look.
Rick

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
RICHARD HODGES answered 3 years ago

OK, sorry; I have not used this before. Here is the link.
https://pastebin.com/hnrq5LuE
Rick

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
RICHARD HODGES answered 3 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
RICHARD HODGES answered 3 years ago

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
 

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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?

0 Vote Up Vote Down
RICHARD HODGES answered 3 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Ok.
Then, let me know.
Regards,
Sara

0 Vote Up Vote Down
RICHARD HODGES answered 3 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
RICHARD HODGES answered 3 years ago

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

0 Vote Up Vote Down
RICHARD HODGES answered 3 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
RICHARD HODGES answered 3 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

It’s great that you get it working with the ESP32.
However, I don’t know why that issue with the ESP8266. I’ve tried to search for that specific issue and I haven’t found any information or discussion about that.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2023 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.