Posted on

CR-10 Auto Leveling Tutorial

CR-10 Auto Leveling Tutorial using an Inductive Proximity Sensor

Printer: CR-10 (300mm x 300mm x 400mm)
Firmware: Marlin 1.1.8

I have a CR-10 and I was looking into adding auto leveling to it but could not find a complete tutorial so I decided to compile everything I found out and what I made to make it happen.

Please READ the entire tutorial. I’m not responsable if you damage your machine following this steps. Be careful, you will be working with the internal electronics.

IMPORTANT:
1) I use a PEI sheet on top of the stock aluminum bed, this sensor works by detecting the metal bed. I haven’t test it on the stock glass alone, will post update on that later.
2) CR-10 board is limited on internal memory, so I needed to disable something on the marlin code to make it fit, so I disable the SD Card functionality, I don’t use it, I print from my Octopi (raspberry pi 3 connected on the USB port). If you know a way to disable another thing and make it work, I’m open to suggestions.
3) You need to solder a cable or find an alternative solution.

You will be replacing the z-probe with an inductive sensor. This feature will enable your printer to take several bed leveling readings and calculate a level plane so your prints are always level.

You will need the following:

1) Inductive Sensor
1) Sensor holder – Usually 3d printed, you can find some of them at thingiverse.com.
2) 1N4148 Diode
3) Raspberry Pi with Octopi
4) The bootloader already installed. You will be flashing a new firmware.
5) Knowledge on how to solder cables together.

My configuration for my printer on this tutorial:

Sensor Holder (3d Printed part, it use the stock fans):
CR-10 Fang with OEM ABL Sensor Mount
https://www.thingiverse.com/thing:2722884

Sensor:
URBEST 8mm Detecting Distance Approach Sensor Inductive Proximity Switch NPN NO DC 6-36V Cylinder Type
https://www.amazon.com/gp/product/B01M1777XK/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

Diode:
1N4148
https://www.amazon.com/gp/product/B01M7S2ROI/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

PEI sheet:
https://www.amazon.com/gp/product/B074XLD5QH/ref=oh_aui_detailpage_o02_s01?ie=UTF8&psc=1

References:
Marlin firmware:
https://github.com/MarlinFirmware/Marlin
http://marlinfw.org/

Useful youtube videos:


Special thanks to:
Kostas Karouzos, he was the one who posted on using a diode this way. Thank you!!!!

Kostas explanation:
Hi. I am using an LJ12A3-4-Z/BX.(NPN, NO). I powered it from 12 Volts. Tried both the resistor voltage divider and the regulator and they both work.
However, the high value isn’t exactly 5 Volts, and the LED on the sensor is always on, a little darker when the sensor is not triggered. (That has no functionality effect, I just don’t like it)
The reason why that happens is because the sensor’s output is actually open collector, and the only thing sourcing 12 Volts to the output when the sensor is not triggered is the led circuit, which also has a 10k resistor.
A better solution to interface the sensor to the board is to use just a diode, like this:
– brown wire to 12 Volts,
– blue wire to Gnd
– black wire to the cathode of the diode
– anode of the diode to the processor input
– internal pull-up enabled!
Any diode would work, I used a 1N4148.
Now the processor ‘sees’ 5Volts for high and ~0.6Volts for Low (diode forward drop), which is perfectly safe.
And the LED turns on only when the sensor is triggered!
Schematic:
BROWN ———- 12V
BLACK —–|<— uP
BLUE —————-GND

INSTRUCTIONS:

1) Print the sensor holder.
2) Install the holder

3) Mount the sensor, the sensor should be around 1-2mm higher than the nozzle tip.
4) Disconnect the power from the printer.
5) Open the CR-10 control box.
6) Follow this schematic to connect the sensor to the board.
BROWN ———- 12V
BLACK —–|<— uP
BLUE —————-GND

Black cable to the cathode of the diode to the input in the Z-stop end at the board.
The following photos were taken when I was checking the voltage, after that I inserted the sensor cable correctly to the control box from the back, attached the Brown cable to positive at the power supply, Blue to the available negative port and solder the diode in the right position to the black cable. To connect it to the board, I cut and use the original Z-probe connector plug. Make sure the black cable with the diode end been connected to the correct pin as shown on the photo. I used heat shrinking tubes to protect the cables I soldered and put everything back together and closed the box.



7) Power the printer on then Flash the following firmware.
Marlin_118_cr10_inductive_sensor

You now have Marlin 1.1.8 plus the inductive sensor installed.
IMPORTANT, don’t home the printer, it will crash to the bed if you home it on Z now.
ADD G29 after the G28 code at Simply3d or Cura so it makes the Auto level routine. You can also try the code in the Octopi terminal.

8) Now is time for the complicated part, the calibration.

In summary, you need to insert in the firmware or the EPPROM the offset of the sensor, where it is relative to the nozzle.
* +– 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 -46 // X offset: -left +right [of the nozzle] #define Y_PROBE_OFFSET_FROM_EXTRUDER -5 // Y offset: -front +behind [the nozzle] #define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // Z offset: -below +above [the nozzle] I measure the X and Y and came with these values, that should be the same for you if you used the same sensor and holder. Now you need to check your Z-offset until you find a perfect fit for your case. In my case it was -0.79. And now is printing awesome!. If you home Z, the printer should rise Z, go to the center of the bed and start lowering until it gets a signal from the sensor. In my case, I left the firmware at 0 and changed the value at the control box, that way I was changing the value, printing, testing again and again until I came with the perfect value for me. After you find the correct Z-offset, you can either change the 0 on "#define Z_PROBE_OFFSET_FROM_EXTRUDER 0" to your value or go to the control box Control->Motion->Z Offset. Remember to hit Store Settings to save your changes. It took me some time and a lot of printing samples to get to the perfect settings.

Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *