Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login
    1. Home
    2. CthulhuLabs
    3. Best
    • Profile
    • Following 0
    • Followers 1
    • Topics 30
    • Posts 125
    • Best 28
    • Controversial 0
    • Groups 0

    Best posts made by CthulhuLabs

    • Surfacing Macro

      I wrote a Macro for surfacing stock and figured I should share:

      ; Constants
      var Debug = false;
      var ProbeThickness = 15.5;
      var CoordSystem	= 20;
      var StepOver = 10;
      var DepthOfCut = 0.2;
      var FeedRate = 8000;
      var ZClearanceHeight = 25;
      
      ; Variables
      var StartX = 0;			; The X starting position
      var StartY = 0;			; The Y starting position
      var EndX = 0;			; The X ending position
      var EndY = 0;			; The Y ending position
      var YDir = 0;			; The direction to go in Y
      var YDist = 0;			; The distance to go in Y
      var YPos = 0;			; The position in Y to move to
      var YDistLeft = 0;		; How much we have left to move in Y
      var ZDepth = 0;			; How far down we should be in Z
      var XSorE = "End"		; Whether X should move towards the start or the end position
      
      ; If the printer hasn't been homed, home it
      if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
      	G28
      
      ; Adjust probe for low speed probing
      M558 K0 P8 C"!io3.in" H20 F120 T300					; Z probe number - Z probe switch type - probe recovery 1s probe speed and travel speed
      G31 K0 P500 X0 Y0 Z0								; Set trigger value - set offset and trigger height - Z probe number
      
      M291 P"Insert your surfacing bit into your spindle and position it above the probe plate" R"Probing" S3 X1 Y1 Z1
      
      ; Set bit above center of probe
      G91																			; relative positioning
      
      ; Probe Z component
      G38.2 Z{move.axes[2].userPosition - (var.ProbeThickness + 2.25)}			; seek until the probe circuit is closed Z-axis 25 mm
      G0 Z{var.ZClearanceHeight}													; rapid move Z axis 5 mm
      
      G10 P1 L{var.CoordSystem} Z{var.ProbeThickness + var.ZClearanceHeight}		; store relative probe offset for coordinates system 1
      
      G90																			; Absolute positioning
      
      M291 P"Move to the starting X Y position for surfacing" R"Start Position" S3 X1 Y1 Z0
      set var.StartX = move.axes[0].userPosition;
      set var.StartY = move.axes[1].userPosition;
      
      if var.Debug
      	M118 P0 S{"StartX = " ^ var.StartX} L2
      	M118 P0 S{"StartY = " ^ var.StartY} L2
      
      M291 P"Move to the ending X Y position for surfacing" R"End Position" S3 X1 Y1 Z0
      set var.EndX = move.axes[0].userPosition;
      set var.EndY = move.axes[1].userPosition;
      
      if var.Debug
      	M118 P0 S{"EndX = " ^ var.EndX} L2
      	M118 P0 S{"EndY = " ^ var.EndY} L2
      
      M291 P"Are you ready to begin surfacing?" S3 X0 Y0 Z0
      
      ; Figure out which direction in Y we are going
      if var.EndY < var.StartY
      	set var.YDir = -1;
      elif var.EndY > var.StartY
      	set var.YDir = 1;
      else
      	set var.YDir = 0;
      
      if var.Debug
      	M118 P0 S{"YDir = " ^ var.YDir} L2
      
      
      set var.YDist = {abs(var.StartY - var.EndY)};
      if var.Debug
      	M118 P0 S{"YDist = " ^ var.YDist} L2
      
      ; Begin surfacing loop
      while true
      	if var.Debug
      		M118 P0 S"Begin Layer Loop" L2;
      
      	set var.ZDepth = {var.ZDepth - var.DepthOfCut};
      	set var.YDistLeft = {var.YDist};
      
      	; go to the start X and Y position then down to Z Depth
      	if var.Debug
      		M118 P0 S{"Move to start X" ^ var.StartX ^ ",Y" ^ var.StartY} L2
      	G0 X{var.StartX} Y{var.StartY}
      	if var.Debug
      		M118 P0 S{"Move to start Z" ^ var.ZDepth} L2
      	G1 Z{var.ZDepth}
      
      	; we should be at the Start X position so move to the End X position
      	if var.Debug
      		M118 P0 S{"Move to X" ^ var.EndX} L2
      	G1 X{var.EndX} F{var.FeedRate}
      	set var.XSorE = "Start"
      
      	while var.YDistLeft > var.StepOver
      		if var.Debug
      			M118 P0 S"Begin Y Loop" L2
      
      		; move in Y by StepOver
      		set var.YPos = {move.axes[1].userPosition + (var.StepOver * var.YDir)}
      		if var.Debug
      			M118 P0 S{"Move to Y" ^ var.YPos} L2
      		G1 Y{var.YPos} F{var.FeedRate}
      		set var.YDistLeft = {var.YDistLeft - var.StepOver}
      
      		if var.XSorE == "Start"
      			; move X to the start position
      			if var.Debug
      				M118 P0 S{"Move to X" ^ var.StartX} L2
      			G1 X{var.StartX} F{var.FeedRate}
      			set var.XSorE = "End"
      		else
      			; move X to the end position
      			if var.Debug
      				M118 P0 S{"Move to X" ^ var.EndX} L2
      			G1 X{var.EndX} F{var.FeedRate}
      			set var.XSorE = "Start"
      
      	; move in Y the rest of the distance left
      	set var.YPos = {move.axes[1].userPosition + (var.YDistLeft * var.YDir)}
      	if var.Debug
      		M118 P0 S{"Move to Y" ^ var.YPos} L2
      	G1 Y{var.YPos} F{var.FeedRate}
      
      	; one last move in X
      	if var.XSorE == "Start"
      		; move X to the start position
      		if var.Debug
      			M118 P0 S{"Move to X" ^ var.StartX} L2
      		G1 X{var.StartX} F{var.FeedRate}
      		set var.XSorE = "End"
      	else
      		; move X to the end position
      		if var.Debug
      			M118 P0 S{"Move to X" ^ var.EndX} L2
      		G1 X{var.EndX} F{var.FeedRate}
      		set var.XSorE = "Start"
      
      	G0 Z{var.ZClearanceHeight}					; get out of the way
      	M400 										; wait for the movement buffer to catch up
      	M291 P"Surface another layer?" S3 X0 Y0 Z0	; then prompt the user if they want to do another layer
      
      

      It is working really well so far, but I cannot promise it is perfect. It is designed to be used with a Z Probe like this:

      https://openbuildspartstore.com/xyz-touch-probe-plus/

      Once the top surface of the piece is determined it will then have you jog to the X / Y start position and press Ok. Next it will have you jog to the X / Y end position and press Ok. Then it will ask you if you are ready. Press Ok and it will begin surfacing your part. Once it has made a pass it will prompt you if you want to surface another layer. If you say Ok it will move back to the X / Y start position and go down in Z by the DepthOfCut variable and continue surfacing. It will keep going till you cancel at the end of a pass.

      There are several constants you can set at the top:

      Debug - Determines if it should spit out the M118 debug output. (Will probably switch this over to echos to a file once 3.4 is finally released)
      ProbeThickness - How thick your XYZ probe is.
      CoordSystem - The coordinate system to save the top of your piece in as Z0
      StepOver - The step over in MM for each pass of your cutter
      DepthOfCut - The depth of cut that will be taken off with each pass
      FeedRate - The feed rate used when cutting
      ZClearanceHeight - How high to retract in Z when moving to the Start Point

      Would love your feedback.

      EDIT: So I forgot to mention that the Start and End points define two opposite corners of the rectangle to be surfaced.

      posted in CNC
      CthulhuLabsundefined
      CthulhuLabs
    • Split Firmware Version In ObjectModel

      Please add a way to get the Major, Minor, and Point info on a boards firmware version in the object model. I am in the process of updating my Surfacing Macro ( https://forum.duet3d.com/topic/26762/surfacing-macro ) to take advantage of 3.5.0's new M291 options for user input. I want to be able to check the firmware version to make sure the Macro will work properly and if not provide feedback to the user. The issue is that:

      echo {boards[0].firmwareVersion}   ; currently returns "3.4.5"
      

      returns the version number as a string like "3.4.5" (I have not update to the beta yet). Without basic string functions there is no way to split that apart and check if the version is equal to or greater than "3.5.0". If however there was:

      echo {boards[0].firmwareVersion}   ; returns "3.4.5"
      echo {boards[0].firmwareVersion.major}   ; returns "3"
      echo {boards[0].firmwareVersion.minor}   ; returns "4"
      echo {boards[0].firmwareVersion.point}   ; returns "5"
      

      I could then do something like:

      if boards[0].firmwareVersion.major == 3 && boards[0].firmwareVersion.minor >= 5
              ; Do all the things
              ...
      else
              M291 P"Sorry but your firmware version is not compatible with this Macro" R"Error" S2
      
      posted in Firmware wishlist
      CthulhuLabsundefined
      CthulhuLabs
    • DRO half function with a 1 line macro

      So I recently got an edge finder for my CNC and wanted to replicate the half function found on many DROs I have worked with in the past to easily find the center of a part. After scratching my head for a bit and playing around I realized it could be done with one Meta Gcode line in a Macro file. Here is the X version of it:

      ; Half X
      G10 L2 P1 X{move.axes[0].workplaceOffsets[0] + (move.axes[0].userPosition / 2) }
      

      To use this I touch off on one side of the part and set that as zero for that axis. Next I go to the other side of the part and touch off. Then I run the above macro. This sets the new work offset half way between the old zero and the current position.

      For completeness here is the Y version:

      ; Half Y
      G10 L2 P1 Y{move.axes[1].workplaceOffsets[0] + (move.axes[1].userPosition / 2) }
      

      I figured I would share as this has proved to be super useful.

      posted in CNC
      CthulhuLabsundefined
      CthulhuLabs
    • RE: CNC Tool Offsets Confusion

      Here is my finished Macro. Hopefully will be helpful for others. I am not entirely sure why certain things behave a certain way though. This Macro does allow me to reliably change tools and still position the base of the tool a the work piece zero position.

      ; If the printer hasn't been homed, home it
      if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
      	G28
      
      ; Clear the tool Z offset
      G10 P0 L1 Z0
      
      G53 G0 Z0											; Go to 0 Z in Machine Co-ordanates
      
      var ZBeginPos = move.axes[2].userPosition			; Save the Z starting position (might not be 0)
      
      G53 G0 X{global.BtStrXLoc} Y{global.BtStrYLoc}		; Move to BitSetter location
      G91													; relative positioning
      
      ; Adjust probe for high speed probing
      M558 K0 P8 C"!io3.in" H20 F600 T300					; Z probe number - Z probe switch type - probe recovery 1s probe speed and travel speed
      G31 K0 P500 X0 Y0 Z0								; Set trigger value - set offset and trigger height - Z probe number
      
      ; Seak down rapidly till we contact the probe
      G38.2 Z{move.axes[2].userPosition + global.BtStrZTrig}
      
      ; Move up 2mm
      G0 Z2
      
      ; Adjust probe for low speed probing
      M558 K0 P8 C"!io3.in" H20 F120 T300					; Z probe number - Z probe switch type - probe recovery 1s probe speed and travel speed
      G31 K0 P500 X0 Y0 Z0								; Set trigger value - set offset and trigger height - Z probe number
      
      ; Seak down slowly till we contact the probe
      G38.2 Z{move.axes[2].userPosition - 3}
      
      var ZEndPos = move.axes[2].userPosition				; Save the Z end position
      
      ; set the tool offset
      G10 P0 L1 Z{global.BtStrZTrig - (var.ZEndPos - var.ZBeginPos)}
      
      G0 Z5												; rapid move Z axis up 5mm
      
      posted in CNC
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Opinions on "FYSETC" ... politely, please.

      @breed said in Opinions on "FYSETC" ... politely, please.:

      I wish sometimes that duet made a board with stepsticks even if it had limited driver support, as I'd rather support duet than a Chinese company.

      I am curious why you need this functionality. When I first got into 3D printing I was using a RAMPS 1.4 board and then went to a RADDS board. I burned out 8x DRV8825 over the course of a year and a half of use. I thought that having built in drivers was a bad idea because everyone seemed to blow them. After a ton of research though I learned that most of the time the blow because of excessive heat or mistakes that can be avoided with improved circuit design. I eventually moved to a Duet 2 Wifi board. Since then I have not burned a single stepper driver even doing the same dumb mistakes as I did in the past. I did have one stepper driver die on my Duet 2 Wifi, but that was on a brand new board and Filastruder immediately RMAed the board once it was confirmed to be a bad board. The Duet boards properly sink the heat away from the stepper driver chips and have all of the necessary protection circuits on them to prevent dumb mistakes. Sure there are still ways to burn one out, but it takes serious effort.

      posted in General Discussion
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Pre crimped cables

      @markuskruse I completely agree with you. Crimping Cables is the biggest pain in the ass. The reason though is because you literally need three hands. It wasn't till I learned this that I was able to do it.

      Get a set of these:

      https://www.amazon.com/ProsKit-900-015-Helping-Hands-Soldering/dp/B002PIA6Z4

      or you can just do what I do and use an alligator clip.

      Here are the steps I use with pictures.

      You will need a set of helping hands or an alligator clip, wire strippers, needle nose pliers, and a crimping tool.

      Position the alligator clip or helping hand vertically:
      0_1560913137433_Crimping-02.jpg

      Put the connector in the alligator clip with the flaps facing up like this:
      0_1560913200590_Crimping-03.jpg

      Strip 2mm from the end of the wire:
      0_1560913215689_Crimping-04.jpg

      Put the wire in the connector so the sheathing is in the first two flaps and the bare wire is in the second two:
      0_1560913229356_Crimping-05.jpg

      Take a pair of needle nose pliers and squeeze the first two flaps so that they are gripping the sheathing, but are not fully closed. You want them to hold the connector to the wire while you put it in your crimping tool:
      0_1560913234832_Crimping-06.jpg

      It should look like this:
      0_1560913243026_Crimping-07.jpg

      Put the connector in your crimping tool so that the flaps are facing into grove and are 90 degrees to the jaws like this:
      0_1560913246336_Crimping-08.jpg

      Squeeze your crimping tool as tight as it will go:
      0_1560913256128_Crimping-09.jpg

      If done correctly it should look like this:
      0_1560913263932_Crimping-10.jpg

      I had to use this method a few dozen times before I got it down. Also I would say I am successful only about 90% of the time with this method. Do not get discouraged.

      posted in Duet Hardware and wiring
      CthulhuLabsundefined
      CthulhuLabs
    • Add Numeric Keypad To M291 Gcode

      It would be very handy for Macros if there was a way to prompt the operator to enter a number and store it in a variable. For instance I am writing a Macro to flatten a piece of stock on my CNC. It would be handy to be able to specify some parameters like the stepover, depth and RPM to use when launching the Macro. Right now I have to hard code them into the Macro and change them if I change tools / materials. The M291 Gcode seems like the obvious choice for this addition to me.

      posted in Firmware wishlist
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Surfacing Macro

      So I am working on a new version of this Macro that will prompt for user input with the M291 command. It will make the Macro far more interactive for things like DepthOfCut, RPM, FeedRate, etc. One of the prompts I want to add is to ask if it should work in Pass mode or Depth mode.

      In pass mode it will prompt you for the number of passes to take. It will then do that many passes before prompting you whether to surface another layer. Default will obviously be 1.

      In Depth mode it will prompt you for how much material to remove. So if your DepthOfCut is say 0.3mm and you enter a depth of 1mm the Macro will do three passes at 0.3mm and then a fourth pass at 0.1mm for a total of 1mm.

      posted in CNC
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Http Post from Macro

      @jay_s_uk Doh! I'm sorry I missed the last word of your post.

      posted in Firmware wishlist
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Surfacing Macro

      @jay_s_uk you just adjust the step over. So if you were using a 1/4in end mill you'd set the step over to like 2mm. I'm using a 1" surfacing bit so I set it to 10mm. Seems to leave a nice finish.

      posted in CNC
      CthulhuLabsundefined
      CthulhuLabs
    • Bad Link

      This seemed like the most fitting place to report this, but feel free to move this post where ever. I was looking at the new 1HCL board here:

      https://www.duet3d.com/Duet3Expansion1HCL

      On the page there is a link to the "Documentation." That link points to:

      https://docs.duet3d.com/Duet3D_hardware/Duet_3_family/Duet_3_Toolboard_1HCL

      which takes you to a Not Found page. It should point here:

      https://docs.duet3d.com/Duet3D_hardware/Duet_3_family/Duet_3_Expansion_1HCL

      posted in Purchasing
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Zeroing Macro For Carbide3D BitZero

      I was an idiot. The spindle was moving. Just doing so slowly I did not see it. All the same I ran into a bunch of issues with the G38.2 command and ended up redoing my code based off someone else's macro. Here it is:

      var ProbeThickness = 13;
      var ProbeXWidth = 58;
      var ProbeYWidth = 58;
      var CoordSystem	= 20;
      
      ; If the printer hasn't been homed, home it
      if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
      	G28
      
      M291 P"Insert a Dowel Pin into your spindle and center it in the probes hole" R"Probing" S3 X1 Y1 Z1
      
      ; Find center of cavity
      M675 X R2 F300 K0							; Find center in X axis
      M675 Y R2 F300 K0							; Find center in Y axis
      
      G10 P1 L{var.CoordSystem} X0 Y0						; Store X and Y as zero in CoordSystem
       
      ; Set bit above center of probe
      G91									; relative positioning
      G0 Z{var.ProbeThickness + 2}						; rapid move Z axis over the surface of the probe
      G0 X{var.ProbeXWidth / 2} Y{var.ProbeYWidth / 2}			; rapid move X and Y axis to middle of probe
       
      ; Probe Z component
      G38.2 Z{move.axes[2].userPosition - (var.ProbeThickness + 2.25)}	; seek until the probe circuit is closed Z-axis 25 mm
      G0 Z5									; rapid move Z axis 5 mm
      
      G10 P1 L{var.CoordSystem} Z{var.ProbeThickness + 5}			; store relative probe offset for coordinates system 1
      G0 X{(var.ProbeXWidth / 2) * -1} Y{(var.ProbeYWidth / 2) -1}		; go back over the hole
      
      G90									; Absolute positioning
      
      posted in Gcode meta commands
      CthulhuLabsundefined
      CthulhuLabs
    • Define Custom Macros For M3/M4/M5 In The M950 Mcode

      I would like to request that an option be added to the M950 command that would allow custom macros to be executed for the M3/M4/M5 commands when that specific tool is used instead of setting a PWM value on a GPIO pin. This would allow for complex actions to be taken when a Spindle's RPM (or Lasers power) is changed.

      For instance I have a Dewalt Brushless Trim Router where the stock ESC has been replaced by an ODrive. While the ODrive is configured to use an ADC to read the voltage from an RC Circuit. It would be far better if I could use execonmcode to run a script that directly tells the ODrive what speed to set the router to. This would be safer and more precise. If I could execute a Macro on M3/M4/M5 commands this would all be possible. It would allow for some error handling as well.

      Another use case for this would be someone who's Spindle does not have an ADC and requires it's dial to be manually adjusted. A servo could be attached to the dial and be controlled by the M3/M4/M5 macros.

      What I purpose is adding a Z argument to the M950 command. It would take three macro names as arguments like so:

      M950 R0 Z"tool0M3.g+tool0M4.g+tool0M5.g"
      
      posted in Firmware wishlist
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Control VESC Spindle Over CAN Bus

      Sounds like it would be easier to use the UART control:

      http://vedder.se/2015/10/communicating-with-the-vesc-using-uart/

      posted in CNC
      CthulhuLabsundefined
      CthulhuLabs
    • Bed Level with end stops and probe

      So I recently purchased a Sainsmart Coreception CoreXY 3D printer to replace my CR10. It is a very capable machine. I am in the process of converting it to use my Duet Wifi board running RRF3. I have all the base functionality of the printer working properly on the Duet. Now comes the fun part of adding one of the IR Probes and switching out the extruder for my Hemera.

      The problem I am currently running into with this is how to handle Z homing / leveling on this printer. One of the few things I do not like about it is that during print removal it is very easy for one side of the heated bed to lower down more than the other by almost an inch. I have wired the two stepper motors to two different stepper drivers and have the independent homing working with the two end switches, which mostly solves this issue but the bed is never back to being level when done.

      What I want to do is have Z home first with the end stops to fix the large difference in height from side to side. Then I want to use the IR Probe to fine adjust the heights from side to side. Then I want to use mesh bed compensation to deal with any front to back problems. I am just not sure how to set this up.

      posted in General Discussion
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Feasibility of running DSF on X86

      @chrishamm Looks like people are claiming the latency is 1ms:

      https://forums.adafruit.com/viewtopic.php?f=19&t=93211

      There is also a latency timer built into the chip that FTDI's techs say can be set as low as 1ms. Not internally sure what that does.

      I'll order one and play around with it to see what kind of results I can get.

      posted in DSF Development
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Stop Macro Arguments

      Woohoo! After playing around with a bunch of settings I was able to get the CAM software to export with M6 commands so all I need to do is implement my own /sys/M6.g macro. No post processing needed.

      posted in Gcode meta commands
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Duet 3 6HC with Openbuilds XYZ Probe

      @dc42 Thanks! I am really loving the flexibility that the object model and meta commands allow for.

      @Yveske here is my final version:

      var ProbeThickness = 13;
      var ProbeXWidth = 58;
      var ProbeYWidth = 58;
      var CoordSystem	= 20;
      
      ; If the printer hasn't been homed, home it
      if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
      	G28
      
      M291 P"Insert a Dowel Pin into your spindle and center it in the probes hole" R"Probing" S3 X1 Y1 Z1
      
      ; Find center of cavity
      M675 X R2 F300 K0							; Find center in X axis
      M675 Y R2 F300 K0							; Find center in Y axis
      
      G10 P1 L{var.CoordSystem} X0 Y0						; Store X and Y as zero in CoordSystem
       
      ; Set bit above center of probe
      G91									; relative positioning
      G0 Z{var.ProbeThickness + 2}						; rapid move Z axis over the surface of the probe
      G0 X{var.ProbeXWidth / 2} Y{var.ProbeYWidth / 2}			; rapid move X and Y axis to middle of probe
       
      ; Probe Z component
      G38.2 Z{move.axes[2].userPosition - (var.ProbeThickness + 2.25)}	; seek until the probe circuit is closed Z-axis 25 mm
      G0 Z5									; rapid move Z axis 5 mm
      
      G10 P1 L{var.CoordSystem} Z{var.ProbeThickness + 5}			; store relative probe offset for coordinates system 1
      G0 X{(var.ProbeXWidth / 2) * -1} Y{(var.ProbeYWidth / 2) * -1}		; go back over the hole
      
      G90									; Absolute positioning
      
      posted in CNC
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Opinions on "FYSETC" ... politely, please.

      @breed

      In other words you need support for external stepper drivers and not necessarily stepsticks. That is exactly what the MB6XD @chrishamm mentioned is designed for. Stepsticks are frankly a horrible design that became standard in 3D printers because they were cheap not because they were good.

      posted in General Discussion
      CthulhuLabsundefined
      CthulhuLabs
    • RE: Getting actual spindle speed from "M3 R1" Mcode

      That did it. @chrishamm @dc42 thank you for your help.

      posted in DSF Development
      CthulhuLabsundefined
      CthulhuLabs