As a student engineer, I'm always looking for small projects to improve my skills. Over summer break, I expanded upon a previous concept of a "Self-Watering-Plant." This iteration would use the WiFi capabilities of the ESP32 to control this device from my phone.
CircuitThe circuit itself is quite simple. It only requires an ESP32, a relay, jumper cables, a pump, and a 12V power source. Much to my surprise, this project ended up being software heavy. The one issue is that the ESP32 doesn't provide enough voltage for the relay that I use. I assumed, incorrectly, the board would output the same 5V as an Arduino board. In future iterations, I would likely use an op-amp or a different relay.
All of the code was written in Visual Studio, using the PlatformIO IDE. From there, I created various classes related to the function of this system. The most important class was the "WiFiConnect" class which set up a web-server for other devices to connect to.
When first connected to power, the board will connect to WiFi and the user will be able to input a URL that corresponds to a variety of options. This is done with the "ScheduleProt" class. The URL itself is just the IP address of the ESP32 and a specific ending such as "/morning/" or "/midnight/".
To streamline the process, I created an Android app to do this using MIT's App Inventor. this app simply has four buttons that loads the respective link for each time.
Once the link is loaded, the board will check the time using the NTP server. This is done with the "CurrentTime" class. The board will connect to the internet and get information about the current hour in the user's time zone.
The watering time is based on four specific hour values that correspond roughly to morning, noon, evening, and midnight. Custom user input was something I considered, but figured was too complicated for me to do. If the watering time matches the current time, then the watering protocol is triggered. If it doesn't, then the ESP32 goes into deep sleep for about an hour.
The watering protocol is handled by the "WaterProt" class. It is simple in it's function, it activates the pump for a short duration before stopping. Afterwards, the board goes into another cycle of deep sleep.
Future PlansAssuming that I don't get sick of this project soon, I plan to implement some more features. The first would allow the user to enter a custom time and date for the plant to be watered. Perhaps I might allow the user to control the amount of water being used as well. A better UI might be in order.
Mechanically, I would create a proper enclosure and fit the pump with an actual tube for watering. I would also need to address the issue of a power supply. Perhaps a powering this via solar energy would be interesting.
Comments
Please log in or sign up to comment.