--- title: Extruder Component description: Documentation for the Extruder component which manages VFD-controlled extrusion with joystick and potentiometer control keywords: extruder, VFD, joystick, potentiometer, torque monitoring, jam detection --- # Extruder **Path**: [`src/components/Extruder.h`](../src/components/Extruder.h) **Revision History**: Initial documentation The Extruder component provides control over a SAKO VFD-driven extruder motor. It supports both manual and automatic extrusion modes, with configurable speed and overload protection via potentiometers. The component integrates with a joystick for manual control and features jam detection based on motor torque feedback. ## Requirements ### Hardware - SAKO VFD (Variable Frequency Drive) for motor control - Joystick for manual control (optional) - Potentiometer for speed control (optional) - Potentiometer for overload threshold control (optional) ### Pins - No direct pin requirements (manages components that have their own pin requirements) ## Features - Dual operating modes: manual (joystick-controlled) and auto (timed operation) - Configurable extrusion speed via potentiometer - Adjustable overload/jam detection threshold - Automatic jam detection based on motor torque feedback - Modbus TCP interface for remote control and monitoring - Safety features including maximum runtime limits - Auto-mode activation via joystick hold ## Dependencies - [Component](../src/Component.h) - Base component class - [SAKO_VFD](../src/components/SAKO_VFD.h) - VFD motor controller - [Pos3Analog](../src/components/3PosAnalog.h) - 3-position analog input (joystick) - [POT](../src/components/POT.h) - Potentiometer interface - [ModbusTCP](../src/modbus/ModbusTCP.h) - Modbus interface ```mermaid graph TD Extruder --> Component Extruder --> SAKO_VFD Extruder --> Pos3Analog Extruder --> POT Extruder --> ModbusTCP ``` ## Behaviour The Extruder component implements a state machine with the following states: ```mermaid stateDiagram-v2 [*] --> IDLE IDLE --> EXTRUDING_MANUAL: Joystick UP EXTRUDING_MANUAL --> EXTRUDING_AUTO: Hold joystick UP for set duration EXTRUDING_MANUAL --> IDLE: Release joystick EXTRUDING_AUTO --> STOPPING: Auto time complete or manual stop EXTRUDING_MANUAL --> JAMMED: Torque exceeds threshold EXTRUDING_AUTO --> JAMMED: Torque exceeds threshold STOPPING --> IDLE: VFD stopped JAMMED --> RESETTING_JAM: Reset command RESETTING_JAM --> IDLE: Reset complete ``` ## TODOs ### Performance - Consider implementing acceleration/deceleration ramps for smoother operation - Optimize VFD polling frequency based on system requirements - Evaluate the potential for predictive jam detection using torque trend analysis ### Security - Implement authentication for Modbus commands that control the extruder - Consider adding physical emergency stop integration - Validate input values from potentiometers to prevent unexpected behavior ### Compliance - Ensure conformance with industrial safety standards for automated machinery - Implement proper error handling and logging for diagnostic purposes - Consider adding UL/CE compliance features if required for deployment environment ### Recommendations - Add temperature monitoring to prevent motor overheating - Consider implementing a material feed sensor to detect material availability - Implement a maintenance tracking system based on operation hours - Add visual feedback (e.g., LED indicators) for different states, especially jammed condition ## Example The following example shows how to create and configure an Extruder component: ```cpp #ifdef ENABLE_EXTRUDER // First ensure required components exist if (sakoVFD && joystick && speedPot && overloadPot) { extruder = new Extruder( this, // owner sakoVFD, // VFD controller joystick, // joystick for manual control speedPot, // potentiometer for speed control overloadPot // potentiometer for overload threshold ); if (extruder) { components.push_back(extruder); Log.infoln(F("Extruder initialized")); } else { Log.errorln(F("Extruder initialization failed")); } } else { Log.warningln(F("Extruder not initialized - missing dependencies")); } #endif ``` ### References