Posts: 22
Joined: Mon Jun 18, 2018 11:01 pm

GUI Auto watering system on Rpi

Mon Jun 18, 2018 11:26 pm

In my search to find as many examples of watering system with the Rpi i told myself i would make a post with mine when done(mostly) so other could see what i did and maybe use some of it for their projects.

It uses python Tkinter module , very easy to use checkbuttons on/off to control which solenoids to turn on or off during watering cycle. dropbox options for each solenoid doing 0.25 gallon increments up to 3 gallon. 3/4" solenoids and 3/4" water counter. One solenoid i use as a purge to drain the reservoir or purge 1/2 gallon before each feeding, as well as opening after feeding to gravity drain any water left inside PVC piping. There is a listbox on the bottom of GUI to print statements i programmed while program is running to keep user knowing what is happening. The 'Cancel' button will safely reset all relays and pins on Rpi to safely stop the cycle at any time allowing for safe exiting.


This has the .py file along with a screenshot of the GUI. Also inside the README is the links of items i bought and used for this project.

so to answer some questions that i ran into myself and had to just buy and play with the items:

https://www.amazon.com/12V-Solenoid-Val ... B007R9U9BM --- these get alittle hot after staying on with 12v for >5 minutes but work pretty well and DO fit regular PVC threads from local Home Depot. just added teflon tape for no leaks.

https://www.sequentmicrosystems.com/ --- This was a major purchase for me. each board has 8 relays. they are smaller than i though. just picture 8 of them on a single card that is the same size as the Rpi. However, they work perfect for me. code was very easy to use. once in a blue moon the relay will not shut of or turn on so i turn on and off the relays during the loop, so each water pulse triggers my loop and will execute turning relay on or off (630 pulses was a 1/2 gallon). Never had an issue again after this. These just plug into the Rpi and work out of the box.

https://www.amazon.com/Iot-Relay-Enclos ... B00WV7GMA2 --- This was plug an play really. setup an output pin on Rpi and turned on plugs that easy.

https://www.amazon.com/DIGITEN-Sensor-S ... Src=detail --- Finally, the hardest purchase i had to make because so many mixed reviews with the different kinds on market. This says 5v sensor. i have mine working perfectly on the 3.3v Rpi, it is counting the pulses using "GPIO.add_event_detect()" You can refer to my code to see how i am beginning the loop then ending the event detect when loop ends.

I have found that is was a PIA to use the add_event_detect() in the GPIO lib because the need of loops inside the code which creates many issues. However, after many houses of chasing code bugs i think i found a happy solution. The function that runs at every pulse is alittle long but works great. Any questions just comment and ill try to answer them as best i could. The code can be changed easily to add or subtract solenoids and amount of watering.

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 17 guests