Overview
Kinematrix is designed with platform abstraction in mind, allowing you to write code once and deploy it across multiple microcontroller platforms. This guide covers platform-specific considerations and best practices.Supported Platforms
ESP32
Primary Target
- 240MHz dual-core
- 520KB SRAM
- WiFi + Bluetooth
- Full feature set
ESP8266
Secondary
- 80MHz single-core
- 80KB SRAM
- WiFi only
- Optimized features
Arduino AVR
Limited Support
- 16MHz
- 2KB SRAM (Uno)
- Basic I/O
- Core features only
Platform Detection
Kinematrix automatically detects the target platform at compile time:Writing Portable Code
Platform-Agnostic Sensor Code
This example works on all platforms:Platform-Specific Features
Use conditional compilation for platform-specific features:Memory Optimization
ESP32 (Generous Memory)
Full feature enablement is fine:ESP8266 (Moderate Memory)
Enable only required features:Arduino AVR (Limited Memory)
Minimal feature set:Platform-Specific Pin Mappings
ESP32
ESP8266
Arduino Uno/Nano
Complete Multi-Platform Example
Here’s a complete example that adapts to all platforms:PlatformIO Configuration
Use PlatformIO for easy multi-platform development:Feature Availability Matrix
| Feature | ESP32 | ESP8266 | Arduino AVR |
|---|---|---|---|
| Basic Sensors | ✅ | ✅ | ✅ |
| SensorModuleV2 | ✅ | ✅ | ✅ |
| Data Filters | ✅ | ✅ | ⚠️ Limited |
| Alert System | ✅ | ✅ | ⚠️ Limited |
| WiFi Modules | ✅ | ✅ | ❌ |
| MQTT | ✅ | ✅ | ❌ |
| Firebase | ✅ | ✅ | ❌ |
| PID Controller | ✅ | ✅ | ✅ |
| Fuzzy Logic | ✅ | ⚠️ Limited | ❌ |
| Machine Learning | ✅ | ⚠️ Limited | ❌ |
| SD Card | ✅ | ⚠️ SPI only | ✅ |
| Display Menus | ✅ | ✅ | ✅ |
Best Practices
1. Use Platform Detection Macros
2. Abstract Hardware Differences
3. Test on Multiple Platforms
Regularly test your code on all target platforms to catch platform-specific issues early.4. Document Platform Requirements
Troubleshooting Platform Issues
Compilation errors on specific platform
Compilation errors on specific platform
- Check if all required modules are enabled
- Verify pin definitions are correct for platform
- Ensure feature is supported on target platform
- Check PlatformIO configuration for correct board
Out of memory errors
Out of memory errors
- Reduce number of enabled modules
- Use simpler data structures
- Decrease buffer sizes
- Consider upgrading to platform with more memory
Different behavior on different platforms
Different behavior on different platforms
- Check ADC resolution differences (10-bit vs 12-bit)
- Verify voltage reference (3.3V vs 5V)
- Review timing-sensitive code
- Test I2C clock speeds
Next Steps
Debugging
Platform-specific debugging techniques
Basic Sensor Reading
Review sensor fundamentals
IoT Data Logger
Build cross-platform data loggers
LED Control
Platform-agnostic LED control