4.0 KiB
4.0 KiB
---
title: "SAKO VFD Component Documentation"
description: "Documentation for the SAKO Variable Frequency Drive (VFD) control component for ESP32"
keywords: ["VFD", "SAKO", "Modbus", "RS485", "motor control", "ESP32"]
---
## SAKO VFD
**Path**: [`src/SAKO_VFD.cpp`](../src/SAKO_VFD.cpp)
**Revision History**: Initial documentation
SAKO_VFD is a component for controlling SAKO Variable Frequency Drives via Modbus RTU over RS485. It provides comprehensive monitoring and control capabilities for industrial applications, allowing for frequency setting, direction control, status monitoring, and fault handling.
## REQUIREMENTS
- ESP32 with RS485 interface capability
- SAKO VFD connected via RS485
- Modbus RTU communication enabled on the VFD
- Proper connection to GND, A+, B- lines of RS485 bus
## FEATURES
- Real-time monitoring of VFD parameters (frequency, current, power, torque)
- Control of VFD operation (start, stop, reverse, frequency setting)
- Fault detection and reset capability
- Support for retract sequences
- Statistical tracking of operational parameters
- TCP Modbus mapping for remote monitoring and control
- Configurable read intervals for performance optimization
## DEPENDENCIES
- [Component.h](../src/Component.h)
- [ModbusRTU.h](../src/modbus/ModbusRTU.h)
- [ModbusTypes.h](../src/modbus/ModbusTypes.h)
- [xstatistics.h](../src/xstatistics.h)
- [Logger.h](../src/Logger.h)
- [Bridge.h](../src/Bridge.h)
```mermaid
graph TD
SAKO_VFD --> RTU_Base
RTU_Base --> Component
SAKO_VFD --> ModbusRTU
SAKO_VFD --> ModbusTypes
SAKO_VFD --> xstatistics
SAKO_VFD --> Enums
SAKO_VFD --> Config
BEHAVIOUR
stateDiagram-v2
[*] --> STOPPED
STOPPED --> ACCELERATING: run/reverse
STOPPED --> ERROR: fault
ACCELERATING --> RUNNING: reached setpoint
ACCELERATING --> DECELERATING: new lower setpoint
ACCELERATING --> ERROR: fault
RUNNING --> DECELERATING: stop/new lower setpoint
RUNNING --> ERROR: fault
DECELERATING --> STOPPED: reached zero
DECELERATING --> ACCELERATING: new higher setpoint
DECELERATING --> ERROR: fault
ERROR --> STOPPED: resetFault
TODOS
PERFORMANCE
- Consider adding a caching mechanism for registers that don't change frequently
- Optimize read block configuration for specific SAKO VFD models
- Implement batch writes for sending multiple parameters in a single transaction
- Add power consumption tracking and optimization features
SECURITY
- Add validation for frequency and command values before sending to VFD
- Implement password protection for critical parameter changes
- Add communication failure recovery mechanisms
- Consider adding CRC validation for received data
COMPLIANCE
- Ensure proper handling of motor parameters according to manufacturer specifications
- Implement safety shutdown procedures for emergency situations
- Add support for compliance with IEC 61800 standards for variable speed drives
- Consider implementing EN/IEC 60204-1 safety requirements
RECOMMENDATIONS
- Configure proper acceleration/deceleration times to prevent mechanical stress
- Use motor auto-tuning functionality before production use
- Implement proper fault handling and logging for diagnostic purposes
- Consider adding thermal protection monitoring
- Implement proper error handling and reporting for network communication failures
EXAMPLE
#ifdef ENABLE_SAKO_VFD
sakoVFD = new SAKO_VFD(
MB_SAKO_VFD_SLAVE_ID, // Modbus slave ID
SAKO_VFD_DEFAULT_READ_INTERVAL // Read interval in milliseconds
);
if (sakoVFD) {
if (sakoVFD->setup() == E_OK) {
components.push_back(sakoVFD);
Log.infoln(F("SAKO VFD initialized. SlaveID: %d, Interval: %d ms"),
MB_SAKO_VFD_SLAVE_ID, SAKO_VFD_DEFAULT_READ_INTERVAL);
} else {
Log.errorln(F("SAKO VFD setup failed."));
delete sakoVFD;
sakoVFD = nullptr;
}
} else {
Log.errorln(F("SAKO VFD initialization failed."));
}
#endif