I aim these posts for those whom has very little or no experience in setting up a DIY 3d printer. However, the information might help more experienced builders as well.
Marlin is the most popular open source control software, designed to run 3d printers and in some cases other type of CNC machines.
One of the tasks during a DIY 3D printer build, is setting correctly the Z axis offset.
What is the Z Axis offset and why is it important?
In order for the software ” to know” where the hotend nozzle is positioned at, we have to pre-set the dimensions of the work space of the machine. The printer uses three on-off momentary switches – with the help of the control board – to let the software to interact with the physical world. When a switch is triggered, using the preset known dimensions, Marlin can calculate any desired position of the print head.
In the case of the Z axis or extruder nozzle offset, we only concerned about one of these three switches.
This particular switch can have a few variations, but in regards of the process of setting the offset, it is irrelevant which solution we are using. However for the sake of the article here are two of the most used conventional Z axis switches:
- Mechanical momentary on-off switch
- Electromagnetic or inductive (metal detecting) switch
and a couple of less conventional
Currently, I am using an inductive switch with my present set up.
When we talk about the offset, we mean the physical (vertical) distance between the tip of the nozzle at the point where the Z axis switch being triggered (called “zero” or home position) and the surface of the print bed. The offset distance is important for accurately starting our print`s first layer deposition. This is also one of the important factors for ensuring proper adhesion of the molten filament and the fabricated object to the print bed.
Hotend designs have a wide variation, it is important to understand the process of setting this attribute as accurately as possible, according to your needs. Especially if you plan to use various hotends or would like to design your own.
Different switches have different trigger points, usually measured from the surface of the printer bed. This distance is not important in relation of the process of setting the offset, however – along with the position of the switch (sensor) – it has an effect on the value of the offset. A perfect design would be, where the offset is zero, i.e. the trigger point is exactly where the nozzle would touch the bed. In reality, that is quite difficult to achieve.
The first layer of our print is usually between 0.1 mm-0.3mm, therefore to keep accuracy as tight as possible, it is good practice to use hotends where the required offset is not greater than 4 mm.
Setting or fine tuning the offset in Marlin:
To determine the required value for setting the offset, a combination of control mechanisms can be used.
A smart LCD control panel makes the process easier. This allows you to make changes in the printer set up by saving the attributes into the RAMPS or MKS board`s (or any Arduino Mega based control boards) EPROM. This is a very easy way to change most settings and to move the print head without using G-code commands. However, using a software based console/ serial monitor is still necessary.
You can use software based control solutions, such as the console panel of most slicers (Slic3r, Repetier, etc) or an Octopi.
I prefer to use the Arduino IDE serial monitor.
The touch screen which are often supplied with cheap Chinese kits are not suitable for the process described below.
It is advisable to get familiar with Marvin, if you want to make eg. the offset changes permanent. Besides, during an initial set up of a DIY printer, the builder has to configure the Vanilla Marvin according to the built printer. A very good source of information can be found on Marlin`s own website. Most commercial DIY kits would have their own version supplied with the kit, ready to be uploaded onto the control board.
The Process of determining the accurate offset value
- Set the current offset value to zero; LCD navigation “Control> Motion> Probe Z offs” or typing “M851 Z0” in the serial monitor – This will help us to easily measure the desired accurate value of it.
- Home your printer head; LCD navigation “Prepare> Auto home” or typing the “G28” command in the serial monitor. – This will move the nozzle to “home” or “zero” position, which means that, because at the moment the offset set to zero, the machine “thinks” that the nozzle is touching the print bed (which in reality most likely is above the print bed by a few millimeters). Make sure that the nozzle is clean and free of residue filament. It is a good idea to pre-heat the bed and the hotend for the process, although in my experience it is not absolutely necessary. If you want to be super accurate, you can move the nozzle to the position where the sensor (switch) is. For that, you need to know the exact coordinates of that position. At this occasion, I assume that our print bed is reasonably flat.
- Switch the Z axis sensor off; Type “M211 S0″ on the serial monitor. There is no option in the LCD menu for that – This will allow you to move the nozzle to “negative direction”, because bare in mind, at this point the machine “thinks” the nozzle could not go any lower as it is in Zero position and would not go “under” the print bed.
- Move the nozzle down to level of the print bed; LCD navigation: “Prepare> Move axis> Move Z> Move minus 0.1mm increment” and make a note of the value or type “G1 Z-0.5, G1 Z-0.6″, so on, in to the serial monitor, until the nozzle is at the desired position and make a note of the correct value (the value of Z) – A good practice is to put a piece of paper under the nozzle and move it (the nozzle) down till it touches the paper. You still need to be able to pull the paper without much effort. The offset value will always be negative, because of the physical attributes of the hotend assembly.
- Move the Z axis back up. LCD navigation “Prepare> Move axis> Move Z> Plus increment” or type e.g. “G1 Z3” in the serial monitor. Be careful not to move to negative direction (downwards) as this might damage your hotend assembly and/or print bed
- Switch the Z axis sensor back on typing “M211 S1″ in the serial monitor.
- Set the determined value as the offset; LCD Navigation “Control> Motion> Probe Z Offs or typing “M851 Z<value of the offset>” in the serial monitor
- Save that value in the EPROM of your controller board; LCD navigation: “Store Settings” or type “M500” in the serial monitor.
- Test by printing your favorite calibration print. I like to print Marvins from Thingiverse. (I have an army of Marvins). What you are looking for is good adhesion and a slight “squash” of the first layer of the print. In my experience, sometimes minor adjustments are needed in the pre-determined offset value to have it just right.
- Consider to make your work “permanent” by updating the copy of Marlin which is running on your board. That requires to change your firmware and upload the updated one. The command is around line ~781 at the “Configuration.h” tab. Search for “#define Z_PROBE_OFFSET_FROM_EXTRUDER” and change the value.
That is it. Congratulation, you have successfully set the correct Z axis offset value on your 3D printer.
One thought on “Z axis, hotend nozzle offset in Marlin, explained”
Pingback: Using an inductive PNP Proximity Sensor with MKS Gen Printer Control Board | Creative