Torch height controller with DRV8825

New Home Forum Mostly Printed CNC – MPCNC Hardware Development – MPCNC Torch height controller with DRV8825

This topic contains 7 replies, has 4 voices, and was last updated by  Chris 5 days, 11 hours ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #72256

    Damien
    Participant

    So I want to build a torch height controller for my MPCNC plasma cutter.

     

    My first question was going to be, would it be ok to parallel a STEP and dir signal onto the STEP and dir pins of the DRV8825.  But I’m guessing that would cause a short?  Or would it?

     

    So if I re-route the STEP and dir wires through a THC and then back to the DRV8825.  Would that work?

     

    Or what if I routed them through a pro mini that would pass through the ramps signals to DRV8825, but I could use the pro mini like a THC to scene plasma voltage and send its own signals to DRV8825?

    Or can this be done through the mega and ramps?

    Am I on the correct thought path?  Would any of this work?

    Thanks.

     

     

    #72260

    Jeffeb3
    Participant

    My first question was going to be, would it be ok to parallel a STEP and dir signal onto the STEP and dir pins of the DRV8825.  But I’m guessing that would cause a short?  Or would it?

    If Marlin pulls tries to turn a pin to OFF, it will connect it to ground, through the microcontroller. If your height controller was trying to turn it to ON, then it will connect it to 5V, through your microcontroller. You’d be essientially shorting 5V to ground, through your microcontrollers, which will destroy one, or both of them. This would be true for either STEP or DIR. BTW, there’s also EN (enable).

    If you connect Marlin’s STEP, DIR, EN to inputs on your microcontroller, and then connect your microcontroller’s output to the STEP, DIR, EN of the DRV8825, then that will work, but the software inside your microcontroller had better be really fast, otherwise, it won’t keep up with the X and Y axes. With 10mm/s and 800steps/mm, your microcontroller has to read and write at 8000 steps/s, which isn’t too terrible, but you’ll have to somewhat know what you’re doing.

    A much simpler solution (IMO) is to physically have another motor, and driver for a short Z axis. Something that can move the torch enough for the THC, but would still rely on Marlin to do the “gross” motor movements. Then you don’t have to read the steps from marlin, you can just look for an enable/disable signal.

    1 user thanked author for this post.
    #72359

    Damien
    Participant

    I had thought of using another motor, but it would be nicer if I could use the original setup.

    While plasma cutting the z axis only moves at the start and end of cut through Marlin.  I was going to program a one second delay after the plasma arc was detected before the torch height microcontroller takes over the z axis.  By that time all z movements through Marlin would have finished.  I was just going to mimic the HIGH or LOW signals going to the STEP and dir pins.  If I was to supply a continuous HIGH to STEP and dir, does this not mean the stepper would turn continuously clockwise?  Or does STEP need to be pulsed HIGH and LOW?

     

    Why would I need it to read steps, or keep up with the x and y axis?  I only want the z axis to move up or down based on the plasma voltage.

     

    Is the Enable pin used through Marlin?  Is that why I need to use it?  In practice though is it ok to start/stop stepper with the STEP pin?  I will have a dead zone voltage where the z will not move.

     

    Thank you very much for your help

    #72366

    Jeffeb3
    Participant

    If I was to supply a continuous HIGH to STEP and dir, does this not mean the stepper would turn continuously clockwise?  Or does STEP need to be pulsed HIGH and LOW?

    Steps are achieved through toggling the pin, each edge is a step.

    Why would I need it to read steps, or keep up with the x and y axis?  I only want the z axis to move up or down based on the plasma voltage.

    Because:

    So if I re-route the STEP and dir wires through a THC and then back to the DRV8825.  Would that work?

    The THC would have to read in the steps, and write them back out again pretty fast. If the THC wasn’t keeping up, Marlin might execute moves like, “Move XY to 0,0, Move Z down to the work, Move XY in a circle” and the Z down move wouldn’t finish before the XY started moving in a circle. Maybe we aren’t on the same page as what “re-route” means.

    Is the Enable pin used through Marlin?

    The Enable pin is what controls when the motors are free-spinning and when they are held in place. In practice, it only gets disabled before and after the job, but it seems like the THC would need to at least read the enable pin to know if it’s steps were being used.

    While plasma cutting the z axis only moves at the start and end of cut through Marlin.  I was going to program a one second delay after the plasma arc was detected before the torch height microcontroller takes over the z axis.

    At the end of a move, Marlin can leave the STEP and DIR pins in whatever state it needed last. It won’t always be OFF. There’s probably a way to leave the THC pins in a floating state, and add a resistor to isolate the Marlin pins when the THC is trying to control. You could also create a separate circuit to switch between the Marlin step/dir and the THC. I wasn’t thinking that way originally, because I was thinking they would both be needed.

    Is the THC something you have control over, or is it something “off the shelf”?

    #72372

    Damien
    Participant

    I was going to have a go at the THC myself using Arduino to compare voltages from plasma cutter generated through a voltage divider.  I would add lcd to display voltage, and a few buttons to change the SET voltage.

    I think I understand what you mean about counting steps now.  I didn’t realise the pins had to be pulsed.

    So how about this.  Enable, STEP and dir are connected from ramps to DVR8825 through a 3 pole changeover relay.  My Arduino THC voltage meter thing delays for 1 second after it senses plasma voltage.  Then it switches relay which disconnects pins from ramps and connects to THC, which then starts controlling z.  When  plasma voltage stops at end of cut, it switches the three pins back to ramps which lifts the z back to home.  Whould that work better?

     

    Thanks.

    #73188

    Guffy
    Participant

    You may try to enable babystepping and then somehow mix in m290 commands into your gcodes stream.

    http://marlinfw.org/docs/gcode/M290.html

    or you can modify firmware to take control from an external pin and inject babysteps directly to stepper.
    search for “stepper.babystep(“

    • This reply was modified 3 weeks, 5 days ago by  Guffy.
    #73443

    Damien
    Participant

    I’m just going to use a 3 pole changeover relay to take control of the z axis Enable, STEP and dir pins.  Marlin, ramps will switch on plasma cutter using the D9 connection.  My controller will switch the relay about a second after it detects arc voltage at around 102 volts.

     

    I have got the stepper moving up and down with varying voltage with a dead zone of a few volts in the middle.

    Just waiting on a few more components to put it all together and test it.

    #75785

    Chris
    Participant

    How’s this going?
    I’m assembling a machine now, once I get the basics worked out with a pen, I have a plasma I’m going to hook up.

    I like your thought process of switching z-axis control, it’s clever.
    I’d like to duplicate your work if it’s working out.

    Thx

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

You must be logged in to reply to this topic.