Coder Social home page Coder Social logo

rpi-watering-system's Introduction

rpi-watering-system

rpi-watering-system is a Raspberry Pi automated watering system based on Ben Eagan's project (https://www.hackster.io/ben-eagan/raspberry-pi-automated-plant-watering-with-website-8af2dc).

Built With

rpi-watering-system is built with the following Stack:

  • rpi-watering-system web interface is written using the Flask Python microframework. For now, it runs on Python 2.7. which is most probably already installed on your machine.

  • This interface allows to send request to the Raspberry Pi through the GPIO (https://pypi.org/project/RPi.GPIO/)

  • It is running on a Gunicorn WSGI server (https://gunicorn.org/). Considering that Flask is only recommended for development purposes, it would not handle a production environment properly.

Software Requirements

  • Python 2.7
  • Python PIP (python-pip)

Installing:

    user@host:~$ git https://github.com/imedgar/rpi-watering-system
    user@host:~$ cd rpi-watering-system
    user@host:~/rpi-watering-system$ pip install -r requirements.txt #this sets up python deps in your environment  

Setting up the rpi-watering-system environment

server.config

    user@host:~/rpi-watering-system$ touch server.config
    user@host:~/rpi-watering-system$ nano server.config
    
    APP_NAME="web_plants"
    HOST="127.0.0.1"
    PORT= 5000

You can change the host to 0.0.0.0 to public expose the server

Server scripts

Once the server.config has been set, there are 2 scripts to start up or shutdown the server:

  • startup.sh
  • shutdown.sh

The startup.sh will start the server on the background and save the PID of the process in a file named {app_name}.pid, used after to automatically shutdown the server through the PID process.

Auto watering

There is a method in water.py used in auto_water.py to water the plant only if the soil moisture sensor detects it's needed. In order to automatize it we need to add a cron in the crontab:

    user@host:~/rpi-watering-system$ crontab -e

    0 */2 * * * cd <your path to web_plants>; sudo python auto_water.py

The cron above will be executed every 2h. Although, you can always change its frequency, e.g. (https://crontab.guru/examples.html)

Acknowledgments

Author

License

MIT License

Copyright (c) 2019 Edgar Rubio

rpi-watering-system's People

Contributors

imedgar avatar

Stargazers

 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.