Prusa firmware for RAMPS Prusa i3 clones with MK42 beds


Depends on your microstepping. See - in short, it’s whatever you’d use in marlin, nothing special about prusa firmware here.



OK, then 4000 is the right value for 16 microsteps.
I thought I had to devide the value with something.

I’ll build the “clone” with a P3steel frame.
Do I have to change any distances in the firmware, so that the very first xyz-calibration works?
How does Pinda find the first calibration point?



By dead reckoning; in calibration, first the printer guides you to jog the Z axis up until it hits the stops and the motors skip steps - this puts the X rods level and the Z height is known (about 210mm IIRC). Then the printer will move to about Z=5 and home X+Y to the limit switches.

The it moves to the (hardcoded) x,y of the first limit calibration point and starts oscillating in X and Y directions whilst slowly lowering Z, until the probe is triggered.

You will need to:-

  • either get your X/Y endstops in the right place such that the calibration points are the the correct X,Y positions, or, edit the firmware to relocate the X,Y points.

  • if you don’t have an identical Z max height, you will need to change that in the firmware too. Otherwise it will either ram the nozzle in to the bed during calibration, or give up trying to find the first point.



Where in the firmware I can find the entries to relocate the X,Y points?
And are the values absolute from X and Y 0 to the middle of the first calibration point? From the nozzle or from the pinda?




Im the same point of you. Im trying change the X, Y first point but without success. Where could I change the first pint when do G28?


// Home position
#define MANUAL_Y_HOME_POS -2.2
#define MANUAL_Z_HOME_POS 0.15

but the print goes to the same X Y point

I also tried change

// Mesh definitions
#define MESH_MIN_X 35
#define MESH_MAX_X 238
#define MESH_MIN_Y 6
#define MESH_MAX_Y 202

but I assume this affect when do G29

Please anybody could help?



Not up to date on this thread re: how the firmware is written but in Marlin it looks like this (and is kinda hard to find):

[code]#define Z_SAFE_HOMING

#define Z_SAFE_HOMING_X_POINT ((X_MIN_POS + X_MAX_POS) / 2) // X point for Z homing when homing all axis (G28).
#define Z_SAFE_HOMING_Y_POINT ((Y_MIN_POS + Y_MAX_POS) / 2) // Y point for Z homing when homing all axis (G28).
You can just enter manual values for the X and Y but that expression will calculate it automatically based on the min/max positions as defined here:

// Travel limits after homing (units are in mm) #define X_MIN_POS -15 #define Y_MIN_POS -41 #define Z_MIN_POS 0 #define X_MAX_POS 190 #define Y_MAX_POS 158 #define Z_MAX_POS 110.2

Edit: Sorry I meant to say this will probe in the center of the bed. If you’re doing MK42 stuff you’ll probably want that to be manually defined, so something like




Don’t work with the Prusa firmware. Because the function is disabled

//#define Z_SAFE_HOMING



Z safe homing isn’t the same thing as prusa’s auto calibration.

The first thing you will need to change, if your printer is a different height in Z (for example, you used shorter leadscrews and modified Z stops, or you’ve build with a different frame, or you’ve built a zaribo edition), is Z_MAX_POS which is in configuration_prusa.h on line 65. This should be set the the height of the nozzle top above the bed surface when the X carriage is touching the top stops. Default for a genuine is 210.

When autocalibration starts, you’re guided to jog the Z axis to the top. When you click the button to confirm it’s at the top, the printer sets the Z height to that value of Z_MAX_POS. Then in the next step, it moves Z to the position set in MESH_HOME_Z_SEARCH which is 5. You don’t really want to change that value though. But the effect is that Z will move down 205mm in this example.

The precise location of the 9 calibration points is defined in mesh_bed_calibration.cpp on line 53:-

[code]const float bed_ref_points[] PROGMEM = {
13.f - BED_ZERO_REF_X, 6.4f - BED_ZERO_REF_Y,
115.f - BED_ZERO_REF_X, 6.4f - BED_ZERO_REF_Y,
216.f - BED_ZERO_REF_X, 6.4f - BED_ZERO_REF_Y,

216.f - BED_ZERO_REF_X, 104.4f - BED_ZERO_REF_Y,
115.f - BED_ZERO_REF_X, 104.4f - BED_ZERO_REF_Y,
13.f  - BED_ZERO_REF_X, 104.4f - BED_ZERO_REF_Y,

13.f  - BED_ZERO_REF_X, 202.4f - BED_ZERO_REF_Y,
115.f - BED_ZERO_REF_X, 202.4f - BED_ZERO_REF_Y,
216.f - BED_ZERO_REF_X, 202.4f - BED_ZERO_REF_Y


At a push, you could change these. But I don’t think you really need to. The right way of setting up your printer, if you are using a MK42, irrespective of your frame and endstop setup, is to make sure your axes are configured so that 0,0 is right above the 0,0 location printed on the bed. If you do that, you won’t need to change the coordinates of these points.

The way you do that is the same as in marlin. In configuration_prusa.h line 60:-

// Travel limits after homing #define X_MAX_POS 250 #define X_MIN_POS 0 #define Y_MAX_POS 210 #define Y_MIN_POS -2.2 #define Z_MAX_POS 210 #define Z_MIN_POS 0.15

The i3 homes to minimums. So, when you are doing a G28, the printer moves until the end stops are triggered and then, when they are, it assigns these values to the current position. So, in a stock i3 mk2, when you hit the X & Y endstops the position is set to 0,-2.2 . Thats exactly the same as saying that the nozzle is 2.2 mm behind the 0 mark in the y axis, and it’s over the zero mark in the Z axis.

If the geometry of your printer is different you need to change these values. If, for example, when the X endstop is triggered, the nozzle is 12mm to the left of the 0 line on the bed, then you need to change X_MIN_POS to -12.

Set them up, flash the firmware and test with G28 XY followed by G28 Z followed by G1 X0 Y0 Z1 and verify that the nozzle is directly above the 0,0 point on the bed. When it is, you can run your calibration process and it should work.

When you’re mucking around trying to get your calibration right, I suggest that instead of doing it from the LCD you instead use pronterface and do M45 V2 - this is the exact same process but with some additional diagnostic information displayed in the pronterface console which is very useful.



Thank you very much slippyr4 for the detailed explanation.
I think I can work well when I have finished building my printer.



Now I have yet another question.
Must the nozzles after the home over x = 0 and y = 0 or over x = 0 and y = -2.2?
I read two different statements.



Homing really means “find the endstops so i can be sure the print head is where i think it is”. It doesn’t actually mean that the head will be at any particular location when homing is finished. Where the nozzle ends up is down to the firmware implementation. Some printers home to maximum and they will probably finish a long way from 0,0 after homing. Point is, you shouldn’t care. After homing you tell the printer where you want it to go.

What you should do, is home your axes (G28 XY then G28 Z), and when its finished, use a G1 move to put the nozzle where you want it - eg G1 X0 Y0 Z0.5

At that point, yes, the nozzle should be above the 0,0 point.



OK. And after homing and before G1 the Nozzle should be over x0 and y-2.2?
The y Endstops triggers at -2.2?

Why is this Offset y-2.2? Why triggers it not a y0?



Just how the printer is made. It doesn’t matter at all.



Yes, it does have he bits left in for that. I use the functionality myself but I use the E2 mosfet on my board. It’d work fine but you may need to change an entry in pins.h




I have now finished the printer so far that I could try the calibration.
When I perform the XYZ calibration, all 4 points are found. However, the subsequent search for the 9 points does not work. It begins with the left front point, but PINDA is about 10 or 12 mm too far left and therefore can not find the point in the bed. The Nozzle moves into the bed.
If I only perform the Z-calibration, this works perfectly. All nine points are found.
What can be the problem? Do I have to adjust something in the firmware?




If you enable Z_DUAL_STEPPER_DRIVERS, the current to the motors will cut out after a certain time of not using the printer.
The official firmware has the Z motors always enabled, to prevent them from becoming misaligned.
This is not the case if you enable dual stepper drivers for the Z axis.

The solution is to change some code in Marlin.h


if defined(Z_AXIS_ALWAYS_ON)
			#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
			#define  enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
			#define  disable_z() ;


#if defined(Z_AXIS_ALWAYS_ON)
			#define disable_z() ; 
			#define  enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
			#define  disable_z() ;


just to make no mistake:
I have a separate stepper driver for each of the two Z motors.
One is connected to the ramps at Z, the other to E1.

In this configuration I have to change the code as described?



I’d never thought to look into that, and not noticed it myself. Thanks for the tip! i’ve implemented your fix in the MK2 branch and also the MK2.

Yes you should, however since I’ve implemented the fix on github (in both the v3.0.12-RAMPS branch and also the MK2_Community_Mod branch) and you can just do a git pull and rebuild/flash and it will work. If you’re not using git then you can just redownload the zip of the code.



Sorry, quite I have not yet understood what causes the change.
For me it is not Z, which is in the wrong position, but X is too far left?



Excellent! Thanks for updating your MK2 branch.