Spindle stop by gcode

This topic contains 11 replies, has 4 voices, and was last updated by  grishien 3 days, 11 hours ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #102083

    grishien
    Participant

    Hi all,

    If already solved in another thread, kindly ask to point by link.

    I’d like to carry out spindle stopping after gcode is finished. Maybe there is some specific pin designated and corresponding Marlin command for it?

    • This topic was modified 3 weeks, 4 days ago by  Ryan. Reason: hardware
    #102092

    Niels P. Andersen
    Participant

    WARNING: Be careful when working with Mains voltages.

    I assume familiarity with connecting Mains voltages through a mechanical relay such as the one shown in the picture. Be careful to check if the voltages and currents you plan to switch through the relay matches the specs on the relay.

    The setup shown in the picture works for a Ramps board.

    The control pin for the relay is connected to the PSON pin on the Ramps board (Brown wire). Mine is a 1.6, and other versions of the Ramps board may have the PSON pin in a different location.

    VCC for the relay is connected to the VCC pin on the Ramps board (Red wire).

    Edit the following lines in the Configuration.h file:

    #define POWER_SUPPLY 0 –> #define POWER_SUPPLY 1

    //#define PS_DEFAULT_OFF –> #define PS_DEFAULT_OFF

    Insert M80 (turn on PSU) as part of your start code.

    Insert M81 (turn off PSU) as part of your end code.

    #102540

    grishien
    Participant

    Thanks! Now yet ready to try, need to buy relay modules. Will report when done.

    #102551

    Barry
    Participant

    https://www.amazon.com/Iot-Relay-Enclosed-High-Power-Raspberry/dp/B00WV7GMA2/ref=sr_1_2?m=A3D4241373L385&marketplaceID=ATVPDKIKX0DER&qid=1559735268&s=merchant-items&sr=1-2

     

    Just wire it to the part fan header and use gcode to start and stop the fan, which will power on and off the spindle.

    #103243

    grishien
    Participant

    WARNING: Be careful when working with Mains voltages.

    I assume familiarity with connecting Mains voltages through a mechanical relay such as the one shown in the picture. Be careful to check if the voltages and currents you plan to switch through the relay matches the specs on the relay.

    The setup shown in the picture works for a Ramps board.

    The control pin for the relay is connected to the PSON pin on the Ramps board (Brown wire). Mine is a 1.6, and other versions of the Ramps board may have the PSON pin in a different location.

    VCC for the relay is connected to the VCC pin on the Ramps board (Red wire).

    Edit the following lines in the Configuration.h file:

    #define POWER_SUPPLY 0 –> #define POWER_SUPPLY 1

    //#define PS_DEFAULT_OFF –> #define PS_DEFAULT_OFF

    Insert M80 (turn on PSU) as part of your start code.

    Insert M81 (turn off PSU) as part of your end code.

    Why is your relay’s GND connected to +5V on your RAMPS 1.6?

    #103255

    Jamie
    Participant

    Why is your relay’s GND connected to +5V on your RAMPS 1.6?

    Looks to me like relay gnd is connected to ramps gnd on one of the servo slots.

    #103258

    grishien
    Participant

    My bad. I am inattentive this morning.

    #103584

    grishien
    Participant

    Here’s the problem.

    In current uptodate marlin for MPCNC declaring “Default off” makes PSON pin to turn on. Meaning that when pin is +5V then it is “PSU off” state. Then you “M80” – PSON pin turns off. “M81” – PSON pin again +5V.

    Which means that when I finish job and turn off arduino – spindle suddenly starts working. How safe and comfortable is that?

    I’m not new to programming, I think I will handle it. Just an info.

    • This reply was modified 1 week, 1 day ago by  grishien.
    #103589

    Jamie
    Participant

    I agree this is troubling.  Good catch.

    You’ve probably already solved it but I think it should be sufficient to instead use

    #define POWER_SUPPLY 2

    This appears to invert the logic so power on is active high instead of active low.  Then use the normally open relay contacts instead of the normally closed ones.

    #103590

    grishien
    Participant

    Thanks, gotta try

    • This reply was modified 1 week, 1 day ago by  grishien.
    • This reply was modified 1 week, 1 day ago by  grishien.
    #103605

    Niels P. Andersen
    Participant

    Thank you for the heads up.

    My Arduino and spindle are powered from the same circuit, i.e. the same on/off-switch/emergency-button kills both, which is why I haven’t seen the problem.

    #104039

    grishien
    Participant

    And.. yes, finally I can confirm it works! 🙂

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.