Centering a print
-
I have been printing some parts that are almost the full width of the bed. The right skirt is about 1mm from the right edge of the steel sheet, while the left skirt is about 7mm from the left edge. So I'd like my slicer to place the part as close to the actual center as possible (giving me a 4mm space either side). Where would l look to find this X value?
FYI, the X and Y are each set by means of a microswitch, the X microswitch being on the extruder assembly. The X stop on the right end of the carriage is just a print but it also guides the articulated cable track when the extruder is on the right side of the printer.
SYSTEM INFORMATION
Troodon V1 400 x 400 x 500
CoreXY style printer
Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet
Firmware electronics: Duet WiFi 1.02 or later + DueX5
Firmware version: 2.03RC3 (2019-05-25b5)
Web interface version: 1.22.6Using PRUSA Slicer 2.8.0
This is my start G-code (in case this is where I would make the edit):
M104 S160 ; ADDED BY DF ON 5 AUG 2022 TO KEEP NOZZLE TEMP NO HIGHER THAN 160 DEG. THIS PREVENTS FILAMENT EXTRUSION DURING MESH BED LEVELING.
M42 P25 S0
M42 P26 S0
M42 P24 S255
M280 P7 S160
T0
M572 D0 S0.05
G92 E0
G1 E-0.3 F1800
G32
G29
G1 X0 Y0 F4800
G92 E0
G1 E0.3 F540
G92 E0
G1 Z50 F1800 ; ADDED BY DF 7 AUG 2022 TO RAISE EXTRUDER TO PROVIDE MORE SPACE TO CLEAN THE NOZZLE AS IT HEATS
M109 S[first_layer_temperature] ; ADDED BY DF 5 AUG 2022 TO SET NOZZLE TEMP TO FIRST LAYER TEMP & WAIT TILL REACHED
G1 E-0.30000 F1800
G1 Z0.200 F200 ; EDITED BY DF 7 AUG 2022 TO LOWER THE NOZZLE SLOWLY GIVING A LITTLE MORE TIME TO REMOVE ANY EXCESS FILAMENT (WAS F1000)
G1 X200 Y0 E43.5631 F1000
G1 E-0.30000 F5400
; G1 X205 Y200 F18000 (COMMENTED OUT BY DF 5 AUG 2022 TO PREVENT THE DOT ON THE BED)
; G1 E0.30000 F5400 (COMMENTED OUT BY DF 5 AUG 2022 TO PREVENT THE DOT ON THE BED)Cheers,
Derek
-
@Derek-F start by reading https://docs.duet3d.com/en/User_manual/Tuning/Bed_origin
-
@dc42 Excellent! thanks for the reference rather than just saying do this. I love learning the details, empowering me to be even more creative.
So I have found M208 in my web console under config.g. These are the current settings:
M208 X5 Y0 Z0 S1 ; set axis minima to end of safe travel.
M208 X410 Y408 Z510 S0 ; set axis maxima to match endstop location.Now my extruder homes at the back right corner (for X & Y of course). However, my slicer shows X0 and Y0 to be at the front left corner.
I believe that I can leave the S0 values as stated (I know the current envelope fits, even though it's slightly off center)
So to move the print 3mm to the left, I would change X5 to X2 in the S1 line?
FYI, these instructions are not preceded by G1 S1. However, the below line does precede the M208 line:
M667 S1 ; select CoreXY modeJust wanted to check before making the change since an error in this case could be catastrophic.
Cheers,
Derek
-
@Derek-F I don't think you've grasped what @dc42 was trying to tell you. Start by jogging the print head in the X minus direction until it either reaches the edge of the build plate or the minimum gantry travel if the cannot reach the edge. Then send G92 X0. This will "tell" the firmware that this is X=0. Then move the gantry as far as possible in the X plus direction, either until it reaches the edge of the build plate or maximum gantry travel if it cannot reach the edge. Note the displayed X position. This is your allowable axis travel. Now divide that number by two. E.g. if it was 402 mm, you'd have 201. Then ln M208 set X min to be minus 201 and X max to be plus 201. Repeat for the Y axis. You've now set the origin to be the exact centre of the bed. Set your slicer to also have the origin as the centre. Now anything you print will always be exactly centred on the bed.
-
@deckingman Thankyou.
Cheers, Derek -
@Derek-F You're welcome. I probably should have emphasised that you must set the bed dimensions in your slicer to match the axis travel. That is to say, in the example I gave, the X width would be 402 mm.
-
@deckingman That makes sense. Thanks again.
Cheers, Derek -
@Derek-F Now I really am confused.
Firstly, to clarify, I was only adjusting the X values in my quest to properly center the print.
I began by jogging the print head to the left using the printer's screen. It would not go less than the X figure se in M208 S1. Reluctant to physically push the extruder closer to the left side, I changed the X5 to X0 in M208 S1 and was able to jog the nozzle to within about 1 - 2 mm of the left edge of the sheet. I invoked the console on the printer and sent G92 X0. However, I suspect that this changed nothing as it was already where it thought X0 was.
Anyway, next step was to measure the X travel. I jogged the extruder to the right until it reached the edge of the bed (<1mm away, I judged). This was 404. So I edited M208 S0 from X410 to X405 (I know, 1 mm too much). It would not jog any further anyway.
Finally I edited the X bed size in Prusa slicer to 404 (it was 410). I can confirm that this was accepted since the slicer reported a new center of 202 (formerly 205)
Two issues then manifest:
-
Mesh bed leveling probed approximately 15 mm from the left edge and almost exactly on the right edge.
-
I printed a wide test print and the skirt extruded about 2mm off the right edge of the bed and about 9mm in from the left edge. FYI, the skirt on the bed in the slicer was exactly central, I guess about 1 - 2 mm inside the edges.
So, where do I go from here?
Cheers,
Derek
-
-
@Derek-F The bit that's missing is that you haven't said what you set the Xmin and Xmax in M208 to. Also, when you make changes to config g you need to load those changes, either by sending M98 P" config.g" or by cycling the power to the board. Another thing you could try is, cycle the power to the printer but do nothing else. At this point the printer won't be "homed" and the motors will be free to move with no holding current. Then physically move the print head by hand SLOWLY to the left hand edge of the bed and note this X position. This will get around any limits set by M208. Then move the print head SLOWLY to the right hand edge of the bed. Note this position. Take the first reading away from the second, divide the answer by two and set your min and max values using M208. Do this by editing config g. Now cycle the power again to apply those changes. Then home the printer. As a further check, move the print head to X=0 and physically measure the distance from the nozzle to the left and right edges to make sure they are equal.
-
@deckingman Firstly, thanks for the tip on how to move the print head. I'll try that.
I would also like to keep the current regime of providing the left, front corner if possible. My understanding is that it is currently set that way and, I presume, should be possible to maintain this scheme (albeit with updated numbers).Also, to clarify (in case it changes anything you suggested).
These are my current M208 lines (copied from my config.g file in the web console).
M208 X0 Y0 Z0 S1
M208 X405 Y408 Z510 S0I have only edited the X values in each line. As supplied, they were X5 and X410.
Whenever I make a change to the code in the web console, I then vote to
a) Save changes (Green ticked box on bottom right)
b) Reboot the printer (it asks)I always check that the change was written by returning to the code.
I have just powered up, moved the print head to the left edge and sent M92 X0 on the printer. I then sent M500 to save the setting. However, after a power cycle and homing operation, the print head will not go to the left edge. I judge it's about 8mm to the right of the left edge. The screen is reporting X=0.
Also, when homed, the screen reports that the print head is at 205, not 202.5 as one would expect from the X values in M208 ie: ((405-0)/2).
Two observations:
- I see that the microswitch for establishing the X axis is about 5 mm to the right of the right side of the bed. Could this be hindering my attempt to center the print?
- Is it possible that other (later) code is overwriting the G92 command I sent?
This is my bed.g code:
; bed.g
M561 ; clear any bed transform
;M564 S0 H0
;G1 Z10 F6000
;G1 X10 F6000 S0
;G1 Y360 F6000 S0
G28
G90 ; absolute positioning
; --- probe the bed at 4 points ---
G30 P0 X10 Y15 H0 Z-99999
G30 P1 X10 Y393 H0 Z-99999
G30 P2 X390 Y393 H0 Z-99999
G30 P3 X390 Y15 H0 Z-99999 S4G1 X205 Y200 F6000 ; Move to center of bed (adujst according to your bed position)
G30 Z-99999 ; Single Z-probe at center of bed
G1 Z10 ; Set Z to 10mmM561 ; clear any bed transform
This is my config-override.g code:
; config-override.g file generated in response to M500
; This is a system-generated file - do not edit
; Heater model parameters
M307 H0 A90.0 C700.0 D10.0 S1.00 V0.0 B1
M307 H1 A517.3 C213.3 D11.1 S1.00 V24.0 B0
M307 H2 A340.0 C140.0 D5.5 S1.00 V0.0 B0
M307 H4 A340.0 C140.0 D5.5 S1.00 V0.0 B0
M307 H5 A340.0 C140.0 D5.5 S1.00 V0.0 B0
M307 H6 A340.0 C140.0 D5.5 S1.00 V0.0 B0
; Z probe parameters
G31 T1 P50 X0.0 Y21.0 Z1.32
G10 L2 P1 X0.00 Y0.00 Z0.00
G10 L2 P2 X0.00 Y0.00 Z0.00
G10 L2 P3 X0.00 Y0.00 Z0.00
G10 L2 P4 X0.00 Y0.00 Z0.00
G10 L2 P5 X0.00 Y0.00 Z0.00
G10 L2 P6 X0.00 Y0.00 Z0.00
G10 L2 P7 X0.00 Y0.00 Z0.00
G10 L2 P8 X0.00 Y0.00 Z0.00
G10 L2 P9 X0.00 Y0.00 Z0.00This is config.g code:
; Configuration file for Duet WiFi (firmware version 1.20 or newer)
; executed by the firmware on start-up; --- general preferences ---
M111 S0 ; debugging off
G21 ; work in millimetres
G90 ; send absolute coordinates
M83 ; relative extruder moves
M555 P2 ; set firmware compatibility to look like MarlinM667 S1 ; select CoreXY mode
M208 X0 Y0 Z0 S1 ; set axis minima to end of safe travel. X5 was as supplied. Edited by DF 21 July 2024
M208 X405 Y408 Z510 S0 ; set axis maxima to match endstop location. X410 was as supplied. Edited by DF 22 July 2024; ---filament sensing---
M591 D0 P1 C3 S1; Automatic power saving
M911 S23 R24 P"M913 X0 Y0 G91 M83 G1 E-3 F1000" ; Set voltage thresholds and actions to run on power loss; --- endstops ---
M574 X2 Y2 S1; Z-Probe
M574 Z1 S0 ; Set endstops controlled by probe
M307 H7 A-1 C-1 D-1 ; Disable heater on PWM channel for BLTouch
M558 P5 X0 Y0 Z1 H5 F300 T20000 ; Set Z probe type to bltouch and the dive height + speeds. DF edit July 2024 - reduced height from H10 to H5, increased speed from T6000 to T20000
G31 P50 X0 Y21 Z3.0 ; Set Z probe trigger value, offset and trigger height
M557 X10:410 Y21:400 S49 ; Define mesh grid; --- z-axis stepper leveling configuration ---
M584 X0 Y1 E3 Z6:5:8:7 ; four motors, at 5, 6, 7, and 8
;M671 X420:420:-100:-100 Y380:-115:-115:380 S20 ; Z belts at 4 corners
M671 X-100:-100:420:420 Y380:-115:-115:380 S20 ; Z belts at 4 corners; --- drive map ---
; _______
; | 6 | 7 |
; | ----- |
; | 5 | 8 |
; -------
; front; Network
M550 P"VIVEDINO" ; Set machine name
M552 S1
M587 S"REDACTED !!!M586 P0 S1 ; Enable HTTP
M586 P1 S0 ; Disable FTP
M586 P2 S0 ; Disable Telnet
M575 P1 B115200 S1
; --- drives ---
M569 P0 S1 ; X
M569 P1 S1 ; Y
;M569 P2 S0 ; Z
M569 P3 S1 ; E0
;M569 P4 S1 ; E1
; -- duex --
M569 P5 S1 ; Z5
M569 P6 S0 ; Z6
M569 P7 S1 ; Z7
M569 P8 S0 ; Z8M569 P2 R-1
M569 P4 R-1
M569 P9 R-1M350 X16 Y16 Z16 E16 I1 ; microstepping with interpolation (I1)
M92 X80 Y80 Z400 E727 ; steps per mm - with bt
M566 X2000 Y2000 Z602.65 E250 ; maximum instantaneous speed changes (mm/min) (jerk)
M203 X20000 Y20000 Z1500 E3200 ; maximum speeds (mm/min)
M201 X1500 Y1500 Z500 E3200 ; accelerations
M906 X1200 Y1200 Z1200 E420 I60 ; motor currents (mA) and motor idle factor in per centM84 S60 ; set idle timeout
; --- firmware retraction ---
M207 S2.5 R0 F6500 T4500 Z0 ; [ Snnn positive length to retract, in mm ]
; [ Rnnn positive or negative additional length to un-retract, in mm ]
; [ Fnnn retraction feedrate, in mm/min ]
; [ Tnnn feedrate for un-retraction if different from retraction, mm/min ]
; [ Znnn additional zlift/hop ]; --- heaters ---
M305 P0 T100000 B4138 C0 R4700 ; set thermistor + ADC parameters for heater 0
M307 H3 A-1 C-1 D-1 ; set PID tuned settings for heater 0
M143 H0 S125 ; set temperature limit for heater 0 to 120C
M305 P1 T100000 B4138 C0 R4700 ; set thermistor + ADC parameters for heater 1
M307 H1 A517.3 C213.3 D11.1 V24 B0 ; set PID tuned settings for heater 1
M143 H1 S280 ; set temperature limit for heater 1 to 280C; --- tools ---
M563 P0 D0 H1 ; define tool 0
G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets
G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C; --- fans ---
M106 P0 S0 I0 F500 H-1 ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned off
M106 P1 S1 I0 F500 H1 T50 ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned on
M106 P2 S0.3 I0 F500 H1 T50 ; Set fan 2 value, PWM signal inversion and frequency. Thermostatic control is turned onM572 D0 S.15
;M572 D0 S.4 ; Linear Advance
;M592 D0 A0.01 B0.0005 ;nonlinear extrusion; --- Set or report heating process parameters---
M106 P3 I-1
M106 P4 I-1
M106 P5 I-1
M106 P6 I-1
M106 P7 I-1
M106 P8 I-1; --- RGB leds - White ---
;M106 P3 S255 ; V+
M42 P24 S255 ; R-
M42 P25 S255 ; G-
M42 P26 S255 ; B-
M42 P28 S195 ;M501
M500
M851Hopefully the above will provide enough information to establish what is happening.
Cheers,
Derek
-
@Derek-F can you also post your homex, homey, homez and homeall files?
-
@jay_s_uk Certainly. And see some additional comments at the end:
; homeall.g
; called to home all axes
;
; generated by RepRapFirmware Configuration Tool v2 on Wed Apr 24 2019 22:25:27 GMT+0800 (中国标准时间)
G91 ; relative positioning
G1 Z5 F6000 S2 ; lift Z relative to current position
G1 S1 X410 Y408 F1800 ; move quickly to X or Y endstop and stop there (first pass)
G1 S1 X410 ; home X axis
G1 S1 Y408 ; home Y axis
G1 X400 Y400 F6000 ; go back a few mm
G1 S1 X410 F360 ; move slowly to X axis endstop once more (second pass)
G1 S1 Y408 ; then move slowly to Y axis endstop
G90 ; absolute positioning
G1 X205 Y200 F6000 ; go to first bed probe point and home Z
M98 Pdeployprobe.g ; deploy mechanical Z probe
G30 ; home Z by probing the bed; Uncomment the following lines to lift Z after probing
;G91 ; relative positioning
;G1 S2 Z5 F100 ; lift Z relative to current position
;G90 ; absolute positioningM98 Pretractprobe.g ; retract mechanical Z probe
; homex.g
; called to home the X axis
;
; generated by RepRapFirmware Configuration Tool v2 on Wed Apr 24 2019 22:25:28 GMT+0800 (中国标准时间)
G91 ; relative positioning
G1 Z5 F6000 S2 ; lift Z relative to current position
G1 S1 X410 F1800 ; move quickly to X axis endstop and stop there (first pass)
G1 X400 F6000 ; go back a few mm
G1 S1 X410 F360 ; move slowly to X axis endstop once more (second pass)
G1 Z-5 F6000 S2 ; lower Z again
G90 ; absolute positioning; homey.g
; called to home the Y axis
;
; generated by RepRapFirmware Configuration Tool v2 on Wed Apr 24 2019 22:25:28 GMT+0800 (中国标准时间)
G91 ; relative positioning
G1 Z5 F6000 S2 ; lift Z relative to current position
G1 S1 Y408 F1800 ; move quickly to Y axis endstop and stop there (first pass)
G1 Y400 F6000 ; go back a few mm
G1 S1 Y408 F360 ; move slowly to Y axis endstop once more (second pass)
G1 Z-5 F6000 S2 ; lower Z again
G90 ; absolute positioning; homez.g
; called to home the Z axis
;
; generated by RepRapFirmware Configuration Tool v2 on Wed Apr 24 2019 22:25:28 GMT+0800 (中国标准时间)
G91 ; relative positioning
G1 Z5 F6000 S2 ; lift Z relative to current position
G90 ; absolute positioning
G1 X200 Y200 F6000 ; go to first probe point
G30 ; home Z by probing the bed; Uncomment the following lines to lift Z after probing
;G91 ; relative positioning
;G1 S2 Z5 F100 ; lift Z relative to current position
;G90 ; absolute positioning
Further comments.
After reading the Duet3D documentation regarding the use of M574, I see that, as supplied, the code disobeys at least two M574 stipulations. ie:
-
Use a separate M574 command for each axis.
The code combines X and Y: M574 X2 Y2 S1 -
This command must be later in config.g than the M584 command that creates additional axes, or axes that have multiple motors and endstops.
M574 is several lines earlier than M584. For ref: M584 X0 Y1 E3 Z6:5:8:7 ; four motors, at 5, 6, 7, and 8
Cheers,
Derek
-
-
@Derek-F your M574 is fine as you're running such an ancient firmware!
You may want to consider starting a fresh with this and upgrading to 3.5.2
Oh and you shouldn't have an M587 in your config as it'll just wear out the flash on the ESP (wifi module) -
@jay_s_uk Thanks for the warning about writing M587 in config.g. I see a macro is recommended. I'm guessing that I could add one to the Troodon but I have no clue how to, nor when it should be invoked (once, every power up?).
Regarding upgrading to 3.5.2. Honestly, that scares me. I'm a mechanical engineer, dabbling in code through necessity. It has taken me 3-1/2 years (off and on) to get my first useable large print out of this Troodon. I have finally got there in slicer settings and a few mechanical mods.
If I upgrade, what kind of task do I have in front of me to get printing again? I think it might be unreasonable to expect the kind of handholding that I might need.
Even if I do upgrade (and I do realise it would be a smart move), I would still like to resolve this issue of centering the print on my current system. In doing this, I'll lean more about gcode, configuration and the way my printer works. I also have several projects waiting that need this size of printer.
Cheers,
Derek
-
@Derek-F said in Centering a print:
................... I then sent M500 to save the setting.
Ahhh - that could be what's screwing things up for you. When you save settings this way, it writes the values to another file called "config-override.g" which does exactly what the name suggests. That is to say, it overwrites any G or M codes that may be in config.g. When power is applied, the contents of config.g are read and applied, then if your config.g contains an M501 command (which it does) it will read and act upon any commands which are contained in config-override.g. So if you have anything in config-override.g which relates to axis dimensions, offsets, or position, these commands will supersede (overwrite) the previous values which were read from config.g. Which effectively means that editing values in config.g will have no effect (because they are being overridden by commands in config.override.g).
This is why personally, I never use M500, M501 and have no config-override.g file and instead only use config.g. In my opinion, having configuration values stored in two different locations simply leads to confusion and mayhem. You can either do as I do and stop using config-override.g and only use config.g, or make sure that if you make any changes, make then in config-override.g instead of config.g (but sooner or later, you'll forget and it will come back and bite you in the arse).
-
@deckingman Hmm, sounds a bit like CREO Parametric that has three possible locations for config.pro, each overwriting the previous commands.
I'd love to consolidate so allow me to define what I believe my steps would be:
- Copy the entire contents of config-override.g to the location of M501 in config.g
- Comment/delete M501 in config.g
- Comment out all of config-override.g (so recovery is possible) and add a first comment explaining what I have done and when.
Questions/comments:
- Do I keep the M500 as the penultimate command in config.g?
- Does the SD card contain any code that is automatically read at bootup?
- I don't currently see anything in config-override.g that might conflict with the settings I am working on. Have I missed something?
(config-override.g and config.g are included earlier in this thread)
I realise that, in this thread, I have asked a number of specific and implied questions, making it hard to respond to everything. I propose to tackle the issues raised one step at a time (overrides, macros, print centering, upgrade). Is that a reasonable approach? If topics are too diverse for "Centering a print", rap my knuckles and send me off to search for or start a new thread.
Cheers,
Derek
-
- M500 stores parameters and should never appear in config.g. M501 reads parameters. If you use config-override.g then it needs to be present at the end of config.g. If you don't use config-override.g then don't use M501.
- Only config.g and config-override.g if it's present.
- Something isn't right. The config.g you posted shows M208 for X to be zero and plus circa 400. If you had followed my instructions, these should be circa minus 200, and circa plus 200.
-
@deckingman Working backwards, I mentioned earlier that I was hoping to keep the current scheme (and just update the numbers slightly) but I will go back and follow your instructions on centering with + and - figures. I didn't need to touch the Y values but I presume I'll have to home those as well (or at least halve the current full Y figure and use that).
I also presume I change the origin in the slicer in the bed shape settings origin from X=0, Y=0 to half the bed sizes respectively.I do have a concern about using the center of the bed... what about all the code that currently refers to X400ish or Y400ish (like all the homex.g code)? There are probably dozens of instances all over the place.
I have no config.g or config-override.g on my SD card so it looks like that can be eliminated as a contributor to the issue.
It seems that my procedure was correct since you did not comment on it.
OK, off to work!
Thanks so much for your help.
Cheers,
Derek
-
@Derek-F I just made the edit to M208 and stored it in the printer.
They now read:
M208 X-202 Y-204 Z0 S1 ; set axis minima to end of safe travel.
M208 X202 Y204 Z510 S0 ; set axis maxima to match endstop location.However, when I homed the printer (from the screen on the printer) the extruder went to the back right as usual, but instead of going to the center to establish the Z value, it descended in the back left corner and the nozzle CRASHED into the heat plate (because the BLtouch sensor was well behind the heat plate). I switched the printer off in this condition.
What should I do when I next switch on?
What have I missed? (why did it try to find Z at the back right corner - it is due to one of the figures I was concerned about in my previous post?)
Cheers,
Derek
-
@Derek-F said in Centering a print:
why did it try to find Z at the back right corner - it is due to one of the figures I was concerned about in my previous post?
Your homez.g file probably contains a G1 command to move the head to bed centre before doing a G30 probe. Bed centre used to be about X200 Y200, but it is now X0 Y0. So you will need to change those coordinates in homez.g, and also in homeall.g if that code is in that file too.