Skip to main content

Overview

Enable definitions control which modules, sensors, and add-ons are compiled into your project. Define these flags before including Kinematrix.h to activate specific functionality.

Usage Pattern

// Define required modules BEFORE including Kinematrix.h
#define ENABLE_SENSOR_MODULE_V2
#define ENABLE_MODULE_WIFI_HANDLER_V2
#define ENABLE_MODULE_PID_CONTROLLER

// Now include the main header
#include "Kinematrix.h"
You can also define all enable flags in lib/enable.h for centralized configuration management.

Add-ons

Complete application systems providing ready-to-use functionality.
ENABLE_ADDONS_AUTOLIGHT
define
AutoLight base system for automated lighting control
ENABLE_ADDONS_AUTOLIGHT_V1
define
AutoLight version 1 - legacy implementation
ENABLE_ADDONS_AUTOLIGHT_V2
define
AutoLight version 2 - enhanced features
ENABLE_ADDONS_AUTOLIGHT_V3
define
AutoLight version 3 - latest implementation with optimizations

Development

Experimental and debugging modules for development workflows.
ENABLE_DEVELOPMENT_CERIA_SERIAL
define
Ceria serial communication development module
ENABLE_DEVELOPMENT_CERIA_DEV_OP
define
Ceria development operations and utilities

Communication Modules

Wired - I2C

ENABLE_MODULE_I2C_EXPANDER
define
I2C port expansion module
ENABLE_MODULE_I2C_SCANNER
define
I2C bus scanner for device detection
ENABLE_MODULE_IO_EXPANDER
define
General I/O expansion via I2C

Wired - Modbus

ENABLE_MODULE_MODBUS
define
Modbus RTU/ASCII protocol support

Wired - Serial

ENABLE_MODULE_SERIAL_ENHANCED
define
Enhanced serial communication with buffering
ENABLE_MODULE_SERIAL_HARD
define
Hardware serial port management
ENABLE_MODULE_SERIAL_NEMA
define
NMEA protocol parser for GPS data
ENABLE_MODULE_SERIAL_SOFT
define
Software serial implementation
ENABLE_MODULE_SERIAL_SWAP
define
Serial pin swapping capability

Wired - SPI

ENABLE_MODULE_DOT_MATRIX
define
LED dot matrix display control via SPI
ENABLE_MODULE_SERIAL_SPI
define
SPI-based serial communication

Wireless - LoRa

ENABLE_MODULE_LORA_COM
define
LoRa communication base module
ENABLE_MODULE_LORA_COM_V2
define
LoRa communication version 2 with enhanced features
ENABLE_MODULE_LORA_EBYTE_E220
define
Ebyte E220 LoRa module support

Wireless - ESP-NOW

ENABLE_MODULE_ESP_NOW
define
ESP-NOW mesh networking for ESP32/ESP8266

Control Modules

Algorithms for automation, control, and machine learning.
ENABLE_MODULE_DECISION_TREE
define
Decision tree classifier with pruning support
ENABLE_MODULE_FUZZY_MAMDANI
define
Mamdani fuzzy logic controller
ENABLE_MODULE_FUZZY_SUGENO
define
Sugeno fuzzy logic controller
ENABLE_MODULE_FUZZY_TSUKAMOTO
define
Tsukamoto fuzzy logic controller
ENABLE_MODULE_KNN
define
K-Nearest Neighbors classifier with cross-validation
ENABLE_MODULE_PID
define
Basic PID controller implementation
ENABLE_MODULE_PID_CONTROLLER
define
Advanced PID controller with auto-tuning (Ziegler-Nichols, Cohen-Coon)
ENABLE_MODULE_STANDARD_SCALER
define
Data standardization for machine learning preprocessing
ENABLE_MODULE_TRAIN_TEST_SPLIT
define
Dataset splitting for model training and validation

Debug Modules

ENABLE_MODULE_SERIAL_DEBUGGER
define
Full-featured serial debugger with detailed logging
ENABLE_MODULE_SERIAL_DEBUGGER_LITE
define
Lightweight serial debugger for memory-constrained devices
ENABLE_MODULE_SERIAL_DEBUGGER_V2
define
Enhanced serial debugger with categorized logging levels

Display Modules

ENABLE_MODULE_LCD_MENU
define
LCD menu system with I2C support
ENABLE_MODULE_OLED_MENU
define
OLED menu system for SSD1306 displays
ENABLE_MODULE_SH1106_MENU
define
Menu system for SH1106 OLED displays

Driver Modules

Motor Drivers

ENABLE_MODULE_MOTOR_DRIVER
define
DC motor control with PWM speed regulation

Servo Drivers

ENABLE_MODULE_SERVO_HCPA9685
define
PCA9685 16-channel servo driver

File Modules

ENABLE_MODULE_EEPROM_LIB
define
EEPROM storage management
ENABLE_MODULE_EEPROM_LIB_ESP8266
define
ESP8266-specific EEPROM implementation
ENABLE_MODULE_SD_ARDUINO
define
SD card support for Arduino platforms
ENABLE_MODULE_SD_CARD_MODULE_ESP32
define
ESP32 SD card module with optimizations

Filter Modules

Basic Filters

ENABLE_MODULE_MOVING_AVERAGE_FILTER
define
Moving average filter for signal smoothing
ENABLE_MODULE_EXPONENTIAL_MOVING_AVERAGE_FILTER
define
Exponential moving average with weighted samples
ENABLE_MODULE_LOW_PASS_FILTER
define
Low-pass filter for noise reduction
ENABLE_MODULE_HIGH_PASS_FILTER
define
High-pass filter for DC component removal
ENABLE_MODULE_MEDIAN_FILTER
define
Median filter for impulse noise removal
ENABLE_MODULE_KALMAN_FILTER
define
Kalman filter for optimal state estimation
ENABLE_MODULE_COMPLEMENTARY_FILTER
define
Complementary filter for sensor fusion
ENABLE_MODULE_BAND_STOP_FILTER
define
Band-stop (notch) filter for frequency rejection

Dynamic Type Filters

ENABLE_MODULE_DYNAMIC_TYPE_MOVING_AVERAGE_FILTER
define
Template-based moving average filter supporting multiple data types
ENABLE_MODULE_DYNAMIC_TYPE_EXPONENTIAL_MOVING_AVERAGE_FILTER
define
Template-based exponential moving average filter
ENABLE_MODULE_DYNAMIC_TYPE_HIGH_PASS_FILTER
define
Template-based high-pass filter
ENABLE_MODULE_DYNAMIC_TYPE_MEDIAN_FILTER
define
Template-based median filter
ENABLE_MODULE_DYNAMIC_TYPE_COMPLEMENTARY_FILTER
define
Template-based complementary filter
ENABLE_MODULE_DYNAMIC_TYPE_BAND_STOP_FILTER
define
Template-based band-stop filter

I/O Modules

ENABLE_MODULE_DIGITAL_INPUT
define
Digital input management with debouncing
ENABLE_MODULE_DIGITAL_OUTPUT
define
Digital output control and management
ENABLE_MODULE_PCF8574_INPUT_MODULE
define
PCF8574 I2C input expander
ENABLE_MODULE_PCF8574_MODULE
define
PCF8574 general I/O expander
ENABLE_MODULE_PCF8574_OUTPUT_MODULE
define
PCF8574 I2C output expander
ENABLE_MODULE_ROTARY_ENCODER
define
Rotary encoder reading with direction detection
ENABLE_MODULE_SEVEN_SEGMENT
define
Base 7-segment display control
ENABLE_MODULE_SEVEN_SEGMENT_PCF
define
7-segment display via PCF8574 I2C expander
ENABLE_MODULE_SEVEN_SEGMENT_74HC595
define
7-segment display via 74HC595 shift register
ENABLE_MODULE_SEVEN_SEGMENT_RAW
define
Direct 7-segment display control

Task Modules

ENABLE_MODULE_FREE_RTOS_HANDLER
define
FreeRTOS task management for ESP32
ENABLE_MODULE_TASK_HANDLER
define
Non-blocking task scheduling system

Time Modules

ENABLE_MODULE_TIMER_DURATION
define
Duration measurement and timing utilities
ENABLE_MODULE_TIMER_MANAGER
define
Multiple timer management system
ENABLE_MODULE_TIMER_TASK
define
Task scheduling with timer-based triggers

Utility Modules

ENABLE_MODULE_EASY_LOGIC
define
Simplified logic operations and conditions
ENABLE_MODULE_LOGIC_CONDITION_MANAGER
define
Complex condition management with rule evaluation
ENABLE_MODULE_STATE_ACTION_MANAGER
define
State machine with action triggers
ENABLE_MODULE_VARIABLE_WATCHER
define
Variable monitoring with change detection

WiFi Modules

Connection Management

ENABLE_MODULE_WIFI_HANDLER
define
Basic WiFi connection handler
ENABLE_MODULE_WIFI_HANDLER_V2
define
Enhanced WiFi handler with reconnection logic
ENABLE_MODULE_WIFI_MODULE
define
WiFi module abstraction layer
ENABLE_MODULE_WIFI_MANAGER
define
WiFiManager for captive portal configuration

Time Synchronization

ENABLE_MODULE_DATETIME_NTP
define
NTP time synchronization
ENABLE_MODULE_DATETIME_NTP_V2
define
Enhanced NTP with timezone support

Firebase Integration

ENABLE_MODULE_FIREBASE_HANDLER
define
Firebase V1 legacy handler
ENABLE_MODULE_FIREBASE_FIRESTORE_V2
define
Firestore V2 database operations
ENABLE_MODULE_FIREBASE_FIRESTORE_V3
define
Firestore V3 with enhanced query support
ENABLE_MODULE_FIREBASE_MESSAGING_V2
define
Firebase Cloud Messaging V2
ENABLE_MODULE_FIREBASE_MESSAGING_V3
define
Firebase Cloud Messaging V3
ENABLE_MODULE_FIREBASE_RTDB_V2
define
Realtime Database V2
ENABLE_MODULE_FIREBASE_RTDB_V3
define
Realtime Database V3 with streaming support
ENABLE_MODULE_FIREBASE_STORAGE_V2
define
Firebase Storage V2 for file uploads
ENABLE_MODULE_FIREBASE_STORAGE_V3
define
Firebase Storage V3 with chunked uploads
ENABLE_MODULE_FIREBASE_APPLICATION_V3
define
Firebase Application V3 unified interface

Cloud Services

ENABLE_MODULE_GOOGLE_SHEETS
define
Google Sheets API integration
ENABLE_MODULE_MQTT_MANAGER
define
MQTT client with auto-reconnect
ENABLE_MODULE_TELEGRAM_BOT
define
Telegram Bot API integration
ENABLE_MODULE_WHATSAPP_BOT
define
WhatsApp Bot API integration

Sensor Modules

Sensor Framework V1

ENABLE_SENSOR_MODULE
define
Sensor Module V1 base framework
ENABLE_SENSOR_MODULE_UTILITY
define
Sensor Module V1 utility functions

Sensor Framework V1 - Calibration

ENABLE_ANALOG_SENSOR_CALIBRATOR
define
Analog sensor calibration system
ENABLE_INTERACTIVE_SERIAL_ANALOG_SENSOR_CALIBRATOR
define
Interactive serial-based analog sensor calibration
ENABLE_INTERACTIVE_SERIAL_GENERAL_SENSOR_CALIBRATOR
define
Interactive serial-based general sensor calibration
ENABLE_MULTI_SENSOR_CALIBRATION_MANAGER
define
Multi-sensor calibration management system
ENABLE_SENSOR_CALIBRATION_MODULE
define
Sensor calibration module V1

Sensor Framework V1 - Individual Sensors

ENABLE_SENSOR_ABSTRACT
define
Abstract sensor base class V1
ENABLE_SENSOR_AHT
define
AHT10/AHT20 temperature and humidity sensor
ENABLE_SENSOR_ANALOG
define
Generic analog sensor wrapper
ENABLE_SENSOR_BME280
define
BME280 environmental sensor (temperature, humidity, pressure)
ENABLE_SENSOR_DHT
define
DHT11/DHT22 temperature and humidity sensor
ENABLE_SENSOR_DIGITAL
define
Generic digital sensor wrapper
ENABLE_SENSOR_DS18B20
define
DS18B20 1-Wire temperature sensor
ENABLE_SENSOR_DUST
define
Dust/particulate matter sensor
ENABLE_SENSOR_FLOWMETER
define
Flow meter V1
ENABLE_SENSOR_FLOWMETERV2
define
Flow meter V2 with enhanced accuracy
ENABLE_SENSOR_FLOWMETERV3
define
Flow meter V3 with calibration support
ENABLE_SENSOR_GM67
define
GM67 barcode scanner module
ENABLE_SENSOR_GPS
define
GPS/GNSS module support
ENABLE_SENSOR_HX711
define
HX711 load cell amplifier
ENABLE_SENSOR_INA219
define
INA219 current/voltage/power sensor
ENABLE_SENSOR_KEYPADI2C
define
I2C keypad module
ENABLE_SENSOR_MAX30100LIB
define
MAX30100 heart rate and SpO2 sensor
ENABLE_SENSOR_MAX3010X
define
MAX30102/MAX30105 heart rate and SpO2 sensor
ENABLE_SENSOR_MAX3010XV2
define
MAX30102/MAX30105 V2 with enhanced algorithms
ENABLE_SENSOR_MAX31865
define
MAX31865 RTD temperature sensor
ENABLE_SENSOR_MAX6675
define
MAX6675 K-type thermocouple sensor
ENABLE_SENSOR_MLX90614
define
MLX90614 infrared temperature sensor
ENABLE_SENSOR_MQ
define
MQ series gas sensors (MQ-2, MQ-135, etc.)
ENABLE_SENSOR_PH
define
pH sensor module
ENABLE_SENSOR_PZEM004T
define
PZEM-004T power monitoring module
ENABLE_SENSOR_RFID
define
RFID reader module (RC522, PN532)
ENABLE_SENSOR_RPM
define
RPM/tachometer sensor
ENABLE_SENSOR_RTC
define
Real-time clock module V1
ENABLE_SENSOR_SCD30
define
SCD30 CO2, temperature, and humidity sensor
ENABLE_SENSOR_SOIL
define
Soil moisture sensor
ENABLE_SENSOR_SOILPH
define
Soil pH sensor
ENABLE_SENSOR_TCS3200
define
TCS3200 color sensor
ENABLE_SENSOR_TDS
define
TDS (Total Dissolved Solids) sensor
ENABLE_SENSOR_TURBIDITY
define
Turbidity sensor for water clarity
ENABLE_SENSOR_ULTRASONIC
define
Ultrasonic distance sensor (HC-SR04, etc.)
ENABLE_SENSOR_VOLTAGE
define
Voltage divider sensor module

Sensor Framework V2

ENABLE_SENSOR_MODULE_V2
define
Sensor Module V2 base framework with enhanced features
ENABLE_SENSOR_UTILITY_V2
define
Sensor Module V2 utility functions

Sensor Framework V2 - Systems

ENABLE_SENSOR_ALERT_SYSTEM_V2
define
Alert system for threshold-based notifications V2
ENABLE_SENSOR_FILTER_V2
define
Integrated filtering system for sensor data V2

Sensor Framework V2 - Tools

ENABLE_INTERACTIVE_SERIAL_GENERAL_SENSOR_CALIBRATOR_V2
define
Interactive serial-based sensor calibration V2
ENABLE_SENSOR_CALIBRATION_MODULE_V2
define
Sensor calibration module V2

Sensor Framework V2 - Individual Sensors

ENABLE_SENSOR_ABSTRACT_V2
define
Abstract sensor base class V2
ENABLE_SENSOR_ANALOG_V2
define
Generic analog sensor V2
ENABLE_SENSOR_BME680_V2
define
BME680 environmental sensor V2 (temperature, humidity, pressure, gas)
ENABLE_SENSOR_CUSTOM_TEMPLATE_V2
define
Custom sensor template V2 for user-defined sensors
ENABLE_SENSOR_DHT_V2
define
DHT11/DHT22 sensor V2
ENABLE_SENSOR_GP2Y_DUST_V2
define
GP2Y dust sensor V2
ENABLE_SENSOR_INA219_V2
define
INA219 current/voltage sensor V2
ENABLE_SENSOR_MHRTC_V2
define
MH-RTC real-time clock V2
ENABLE_SENSOR_MLX90614_V2
define
MLX90614 infrared temperature sensor V2
ENABLE_SENSOR_MQ_V2
define
MQ series gas sensors V2
ENABLE_SENSOR_RTC_V2
define
Real-time clock module V2 base
ENABLE_SENSOR_RTC_DS1307_V2
define
DS1307 RTC module V2
ENABLE_SENSOR_RTC_DS3231_V2
define
DS3231 high-precision RTC module V2
ENABLE_SENSOR_RTC_PCF8523_V2
define
PCF8523 RTC module V2
ENABLE_SENSOR_RTC_PCF8563_V2
define
PCF8563 RTC module V2

Include Pattern Examples

Basic Sensor Application

#define ENABLE_SENSOR_MODULE_V2
#define ENABLE_SENSOR_DHT_V2
#define ENABLE_SENSOR_FILTER_V2
#define ENABLE_MODULE_SERIAL_DEBUGGER_V2

#include "Kinematrix.h"

WiFi-Connected IoT Device

#define ENABLE_MODULE_WIFI_HANDLER_V2
#define ENABLE_MODULE_MQTT_MANAGER
#define ENABLE_MODULE_DATETIME_NTP_V2
#define ENABLE_SENSOR_MODULE_V2
#define ENABLE_SENSOR_BME680_V2

#include "Kinematrix.h"

Control System with Fuzzy Logic

#define ENABLE_MODULE_FUZZY_MAMDANI
#define ENABLE_MODULE_PID_CONTROLLER
#define ENABLE_SENSOR_MODULE_V2
#define ENABLE_SENSOR_ANALOG_V2
#define ENABLE_MODULE_SERIAL_DEBUGGER_V2

#include "Kinematrix.h"

Display Menu System

#define ENABLE_MODULE_OLED_MENU
#define ENABLE_MODULE_ROTARY_ENCODER
#define ENABLE_SENSOR_MODULE_V2
#define ENABLE_SENSOR_DHT_V2

#include "Kinematrix.h"

Memory Optimization Tips

Only enable modules you actually use. Each enabled module increases flash and RAM usage.
Some modules have dependencies. For example, Firebase modules may require WiFi handler modules.
Use helper versions (ENABLE_MODULE_HELPER_*) for utility-only access without full implementation.

See Also

Build docs developers (and LLMs) love