If your printer is not a coreXY type, please refer to this post for setting up its origin and end stops.
I will refer to the motor that connects to the X or alpha output on the controller as the alpha motor, and the motor connecting to the Y or beta output as the beta motor. The Z axis motor connects to the Z or gamma output. I will largely ignore the Z axis because it's pretty straightforward- you're going to have an endstop at the Z=0 position at the top of the Z axis (where the bed touches the nozzle).
CoreXY motion can be a little confusing when trying to set up endstops and motor direction in firmware. The printer's firmware needs to know:
- That a corexy mechanism is being used
- The locations of the printer's endstop switches and origin
- The length of each axis
- The direction to spin each motor
Step by step CoreXY firmware setup
- Build your printer, and mount the motors and limit switches.
- Choose origin location
- Set home_to direction for each axis, plug in the endstops
- Assign appropriate ordinate values for each axis
- Set motor rotation directions for all three motors.
Mounting Motors and Switches
You can mount the motors either pulley-up or pulley-down or one up and one down - it doesn't matter. You can put limit switches at either end of either axis, but you have to make appropriate assignments in the firmware and plug the switches into the appropriate inputs on the controller board. We'll get to that in a minute.
First things first: you have to tell the controller that your printer uses a corexy mechanism. You do that in SmoothieWare by using this line in the config file:
arm_solution corexy
In RepRap Firmware (Duet board):
M667 S1 ; set up corexy kinematics
Origin Location
The printer's origin (0,0,0) can be located literally anywhere but the directions of increasing ordinate values must be in the proper orientation for right-hand-rule coordinates or your prints will come out mirrored because the CAD software that designed the print used right-hand-rule coordinates. People typically set the origin up at the left-front (L-F) corner (X increases as the extruder moves to the right and Y increases as the extruder moves to the rear) or the right-rear (R-R) corner of the bed or printer (where X increases as the extruder moves left and Y increases as the extruder moves toward the front of the machine), but there are some significant advantages to setting it up at the center of the bed. Continue reading this post, and once you understand it, see the newer post, here, about setting the origin at the center of the bed.
Slicers commonly default to showing the origin at the left-front, and the jog controls in Pronterface assume a left-front origin, so you can save yourself some mental gymnastics by doing the same. There is no explicit statement in the config file that tells the controller where the origin is- its location is implied by the homing directions and endstops used.
The Z=0 position is at the level of the bed surface. Z increases as the nozzle goes up relative to the bed (the bed moves down relative to the nozzle).
Setting "home_to" Direction for Each Axis
If the switch is at the origin end of its axis, you'll set that axis for home_to_min. If it's at the far end, set that axis for home_to_max.
Printer
Origin
|
X axis
|
Y axis
|
||
endstop location
|
alpha home-to
|
endstop location
|
beta home-to
|
|
L-F
|
left
|
min
|
front
|
min
|
L-F
|
right
|
max
|
front
|
min
|
L-F
|
left
|
min
|
rear
|
max
|
L-F
|
right
|
max
|
rear
|
max
|
R-R
|
left
|
max
|
front
|
max
|
R-R
|
right
|
min
|
front
|
max
|
R-R
|
left
|
max
|
rear
|
min
|
R-R
|
right
|
min
|
rear
|
min
|
Let's say that the origin is at the L-F and the switches are located at the right and rear. In SmoothieWare, you'll have entries like this:
corexy_homing true
alpha_homing_direction home_to_max
beta_homing_direction home_to_max
gamma_homing_direction home_to_min
In the example above, the alpha and beta endstop switches are both located at the maximum ends of the X and Y axes, so you have to plug the endstop switches into the Xmax and Ymax endstop inputs on the controller board. The Z endstop should plug into the Zmin endstop input, assuming you have positioned the Z limit switch at the physical top of the Z axis, at the level of the extruder nozzle.
In RepRap Firmware (Duet board) it will look like this:
M574 X2 Y2 Z1 S1 ; Set active high endstops
In RepRap Firmware (Duet board) it will look like this:
M574 X2 Y2 Z1 S1 ; Set active high endstops
X2 and Y2 define the positions of the endstops at the maximum end of the X and Y axes. Z1 means the Z axis endstop is at the minimum end of the Z axis. S1 sets them as active high. The endstop switches will be plugged into the X, Y, and Z endstop inputs (there are no min and max inputs, just a single input for each axis).
Set Ordinate Values for Each Axis
Measure the length of the X axis by manually moving the extruder carriage from the far left to the far right. Do the same for the Y axis by measuring the distance the extruder nozzle moves from the front to the back of the machine. And, of course, measure the usable Z range of motion.
Let's say the X axis range of motion is 380 mm, the Y axis is 340 mm, and the Z axis is 400 mm. In SmoothieWare you'll have entries like this:
alpha_min 0
alpha_max 380
beta_min 0
beta_max 340
gamma_min 0
gamma_max 400
In RepRap Firmware (Duet board) the assignments will look like this:
M208 X0:380 Y0:340 Z0:400 ; Set axis minima:maxima
M208 X0:380 Y0:340 Z0:400 ; Set axis minima:maxima
Setting Direction of Rotation
Setting direction of rotation is done either by reversing the connectors at the motors or controller board (only with power off or you may destroy the motor driver chip!), or by inverting the direction logic via the firmware.
Left Motor
(alpha)
|
Right Motor
(beta)
|
Extruder Motion
Toward:
|
CW
|
CW
|
left
|
CW
|
CCW
|
front
|
CCW
|
CW
|
rear
|
CCW
|
CCW
|
right
|
CW
|
off
|
left-front
|
CCW
|
off
|
right-rear
|
off
|
CW
|
left-rear
|
off
|
CCW
|
right-front
|
Remember, when homing the mechanism, the location of the switches are important, not the location of the origin. Homing should always send the extruder carriage toward the switches. Using the table above, just the top four entries, notice that, when homing, if the switches are at the
- left and front, the alpha motor must turn CW.
- left and rear, the beta motor must turn CW.
- right and front, the beta motor turns CCW
- right and rear, the alpha motor turns CCW
In Smoothieware, the motor rotation direction is set by these lines in the config file:
alpha_dir_pin 0.5
beta_dir_pin 0.11
gamma_dir_pin 0.20
We can use the table to easily set the motor rotation directions. For example, if the switches are located at the right and rear, manually push the extruder carriage to the center of the build area, tell the controller to home all axes (G28), and watch the rotation of the alpha motor. It should turn CCW. If it doesn't, reverse its direction either by shutting off power and reversing the cable connection to the motor, or by appending a "!" in the config file, like this:
alpha_dir_pin 0.5!
Once the alpha motor is turning the right way, push the extruder carriage to the center of the XY space, send another home-all-axes command (G28), and watch the mechanism. If it moves toward both switches, both motors are turning in the right directions. If not, reverse the beta motor direction like this:
beta_dir_pin 0.11!The Z motor should likewise move the bed toward the limit switch, normally at the level of the extruder nozzle. If you have positioned the switch at that location, Z is homing to minimum (Z=0) and the G28 command should drive the bed upward, toward the switch.
In RepRap Firmware (Duet board), P selects the driver and S sets the rotation direction:
M569 P0 S1 ; motor A goes forward
M569 P1 S0 ; motor B goes backward
M569 P2 S1 ; Z motor goes forward
Endstop wiring
If you are using simple, reliable, snap-action switches for the endstops, they can be wired either normally open (NO) or normally closed (NC). For safety, it is best to wire them NC. That way, if a wire breaks or becomes disconnected the controller will interpret that as a switch closure and it will quickly become apparent that something is wrong.
The SmoothieBoard config file defaults to NC. If you wire any of the switch(es) NO, you have to invert their inputs in the config file. Refer to the SmoothieWare endstop configuration documentation here.
Be sure to plug the endstop switches into the appropriate inputs on the controller board. For example, if the Y axis endstop is at the maximum end of the Y axis, plug that endstop switch into the Ymax endstop input.
The Duet controller boards have only one endstop input per axis, and it is defined as a minimum or maximum using the M574 command as above.







