Requests for help: Gcode cam follower/ tangential knife control.

  • Hello everyone, i'm posting this here to to keep the discussion going, however i already made the post on my other thread so i will link you to the other post, as well as copy some of the things i'm trying to do here in this thread.

    Please see here for more info:

    I created a flat coil winder using the duet controlled delta i built,
    here is a few videos of it working:

    It even made it to hackaday, that was cool,

    I do have a request, in order for this to work correctly, i need to find a way to make a stepper motor turn the cam follower head in the direction that I'm trying to lay the wire, This way i can control precisely where i lay the wire and i dont have to rely on the wire to " pull" the cam around. right now there is an offset between the roller and the zero point of the Gcode / indefector.

    Dose anyone know if there is a way i can use the extruder motor out put ( or an extra output to a driver) that i can automatically tell it to move in accordance to the direction that the endefector is moving?

    The alternative is to offset the Gcode so that the cam follower is in the correct place. if i wanted to place the wire exactly, or make sharp corners i can have to offset this. very hard thing to do.

    I thought about trying a drag knife type Gcode editor for corners. but that's not a good option. because the radius of arcs or any moment really is going to be off set.

    so the best thing is to have a motor that can move the head around to make sure it fallows the current direction on the fly. then i can make the roller in the zero location and have no offset. right now there has to be an offset or the wire / roller will not work correctly.

    If there is any possible way to do this with current duet functionality or G code script... please let me know,

    if there is not please let me know if you'd be interested in making a script or some type of program / addition to the duet that can do this.

    to be clear, I want to drive a stepper motor that would be turning the cam follower (360 deg) so it always was trailing the direction of travel. and for this to be done internally on the fly or from a gcode script that would add the extra g code to do this, using the already created G code for the wire placement.

    This would also be helpful for a drag knife type tool...

    here is just a photo of some # 40 AWG wire with a gap, this is a bifilar coil...
    alt text

    Thanks for any input and help / feed back. positive criticism is welcome 😉

    god bless!

    ~Russ Gries

  • administrators

    Hi Russ, nice to hear from you again. I suggest you look at this post and maybe send a PM to its author, because he does the same thing (I think) on his concrete printer. AFAIR he uses an extra axis (U) to control the extruder rotation, and he processes the GCode from the slicer to add the U coordinates to the G1 commands.

    You need to use a very recent version of RRF for the extra axis support to work on a delta.

    HTH David

  • Hello David! Thanks for the response ( and the return email) i have know idea how you get anything done while also helping everyone!!! your a blessing.

    yeah its been a while, so much going on cant keep up with everything. one day at a time.

    Yes, that's basically what i want to do. That's a really cool concrete printer. now that's a big project...
    I have sent him some messages in different platforms, will see if he responds.

    I have spend a while now looking for something that will edit the G code based on what direction the printer is going.

    It seems i haven't been so lucky as to find anything to do what i want. I'm posing a video on the subject shortly and hope some fine folks who are smarter than me in that domain to help make a script or something that can spit out the proper G code according to the already generated G code. unfortunately i'm a mechanical electrical guy 🙂 not a software guy... hehe

    The goal would be to use any Gcode already generated to make the new Gcode for direction of G code for the 360 deg tool head.

    If you have any thought processes that would be helpful in this task please post them. anything you can think of that help guide how one would do this would be great.

    Again, Thanks for making this community what it is. its a big deal, and we all appreciate your professionalism and your dedication.

    Thanks! ~Russ

  • @Russ-Gries

    Loved your design and idea.

    If you combine it with a small laser and add layers you can weld crossing wires with the layer below with a pulse every crossing and create a metal 3d printer 😄

    That would create very a interesting "permeable" porous metal part that is very very very useful in aerospace technologies (thermal protection, scramjet/rocket fuel injectors, icing control, metal/metal composites, catalyst injectors, etc.).

  • Thanks, yeah there are a lot of possibility's for this. thanks for the feed back.

    so, after more searching I found that using the proper words help in searching "_"

    it seems what I'm looking for is a tool path gcode generator for a "tangential knife" this is the other version of the drag knife but the tangential knife id motorized to face the proper direction...

    here is a few things i found:
    new version :

    the first on there i have know idea how to use, the second is for inkscape

    not the best solution for what I'm trying to do but it might work for testing.

    in the end id rather have the a type of script that adds the G code according to the direction already in the G code.

    its a start...

    ill keep looking and trying to find some one who can help in this path of "tangential tool path" Gcode editor...

    unfortunately any already defined software / add on is not the best option...

    also mach3 also supports tangential knife...

    oh man i'm in over my head... i need a script to directly edit the gcode...

    any software guys / gals out there?


  • @dc42

    ok, after some work and looking, i have a good friend who is working on wright a script. ( Thanks Matt, "you so smart") 🙂

    so the next question is:

    I'm going to use a U axis to rotate the tool head in the correct position. ( 0-360 deg) this will allow for a lot of options for others to make knife and other tools to attach to the Duet. once complete i will do my best to make a video showing everything needed to make this happen for others to fallow.

    The questions are:

    1. can the moments be relative? or absolute? or can i pick some how in the config file one or the other?

    2. can I set the axis up to be rotational? ( Telling it a degree number instead of a position). I would do this in the G code. so that the printer would automatically know its a rotational position.

    3. Besides the "M584: Set drive mapping" what else do i need to add to the config file? homing files? anything else?

    Thank you for the help!

    ~Russ Gries

  • @russ-gries I dont know if this is the best way to do it, but assuming you are going to use a stepper motor you could maybe configure it as an extruder so it uses relative movement by default and if you set your steps/mm to 360°/(200stesp/rev motor) *16microstepping = 8.889 you would have an "Extruder"=Rotating Head that can be commanded to move 30° clockwise by sending G1 E30.
    You would have to align it somehow before turning that stepper and make that your initial angle.

    BTW I saw your video a while back, good work, I guess this is where all the cool kids hang.

  • @genghisnico13

    Good thinking there! its defiantly something to think about.
    One question though. if its set up as an Extruder. then how dose the firmware handle it.

    let me restate that question.

    from my understanding, if the extruder gets a command in relative movement ( E30) then over the entire moment the extruder moves that much right? so that the plastic is evenly extruded?

    so i'm not sure where that is handled. is it in the firmware or else where?

    so if the code looks like this for Printing:
    G1 X33.265 Y27.359 E1.37686
    G1 X32.331 Y28.899 E0.07487
    G1 X29.933 Y32.214 E0.17009

    Then everything is moving at the same time so to speak. while x and y are moving the extruder is moving that much and ending at the same time as the line of code.

    however, I would need to have the E ( rotational motor) move before the next moment. so that its allways going in the right direction.

    so, with this in mined, can it be done like this:

    then it would need to look like this for the rotational motor? :
    G1 X33.265 Y27.359
    G1 X32.331 Y28.899
    G1 X29.933 Y32.214

    am i thinking of this correctly?
    it will read each line and move there before going to the next line?

    Thanks for the feed back. Unfortunately I'm not that familiar with how things are read in the buffer... so some trial and error is needed, that or one who can answer the questions can help 🙂

    good stuff. will get there. 🙂

    ~Russ Gries

  • @russ-gries said in Requests for help: Gcode cam follower/ tangential knife control.:


    Correct, the movement of all the axis and extruders in the same command are coordinated.


    Yes, the firmware is designed to do this

    however, I would need to have the E ( rotational motor) move before the next moment. so that its always going in the right direction.

    well I suppose it depends, the ideal way would probably be to not use a slicer because as far as I know they don't support arc movements G2/3(they approximate with small lines), but with a small enough linear approximation to a curve the difference between doing it before or during will be very small probably insignificant.
    I'm not 100% sure, but if it doesn't work, the way you suggested below should work.

    G1 X33.265 Y27.359
    G1 X32.331 Y28.899
    G1 X29.933 Y32.214
    am i thinking of this correctly?

    Correct, for consecutive movements each line is executed after the previous movement is finished and the movements are coordinated only when they are in the same G command.

    BTW I am relatively new to this so I'm sure someone will correct me if I'm wrong.

  • Ok, Thanks for the feed back!

    After doing some work on this a second option for turrning the tool head is to use a servo....

    I could get a 360 deg servo. Then just move the servo accordingly.

    Ill have to think about this more.

    Somthing like this would work with the right controls...

    So a stepper might be best for eazy installation and uses...

    I'm going to use a geared stepper for this first version so the size is small. Wont be fast but it will be functional...

  • Progress.. a short video of it working! well just proof it can be done but a lot more to do in the G code script...

    I'm not so sure using the extruder output is going to work.
    due to how its controlled in the firmware. I have two choices from what i can see.

    1. try to hack some thing to let me move the extruder before the move but on the fly. ( no waiting)
    2. wait every time it has to move by placing it on the next line by its self... not a good option for fast coil making...

    The other option is to use the U axis and try to make absolute movements work...
    I wonder if I'm still going to have the same problem with that too...

    feed back please.

    Thanks for the help everyone! I can see us all cutting vinal, cloth, paper, cardboard, leather? ... and for me ... making coils!


  • 0_1538465686113_20181002_000750.jpg

    Progross ! Got the motor and gear system all ready for testing.

    Alot more to do.. but a little at a time...


    Had to re build the motor to make it 24V bipolar...

  • Short snippet of it working.

    Alot of slop in the original stepper motor gears. May need to change that out for somthing better. Or see if i can fix it at all.

    But its a start! Thats what prototypes are all about!


  • ok, I'm lost...

    I set up the U axis,

    I want to control it at the same time as XYZ ( delta) but it is doing all kinds of weird things.

    here is my config.g can you see anything i need to change?

    ; Configuration file for dc42 Kossel updated RWG 11-25-16

    ; Axis and motor configuration
    M569 P0 S1 ; Drive 0 goes forwards
    M569 P1 S1 ; Drive 1 goes forwards
    M569 P2 S1 ; Drive 2 goes forwards
    M569 P3 S1 ; Drive 3 goes backwards
    M569 P4 S0 ; Drive 4 goes backwards
    M574 X2 Y2 Z2 U2 S0 ; set endstop configuration (all endstops at high end, active high)0 = none, 1 = low end, 2 = high end.
    M584 U4 ; ********** map U drive to second extruder driver.

    M665 R166.636 L343.788 B155 H405 X 0°, Y 0° ; set delta radius, diagonal rod length, printable radius, homed height and XY tower corrections
    M666 X0.01 Y-0.45 Z0.44 Z0.00 U0 ; **********put your endstop adjustments here, or use auto calibration to find them
    M92 X80 Y80 Z80 U90 ; Set axis steps/mm (20 tooth pulleys, 1.8deg/step motors)
    M350 X64 Y64 Z64 U1 E16 I1 ; ( set E to 😎 Set 16x micro-stepping with interpolation
    M906 X1500 Y1500 Z1500 U200 E800 I50 ; Set motor currents (mA) and increase idle current to 60% Russ change from default 60 to 10
    M201 X1000 Y1000 Z1000 U3000 E1000 ; Accelerations (mm/s^2)
    M203 X30000 Y30000 Z30000 U3000 E30000 ; Maximum speeds (mm/min)
    M566 X1200 Y1200 Z1200 U3000 E1200 ; Maximum instant speed changes
    G21 ; Work in millimetres
    G90 ; Send absolute coordinates...
    M83 ; ...but relative extruder moves
    ;M557 R80 S18 ; ***moved to auto cal file!! define a grid with the specified radius and spacing (for delta printers)results are spored in file /sys/heightmap.csv

    M106 P0 I1 ; invert fan pwm

    ; Thermistors and heaters
    M305 P0 T100000 B3950 R4700 H0 L0 ; Typical Chinese bed thermistor. Put your own H and/or L values here to set the bed thermistor ADC correction.
    M305 P1 T100000 B4388 R4700 H0 L0 ; E3Dv6 hot end. Put your own H and/or L values here if necessary to set the first nozzle thermistor ADC correction.
    M301 H0 P20 I0.5 D1000 T0.85 W150 B5 ; PID settings for the bed
    M301 H1 P10 I0.10 D100 T0.50 ; PID settings for extruder 0
    M570 ; Allow extra heating time

    ; Tool definitions
    M563 P0 D0 H1 S"Extruder 1" ; Define tool 0
    ;M563 P1 D1 S"360 Drive" ; **********Define tool 1 ( use if tool is an extruder)
    G10 P0 S0 R0 ; Set tool 0 operating and standby temperatures
    ;M92 E90 ; ********** (Set extruder steps per mm 20 1024 ,this is 360 deg ) for first and second extruders ( use if tool is an extruder)

    ;Servo control
    M307 H6 A-1 C-1 D-1 ; Disable heater channel 6 for use with servo CNC spindle. use M280 P6 Sxx the S is the ms use 0-200, I1 to invert Sig, must use on every command
    M280 P6 S30 ; set the "throddle" to boot high, low, high. boots the esc
    M280 P6 S5
    M280 P6 S30

    ;M563 P1 D1 H2 ; Define tool 1
    ;M92 E663:663 ; Set extruder steps per mm

    ; Z probe and compensation definition
    M558 P1 X0 Y0 Z1 H5 F300 T10000 I1 ; Z probe is IR and is not used for homing any axes, Z probe dive height 3mm, probing speed 300mm/min, travel speed 10000mm/min , Invert (I1) or do not invert (I0)
    G31 X0 Y0 Z0 P500 ; Set the zprobe offset and threshold (put your own values here). For a delta, use zero X and Y offset.

    ;M556 S78 X0 Y0 Z0 ; Axis compensation here

    M207 S7.0 F3600 Z0.1 ; Set firmware retraction details
    M572 D0 S0.1 ; set pressure advance

    M208 X0 Y0 Z-30 U0 S1 ; ********** set minimum limments
    ;M208 X0 Y0 Z0 ; set max limments
    T0 ; select first print head

    M501 ; load Eprom settings

    I'm sure there are thing in there that are old, its not a clean file... i need it clean it up.

    If i dont home U, i can get it to work, but if i home it it dose not run at all... i have know idea why.

    here is my homeu.g

    G91 ; use relative positioning
    M220 S100 ; Set speed factor override percentage to 100% if its higher so the home dose not slam the top.
    G1 S1 U360 F3000 ; move axis 360 and look for and stop
    G1 S2 U20 ; move axis
    G1 S1 U-20 ; move axis to find home again
    G1 U10 F2000 ; move to X0 facing position ( change this number to set home where you want)
    G90 ; back to absolute positioning
    G1 U200 F500 ; center the head and set a reasonable feed rate

    any help is a huge plus!

    Thank you!


    ps. the first time i hit home U the entire printer makes high pitch noises from the motor? know idea what that's all about but it messes up the motors... egh!

  • administrators

    Which firmware version are you using? There was a bug with homing additional axes on a delta, that I fixed in one of the 2.02RC releases.

  • Thanks David,

    Im using 1.19 i believe. Need to double check in the morning.

    I can upgrade and see if that fixes it.

    A few other Q.

    1. In the mean time dose the config.g look good or did i miss somthing? Also the homeu.g

    2. Can i set up one axis as relative while the rest are absolute?

    3. If i send this command. G1 X50 Y50 U10 will the U complete before the X and Y or will they all finish at the same time?

    4. Can i set up axis U to allways move at the same apeed all the time? And use the F command to change it other wise?

    Such as using a G0 command to move it one speed and use G1 to move another? Thses will be fixed speeds for each? But only for the U axis?
    If i can set up G1 and G0 for set speeds on U where do i do that?

    Thank you thank you thank you!

    Im going crazy over here 😉

    But ill get there!


  • administrators

    1. Your M584 command that creates the U axis must come before the M574 command that refers to U. Also the M584 command should re-define the extruder drivers, otherwise driver 4 will be both an axis and an extruder.

    2. No.

    3. At the same time.

    4. No. The F parameter determines the speed of the move as a whole. If there is any XYZ movement, then it is the speed of the XYZ component of the move.

  • Having read all above (but quite quickly to be honest), were I to attempt this, I would lean heavily on the G-Code concept that a G1 move does internal calculations to ensure that all axis specified on that move arrive at the same point at the same time when the move ends.

    Also, A is normally the first rotational axis. Given RepRap flexibility, you could call it A or U... but I'm going to call it A below, as this is more normal CNC nomenclature.

    Assuming A is defined as a rotational axis:

    G1 Xnnn Ynnn Annn will smoothly rotate the A axis "in coordination with" the XY move. A series of these should do what you want.

    Homing on A should be setup mechanically so that A can continuously rotate, and that "home" is triggered for a fraction of a degree of that rotation.

    Relative vs. absolute? Doesn't really matter, when you realize an NIST standard rotational axis can be moved an infinite amount, limited only by the number of digits that the G-Code parser will accept.

    That is, as you wind a coil, A might move through 0, many tiny increments, past 360, and just keep going. Far along in a coil, moving from 394857.2 to 394857.24 is perfectly legitimate.

    Anyway, I'd build everything on those assumptions. You MAY already be doing that... but I wanted to make a pretty strong recommendation to NOT treat a rotational axis as an extruder, or anything else. Treat it as a rotational axis. G-Code standards will give you a big jump on what you are trying to accomplish.

  • DC42, does RepRap support rotational axis move coordination on G2?

    Russ, if it does, that would make the G-Code much simpler. You could have a single line of G-code that does each "circle" of the coil. If it does, I'll post some examples.

    By the way, for coil winding, you may wish to generate the G-Code with a simple script. PERL, Python, Java, etc.

  • administrators

    @danal said in Requests for help: Gcode cam follower/ tangential knife control.:

    DC42, does RepRap support rotational axis move coordination on G2?

    RRF does not currently distinguish between linear and rotational axes.

    G2 and G3 moves can specify movement along additional axes, which will be done linearly and coordinated with the XY motion.

