BLTouch / 3DTouch
BLTouch / 3DTouch

Install and configure BLTouch / 3DTouch in Marlin 2.0.x (MKS Gen, SKR, Anet A8, RAMPS)

Recently a colleague sent me a BLTouch / 3DTouch sensor from the Geeetech brand. I usually use optical infrared sensors for my printers, but I wanted to try the BLTouch sensors since none had fallen yet by my hands. So I got down to work for Configure BLTouch with BabyStepping in the last Marlin available today and satiate my curiosity.

I have always used leveling sensors on my machines, as leveling the four corners of the printing surface with a folio is definitely not my thing. Nor do I see it practical and much less precise, although at this point I surely disagree with some reader 🙂

I have to say that I tried quite a few inductive and capacitive sensors, I even opted for the original PINDA 2 , which is very comfortable to install since is one of the few that actually powers 5V and gives quite a bit of precision. But it didn’t convince me either. In each and every one of them a common denominator, the detection distance varies depending on the metal and even the temperature of the bed.

It’s something I don’t like at all. It doesn’t give me any sense of precision, since what I’m looking for is an immutable (or at least minimal) measurement. Having a component that according to the conditions of use works differently has no meaning whatsoever. I don’t want to calibrate that distance again if I change the filament from PLA to ABS, it’s a hassle.

With the optical sensors, which I love, we forget about these variations since under normal conditions they do not affect the type of metal or the temperature. And with the BLTouch the same, since they are completely mechanical sensors (hence my desire to try it).




Before starting I have to confess that I do not have a commercial 3D printer as many of you may have ( Anet A8 , Ender3 or Artillery X1 for example). I had a commercial at the beginning (a completely disaster), so I decided to design and manufacture my own to my liking and needs.

However, you should not worry because when configuring the BLTouch sensor the options to be modified in the Marlin firmware will be exactly the same . The only thing that will vary will be the connections, but we will indicate some examples so that you do not have any problem in its corresponding section.

In this article we will only discuss the options to modify to support BLTouch / 3DTouch. If you need to completely configure Marlin do not hesitate to visit the Complete guide: Configure Marlin 2.0.3 from scratch and not die trying that you also have available on our website.


Why use BLTouch / 3DTouch?

BLTouch / 3DTouch

The main reason for me would be not having to be leveling 4 corners with a sheet of paper or making squares in bed. If we make the leveling of the printing surface in the 4 corners, when you are leveling one another it is unbalanced. In the end, so that everything is square, you end up making several passes, especially if you are a precision maniac.

So the question is extremely simple. Why not install a leveling sensor to level at a single central point in the bed (SAFE_HOMING), and let Marlin generate the mesh of points and worry about the rest? That’s what Marlin is for, to make life easier for us.

For more reasons, you can install capacitive or inductive sensors, but these types of sensors vary depending on the temperature of the bed and the metal. The higher the temperature, the lower the detection range. So you can not leave a fixed value for PLA and another for ABS.

In addition, on aluminum the detection range of capacitive and conductive sensors is considerably reduced with respect to using steel or iron. Another negative point since if you use glass you will be very fair and in any failure your nozzle will go through the glass with the consequent risk of breakage.

BLTouch / 3DTouch sensors are mechanical, so they are not affected by heat, humidity or the type of material on your printing surface.

Furthermore, the connection of the BLTouch / 3DTouch sensors to the boards is relatively simple and you do not need to carry out any electronic modification as it happens in other sensors. Some Chinese sensors indicate operating ranges from 6-36v, nothing is further from reality. If you feed them at minimum values ​​they don’t work, so you have to feed them at 12v.

The problem comes when you have to send the signal (S) to your electronic board, if you don’t regulate that voltage (with additional electronics) you can burn the port as it happened to me in my MKS Gen v1.4. The result was that the Z- was completely unusable for me having inserted 12v. in a 5v input. It is not a major problem, you can change within the Marlin firmware and indicate that for Z- we are going to use the Z+, but you have to make unnecessary modifications.


Where can I buy a BLTouch / 3DTouch?

You can buy this type of sensor in any online store, since they are very common in the world of 3D printing. Below I leave you two affiliate links to Amazon and Banggood. Of course you can buy them wherever you want, there are dozens of pages.

If you decide to acquire it through these links, it is my duty to tell you that a small commission will go to the project and we will be eternally grateful to you. In this way we can continue writing 3D printing guides and articles on interest. Or alternatively, you can follow us on our social networks.

BLTouch Original (Antclabs) Amazon Logo PNG e1579685453346 aliexpress logo
3DTouch Amazon Logo PNG e1579685453346 aliexpress logo banggood
Bigtreetech 3DTouch v3.0 banggood
Creality 3D BLTouch v2 Amazon Logo PNG e1579685453346


Or if you wish, you can use our component search engine, where you can compare prices in different Marketplaces (Amazon, Aliexpress, Banggood, etc.) with a single search and very easily.



Configure BLTouch / 3DTouch in Marlin

Marlin 12

Well, let’s start configuring our Marlin firmware to support BLTouch / 3DTouch sensors. As I explained in the previous article of Configure Marlin 2.0.3 from scratch, to activate the options you simply have to uncomment them. This is done by removing the two bars in front of each #define, this way the compiler can make use of them and add them to the final firmware.

We will start the configuration by editing the file Configuration.h with your favorite text editor (mine is Sublime). Once you have edited it, we are going to indicate to our dear Marlin that our 3D printer has a limit switch (sensor) on the Z axis. We will proceed to uncomment the USE_ZMIN_PLUG options.

// Specify here all the endstop connectors that are connected to any endstop or probe.
// Almost all printers will be using one per axis. Probes will use one or more of the
// extra connectors. Leave undefined any used for non-endstop and non-probe purposes.
//#define USE_XMAX_PLUG
//#define USE_YMAX_PLUG
//#define USE_ZMAX_PLUG


Now we uncomment the option Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN.

 * Enable this option for a probe connected to the Z Min endstop pin.


And in this other line of the code we are going to indicate that our installed sensor is a BLTouch / 3DTouch, which for Marlin come to be the same.

 * The BLTouch probe uses a Hall effect sensor and emulates a servo.
#define BLTOUCH


If we use a self-leveling sensor (either BLTouch or any other), we must indicate to Marlin the position of the sensor with respect to our print nozzle. This will necessarily be separated and we will define it as coordinates and in millimeters.

My leveling BLTouch is 37mm to the right of the nozzle, and 2mm behind it, so I would put the following settings. You must measure these values ​​to enter on your printer (do not use mine).

 * Z Probe to nozzle (X,Y) offset, relative to (0, 0).
 * In the following example the X and Y offsets are both positive:
 *   #define NOZZLE_TO_PROBE_OFFSET { 10, 10, 0 }
 *     +-- BACK ---+
 *     |           |
 *   L |    (+) P  | R <-- probe (20,20)
 *   E |           | I
 *   F | (-) N (+) | G <-- nozzle (10,10)
 *   T |           | H
 *     |    (-)    | T
 *     |           |
 *     O-- FRONT --+
 *   (0,0)
 * Specify a Probe position as { X, Y, Z }
#define NOZZLE_TO_PROBE_OFFSET { 37, -2, 0 }


Now we must uncomment the AUTO_BED_LEVELING_BILINEAR function and then the RESTORE_LEVELING_AFTER_G28 function, so that they remain active in our firmware.

 * Choose one of the options below to enable G29 Bed Leveling. The parameters
 * and behavior of G29 will change depending on your selection.
 *  If using a Probe for Z Homing, enable Z_SAFE_HOMING also!
 *   Probe 3 arbitrary points on the bed (that aren't collinear)
 *   You specify the XY coordinates of all 3 points.
 *   The result is a single tilted plane. Best for a flat bed.
 *   Probe several points in a grid.
 *   You specify the rectangle and the density of sample points.
 *   The result is a single tilted plane. Best for a flat bed.
 *   Probe several points in a grid.
 *   You specify the rectangle and the density of sample points.
 *   The result is a mesh, best for large or uneven beds.
 * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling)
 *   A comprehensive bed leveling system combining the features and benefits
 *   of other systems. UBL also includes integrated Mesh Generation, Mesh
 *   Validation and Mesh Editing systems.
 *   Probe a grid manually
 *   The result is a mesh, suitable for large or uneven beds. (See BILINEAR.)
 *   For machines without a probe, Mesh Bed Leveling provides a method to perform
 *   leveling in steps so you can manually adjust the Z height at each grid-point.
 *   With an LCD controller the process is guided step-by-step.

 * Normally G28 leaves leveling disabled on completion. Enable
 * this option to have G28 restore the prior leveling state.


Once the type of self-leveling that we want Marlin to carry out is configured, we will indicate with the GRID_MAX_POINTS parameters the number of probes (or tests) to be carried out. I usually make 9 checkpoints before each print, you can expand or reduce it, that is up to you.

// Set the number of grid points per dimension.


And since I always like to do HOMING in the center of the bed for safety, I activate the Z_SAFE_HOMING option.


#define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28).
#define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28).


Now we will save the Configuration.h file and edit a new file called Configuration_adv.h . The difference compared to Configuration.h is that it offers us more detailed customization options, and experimental or in development functions.

In my printer I use a leveling function available in Marlin 2 called BABYSTEPPING. This function allows me to calibrate the height of my leveling sensor in the center of the bed once with a sheet of paper.

Later, the printer will perform 9 probe points automatically at the beginning of each print. This way I won’t have to go corner by corner unnecessarily to calibrate my bed. By default it is deactivated, so we will activate the BABYSTEPPING option, as I show you below:

//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
#define BABYSTEP_MULTIPLICATOR_Z 20 // Babysteps are very small. Increase for faster motion.

#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
// Note: Extra time may be added to mitigate controller latency.
#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
//#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle.
#define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size.

//#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28

#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
//#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor

Well, these would be the basic options to configure your BLTouch. Of course, you can configure much more parameters such as limits, polls, travel speeds, etc. But for starters it is more than enough.


Installing BLTouch / 3DTouch

Configurar sensor BLTouch / 3DTouch con Babystepping en Marlin 2.0.3 (MKS Gen v1.4)

Regardless of where it is located with respect to the X and Y axes, which are the ones you must configure in Marlin, you have to position the BLTouch / 3DTouch sensor at a certain distance in height from your nozzle.

It is logically has to be within its range of action. When the probe is retracted, it must be above the nozzle (otherwise we will have problems). And when it is extended, it must lower several millimeters below the nozzle to be able to act.

The recommended is 2mm. As I have seen in some places, but it was a little short after some tests and I decided to set it to 2.5mm. that works for me correctly. Of course, this distance is at your absolute choice, it is only a guideline value.


BLTouch / 3DTouch electronic connection


As you can see in this image, the BLTouch / 3DTouch leveling sensors have two connection cables. One with three pins and the other with two pins, which will be the ones we will need to connect to our electronics.

In my case, I use MKS Gen v1.4, so the connection couldn’t be easier (just like in RAMPS). Below I leave you 2 images so you can see where the BLTouch would be connected on my board, and on a RAMPS board, much more common than the one I own.


MKS Gen v1.4 board connection

Configurar sensor BLTouch / 3DTouch con Babystepping en Marlin 2.0.3 (MKS Gen v1.4)

Very easy as you have been able to check, click on those 2 sites and that’s it. When you turn on the printer you will see that the sensor does a little checking (unfolds and retracts the probe).


RAMPS board connection

Configurar sensor BLTouch / 3DTouch con Babystepping en Marlin 2.0.3 (MKS Gen v1.4)

This connection is similar, but you must make sure that you have the jumper activated, so we will make sure that the level sensor reaches the 5v. necessary (very important).


SKR v1.3 board connection

Configurar sensor BLTouch / 3DTouch con Babystepping en Marlin 2.0.3 (MKS Gen v1.4)


SKR v1.4 board connection

Configurar sensor BLTouch / 3DTouch con Babystepping en Marlin 2.0.3 (MKS Gen v1.4)

Just one important thing. In the case that connecting the 2 wires to the Probe connector the sensor not works, try to connect to the ZMin connector. Depending of the firmware version of your Marlin, in some cases it gives issues, but if you connect to ZMin it will work perfectly.


Initial script (GCODE commands)

You will need to add the self-leveling function at the beginning of each print. This is done very easily by configuring yourself in your favorite Slicer (Repetier, Simplify3D, Cura, etc.). It is simply adding the G29 command to level your head before each impression.

I leave you an example of my startup script on each print:

G28          ; Make HOME on all axes
G29          ; Auto-leveling command
G1 Z5 F5000  ; Nozzle up
M75          ; Launch timer


Configuring the offset

Guía completa para configurar Marlin 2.0.x desde cero y no morir en el intento

To finish, and having activated BabyStepping you will have your own menu called Offset. You can access it before the printing process and during (yes, you read me correctly) the printing process by pressing the button twice on your display.

In this way, and in real time, you can adjust the offset while you are making the first printing perimeters, and leave a perfect fit. To me this has saved me the odd impression, the truth is that it is quite useful.

Once you have made the offset settings, don’t forget to save the value in memory. You should have an option called Record to EEPROM , as long as you have supported it in your Marlin. If you can’t find it, you can alternatively run the command M500 (Save settings). This will store all the current settings in your EEPROM permanently.



If you have read the complete article, I congratulate you. It would not be surprising if he had left me something in the pipeline, if so, do not hesitate to notify me in the comments at the end of the article Install and configure BLTouch / 3DTouch in Marlin 2.0.x (MKS Gen, SKR, Anet A8, RAMPS).

Finally remind you, as always, that you can find us on our Telegram channel full of maniacs by 3D printing at next link, or on our social networks (don’t forget to follow us if you like the web).


If you wish, you can find other interesting articles in 3DWork at the following links: