Browse by type
eFLL (Embedded Fuzzy Logic Library) is a lightweight, efficient library designed for implementing fuzzy logic systems on embedded platforms. It provides a simple yet powerful API for creating fuzzy inference systems with minimal resource overhead.
Documentation & Examples:
Portable & Lightweight
stdlib.h libraryFlexible Architecture
Industry-Standard Inference
Step 1: Open the Arduino IDE
Step 2: Navigate to Sketch → Include Library → Manage Libraries
Step 3: Search for "eFLL" or "Fuzzy"
Step 4: Click Install
You can now include eFLL in your sketches!
Step 1: Download the library from the GitHub repository
Step 2: Extract the ZIP file and rename the folder to "eFLL" (if needed)
Step 3: Copy the folder to your Arduino libraries directory:
Documents\Arduino\libraries\~/Documents/Arduino/libraries//usr/share/arduino/libraries/~/Arduino/libraries/Step 4: Restart the Arduino IDE
Step 5: Navigate to Sketch → Include Library → eFLL
Step 1: Clone or download the repository from GitHub
git clone https://github.com/alvesoaj/eFLL.git
Step 2: Add the library files to your project
Step 3: Compile and link with your code (refer to the Makefile for examples)

Fuzzy
FuzzyInput
FuzzyOutput
FuzzySet
FuzzySet(float a, float b, float c, float d)FuzzyRule
FuzzyRule(int id, FuzzyRuleAntecedent* antecedent, FuzzyRuleConsequent* consequent)FuzzyRuleAntecedent
FuzzyRuleConsequent
The fuzzy inference process involves three main steps, handled by three key methods of the Fuzzy class:
bool setInput(int id, float value);
Sets a crisp input value for a specific FuzzyInput. The id parameter identifies which FuzzyInput object receives the value.
bool fuzzify();
Initiates the fuzzification process, evaluates all fuzzy rules, performs composition, and prepares for defuzzification.
float defuzzify(int id);
Calculates and returns the crisp output value for a specific FuzzyOutput using the Center of Area (COA) method.
// 1. Create fuzzy system
Fuzzy* fuzzy = new Fuzzy();
// 2. Define inputs and outputs
FuzzyInput* temperature = new FuzzyInput(1);
FuzzyOutput* fanSpeed = new FuzzyOutput(1);
// 3. Define membership functions
FuzzySet* cold = new FuzzySet(0, 0, 10, 20);
FuzzySet* warm = new FuzzySet(15, 25, 25, 35);
FuzzySet* hot = new FuzzySet(30, 40, 50, 50);
FuzzySet* slow = new FuzzySet(0, 0.33, 0.33, 0.5);
FuzzySet* fast = new FuzzySet(0.5, 0.66, 0.66, 1);
// 4. Add sets to inputs/outputs
temperature->addFuzzySet(cold);
temperature->addFuzzySet(warm);
temperature->addFuzzySet(hot);
fanSpeed->addFuzzySet(slow);
// 5. Create rules
FuzzyRuleAntecedent* ifCold = new FuzzyRuleAntecedent();
ifCold->joinSingle(cold);
FuzzyRuleConsequent* thenSlow = new FuzzyRuleConsequent();
thenSlow->addOutput(slow);
FuzzyRule* rule1 = new FuzzyRule(1, ifCold, thenSlow);
fuzzy->addFuzzyRule(rule1);
// 6. Run inference
fuzzy->setInput(1, 22.5); // Set temperature to 22.5°C
fuzzy->fuzzify(); // Perform fuzzification and inference
float output = fuzzy->defuzzify(1); // Get fan speed
Author: AJ Alves alvesoaj@icloud.com
Co-authors:
Special Thanks to Contributors: @mikebutrimov, @tzikis, @na7an
MIT License