How to Install a Capacitive Bed Leveling Sensor on Anet A8 3D Printer


Today we’ll learn to install a bed leveling sensor on Anet A8 3D printer with Mr. Daniel Kreuzhofer from the Crosslink YouTube channel.

Importance of a bed leveling sensor

A bed leveling sensor helps your 3D printer to find out how far the nozzle is away from the print bed. That’s specifically important for the first print layer. If you want the first print layer to stick very well to the print bed, the distance between the nozzle and the print bed needs to be very thin. Without a bed leveling sensor, you have to manually adjust the height and level the print bed with the four knobs underneath the corners of the print bed. The problem is it doesn't work pretty well and always has to be redone every time if you change something on your Anet A8 3D printer. For example if you change the filament, you also have to level the print bed again.

But with a bed leveling sensor installed, this whole process is automatically done every time when a new print starts. And you will never have to do any kind of leveling again once you calibrate the sensor properly.

I - Preparation

1. Get the right leveling sensor for your Anet A8 3D printer on Ebay or Amazon.

There are a lot of different leveling sensors available on the market.


A capacitive sensor with JST connectors works on a glass bed is recommended.


There are some drawbacks when using a capacitive sensor. It’s a little bit sensitive to the ambient temperature and humidity. They must be the same for leveling the print bed and for doing the print. Otherwise, you’ll get different result.

Sensor must have 3 connectors to do this project.

Sensor recommendation:

Autolevel Sensor Inductive Auto Level LJ18A3-8-Z/BX for Anet A8 A2 A6 3D Printer

2. Print the sensor holder out.

You can either print the front mount or the back mount. It depends on where you want or if you want other parts to be installed on your extruder.
This must be done before you go to the modification steps because the printer will be unusable once you already start the modification.
Front mounting:
Thingiverse: 1852762


Back mounting:

Here Mr. Daniel chose the front mounting (see below picture) because he had something else mounted to the back of the extruder.

II - Mount the Capacitive Sensor

1. Unmount the original access sensor on the printer.

2. Mount the capacitive sensor onto the printer with the holder you printed.

3. Connect the wiring.

III – Measure & Decide X/Y Axis Distance Value

1. Measure out the X axis and Y axis distance from the sensor tip to the nozzle tip with a triangular ruler.

2. Write down these values on a paper.

3. Find out whether the values are positive or negative.

Mr. Daniel got 65mm in X axis and 60mm in Y axis.

However these values cannot be used directly in a configuration file. We need to find out whether they are a positive or a negative value related to the nozzle.

4. Draw the bed, the nozzle and the sensor out on the paper.

•• Nozzle position

○ Sensor position

5. Decide if the values are positive or negative.


We regard the left corner as the 0.0 start of X and Y axis.

The sensor is to the right of the nozzle, so the X axis distance is a positive 65mm.

The nozzle is behind the sensor at Y axis, so we get a negative distance value, -60mm.

+So we get the value for configuration setting: X 65 / Y -60.

IV - Install Marlin Firmware

Watch Marlin firmware installation instruction video made by Daniel to learn how:

V - Configure Marlin Firmware

1. Visit to learn how to do the configuration on marlin firmware.


Information in this page is a little bit outdated because the settings have slightly changed for the latest firmware. We can’t really adapt this 1-on-1 because some of the settings can’t be found. For example, enabling the bed leveling functionality has changed.

2. Download the “Configuration.h” file below and revise the X and Y value according to your measurement.


3. Revise the downloaded “Configuration.h” file with the new probe offset value (the X/Y axis distance value in previous section) to the extruder you measured.

See reference on the link in step one and find the Marlin section.

4. Flash the Marlin firmware with the revised “Configuation.h” file to your printer.

VI - Calibrate the Nozzle & Sensor

1. Power on the printer and preheat the nozzle and the print bed.


Press the button on the control panel to select “Prepare” and go to “Preheat PLA” menu. And then select “Preheat PLA”, the printer will start warm up. Wait for 10 minutes or more until the printer totally warms up in the nozzle and the print bed.

2. Back to the main menu and select “Control”, “Motion” and then the “Probe Z offset”.

3. Set the Probe Z Offset value to “-01.00” because the sensor is a little higher than the nozzle.

4. Go back and select “Store settings” to save the probe Z offset value.

5. Go back to the “Prepare” menu and select “Auto home” option.

6. The printer automatically homes the nozzle.

Note: keep the print bed and nozzle warmed up during the calibration.

7. Put a piece of paper under the nozzle and observe the distance.

8. Go back to the main menu and select “Prepare” and then “Move axis”.

9. Select “Move Z” and then select the “Move 0.1mm”; the nozzle is about to move down by 0.1mm every time when you press the lower button on the right of LCD screen.

10. Press the lower button to move the nozzle down until a slight motor vibration and a tight friction can be felt while we slide the paper between the bed and the nozzle.

11. Now we get the “Move Z” value: +0.4.

Right value for “Probe Z offset” = 0.4 + (-0.1) = -0.6

12. Go back and set the “Probe Z Offset” value to “-0.6”.

13. Store the setting as we do in previous step.

14. Go back to main menu and select “Prepare” and then “Auto home” again.

15. Place the paper under the nozzle again after the printer finishes auto homing.

Tips: we can see the paper is moving easily. Auto home gives you a little more distance and the nozzle doesn’t go as low as it would when the printer is not printing.

16. Go back to the “Prepare” menu and select “Move Axis” and then “Move Z”.

17. Select “Move 0.1mm” and we see the “Move Z” value is 0.6mm.

18. Press the lower button to set the “Move Z” value to 0.

19. Slide the paper until we can feel a perfect space between the nozzle and the print bed.

VII - Initiate Bed Leveling & Do the First Print

1. Connect your printer to Cura.

2. Load model file into Cura and slice it and send them to your printer.

3. Select “Settings”, “Printer”, “Manage Printers” and then click on “Machine Settings” on Cura

4. Paste the G-codes below into the “Start G-code” section to initiate it to use the auto bed leveling feature.

*** Start G Code Sequence for Bed Leveling (do not copy this line)

G21 ;metric values

G90 ;absolute positioning

M82 ;set extruder to absolute mode

M107 ;start with the fan off

G28 ;move X/Y/Z to min endstops

G29 ;auto level

G1 Z15.0 F9000 ;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

G1 F9000

;Put printing message on LCD screen

M117 Printing...

*** End of GCode sequence (do not copy this line)

5. Now the printer will automatically calibrate at 9 points and we can do our first print.

Thanks to Mr. Daniel Kreuzhofer again that we can install capacitive sensors onto our Anet 3D printers for auto bed leveling features.

Previous article Tips for Easy Anet A8 Plus 3D Printer Assembly
Next article Anet A8E 3D Printer Installation


jesus - April 8, 2021

ya realize todos los pasos pero cuando intento copilar el programa me dice Error compilando para la tarjeta Arduino Mega or Mega 2560.

Leave a comment

Comments must be approved before appearing

* Required fields