Giter VIP home page Giter VIP logo

rpirrigo's Introduction

RPirrigo - automated watering system

The motivation for this project was to put a Raspberry Pi in action in order to water the plants of my appartment. This with the aim to guarantee their survival during the summer break.

The developed system triggers two peristaltic pumps during a given period of time (seconds), mainly to control the amount of water. Then, the Pi camera module is activated and takes a picture of the plants. Enventually, an email is sent with the lastest picture recorded. At each action, a log file stores the different actions of the program.

This project has two main blocs: the hardware elecronics and the software logic.

Hardware

The reauired elements were:

  • Raspberry Pi 3b+ (RPi)
  • Two peristaltic pumps operated at 12 V
  • Power source of 12 V DC
  • A 2-channel relay module of 5V (very important to be triggered at 5 V)
  • Plastic tubes of 4 and 7 mm internal and external diameter, respectively
  • Simple aquarium air regulators to control the water flow
  • One gallon container to keep the water reservoir
  • Cables
  • (optional) Pi camera module 5M
  • (optional) Wood box to attach the elements, in this case a used a Porto wine box

Below the distribution of the GPIOs of the RPi model 3b+. For this project, I connected the following pins:

  • #2 (5 V) to power the relay
  • #4 to the ground of the relay
  • #16 and #32 to trigger the signals for the pumps

RPi 3b+ GPIO distribution

General Purpose Inputs/Outputs (GPIO) distribution of the RPi model 3b+

The circuits connections are detailed in the following picture.

hardware circuits

Connection of the RPi components with the relay, the peristaltic pumps and the Pi cam

pumps and Pi cam attached to a Porto wine wood box

Software

The logic was implement on python 3.8. The application requires the packages indicated on this file.

pip install -r requirements.txt

In addition, a directory named img/ must be created at the same level of the directory src/. The snapshots will be stored on that directory.

user@pc:~/RPirrigo$ ls

img  README.md  requirements.txt  src

Sensitive data

For the correct performance of the main script, a .env file should be placed on the src/ directory and should contain the following environment variables.

PORT = Number of port indicated by the SMTP server
SMTP_SERVER = SMTP server
SENDER_EMAIL = Email of the sender
RECEIVER_EMAIL = Email of the recipient
PASS = Password to access the SMTP server
IMG_DIR = Directory to store the cam images
LOGS = "/file.log"

Running the application

The following command runs the application on a terminal.

python3 watering.py

Alternatively, there is the possibility to run the application automatically at startup of the RPi. To do so, a cron task should be declared on a terminal by typing:

crontab -e

Then, add the following line at the end of the file. It is really important the last "&" for the correct functionning of the RPi.

@reboot cd /path/to/RPirrigo/src && python3 watering.py &

After reboot the following command allows to verify the declared cron task.

systemctl status cron

watering system in action

System in action

Enjoy! :shipit:

rpirrigo's People

Contributors

aaronmilloro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.