An automatic plant watering system created with Python and a Raspberry Pi.
You can read more about how I created this project here.
- gpiozero library
- Used for interfacing with the GPIO pins on the Raspberry Pi
- schedule api
- Used for running Python functions at pre-determined intervals
- smtplib module
- Used for sending emails
- ssl module
- Used in tandem with the smtplib module
The gpiozero library should already be installed into your Pi by default but if not you can run the following command:
sudo pip3 install gpiozero
You can install the schedule api by running the following command:
sudo pip3 install schedule
To install this code onto your Raspberry Pi you can clone the repository to your Pi's Desktop by typing in the following command into the terminal:
git clone https://github.com/AlanConstantino/rpi-plant-project.git
Once cloned, you can move the "run" folder onto your Pi's desktop and then run the following command:
sudo crontab -e
Now you'll see a window that looks something like the following:
From here, you want to append the following code snippet to the file:
@reboot python3 /home/pi/Desktop/run/water_plant.py
By doing so, you're telling the Pi "Hey whenever you reboot, run the python script 'water_plant.py' inside the 'run' folder located on our Desktop."
Now you can turn off your Pi and whenever you turn it back on, the "water_plant.py" script will get executed.