Repetier server control 3D printer and CNC

As I knew , Repetier server can control multiple printers simultaneously , but if we build a repetier firmware for CNC , could we control the 3D printer and a CNC simultaneously from Repetier server ?

Comments

  • Sure. Server is in first place just a software sending gcode and does not care about the intention as long as the firmware is supported. Only thing is that preview images will be empty and on control you see most likely only travel moves.
  • Thanks a lot for your reply , further , could we schedule the working process for 3D printer and CNC on Repetier Server , for example , if we finish the printing , a Robot will move the printed part to CNC platform , and then Repetier server will tell CNC start to machining the part .
  • Naturally such a complex thing is not implemented directly. But there are ways to do that with some clever placing of e.g. some scripts that you run with @execute at the end of the print. Using the web API you can send commands to the server to e.g. do the robot handling and start cnc.
  • Great , the mechanism of scripts which you mentioned should be work for the project , could you show any example to explain the operating process of @execute.  
  • In the manual is an example in chapter advanced setup for calling play as @execute play file
    <execute name="play" allowParams="true">/usr/bin/afplay</execute>
    important thing is to consider that the script is run as user repetierserver on linux. So that user must have execute permission for the script.
  • Great , I try it , thanks a lot .
  • About the repetier firmware for CNC , it can control the mill with M3/M4/M5 code , we used VFD inverter to control the spindle speed  , my question is , if I want to control the speed with M3 S12000 , which pin should be assigned on Ramps 1.4 to wire to Inverter ? thanks .
  • You need to modify the firmware for this. Currently only on/off is supported. I'm no electronic guy so no idea how a vfd inverter gets controlled. But the driver replacement must create that signal on a pin that is not used. If this involves a periodic signal you may want to use a timer, but timer 0-3 are already in use for internal usage, so use a pin connected to time 4 or 5 in that case.
  • Currently ,  we can use Fan Pin to control spindle speed with PMW control , for example , if I use M106 S255 , the spindle will turn as maxium speed , use M107 to stop the spindle , my question is , Can I assign M3 code to fan pin instead of M106 , then use M3 S255 to achieve the spindle maxium speed and M5 instead of M107 to stop the spindle , thanks . 
  • As I said you can when you change the cnc driver to do that. Currently the CNC driver which gets said M3 value will only turn it on or off. You are now using it in extruder mode I guess where M3 is not used and M106/M107 control the fan which you used for that. See driver.cpp at the end there you see current functions:

    #if defined(SUPPORT_CNC) && SUPPORT_CNC
    /**
    The CNC driver differs a bit from laser driver. Here only M3,M4,M5 have an
    influence on the spindle. The motor also keeps running for G0 moves. M3 and M4
    wait for old moves to be finished and then enables the motor. It then waits
    CNC_WAIT_ON_ENABLE milliseconds for the spindle to reach target speed.
    */

    int8_t CNCDriver::direction = 0;
    secondspeed_t CNCDriver::spindleSpeed = 0;
    uint16_t CNCDriver::spindleRpm = 0;

    /** Initialize cnc pins. EVENT_INITIALIZE_CNC should return false to prevent
    * default initialization.*/
    void CNCDriver::initialize() {
    if (EVENT_INITIALIZE_CNC) {
    #if CNC_ENABLE_PIN > -1
    SET_OUTPUT(CNC_ENABLE_PIN);
    WRITE(CNC_ENABLE_PIN, !CNC_ENABLE_WITH);
    #if CNC_DIRECTION_PIN > -1
    SET_OUTPUT(CNC_DIRECTION_PIN);
    }
    }
    /** Turns off spindle. For event override implement
    EVENT_SPINDLE_OFF
    returning false.
    */
    void CNCDriver::spindleOff() {
    spindleRpm = 0;
    if (direction == 0)
    return; // already off
    if (EVENT_SPINDLE_OFF) {
    #if CNC_ENABLE_PIN > -1
    WRITE(CNC_ENABLE_PIN, !CNC_ENABLE_WITH);
    }
    HAL::delayMilliseconds(CNC_WAIT_ON_DISABLE);
    direction = 0;
    }
    /** Turns spindle on. Default implementation uses a enable pin CNC_ENABLE_PIN.
    If CNC_DIRECTION_PIN is not -1 it sets direction to CNC_DIRECTION_CW. rpm is
    ignored. To override with event system, return false for the event
    EVENT_SPINDLE_CW(rpm)
    */
    void CNCDriver::spindleOnCW(int32_t rpm) {
    spindleSpeed = map(rpm, 0, CNC_RPM_MAX, 0, CNC_PWM_MAX); // linear interpolation

    if (direction == 1 && spindleRpm == rpm)
    return;
    if (direction == -1) {
    spindleOff();
    }
    spindleRpm = rpm; // for display
    direction = 1;
    if (EVENT_SPINDLE_CW(rpm)) {
    #if CNC_DIRECTION_PIN > -1
    WRITE(CNC_DIRECTION_PIN, CNC_DIRECTION_CW);
    #if CNC_ENABLE_PIN > -1
    WRITE(CNC_ENABLE_PIN, CNC_ENABLE_WITH);
    }
    HAL::delayMilliseconds(CNC_WAIT_ON_ENABLE);
    }
    /** Turns spindle on. Default implementation uses a enable pin CNC_ENABLE_PIN.
    If CNC_DIRECTION_PIN is not -1 it sets direction to !CNC_DIRECTION_CW. rpm is
    ignored. To override with event system, return false for the event
    EVENT_SPINDLE_CCW(rpm)
    */
    void CNCDriver::spindleOnCCW(int32_t rpm) {
    spindleSpeed = map(rpm, 0, CNC_RPM_MAX, 0, CNC_PWM_MAX); // linear interpolation

    if (direction == -1 && spindleRpm == rpm)
    return;
    if (direction == 1) {
    spindleOff();
    }
    spindleRpm = rpm; // for display
    direction = -1;
    if (EVENT_SPINDLE_CCW(rpm)) {
    #if CNC_DIRECTION_PIN > -1
    WRITE(CNC_DIRECTION_PIN, !CNC_DIRECTION_CW);
    #if CNC_ENABLE_PIN > -1
    WRITE(CNC_ENABLE_PIN, CNC_ENABLE_WITH);
    }
    HAL::delayMilliseconds(CNC_WAIT_ON_ENABLE);
    }

    As you see you can add custom events for EVENT_SPINDLE_CW and EVENT_INITIALIZE_CNC to use the M3 value to do what you want instead of the default behaviour. Just make them return false to override the default behaviour.
Sign In or Register to comment.