Saturday, August 5, 2017

Setting Up a CoreXY Printer's Origin and EndStops

In this explanation, I'm going to use SmoothieWare as an example for the config file entries, but there are similar entries for whatever firmware you are using.  Look them up!

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.

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:
  1. That a corexy mechanism is being used
  2. The locations of the printer's endstop switches and origin
  3. The length of each axis
  4. The direction to spin each motor


Step by step CoreXY firmware setup

  1. Build your printer, and mount the motors and limit switches.
  2. Choose origin location, either left-front or right-rear
  3. Set home_to direction for each axis, plug in the endstops
  4. Assign ordinate values for each axis
  5. Set motor rotation direction for both 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.

Example corexy layout , viewed from the top of the printer, that will be used to illustrate firmware configuration.  Motors are at the front of the machine, origin is at the left-front (L-F) corner, X axis endstop is at the right (bright green box), Y axis endstop is at the rear (red box).


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

Origin Location


The printer's origin (0,0,0) has to be located at the left-front (L-F) corner or the right-rear (R-R) corner in order to match the right-hand-rule coordinate space used in CAD and slicing software, otherwise your prints will come out mirrored.  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.

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
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.

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

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.  

Here is how the mechanism works, ignoring any of the electrical stuff (rotation of the drive pulleys, viewed from above, motors at the front of the mechanism):

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 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, 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, 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!

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.

If you don't have a smoothieboard, look up the endstop wiring in your controller's documentation.

No comments:

Post a Comment

Leave comments or a questions here and I'll try to post a response as soon as I can.