Skip to main content

Overview

Kinematrix provides a unified API that works across multiple microcontroller platforms, automatically detecting and optimizing for each platform’s capabilities. Write your code once and deploy it across different hardware with platform-appropriate optimizations.

Supported Platforms

ESP32 (Primary Target)

Full feature set with all modules available.

ESP32 Specifications

  • Processor: Dual-core Xtensa LX6 @ 240MHz
  • SRAM: 520KB
  • Flash: 4MB typical (up to 16MB)
  • Connectivity: WiFi 802.11 b/g/n, Bluetooth 4.2 & BLE
  • Peripherals: SPI, I2C, UART, ADC, DAC, PWM, Touch

ESP32 Features

// All features available on ESP32
#define ENABLE_MODULE_WIFI_HANDLER_V2         // ✓ Full WiFi
#define ENABLE_MODULE_FIREBASE_RTDB_V3        // ✓ Cloud services
#define ENABLE_MODULE_FREE_RTOS_HANDLER       // ✓ Multitasking
#define ENABLE_MODULE_SD_CARD_MODULE_ESP32    // ✓ SD card
#define ENABLE_MODULE_PID_CONTROLLER          // ✓ Advanced control
#define ENABLE_SENSOR_MODULE_V2               // ✓ All sensors
#include "Kinematrix.h"
  • IoT applications with cloud connectivity
  • Advanced control systems with PID/Fuzzy logic
  • Data logging with SD card storage
  • Multi-sensor monitoring systems
  • Web-based HMI interfaces

ESP8266 (Secondary Target)

WiFi-enabled platform with memory-optimized features.

ESP8266 Specifications

  • Processor: Xtensa L106 @ 80MHz (160MHz boost)
  • SRAM: 80KB user-available
  • Flash: 4MB typical
  • Connectivity: WiFi 802.11 b/g/n
  • Peripherals: SPI, I2C, UART, ADC, PWM

ESP8266 Features

// WiFi features with memory optimization
#define ENABLE_MODULE_WIFI_HANDLER_V2         // ✓ WiFi (optimized)
#define ENABLE_MODULE_MQTT_MANAGER            // ✓ MQTT
#define ENABLE_MODULE_EEPROM_LIB_ESP8266      // ✓ ESP8266-specific EEPROM
#define ENABLE_SENSOR_MODULE_V2               // ✓ Most sensors
#define ENABLE_MODULE_PID                     // ✓ Basic PID
#include "Kinematrix.h"
ESP8266 has limited RAM (80KB). Avoid enabling too many modules simultaneously. Use the modular compilation system to keep memory usage under control.

Platform-Specific Optimizations

// ESP8266-specific EEPROM module
#define ENABLE_MODULE_EEPROM_LIB_ESP8266
#include "Kinematrix.h"

EEPROMLibESP8266 storage;

void setup() {
    storage.begin(512);  // Allocate 512 bytes
    storage.write(0, 42);
    storage.commit();    // ESP8266 requires explicit commit
}
  • WiFi-enabled sensor nodes
  • MQTT-based IoT devices
  • Simple web servers
  • Basic automation controllers

AVR (Limited Support)

Arduino Uno, Nano, Mega with basic I/O and sensor operations.

AVR Specifications

  • Processor: ATmega328P @ 16MHz (Uno/Nano), ATmega2560 @ 16MHz (Mega)
  • SRAM: 2KB (Uno/Nano), 8KB (Mega)
  • Flash: 32KB (Uno/Nano), 256KB (Mega)
  • Peripherals: SPI, I2C, UART, ADC, PWM

AVR Features

// Basic modules optimized for limited resources
#define ENABLE_SENSOR_MODULE                  // ✓ Basic sensors
#define ENABLE_MODULE_I2C_SCANNER             // ✓ I2C
#define ENABLE_MODULE_SERIAL_HARD             // ✓ Serial
#define ENABLE_MODULE_PID                     // ✓ Basic PID
#define ENABLE_MODULE_EEPROM_LIB              // ✓ AVR EEPROM
#include "Kinematrix.h"
AVR boards have very limited RAM. Arduino Uno has only 2KB RAM. Use minimal module sets and avoid String objects. Prefer lightweight modules like SERIAL_DEBUGGER_LITE over full-featured ones.

Memory-Conscious Example

// Minimal AVR configuration - fits in 2KB RAM
#define ENABLE_SENSOR_ANALOG_V2
#define ENABLE_MODULE_MOVING_AVERAGE_FILTER
#include "Kinematrix.h"

SensorModuleV2 sensors;
AnalogSensV2 tempSensor(A0);
MovingAverageFilter filter(5);  // 5-sample window

void setup() {
    Serial.begin(9600);
    sensors.addSensor("temp", &tempSensor);
    sensors.init();
}

void loop() {
    sensors.update();
    float raw = tempSensor.getValue();
    float filtered = filter.update(raw);
    Serial.println(filtered);
    delay(1000);
}
  • Educational projects
  • Basic sensor reading
  • Simple control loops
  • Low-cost prototypes

Platform Detection

Kinematrix automatically detects the platform at compile time:
// Internal platform detection (you don't need to write this)
#if defined(ESP32)
    // ESP32-specific code
    #include <WiFi.h>
    #include <SPIFFS.h>
#elif defined(ESP8266)
    // ESP8266-specific code
    #include <ESP8266WiFi.h>
    #include <FS.h>
#elif defined(ARDUINO_ARCH_AVR)
    // AVR-specific code
    #include <EEPROM.h>
#endif
Your application code remains the same across platforms:
// Same code works on all platforms!
#define ENABLE_SENSOR_MODULE_V2
#define ENABLE_SENSOR_DHT_V2
#include "Kinematrix.h"

SensorModuleV2 sensors;
DHTSensV2 dht(2, DHT22);

void setup() {
    sensors.addSensor("temp", &dht);
    sensors.init();
}

void loop() {
    sensors.update();
    Serial.println(dht.getTemperature());
    delay(2000);
}

Feature Availability Matrix

Feature CategoryESP32ESP8266AVR
WiFi✅ Full✅ Optimized
Bluetooth
Cloud Services✅ Firebase, MQTT✅ MQTT, limited Firebase
SD Card⚠️ Limited✅ Basic
EEPROM✅ Emulated✅ Emulated✅ Native
FreeRTOS
Advanced Sensors✅ All✅ Most⚠️ Basic
PID Control✅ Advanced✅ Advanced✅ Basic
Fuzzy Logic⚠️ Limited
Machine Learning⚠️ Limited
Display Systems
I2C/SPI
✅ Full support | ⚠️ Limited/Optimized | ❌ Not available

Module Availability by Platform

WiFi-Only Modules (ESP32/ESP8266)

// These modules require WiFi capability
#define ENABLE_MODULE_WIFI_HANDLER_V2
#define ENABLE_MODULE_WIFI_MANAGER
#define ENABLE_MODULE_MQTT_MANAGER
#define ENABLE_MODULE_FIREBASE_RTDB_V3
#define ENABLE_MODULE_GOOGLE_SHEETS
#define ENABLE_MODULE_TELEGRAM_BOT
#define ENABLE_MODULE_WHATSAPP_BOT
#define ENABLE_MODULE_DATETIME_NTP_V2

ESP32-Only Modules

// These modules require ESP32 capabilities
#define ENABLE_MODULE_FREE_RTOS_HANDLER
#define ENABLE_MODULE_SD_CARD_MODULE_ESP32

Universal Modules (All Platforms)

// These work on ESP32, ESP8266, and AVR
#define ENABLE_MODULE_I2C_SCANNER
#define ENABLE_MODULE_SERIAL_HARD
#define ENABLE_MODULE_PID
#define ENABLE_MODULE_MOVING_AVERAGE_FILTER
#define ENABLE_SENSOR_MODULE_V2
#define ENABLE_SENSOR_ANALOG_V2
#define ENABLE_SENSOR_DHT_V2

Best Practices by Platform

ESP32 Best Practices

Leverage Full Capabilities
// Use dual-core processing
#define ENABLE_MODULE_FREE_RTOS_HANDLER

// Enable cloud connectivity
#define ENABLE_MODULE_FIREBASE_RTDB_V3
#define ENABLE_MODULE_MQTT_MANAGER

// Use advanced features
#define ENABLE_MODULE_FUZZY_MAMDANI
#define ENABLE_MODULE_KNN
Memory is Plentiful
  • Don’t worry about enabling multiple modules
  • Use String objects freely
  • Enable debugging with SERIAL_DEBUGGER_V2

Platform-Specific Examples

#define ENABLE_SENSOR_MODULE_V2
#define ENABLE_SENSOR_BME680_V2
#define ENABLE_MODULE_WIFI_HANDLER_V2
#define ENABLE_MODULE_MQTT_MANAGER
#define ENABLE_MODULE_SD_CARD_MODULE_ESP32
#define ENABLE_MODULE_DATETIME_NTP_V2
#define ENABLE_MODULE_FREE_RTOS_HANDLER
#include "Kinematrix.h"

// 520KB RAM - plenty of room for all features

ESP8266: WiFi Sensor Node

#define ENABLE_SENSOR_MODULE_V2
#define ENABLE_SENSOR_DHT_V2
#define ENABLE_MODULE_WIFI_HANDLER_V2
#define ENABLE_MODULE_MQTT_MANAGER
#include "Kinematrix.h"

// 80KB RAM - keep it focused

AVR: Basic Sensor Logger

#define ENABLE_SENSOR_ANALOG_V2
#define ENABLE_MODULE_EEPROM_LIB
#define ENABLE_MODULE_SERIAL_HARD
#include "Kinematrix.h"

// 2KB RAM - extreme minimalism required

Troubleshooting

Symptoms: Crashes, resets, heap corruptionSolutions:
  • Reduce number of enabled modules
  • Use SERIAL_DEBUGGER_LITE instead of SERIAL_DEBUGGER_V2
  • Decrease buffer sizes in WiFi/MQTT modules
  • Use F() macro for all string constants
  • Monitor free heap with ESP.getFreeHeap()
Symptoms: Won’t compile or immediate crash on bootSolutions:
  • Enable only 1-2 modules at a time
  • Use Arduino Mega instead of Uno
  • Avoid dynamic memory allocation
  • Remove Serial.print() debugging (uses RAM)
  • Check RAM usage: Sketch → Verify/Compile → Check output
Symptoms: Undefined reference errors for WiFi modulesSolutions:
  • WiFi modules only work on ESP32/ESP8266
  • Use Ethernet shield for AVR networking
  • Or upgrade to ESP8266/ESP32 platform

See Also

Build docs developers (and LLMs) love