Skip to content

Imashanilupul/Smart-Irrigation-Fuzzy-Logic-Controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Smart Irrigation Fuzzy Logic Controller

A self-contained Jupyter notebook implementing a Mamdani-type fuzzy logic controller to compute watering duration based on soil moisture and ambient temperature. Built with scikit-fuzzy and matplotlib, it includes visualizations, a rule base, partition testing, and rule conflict checks.

Repository structure

  • Fuzzy_Assignment_225522M.ipynb — Main notebook with the full implementation and documentation.

Features

  • Linguistic variables and membership functions:
    • Inputs: Soil moisture (0–100) — dry/moist/humid; Temperature (0–40 °C) — low/medium/high
    • Output: Watering duration (0–30 min) — short/medium/long
  • 9-rule fuzzy rule base
  • Inference demo for sample inputs
  • Visualizations of membership functions and output decision
  • Validation utilities:
    • Partition testing to ensure coverage of fuzzy sets
    • Rule conflict testing for contradictory antecedents

Requirements

  • Python 3.8+
  • numpy
  • scikit-fuzzy
  • matplotlib

Install packages on Windows (cmd):

pip install -U scikit-fuzzy numpy matplotlib

Tip: The notebook’s first cell contains a commented pip install line that you can run inside the notebook if preferred.

Getting started

  1. Open the notebook in VS Code (with the Jupyter extension) or Jupyter Lab/Notebook.
  2. Select a Python environment with the required packages installed.
  3. Run cells from top to bottom. Plots will display inline, and the computed watering duration will be printed.

How it works

  • Defines universes of discourse for inputs and output and assigns triangular membership functions.
  • Encodes interpretable rules (e.g., dry soil + high temperature → long watering).
  • Uses scikit-fuzzy’s control system to perform fuzzification, inference, and defuzzification.
  • Provides plots and simple checks to validate the fuzzy set coverage and rule consistency.

Customization

  • Tune membership function parameters to match your sensor calibration and irrigation needs.
  • Extend the rule base or add new inputs (e.g., humidity, sunlight) as needed.

About

Smart Irrigation Fuzzy Logic Controller

Topics

Resources

Stars

Watchers

Forks