3D Touch Sensor Setup on Anet A8 with Marlin Firmware

In this article I will explain how 3D Touch sensor (one of the BL Touch clones) is installed on the Anet A8 using the stock extruder.

If you use E3D Bowden or other type extruder you can continue from Part 2. However you need to mount proper 3D Touch connected holder (example https://www.thingiverse.com/thing:2193695 or https://www.thingiverse.com/thing:2668564, there are many in Thingiverse) and adjust 3D Touch distance from the bed as described in Part 1.

I used new designed & latest version of 3D Touch sensor. (Where to buy link can be found end of the article)

Part 1 – Printing and Mounting the 3D Touch Holder on Stock Extruder

This holder designed by Mustafa Tokay (all credits goes to him) but not available in Thingiverse yet. Therefore click following button to download the holder STL file. You can also select some alternative 3D Touch holders available in Thingiverse (https://www.thingiverse.com/thing:2975487)

İndir “3D Files” 3DTouchHolder.zip – 71 defa indirildi – 749 KB

Then assemble the 3D Touch as shown in following pictures. You will need 4 pcs M3*30 type screws. We won’t use the ones come with the pack.

Then attach the holder with 3D Touch to the extruder unit.

This step is extremely important. 3D Touch probe and printer nozzle should be adjusted with this way. Make sure 3D Touch sensor probe in Retract position (up).

Then you must ensure that the distance between the 3D Touch and the bottom of the nozzle are within a range of 8 +/- 0.5 mm:

You can use paper type ruler or you can print following Leveling Height Gauge STL to measure the distance. https://www.thingiverse.com/thing:1538742

There is a video how to use this Leveling Height Gauge here.

I have measured that as seen in following picture using a paper ruler (8.2mm or 8.3mm is best). Position the nozzle to the bed. Use a paper to keep the nozzle distance around 0.02mm from the bed as you’re making the manual calibration. 


Step 2 – 3D Touch Wiring

In following picture you will see which 3D Touch cable should be connected to Anet board pins. You need to use your extension cables came with the sensor pack. Extension cables have the same colors as the main unit cables. Match the cable colors. (Double check this !!)

As you can see on the picture orange cable should be connected to LCD cable connection port Pin3. To connect orange cable to that pin there are two options;

Option-1: Soldering a pin

This option requires experience in soldering. You will need “90 degree male pin connector”.

You can get it from Aliexpress or Amazon or local electronics shop. You may prefer cutting the cable and directly solder. It doesn’t matter. We will connect orange cable here on 3rd pin shown in following picture.

Option-2: Cutting the LCD cable

Alternatively you can cut the 3rd cable counted from red line side of the LCD ribbon. This cable is unused. Cut it and connect 3D Touch orange cable. Then tape the connection. I suggest using Heat Shrink Tubing as you can see in 2nd picture below. You can get it from Aliexpress or Amazon or local electronics shop

 


Part 3 – Marlin Configuration Setup

When we finish the mounting and cable connections now we will alter some settings in Marlin configuration.h file.

Step 1- Config file modification

Backup and open your existing configuration.h file in your Marlin folder and open Marlin.ino file using Arduino IDE and switch to configuration.h tab.

Find following lines inconfiguration.hfile. In Marlin v1.1.9 it is around line 730

//#define BLTOUCH
#if ENABLED(BLTOUCH)
  //#define BLTOUCH_DELAY 375   // (ms) Enable and increase if needed
#endif
  • Remove // characters from beginning of //#define BLTOUCH line
  • Add #define SERVO0_PIN 27 beneath it.

It should read like this

#define BLTOUCH
#define SERVO0_PIN 27
#if ENABLED(BLTOUCH)
  //#define BLTOUCH_DELAY 375   // (ms) Enable and increase if needed
#endif

We now activated the BLTOUCH (and clones) in Marlin configuration.

Then find following part. In this part we will tell Marlin where our 3D Touch will be placed around nozzle. If 3D Touch will be installed right side of the nozzle (X axis) offset value will be (4) positive. Opposite side is (-) negative. Same should be done with Y and Z axis.

/**
 *   Z Probe to nozzle (X,Y) offset, relative to (0, 0).
 *   X and Y offsets must be integers.
 *
 *   In the following example the X and Y offsets are both positive:
 *   #define X_PROBE_OFFSET_FROM_EXTRUDER 10
 *   #define Y_PROBE_OFFSET_FROM_EXTRUDER 10
 *
 *      +-- BACK ---+
 *      |           |
 *    L |    (+) P  | R <-- probe (20,20)
 *    E |           | I
 *    F | (-) N (+) | G <-- nozzle (10,10)
 *    T |           | H
 *      |    (-)    | T
 *      |           |
 *      O-- FRONT --+
 *    (0,0)
 */
#define X_PROBE_OFFSET_FROM_EXTRUDER 81   // X offset: -left  +right  [of the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0   // Y offset: -front +behind [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER 0   // Z offset: -below +above  [the nozzle]

Here is an example how X-axis distance will be measured. Our printed holder distance is approx. 81mm (measure yours). Write this value in X_PROBE line. When 3D Touch probe is in react position (up) it should be min 2mm, max 3mm higher from nozzle end point. If it is 3mm set Z_PROBE value as 3.

And now enable Z_SAFE_HOMING (around line 1145). When you enable it nozzle with go to the center of the bed.

#define Z_SAFE_HOMING

#if ENABLED(Z_SAFE_HOMING)
  #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).
#endif

Then find Z_MIN_PROBE_ENDSTOP_INVERTING and change it false

#define Z_MIN_PROBE_ENDSTOP_INVERTING false  // set to true to invert the logic of the probe.

Find AUTO_BED_LEVELING_BILINEAR (line 979) and enable it (remove //)

//#define AUTO_BED_LEVELING_3POINT
//#define AUTO_BED_LEVELING_LINEAR
#define AUTO_BED_LEVELING_BILINEAR
//#define AUTO_BED_LEVELING_UBL
//#define MESH_BED_LEVELING

Find following code block (around line 1027) and replace with following.

  // Set the boundaries for probing (where the probe can reach).
  #define LEFT_PROBE_BED_POSITION (X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER)
  #define RIGHT_PROBE_BED_POSITION (X_BED_SIZE - MIN_PROBE_EDGE)
  #define FRONT_PROBE_BED_POSITION (MIN_PROBE_EDGE + Y_PROBE_OFFSET_FROM_EXTRUDER)
  #define BACK_PROBE_BED_POSITION (Y_BED_SIZE - MIN_PROBE_EDGE)

Find following code and enable that

#define NOZZLE_CLEAN_FEATURE

Finally check following part and make sure EEPROM_SETTINGS parameter is enabled. (No // beginning of the line)

#define EEPROM_SETTINGS   // Enable for M500 and M501 commands

Step 2- Uploading the Firmware 

Upload the new modified Marlin firmware to the printer.

If you want to know more about those sensor related marlin config parameters you can check this article: http://www.cazda.com/en_US/bl-touch-sensor-positioning-and-parameters-in-marlin/


Part 4 – Final Adjustments

In this part we will make some fine tuning on the bed and sensor. We will need gcode terminal application. This is available in Repetier-Host and Simplify3D but if you don’t use those applications there is free application available named Printrun-Pronterface. This app is available for both Windows and Mac and can be download from https://github.com/kliment/Printrun/releases/tag/printrun-1.6.0

Download and open ZIP file and run it.  Select connection COM port and baud rate (115200 suggested) and click Connect.

When connection established you will see some existing parameters set in your printer eeprom on the right gcode entry panel.

Click on home button  and wait until the extruder gets in home position. 3D sensor will move the center of the bed. (If it is not positioned in center, you need to adjust X_MIN_POS and Y_MIN_POS values in configuration.h file. Check this article later.)

Send following gcodes commands in gcode panel one by one.

M851 Z0
M500
M501
M503

On gcode output panel at the end you will get echo: M851 Z0.00 message.

Send following code for Z homing

G28 Z0

Send following command to send nozzle to zero position. Nozzle will go down towards to bed.

G1 F60 Z0

Then send following command (Soft end stops – off)

M211 S0

At this position move the extruder nozzle to the center of the bed using the +x way movement circles. Use 1 and 0.1 step circles for better positioning.

Then get a piece of paper and place under the nozzle.

If you can move the paper too easily and there isn’t any resistance then the nozzle is too far away from the bed. If so, similar to manual calibration process, move the paper front and back while adjusting z-height on the application until the nozzle is causing some resistance. 

Now read your Z value shown on the LCD screen. Probably it will be minus. We should also add the paper thickness over this value. Average 80 gsm copier paper is around 0.06mm thickness. When we add this over the Z value, now our Z value becomes -1.69-0.06 = -1.75

Now send following gcode using your own value.

M851 Z-1.75

Lets enable the soft endstops by sending following code.

M211 S1

Send following one by one. Now we will store the Z value in EEPROM.

M500
M501
M503

Then remove the paper and take the extruder in home position by clicking on 

You can check this video.

Thats all.


Part 5 – Start & End gcodes setup in Slicer Settings

Make this change if you want to add auto bed leveling before the each print. 

Start g-code

G21            ;metric values
G90            ;absolute positioning
M82            ;set extruder to absolute mode
M107           ;start with the fan off
G28            ;home position
G29            ;bed leveling with BLTouch/3D Touch
G1 Z15.0 F600  ;move the platform down 15mm
G92 E0         ;zero the extruded length
G1 F200 E3     ;extrude 3mm of feed stock
G92 E0         ;zero the extruded length again
M117 Printing...

End g-code

M104 S0                      ;extruder heater off
M140 S0                      ;bed heater off
G91                          ;relative positioning
G1 E-1 F300                  ;retract the filament to release pressure
G1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit
G28 X0 Y0                    ;move X/Y to min endstops
G90                          ;absolute positioning
G1 Y190 F9000                ;(optional) move heatbed to front
M84                          ;steppers off

 


With this updated version of 3D Touch solves the impact of tremor on the sensor during 3D printer movement.

   

Updated version can be purchased from following links:

      


If you want to be the first to know about 3D articles, join my Facebook group and this one as well.


If you like the article or topic and it worked for you, you can send some coins to the following BTC or ETH addresses to buy a coffee for me 🙂

BTC: 1BQa1dQVzGySnNTLVvn3AZrPkQSJXDbZxi
ETH: 0xf467adb07d910e985d0dd08442c246a66bbc0eec

Alternatively to keep this blog up and running you may use following affiliates links to buy your needs. Cheers…


Anet A8 Related Articles: