Skip to content

Contrasens/GoWaterPi

Repository files navigation

GoWaterPi

A plant irigation system based on Raspberry Pi, either manual or at scheduled intervals. A submersible water pump is started to water the plants, then stopped after a configurable time interval. The scheduling is done via Google Calendar events: one has to add events in the calendar of the irigation system to start the irigation. The irigation duration is configurable. Here you can see how the GoWaterPi looks and works:

Currently, the system works in two modes:

  1. a Python script is started by a Cron job at predifined intervals (see http://www.adminschoice.com/crontab-quick-reference). The Python script starts the water pump and keeps it running for a time priod which is specified in a configuration file, OR

  2. a webpage is available at the Raspis webserver to monitor the activity of the watering system over the internet, and switch it on and off remotely. A web-server must be set up, and the server port must be opened in your router to be able to access it from remote locations. Of course, then a wireless USB dongle is needed, which is able to work from inside the case. The web-page version uses Flask and Ajax, an introduction on how to install them can be found here: http://randomnerdtutorials.com/raspberry-pi-web-server-using-flask-to-control-gpios/

Newest features:

  • Now an email is send to a selected email address when the watering finishes. The email informs about the duration of the watering, time, and internal & external temperature and humidity. Info on what packages to install can be found here: https://www.youtube.com/watch?v=0kpGcMjpDcw

  • The irigation system can be fully managed via Google Calendar events (single, recurrent etc). The events are then parsed and a cron job starts at the defined time. Instructions on how to use and configure Google Calendar API can be found in the GCALCron project: https://github.com/fabriceb/gcalcron. Also good instructions on creating Google API key can be found here: https://docs.simplecalendar.io/google-api-key/

Future features:

  • add a simple logic to trigger the watering only when needed (eg: not trigger when scheduled if the soil is already wet, or if the weather forecast for your area announces rain with a probability higher than a certain threshold etc.)

What you need:

Optional (not used yet by the software in this project, but everything already prepared)

How to install GoWaterPi

  1. Install latest Raspbian on an SD card, put into Raspberry Pi and configure it
  2. Get GoWaterPi repository:
        git clone https://github.com/Contrasens/GoWaterPi.git
  1. Install ADAFRUIT_DHT for Python3:
        sudo apt-get update
        sudo apt-get install python3-pip
        follow instructions from https://pypi.org/project/Adafruit-DHT/ to install Adafruit_DHT
  1. Install graphical tools for editing cron jobs (together with other useful packages):
        sudo apt-get install gnome-schedule
  1. Edit crontab to add an entry to execute (in this example everyday at 19:00):
        0 19 * * * python /home/pi/GoWaterPi/autoWater.py
  1. Edit crontab to send an email everytime when plants get water:
        0 19 * * * python3 /home/pi/GoWaterPi/email_ifttt.py
  1. Edit email_ifttt.py and add the eventID and the API_Key that you got when you created an applet at IFTTT (check this out for detailed instructions: https://anthscomputercave.com/tutorials/ifttt/using_ifttt_web_request_email.html)
  2. It might be that the google account associated with the GoWaterPi will not send you emails. In this case, check that the Less secure app access for that account is enabled! LE: this is not working for me anymore so I started using the IFTTT applet that sends an email on webhook.
  3. Tweak the config parameters from config.py (as is, the plants will be watered for 200 seconds)

About

A plant irigation system based on Raspberry Pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published