5 Axis Homing using CoreXYUV

For readers of this blog who don’t know, I have what is essentially a dual CoreXY printer with two CoreXY mechanisms stacked one above the other. The lower gantry carries the hot end and the upper gantry carries the 5 E3D Titan extruders. This enables me to use much shorter Bowden tubes than I would otherwise need an a 600mm x 600mm frame.

The way it works is that the upper left and lower left motors are mapped to the X axis and the upper right and lower right motors are mapped to the Y axis, so as far as the electronics are concerned, this is a single CoreXY printer which happens to have two motors driving each X and Y axis.

One little problem with this arrangement is that if I was working on the printer, with no power applied to the motors, it was possible, due to some slack in the Bowden tubes, to move the extruder carriage independently of the hot end carriage. Sometimes it is desirable to be able to do this so I don’t want to fix the carriages rigidly together. The trouble is that the homing switches were fitted only to the hot end carriage. This meant that I had to remember to line the extruders up with the hot end before I attempted to home the printer. There is extra travel on the extruder gantry so they didn’t have to be too precisely aligned but there have been a couple of occasions when I have forgotten and the extruders have been either too far to the left or too far to the front. Then when I’ve homed the printer, the extruders have collided with the frame before the switch on the hot end gantry was triggered.

Whilst I was perusing the Duet3 forums I came across a post that was to do with using two end stop switches for squaring an axis. David Crocker (DC42) said that this could be done by temporarily using additional axes. I realised that this could be the answer to my little problem.

I’m going to digress a little here just to explain why I am such a fan of the Duet electronics. It transpired that normally, additional axes created for a CoreXY would have Cartesian kinematics. i.e. driven in one direction, usually by a single motor. I discovered this and posted on the Duet forums on 23rd November at 12.17.  David came back at 12.46 to say that what was needed was a new arrangement which would allow additional axes to be created which would use CoreXY kinematics. He came back again at 15.38 to say that he had just implemented it and that it was in the latest beta firmware. That’s just a tad over 3 hours from posing the question to having a new CoreXYUV kinematics implementation written into the firmware! I’m reasonably sure that with any other printer controller, this would have taken weeks or months, if it got implemented at all.

So, back on topic. Obviously I needed to fit additional switches to the upper gantry. These had to be connected to end stops  E0 and E1. So on my machine I had to move my axis max end stops and emergency stop button to E2 and E3 on the Duex 5. The U axis is the second “X” axis and uses E0 and the V axis is the second “Y” axis and uses E1

Then it is necessary to create the two additional axes,  U and V. These axes have to have values for steps per mm, speed, acceleration etc.

The first thing to change in config.g was the kinematics which needs to be CoreXYUV. This was done by using M669 K8 instead of  M667 S1. The next thing was to configure the end stops for the new axes. In my case I added the line M574 U1 V1 S1. Next up was to create the new axes but using non-existent drives. So in my case I changed this:

M584 X0:3 Y1:4 Z2 E5:6:7:8:9

to this:

M584 X0:3 Y1:4 Z2 U10 V11 E5:6:7:8:9

Note that at the time of writing thee is a little glitch in the firmware. Normally, the above M584 command would have “P3” (without the quotes) at the end which will limit the number of visible axes to 3. However, for now the P3 command needs to be omitted but added later near the end of the file. No doubt by the time anyone else comes to use this feature, that little glitch will have been put right.

This now fixed so the line in config.g now looks like this:

M584 X0:3 Y1:4 Z2 U10 V11 E5:6:7:8:9 P3.

The “P3” parameter restricts the number of visible axes to 3. Note that axes need to be made visible in order for them to move. More on this later….

Note also that the M584 command needs to be before M350, M92, M566, M203 and all the other command that affect motor movement.

Then it was necessary to set the steps per mm, speeds accelerations etc for the new axes. The U axis has teh same values as the X axis and the V axis has the same values as the Y axis. The drives section of my config.g file now looks like this:

M350 X16 Y16 U16 V16 Z16 E16:16:16:16:16 I1; Configure XYUVZ and 5 extruders microstepping with interpolation
M92 X80 Y80 U80 V80 Z3200 E393:397:403:400:401 ; Set steps per mm
M566 X600 Y600 U600 V600 Z20 E600:600:600:600:600 ; Set maximum instantaneous speed changes (mm/min)
M203 X50000 Y35000 U50000 V35000 Z300 E1800:1800:1800:1800:1800 ; Set maximum speeds (mm/min)
M201 X1000 Y1000 U1000 V1000 Z20 E1000:1000:1000:1000:1000 ; Set accelerations (mm/s^2)
M204 P500 T1000; set print accel to 500, non print to 1000
M906 X1800 Y1800 U1800 V1800 Z1800 E600:600:600:600:600 I20 ; Set motor currents (mA) and motor idle factor in per cent

The next thing to do is set the axes minima and maxima for U and V which on my machine now look like this:

M208 X0 Y0 U0 V0 Z0 S1 ; Set axis minima
M208 X360 Y364 U360 V364 Z760 S0 ; Set axis maxima

IMPORTANT. The axis minima and maxima must come after the M584 command otherwise the new axes will default to maxima of 0 (zero) so won’t move after homing. If the original config.g has been created using the configuration tool, the axis limits will be before the drives section so will have to be moved.

Then finally I added the M584 command again at the end of the but this time added P3 to the end of it. As mentioned earlier, this is a temporary glitch in the firmware which will be put right so it should not be necessary for anyone else to have to do this. That step is no longer necessary.

That’s all the changes that are necessary to config.g. To make use of these features, all that is needed now is to change the homing files, homex.g, homey.g and homeall.g (homez.g is unaffected).

So what I do is start by re-mapping the X and Y motors to X Y  U and V like this:

M584 X0 U3 Y1 V4 P5

The P5 parameter is necessary to make the U and V axes visible. This is important because they will not move if they are not visible.

To save me further typing, all I’m going to do is paste my homex.g file here. It is well annotated so should each step should be self explanatory.

; homex.g
; called to home the X axis

M584 X0 U3 Y1 V4 P5; temporarily map drives to U and V axes – have to map both axes even thought only U is being used due to both motors being employed per axis

M906 X400 U400 Y400 V400 Z1200 ; reduce motor currents

; Lower bed relative to current position
G91 ; set to use relative coordinates

G1 Z5 F600 ; move bed down 5 mm

G1 X-380 U-380 F4800 S1; move both axes fairly quickly left until one or other triggers a switch

G1 X-380 S1; course home X
G1 U-380 S1; course home U

G1 X10 U10 F600 ; Go back a few mm

G1 X-380 U-380 F360 S1; Move slowly to X and U axis end stops once more and stop when either one triggers

G1 X-380 F360 S1 ; fine home X
G1 U-380 F360 S1 ; fine home U

M906 X1800 Y1800 U1800 V1800 Z1800; reset motor currents

M584 X0:3 Y1:4 Z2 U10 V11 E5:6:7:8:9 P3 ; put motor mapping back to normal so that X uses drives 0 and 3, Y uses 1 and 4 and hide the U and V axes

G90; set to absolute coordinates

G1 X180 F6000; move to more or less the centre of the bed (not strictly necessary)

; Raise bed again
G91
G1 Z-5 F300
G90

Home Y is similar except that X is substituted for Y and U is substituted for V.

Homeall.g is a bit different but once again if I paste it here, each of the steps should make sense. The main difference is that I use the nozzle to probe the bed (as a switch) so I heat it to 140 deg C to soften any filament that may have oozed out of the nozzle.

; homeall.g
; called to home all axes

; start by warming the hot end so that any oozed filament is molten
TO; select a tool – any one will do
M104 S140; heat to 140 but don’t wait

M584 X0 U3 Y1 V4 P5 ; temporarily map drives to U and V axes and make U and V visible by using P5

M906 X400 U400 Y400 V400 Z1200 ; reduce motor currents

G91 ; set to use relative coordinates

G1 Z5 F600 ; move bed down 5 mm

G1 X-380 U-380 Y-380 V-380 F4800 S1; move all 4 axes fairly quickly until one or other triggers a switch

G1 X-380 U-380 F4800 S1; now move just X and U fairly quickly left until one or other triggers a switch

G1 X-380 S1; course home X
G1 U-380 S1; course home U

G1 X10 U10 F600 ; Go back a few mm

G1 X-380 U-380 F360 S1; Move slowly to X and U axis end stops once more and stop when one triggers

G1 X-380 F360 S1 ; fine home X
G1 U-380 F360 S1 ; fine home U

G1 Y-380 V-380 F4800 S1; now move Y and V fairly quickly left until one or other triggers a switch

G1 Y-380 S1; course home Y
G1 V-380 S1; course home V

G1 Y10 V10 F600; Go back a few mm

G1 Y-380 V-380 F360 S1; Move slowly to Y and V axis end stops once more and stop when one triggers

G1 Y-380 F360 S1 ; fine home Y
G1 V-380 F360 S1 ; fine home V

M584 X0:3 Y1:4 Z2 U10 V11 E5:6:7:8:9 P3 ; put motor mapping back to normal so that X uses drives 0 and 3, Y uses 1 and 4. Also hide U and V by using P3

G90; set to absolute coordinates

G1 X180 Y180 F6000; move to more or less the centre of the bed

M109 S140 ; continue heating bed to 140 but this time wait

G30 ; home Z

G91 ;relative
G1 Z5 F300 ; move bed down 5mm
G90 ; back to absolute

M906 X1800 U1800 Y1800 V1800 Z1800 ; set motor currents back to defaults

M104 S0; set hot end temp back to zero

In the files above, I could probably use a simpler form of remapping the drive at the end like this  M584 X0:3 Y1:4 P3 because the Z axis and 5 extruders were not changed.

From the web interface, the net effect of all this is that the U and V axes are normally hidden but “pop up” during homing. Once homed, they “disappear” again.

The best way to see it all working is to watch this little video that I have put on my YouTube channel.

5 axis homing video

As ever, I hope someone at some time finds this useful although I suspect there aren’t many people crazy enough to do what I do with my extruders. 🙂

Ian

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s