Hi,
Thank you for your excellent guide!
i am working on a project for my garden that uses capacitive soil moisture sensors with an analog output.
I have written a class that I use to calibrate the sensors (wet soil and dry soil) which I call by using a touchpad wakeup, so that it only runs when I want it to.
I also have the ESP32 sleeping for 2 minutes, then waking and taking soil moisture readings (and BME280 readings), before going back to sleep again.
Now I want to integrate the Webserver example and have the readings update on the webpage every 2 minutes, or if someone sends a HTTP GET request, but I am unsure how to do this.
Can a HTTP GET request be used as an interrupt? Or can I use the last readings taken to populate the webpage? Or would you suggest a different way to approach this?
Thank you 🙂
Hi Ross.
Thank you for sharing your project.
I didn’t understand if you want to run the web server on the same ESP32 that is taking readings or in a different ESP32. Can you clarify that?
The ESP32 that is sleeping can’t be used as a web server because it won’t be accessible because it is asleep.
What web server example were you looking for to integrate in your project?
Regards,
Sara
Hi Sara,
Thanks for your reply.
I am currently using the Webserver – Display Sensor Readings example, and have successfully modified it to display my Moisture Sensor readings along with the BME280 readings in a local webpage.
My plan was make the ESP32 in my garden battery powered and set up solar charging for the battery. To reduce power consumption I planned to make it sleep most of the time and wake at 2 minute intervals (or when I touched a touch interrupt pin, which would be used to calibrate a soil moisture sensor).
So if I am understanding correctly, I would need to use 2 x ESP32’s: one in the garden (sleeping most of the time), and one as the webserver. Is that correct?
If that is correct, how would you suggest I set up the communication between the 2 ESP32’s?
An alternative may be to use a larger battery and solar cell combination to provide the power requirements for a single ESP32 that is always on?
Eventually I want to :
- set up a pump to automatically individually water the plants based on their needs
- get weather forecasts and decide whether to water based on soil moisture and rain forecast
- track weather conditions over long periods and perhaps compare to previous years
- possibly contribute to something like WeatherUnderground (although it looks like it is being killed off?)Â
- maybe even add a webcam of my gardenÂ
Thanks,
Ross
Hi again.
Yes, if you want to use deep sleep, you’ll need two ESP32 boards.
To send the data between boards, I suggest using something like: Wi-Fi, or LoRa, or ESP-NOW.
See some examples:
- https://randomnerdtutorials.com/esp32-client-server-wi-fi/
- https://randomnerdtutorials.com/esp-now-two-way-communication-esp32/
- https://randomnerdtutorials.com/esp32-lora-sensor-web-server/
If you want to use a single ESP32, it will consume a lot of power with the Wi-Fi always powered on. But you need to see the power consumption and check if your solar panels and battery are able to keep up with the demands.
Thanks for sharing your project.
Regards,
Sara
Hi Sara,Â
I think I’ll go the WiFi Client Server route. Ill post back and let you know how I go.
Thanks for your help!