Skip to content

Plants Care is a system that automatically takes care of plants.

License

Notifications You must be signed in to change notification settings

deuzu/plants-care

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Plants Care

Report Bug · Request Feature · Send a Pull Request

Table of Contents

About the Project

Plants Care is a system that automatically takes care of plants.
It controls soils moisture and trigger watering based on configured rules.

Built With

Getting Started

plants care diagram

Hardware Setup

schematic

Arduino

  1. Rename ./arduino/Secrets.h.dist to ./arduino/Secrets.h and replace its values.
#define PUSH_GATEWAY_BASEURL "https://ip:5091/metrics/job/plantcare/instance/a"
#define PLANTS_CARE_BASEURL "https://ip:5080/api/watering/a"

a at the end of the URLs represent a microcontroller, name it as you want.
You can install how many microcontroller as needed.

  1. Compile & Upload (see Makefile)
  2. Bury soil moisture sensors in plants
  3. Plug a battery
  4. ???
  5. Profit!

Box, Connectics & PCB

To do

Software Setup

Using Docker-Compose

docker-compose.yaml

services:
  plants-care-api:
    image: deuzu/plants-care-api:alpha
    restart: unless-stopped
    environment:
      DATABASE_HOST: plants-care-database
      DATABASE_NAME: ${DATABASE_NAME}
      DATABASE_USER: ${DATABASE_USER}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
      DATABASE_CONNECTION_TIMEOUT: ${DATABASE_CONNECTION_TIMEOUT}
      DATABASE_CONNECTION_LIMIT: ${DATABASE_CONNECTION_LIMIT}
    ports:
      - 5080:80

  plants-care-database:
    image: mariadb
    restart: unless-stopped
    environment:
      MARIADB_RANDOM_ROOT_PASSWORD: 1
      MARIADB_DATABASE: ${DATABASE_NAME}
      MARIADB_USER: ${DATABASE_USER}
      MARIADB_PASSWORD: ${DATABASE_PASSWORD}
    volumes:
      - plants-care-database:/var/lib/mysql
      - ./database-init.sql:/docker-entrypoint-initdb.d/1-database-init.sql

  prometheus:
    image: prom/prometheus
    volumes:
      - ./prometheus.yaml:/etc/prometheus/prometheus.yml
      - prometheus:/prometheus
    ports:
      - 5090:9090

  push-gateway:
    image: prom/pushgateway
    volumes:
      - pushgateway:/data
    ports:
      - 5091:9091

  grafana:
    image: grafana/grafana
    volumes:
      - grafana:/var/lib/grafana
    ports:
      - 5030:3000
      
volumes:
  plants-care-database: ~
  prometheus: ~
  pushgateway: ~
  grafana: ~

prometheus.yaml

global:
  scrape_interval: 30s
  evaluation_interval: 30s

rule_files: ~

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: [localhost:9090]

  - job_name: push-gateway
    static_configs:
      - targets: [push-gateway:9091]
    honor_labels: true

Consider using a reverse proxy like nginx-proxy/nginx-proxy or traefik/traefik.

Roadmap

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are extremely appreciated.
Please read those guidelines before contributing to this repository.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feat-amazing-feature)
  3. Commit your Changes (git commit -m 'feat(scope): Add some AmazingFeature' -m "Closes #42")
  4. Push to the Branch (git push origin feat-amazing-feature)
  5. Open a Pull Request

Development

Arduino

cd arduino & make

Arduino CLI

To find the board:

arduino-cli board list

If error "Could not open serial port /dev/ttyUSB0" is encountered:

sudo usermod -a -G dialout <username>
# or
sudo adduser <username> dialout

Example soil moisture level sent:

cat <<EOF | curl --data-binary @- localhost:5092/metrics/job/plantcare/instance/a
# HELP moisture level in percentage
# TYPE moisture_level gauge
moisture_level{sensor="0"} 12
moisture_level{sensor="1"} 74.605713
moisture_level{sensor="2"} 42
moisture_level{sensor="3"} 654
EOF

API

cd api && make

License

MIT

About

Plants Care is a system that automatically takes care of plants.

Topics

Resources

License

Stars

Watchers

Forks