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.
I am having problems setting up my homing/end stops.
ReplyDeleteWhen homing X or Y the opposite motor keeps on travelling, i.e if I home X axis, once the end stop is triggered the X motor stops but the Y motor keeps turning.
I have tested the end stops with G code and they're all working as they should. I have also reduced the homing speed, to no avail. Please follow paste bin link for config. apologies if I have missed any other information. https://pastebin.com/9iP1DPyx
Specs are as follows:
Frame is a Ratrig coreXY
Smoothie board
Silencioso external drivers
Nema 17 steppers
I have been trying to figure out WTF is wrong for a while now and it is doing my head in! Any help would be greatly appreciated! :)
Comment
Check line 188: #corexy_homing true
DeleteRemove the # and I think it will work.
Hi. Wanted to say a big thanks to you! I struggled with my corexy (HEVO) stupidly long, but as soon as I saw your direction rotation table, everything was fixed within 5 minutes. Thanks!
ReplyDeleteI'm glad it helped!
DeleteHi, great write up! A silly question: In your picture, you refer to the stepper motors as alhpa and beta. The boards mark the sockets with X and Y. Am I correct in thinking that the alpha stepper goes into the X socket and the beta stepper into the Y one? Cheers.
ReplyDeleteYes, I used the alpha and beta designations because in a corexy mechanism there is no X motor and no Y motor. The controller boards are usually labeled X and Y, so yes, plug the alpha motor into the X driver and the beta motor into the Y driver.
DeleteThe following is for a cube XY printer with a Z travel bed with "zero" at the top.
ReplyDeleteI may figure this out on my own before you see this, but where does the Z endstop switch go in relation to the hot end? Obviously the bed needs to be able to get very close to the hot end, if not touch it "just to be sure." At the same time, the Z endstop switch keeps the Z steppers from driving the bed into the hard stops. But, the hot end is slightly lower than that, so it seems like the controller board has to stop the bed short of the endstop switch so that it doesn't crash into the hot end, yes? I'm guessing that the offset is set during configuration somewhere, true?
This still leaves the nagging situation of "homing" the Z-bed... where does it go. If it's right after power up, it seems like it'll drive upward until it sees the endstop switch, but per the above, it means that it'll smack the hot end, so I'm missing something! Thanks
The Z endstop usually goes at the top of the Z axis where Z=0. In my printer, the XY home position is off the bed so it can't crash when homing Z. If your XY home position is on the bed, you'll have to be careful about homing Z for the first time.
DeleteWhen I set up my printer, with the bed well below the nozzle, I moved the nozzle to (0,0) in XY space (the center of the bed) and then moved the Z=0 endstop so it would trigger about 5 mm above the bed, then used the M564 command to disable motion limits, then slowly raised the bed until it just touched the nozzle. Then I physically moved the Z=0 switch to the position that just barely triggered it and bolted it down.
I think you can place the switch so that it triggers when the nozzle is a few mm away from the bed and then assign a positive offset to the Z ordinate (say 5 mm or so). If you set the Z minimum value to zero, it should be possible to travel to Z=0 even though the endstop is at Z=5.
Oh, and somewhat related, where do people put their Z stop if they have three Z steppers? I mean, I realize they pick one stepper and use that, but then that leaves two steppers that the controller doesn't know where they are. I'll guess that an auto level figures it out off the one endstop switch and the bed sensor.
DeleteI haven't built an auto-leveled machine, so I am not really familiar with the techniques used, but I think that in machines with 3 independent Z axis motors and auto bed leveling, the bed sensor on the extruder carriage is used to locate the Z=0 point as well as to handle the leveling and mesh compensation.
DeleteI know that the Z endstop switch "synchronizes" the bed so that the controller knows where the bed is, THEN it can continue upward past that point slightly to end up right at the nozzle, correct?
ReplyDeleteYes, the purpose of homing any axis is to the extruder nozzle at a known location with respect to the bed in all three dimensions. That known location doesn't have to be at the ends of the axes.
DeleteThe "light went on for me" when I realized that the endstop switch actually serves two purposes:
ReplyDelete1. Tells the controller the part is at a known point in its travel.
2. Prevents the controller from driving the part into a hard stop.
#2 only prevent the issue at one end. It's left to the controller to count the steps needed to get to the other end, but stop short since there is no switch at that end.
The endstops define a single point (home) at which the coordinates are known. All other locations are counted from that point. AFAIK, 3D printing firmware only activates the endstops when homing, so it wouldn't do any good to put more endstop switches at the home-opposite end of each axis. In a properly functioning machine, counting works fine. problems start when the machine malfunctions and the extruder/bed end up at a different location from where the controller thinks they are. That sort of thing can lead to layer shifting, head crashes, etc. Fortunately, those sorts of problems are easily avoided by careful printer design and construction, and proper configuration- don't set jerk/acceleration too high, etc.
DeleteThanks for the quick replies. Later, I found this on the Duet3D pages regarding an example of a two-stepper Z bed:
ReplyDelete"... Make sure that the two endstops are defined in the same order in the M574 command as the corresponding Z motors in your M584 command. For the example above, M584 Z2:4 would be correct, assuming one Z motor is plugged into driver 2 (Z driver on Duet 2) and its endstop is plugged into zstop, while the second Z motor is plugged into driver 4 (E1 driver on Duet 2) and its endstop is plugged into the E1 endstop pins..."
So it appears that they expect a stopswitch on every stepper.
The above quote came from: https://duet3d.dozuki.com/Wiki/Bed_levelling_using_multiple_independent_Z_motors#Section_In_RepRapFirmware_Num_3
I have a corexy machine that I have screwed up.
ReplyDeleteWould it be possible for you to email me a table of rotation for the motors?
viewed from the top/front: Y motor=L/R, X motor=R/R, Y-stop=R/F, X-stop=L/Carriage
In a corexy machine there are no X or Y motors. All XY motion is defined by the relative motions of the two motors, usually called A and B to prevent confusion. The A motor is usually plugged into the X motor driver on the controller board and the B motor is usually plugged into the Y driver, but they are not driven independently for X and Y motion. Be sure that you have configured the controller for corexy motion!
DeleteI can't email you because your comment is posted as user unknown, and you did not provide an email address. I see a lot of comments from "unknown". I don't know if it's something weird that blogger does (it wouldn't surprise me), or if the users have somehow blocked their identity (that wouldn't surprise me either).
Three things to keep in mind when setting up motor rotation directions, placing endstops, and placing the origin of the machine:
1) You must set up right hand rule coordinate system or your prints will be mirrored. The right hand rule coordinate system is defined by the relative directions of motion, not by the specific location of the origin, and is always defined relative to the print/bed. The Z ordinate increases as the nozzle gets higher above the bed whether the bed moves down or the nozzle moves up (so the Z arrow always points up). That means that right hand rule coordinate system demands that if X increases as the nozzle moves to the right, Y must increase as the nozzle moves toward the back of the machine. Alternatively, if X increases as the nozzle moves left, Y will increase as the nozzle moves toward the front of the machine.
2) Home position does not have to be at the origin (0,0,0) of the printer. Home is where the endstops are (that would make a great t-shirt!). When homing, the extruder carriage should move toward the endstops.
3) Z=0 is always on the bed surface, but the XY origin (0,0) can be placed anywhere you want in or out of the mechanically addressable (X,Y) space of the machine. It's easiest to use the machine if you keep it within the addressable space, and I find it most useful to place the XY origin at the exact center of the printer's bed because it makes it especially easy to switch from one slicer to another. See:
https://drmrehorst.blogspot.com/2018/07/ummd-better-way-to-set-up-origin-and.html
The origin location is defined by the coordinate you assign to the extruder nozzle when the machine has been homed and the limits of travel you specified in the config file.
Thanks for this, how about one tut for marlin fw, afaik there is no corexy_home
ReplyDeleteSorry, but I haven't used Marlin in at least 7 years and have no idea how it has changed since I used to use an arduino/RAMPS controller in my first printer.
DeleteI know some people use controllers running Marlin in corexy machines, so it must have that capability.
Thank you for the prompt reply,guess i have to look somewhere else or try using other fw. keep safe.
DeleteHello, please could you help me to leave the origin in the back left (next to the alpha engine) corner. I have the alpha engine turned upside down. I've been trying to achieve this for three days now, but it doesn't work.
ReplyDeleteAs you have discovered, this stuff can be confusing. I find it helps to draw diagrams of the machine, marking the endstops, origin, direction arrows, and coordinates of the endstops and corners of the bed.
DeleteThere's a pretty good guide here that is written specifically for Duet controller boards, but the motion specifics should apply to any controller: https://duet3d.dozuki.com/Wiki/ConfiguringRepRapFirmwareCoreXYPrinter#Section_Testing_motor_movement
Be sure that when you tell the mechanism to home, the extruder is driven toward the X and Y endstops.
Further thought- for right hand rule coordinates (the same as CAD and slicers), and if you want positive values of X and Y to be on the bed, the origin should be the left-front or right-rear corner.
DeleteIf you put it at the left-rear corner, positive X will be off the bed, negative X will be on the bed.
The Creality Ender 6 has origins right below the alpha engine (i.e. bottom left if I'm looking at the printer from above and the engines are closer to me) and this didn't cause any problems.
DeleteLooking at it from the top with the motors in front yes, you can have the origin near the motor on the left (A motor). In your first post you said you wanted the origin at the left rear. If you rotate it so that A motor is at the back, it will be at the right rear, not the left rear. You'll need to be much more descriptive. What isn't working? Where are your endstop switches? Where are the motors located?
DeleteDear Dr. Rehorst,
ReplyDeletefirst of all thank you for this description.
I did follow your advices but for whatever reason my Ender6, which I want to run on my BTT Octopus Pro board with Marlin 2.0.9.3 does not behave as you discribe.
My mAchine has the motors in the back. the Motor connected to X board driver ist left (viewed from top, printer front is pointing to the bottom) and the stop switches are located right-rear => print plate origin is therefore left-front.
This means, according to what I understood from your description, that my Motor connected to Y (beta motor) must turn CW at homing, what it does. In this case the motor connected to X (alpha motor) drives the extruder to the left, away from the X stop switch => change its turning direction via FW…
As soon as I switch the direction of the alpha motor, that it drives the extruder to the right at homing, it automatically leads to the behavior of my whole mechanical setup that it switches also the direction in Y direction!? Means that now, when homing, the extruders first movement is suddenly not anymore in X direction to the right but in Y direction to the front! Although before switching the turn direction of the alpha motor via FW the first extruder movement when homing was in X direction to the left !?
I do not understand why my setup changes suddenly the movement of the extruder fron X direction into Y direction if I have the beta Motor turn CW (as mentioned before) and then switch the turn direction of the alpha motor to make it drive the extruder to the right instead of left.
Do you have any idea what I do wrong. Can it be some other setting in Marlin FW or the board HW setup it self causing this behavior?
FW setting is using max position for x and y endstop switch an min position for z endstop switch.
Thank you for your support
Majestix
Different firmware may handle motor rotation direction differently. There may even be changes from one firmware version to another. You either have to do some experimenting with motor direction assignment or find an accurate description from the firmware author/vendor. Make sure you are telling the firmware that you have a corexy mechanism!
DeleteI don't know how Marlin handles corexy motor direction (which directions of rotation are considered forward), but if the motors are driving the extruder toward the endstops when you home the machine, but other motion behavior is wrong, then either the motor assignments are wrong or the directions of rotation are wrong (or maybe both).