3D printing guides: Setting up auto bed tramming leveling tilt compensation!

3D printing guides: Setting up auto bed tramming leveling tilt compensation!

I’m Tom and today I’m going to show you how to set up automatic bed leveling or automatic bed trimming on your printer now people are still figuring out how to exactly call this procedure since neither leveling nor trimming are technically 100% correct but because tramming is a bit closer to what we’re doing here that’s what I’m going to call it for the rest of this video and what exactly are we trying to do here you might ask easy we are going to replace the ZN stop with a sensor that detects if and how much the print bed is tilted in any direction so if one of the adjustment screws is off by a tiny or a larger bit the printers firmware can then automatically tilt the printed model accordingly to compensate for that which gives you a perfect first layer and good adhesion without ever having to manually adjust and trim the print bed ever again after the initial setup that is in fact printable trust this process so much that they don’t even provide a way to adjust the print bed at all on their new printers so let’s get started you will need the following things 1 a 3d printer obviously 2 an inductive sensor there are other ways for probing the surface of the print bed but these sensors are really the most reliable and most straightforward way to do it the sensor I’ll be using is the exact same model that printable uses as far as I know and in fact you can even order one from them or from the links in this video’s description 308 to mount set sensor to your printhead as close as possible to a hot end but not touching it of course you can use anything that you can screw the sensor onto I use the 3d printer part as the easy way out but as always don’t use PLA to print parts that will be sitting close to a heater bed we’re close to the hot end that stuff will melt for an aluminum print bed now this is the one big catch when using these inductive sensors because they simply can sense glass acrylic glass Tufnell or heater PCBs these sensors are ready for a four millimeter sensing distance onto a thick slab of iron but since aluminum is less inductive if you need to bring closer to the sensor to trigger it and now putting a thin aluminum sheet under a glass bed does not work I tried if you have a heated bed aluminum is superior to glass anyways as it makes for a more evenly heated surface and has no risk of shattering you will also need two resistors with the larger one having roughly 1.5 times the resistance of smaller one so for example 10k ohm and 15 km or 22 km and 15 km you know just somewhere in that ballpark you will also need a readily configured version of your printers firmware I will be showing you how to set up modeling for this task so first of all we will be preparing the sensor for use with your electronics the two resistors are there to reduce the output voltage from 12 volts to 5 volt since the sensor will need to run off of 12 volts but your electronics need a 5 volt signal if you look onto the side of your sensor you usually see a short wiring info in this case Brown for the input voltage black for the output and blue for ground yours my different so to reduce the output voltage we are going to create a simple voltage divider so here’s your printers 12 volt supply Zn stop signal input and the zero volt or ground plane connect 12 volts from your printer to the input voltage input of your sensor connect ground to ground then connect the larger resistor from sensors output to the end stop input and the smaller resistor from the end sub input to ground that’s it if you wanted you can check if the output voltage is really 5 volts with a multimeter but if you used the right resistors you should be golden here in my case it read 3.3 volts but anything above three walls is okay now I saw that the resistors directly to the wires and sealed everything up in shrink-wrap but you can also make a little circuit board and do it that way you also need to wire a connector to just a signal line or you can also use the ground connection from there and use a two pin connector next up you can remove your current Zn stop and unplug it from your electronics then mount the sensor to your carriage connect the 12 volts and zero bold lines and plug in the end stop connector to uz- n sub input yes I’m showing this glorified version on a bear Rambo as this is what the electronic compartment of my printer looks like not much to see there right up next firmware as previously stated you need to have your firmware all set up for regular use already so let’s open up your config file and get hacking in the configuration you will need to double check the following settings you will need to disable the end stop pull-up for the Z sensor so depending on whether or not your current end stops are using the pull-up resistor you should make sure that install pull-up Z min is commented out here or here but you can simply just comment up both spots by the way you turn a line into a common and hence disable that line by adding a double forward slash in front of that line next you will need to set the Zeeman end stop inverting setting to true since the output of the sensor we are using here is high when it’s not triggered and low when it is then you will need to make sure that you are homing to minimum on your z-axis this is the default setting on most printers but for example my Mendel 90 homes to the top of the X’s to keep the hot end and print bed from doing the touchy-touchy thing when things should go wrong also check that your Z min pass is set to 0 next up we will start messing with the actual auto leveling or Auto trimming or auto bed tilt correction settings right on top enable pad trimming altogether by uncommenting this line and then choose which type of trimming your printer should do the text accompanying this part explains pretty nicely what the grid and three-point modes do I will be using the grid but for example printable uses the three-point method so that choice is up to you so for setting up the grid all you need to do is tell it which area of the print bed it came Pro just keep in mind that you are telling it the spots that the sensor will lower onto and the firmware will try to reach those spots while ignoring the physical dimensions of the printer so if I try to probe the very rear of my bed the carriage would slam all the way to the front while trying to reach that spot with the sensor so limit that area to regions that your sensor can actually reach also make sure that you are jamming into any screws or binder clips and keep a bit of a distance to them since that would influence the sensors reading next important setting offset from extruder this tells the firmware at what spot relative to the nozzle your sensor is sitting since mine is sitting 75 millimeters in front of the hot end I’ll enter 0 minus 75 0 here these values don’t need to be super accurate but should be somewhere in the right ballpark will calibrate the Z offset later so we’re going to set that to 0 for now for the other settings negative values mean that your sensor is sitting closer to the minimum position of each axis so the front and left sides of your bed while positive values mean that the sensor is further away from the minimums I also changed all these Ray’s values down here to one millimeter but the defaults work just as well with just a little slower there is one more setting you need to adjust and that is found over in the configuration add file particularly you need to enable n stops only for homing otherwise you won’t be able to adjust offset off the sensor properly and that is it you can it upload and enjoy all that auto-leveling goodness being pumped onto your our Torino or whatever motherboard you are using so let’s jump over to our printer host and try things out that we hate but wait before that you should of course have installed that aluminium print bad top if you have been using glass or any other non inductive surface before I already smeared a thin coat of glue stick onto my aluminium plate but again you can use any topping you want as long as it isn’t too thick so captain or finish tape work but not a thick sheet of Tufnell I personally just stick to glue stick haha since I find that just works really well for almost anything that I’m printing so in the host first of all you want to check that the firmware is reading the end stop correctly and you can do that by sending m1 1:9 and checking if the Zeeman and stop shows up on triggered correctly then hold a metal object to it while sending another m-19 and make sure that it now says trigger next check that the sensor is actually at about the right height relative to the hot end which is about a millimeter above the bed when the nozzle is just touching the bed surface the sensor should trigger and light up in this position if it does not adjust its height until it does now for the fine-tuning there are three ways to do it one is by using AG 92 command which lets you temporarily set a position offset independently of the probe so you’d have to add that right after the g28 Z so the home command in your start g code the other option is going back into your firmware config and adjusting the probe offset that we simply set to zero before and lastly you can also adjust the height of your bed probe but that will tap the heart and onto the bed each time the bed is probe so it’s probably not the best choice in my case I’ll show you how to do it properly through the firmwares offset settings so to figure out the right offset value you want to home Z which now moves to the center of the bed then send AG 29 to run through the auto trimming procedure then grab a piece of copy paper and slide it under the preheated hot end and send a G 92 z10 which tells the printer to assume that the print head is now actually 10 millimeters above the bed surface then move the z-axis down in increments of 0.1 millimeters until the tip of the hot end just touches the surface of the paper if you kept track of how often you click the move button you now know you’re off set but you can also send m11 4 to see how much length of that 10 millimeter offset on Z you have used up to get down this far the offset you’ll get should be around or less than one millimeter enter that into the Z probe offset from extruder as a negative value since the trigger point of the probe is actually closer to the bed surface then the tip of your hot end then re-upload from where and you’ll be able to move the hot end down all the way after running the auto leveling procedure now there’s only one more thing left to do and that is to add the auto charming procedure to the start g-code of your slicer and for that all you will need to do is to open up your slicer look for the g28 aka home command and add AG twenty-nine right after that line and you’re done you should have now successfully set up automatic back training surface to compensation leveling on your printer of course you’ll still need to fine-tune the height offset depending on how the first layers of your prints turn out for which you can use the Z offset setting in your slicer and that’s it no more manually fiddling around with the adjustment screws off your print bed let me know in the comments below how this worked out for you and please leave a like on this video and share with your 3d printing buddies if you did actually like it but wait there’s one more thing that I would like to point out to you again and that is Tomlin’s toolbox Kickstarter for 6 new and awesome types of filaments that each have unique and spectacular new properties so go check that out and support them I put a link to that in the description so that’s it for today as always thanks for sticking around this long and watching this video all the way to the end I appreciate it you

About the Author: Michael Flood


  1. (4mm 300mAh DC6-36V Inductive Proximity Sensor Detection Switch NPN LJ12A3-4-Z/BX )
    are this sensor need any thig or connect directry

  2. what type of resistor did you use and what is the wattage etc. etc I just want to know because radioshack is asking when I call to buy some

  3. Has anyone tried this with a Monoprice Mini/Malyan M200? I want to setup auto bed leveling and I'm not sure if the controller is the same as described in the video or not.

  4. Hi,
    I 'm not sure what's happening with my sensor which is the 8 mm inductive npn one. Before adding the Voltage divider I put in 12V across blue and brown and get a 12V signal on the black when I hold the sensor near metal and 0V when the metal is removed. When I add the Voltage divider as Tom did (double checked and resistors measured with multimeter to test) I get 3.6V signal on black when not near metal and 0V when I put sensor near metal.

    What have I done wrong? can I use this as a normally closed (nc) switch for bed levelling/tramming?

  5. The ENDSTOPS_ONLY_FOR _HOMING command is not in the later versions of Marlin. What do I do now, everything else appears to be working as it should?

  6. Procedure for determining the Z offset mentioned in this video does not work with new Marlin from main Github repo (March 2017). See https://github.com/MarlinFirmware/Marlin/issues/3647 – and in particular :
    "@Blue-Marlin Correct. The G92 command can no longer be used to overcome the software endstops.

    "If you are at Z=0 after homing with G28 and you issue the G92 Z20 command, this tells the machine that the current position is now Z=20 (no longer Z=0), and the software endstop for Z gets 20 added to it so that you still cannot move any lower.

    If you want to move lower than the Z home position, you must change your physical limit settings, which determine where the software endstops are set. Change Z_MIN_POS to something below zero (-2 for example). But still set your Z_HOME_POS (and/or MANUAL_Z_HOME_POS) to zero. Then when you home you will be at Z=0, but your machine will now allow you to move to -2mm."

  7. In my case I had to add the "M420 S1" command to my start gcode in order for the autoleveling to be enabled. is there a setting in the firmware (skynet3d) that I should enable to avoid this issue? As without it my nozzle would run right into the build platform.

  8. Hi Tom,

    I have a hictop prusa i3 with 24v power and connecting lj18a3-8-z/bx (6-36v) to 24v with 8.1k+22k resistors on signal I have 12v that is too big, how should I do? tia

  9. Hello, Thomas. I recently installed on my Prusa i3 an inductive sensor for auto bed leveling. I followed your tutorial on that and managed to get the correct responses from the printing, meaning that the probe provides the printer the correct trigger when encountering a metal object. I also installed a MK3 aluminium bed, that is functioning properly. I am using Repetier Host. My issue is that when I try to home the axes, with G28 XYZ or by clicking the home button in Repetier, the axes go to X=0, Y=0, that is outside the bed and then begin to home Z. I tried using safe homing for Z or manual homing positions for X and Y, but with no luck. Do you know if the issue is with Repetier or with the firmware? Thank you.

  10. Has anyone been able to get this type of sensor working with a MKS Gen_L V1.0 board?
    I can not seem to get it working for that board. The Sensor itself works and has the right voltage but when I run M119 I only get what I set in Marlin. The sensor detecting the aluminum bed does not change it. I have tried every setting combination in Marlin that I could think of with no luck. I am wondering if my problem is the board itself. I read somewhere that one person's MKS board had physical pullups on it. Not sure which board it was as they just said MKS. In that thread one person wrote that you have to desolder them. If possible I would like to NOT go that route if my board has that and that turns out to be my issue. Any help would be appreciated.

  11. Not working! Tried that proposed voltage splitter and varied it in many ways: No way to get it work. Also you say that any resister combo that is 1/3 vs 2/3 will work. I doubt that because the overall resistance will limit the max current of the signal. I do not understand how this was posted here on Youtube. Did you use a special machine or did you never really try that out? It is all theory it seems. A myth that has cost me 2 days fumbling. Will use another sensor solution or add an relay.

  12. Hi, would you be willing to make a video about how to do z-probing using the Smoothieware with proximity sensors. I read through the documentation on smoothieware.org but I don't quite get it.
    – What is the interaction between the Z-endstop and the z-probe?
    – Why does the distance between the probe and nozzle in the Z-domain not matter?

    I use a inductive sensor against an aluminium plate and I understand that the G32 command with smoothie just defines relative offsets not directly related to the absolutre bed height. For this to work as intended you must have both the relative offsets AND the absolute distance to the nozzle tip. Where and how should this distance be established? reading the positions after a completed probe and a subsequent home all (G28) the Z value might not be 0. Why? If the endstop does not set the Z to 0, how do I define the bed height?

    So far, I only tried out the three-point strategy. Does the matrix strategy work in the same manner as the 3-point regarding relative offsets?

    BTW, I always follow your videos. Great work! Keep it up!
    Thank you

    Bgrds /Thom

  13. I followed this tutorial but my port isn't triggered although my probe is. The m119 command returns open wether the led is on or off.

    My voltage drops from 4.1v to 2.3v when close to a metal object. I'm guessing that isn't enough. How should I fix this?

  14. Couple month ago I've tested a LJ18A3-8-Z/AX sensor and I was able to trigger it with small cut of aluminum from my coke container! I also tried aluminum foil and it triggered fine. But I did not try to install the sensor onto my printer and run some real tests because I have now HE280 from SeeMeCNC and it uses calibration installed in the Hot End circuitry. I also tested similat sensor LJ12A3-4/ZBX and it performed same with aluminum foil .. as described above.
    Thanks for your videos Thomas!!!

  15. Hello, somebody know what firmware Tom use in this tutorial. I try to use the last stable version but i am lost not working.

  16. When i set the ZProbe offset on Marlin firmware, it is not needed to use M500 to save the offset on EEPROM, am i right ??
    Also, is it not needed to put the offset on Cura/Repetier Z-OFFSET field ??

  17. what a mistake…i watch your stuff and what you said made my day…you made a whole meaning of configuration file…lol, ty for that…

  18. Is that PNP or NPN sensor? I've read that NPN sensor is connected to positive (i mean load wire is connected back to positive… 12v….load (15k & 10k wired to plus… ground)) then is PNP opposite.. 12v than load with resistors (15k and 10k) back to minus… and at least ground wire.

  19. So can I have tape over the aluminum bed, or a build tac sheet?

  20. Thank you for your good explainations!

    I'm having some trouble with my autoleveling on an Anet A8 with Skynet 2.4.3 Software.
    I calibratet my sensor like the toturial from Skynet told me. I get really good results over the whole bed if the sensor mesures right.
    Now to the IF: When starting a print the height of the sensor varies about 0.2 mm after the leveling. Sometimes it works sometimes not… I have no good explaination for that.
    I already turned of the heat bed when the leveling process starts and wired the cable as far away as possible from other cables to avoid any electric fields.

    I need some good ideas to get this fixed 😉

  21. If the bed is tilted out of parallel with X or Z, will it print a box at an equal tilt so the box remains square?

  22. On my benchtop power supply I am getting between 5.1v (when I have exactly 12v input) and 5.6V when I have it around 12.5V which is what I think my printer is actually outputting. Will this be alright?

  23. I just added this to my Prusa i3. When I am moving my z axis around in Repetier, the height difference between the left and right z stepper motor is not right. example, I tell it to move 30 mm up and it doesn't make it all way because it binds and I hit emergency stop, after I do that I measure height difference and they can be off 2-3 mm or more. Any idea what to change? I think they are both wired into the same stepper controller on back of Ramps, is that correct? Any advice is much appreciated.

  24. A little simpler when using a pnp sensor is to use a zener diode (in reverse) and make sure the pull up resistor is active…

  25. Does anyone know what is happening with my setup? I've used an NPN induction sensor with the same voltage divider. When untriggered the voltage is about 3.36V, when triggered the voltage is 0.35 ish. When using the m119 the state of the sensor is cycling between open and triggered. Almost every time i send the m119 command, it has changed state. What the heck is wrong, and how to fix it? Any help would be much appreciated!

  26. I havent got a level sensor, and that when I set up the printer that the hot end to the bed hight is done, but when I hit print the hot end is abouv the first layer hight by about 3mm, and all is set for 1.74mm filament, so thinking it must be frmware offset of somekind but not sure where it could be,, as this would possibly still happen with a level sensor as well, as that bed level is set as via the end stop and bed hight,, where could it be fixed ?

  27. How does someone work out wattage needed, as of for 12v or 24v to the 10k and 15k resistor, as that when buying the resistors that also wattage is shown to be differnt than voltage and K ohms value.
    I seem to recal a math problem to get a answer to this, but not sure if it's, volt divid k = watt or if it's, volt times k = watts?

  28. hey guys, quick question. I set up my whole printer and everything works. but when I start a print, the printer homes and then the hotend digs into the bed, the z probe is as far as it can go. Where can I adjust this in firmware? I am kind of in a rush so any help is much appreciated.

    Many thanks!!!!

  29. Actually…. Instead of a voltage divider, I'm kinda wondering why you can't use a zener diode straight in series with the sensor output.

  30. Tom, I know this is referring to an older version of Marlin. I enabled this for my first printer, a Geeetech i3 Pro X and it works beautifully.
    I am trying to duplicate it for my new build (a Wilson 2), however, once enabled, the Z home is NOT moving to the centre of the bed with a G28 is not working, it's simply homes to 0,0 as without bed leveling enabled

    I feel it would get a better starting point for the grid (3×3 points) if it started in the centre, as yours does at 9:55 and my old printer does too.

    For reference, I am using Marlin 1.1.4 on my new printer. Do you know if homing Z to the centre is an option in this new version?

  31. Hi when I home z it automatically goes back up not giving me a chance to try place the paper underneath also the pause option is blanked out any help would be appreciated.

  32. You should update this video for 2017. It was all kinds of wrong even in 2014 because you skipped steps after you set the sensor height.

  33. If I use a capacitive sensor instead of that inductive one you are using, would it not be possible to use a glass bed then?
    And is it not better to use a L7805CV instead of that voltage splitter with resistors?

  34. Please do an update on this tutorial. There's so many new features and settings in new firmwares. This video is 3 years old!

  35. Hi

    i want buy this sensor for my ANET A8 3D PRINTER
    but i dont know if i buy this one:

    or this one:

    can you help me to get the great choose ?

    and can i buy a support(hanging) for fix it in my printer ? where i can found this support

    thank you

  36. You can simplify the circuit by using a 1n4148 diode with the black strip side looking to the sensor. This way you drop the sense pin to 0.7V (logic zero) and keep the z endstop as a safeguard. It works, tested.

  37. after I try this always fails to upload, there may be a little error but I do not know, so please if you have firmware that can already please give video link or download link 🙂

  38. The transistor isn't needed with an NPN sensor, all you need is a diode like 1N4007 in series with the black wire sensor output and the MCU input (a schottky type isn't even needed as the MCU is 5V and the logic levels are good), with cathode pointing towards the sensor. There should also be a pull-up on the sensor's input but most boards have one already, if it doesn't just turn on the pull-up on the MCU input pin.

  39. Tom, as usual great video. I do have a problem. I am the 9:20 mark in the video and I see that after doing a G28Z followed by a G92Z10, I can't go past 0.00 (get a negative value) in my display so that I can determine the z-offset. Any help would be appreciated. Thanks in advance.

  40. resistor voltage divider is not a good idea…. it depends on load of the circuit… you need a transistor or you risk to blow up your electronics… (and resistors can became very hot)

  41. I have been trying to set up auto leveling on my Tevo Tarantula (runs off an Arduino Mega 2560 board) using a

    LJC18A3-B-Z/BX 1-10mm Capacitance Proximity Sensor Switch NPN NO DC 6-36V 300mA.

    I have done a LOT of reading and trolling websites and YouTube videos before taking on this task… Unfortunately I ordered the probe before I knew that the NO state is not the preferred option…

    In any case I believe that I followed Toms and Jim Browns guide quite closely. And the set up using a resistor based voltage divider does not work…. And now I am out of ideas.

    When the ground and signal leads are NOT connected to the board everything behaves as expected:

    +4.5 V between signal and ground lead when the sensor is away from a surface (not triggered state in NO – sensors), LED on sensor is off.

    +0.2 V between signal and ground lead when the sensor is close to a surface (triggered state in NO – sensors), LED on sensor is on.

    (After a lot of troubleshooting I found out that) when the hen the ground and signal leads are *connected to the board* something completely weird happens:

    +4.5 V between signal and ground lead when the sensor is away from a surface (not triggered state in NO – sensors), LED on sensor is off.

    +4.8 V between signal and ground lead when the sensor is close to a surface (triggered state in NO – sensors), , LED on sensor is on.

    I checked an double checked that the Configuration.h settings are advised by Tom and Jim etc. and tried a few different permutations.

    I am guessing that somehow that 5V normally supplied across the Z end stop switch supplied with the printer is somehow being activated and supplied through the sensor circuit, and as a result the board sees 5V across this connection whether the sensor is triggered or not.

    Does anyone have any idea as to what I have done wrong? Do you think that connecting through a diode in the way that Kostas Karousos described in a post here 2 years ago will work in my situation? it seems to turn a NO switch into the NC configuration.

    Having said getting a diode will be just as expensive and troublesome as getting a NC switch.

    Any help appreciated.

  42. Hi Tom! Can you do a video on making the switch to "constant pressure"? It is a cool upgrade because it is a way to improve print quality without any expense or changes to the printer, aside from maybe a firmware upgrade. Thank, Peace!

  43. Im confused. My z min plug on my mkp vi board but out 5.7 dcv and my sensor runs on 6-36v. I did this with one 10k and one 15k and it didn't do anything. Is this not what I need to do? I measured the out voltage after doing this and it's reading 3.5 dcv. Any advice?

  44. Danke! hat mir sehr geholfen. ich hatte zuvor 150k und 100k Widerstände und deshalb hat das mainboard den geringen strom beim durchschalten nicht detektiert. mit 15k und 10k funktioniert es wunderbar.

    Printer: Anet A8
    Marlin firmware
    induktiver sensor

  45. Hi, how to use inductive sensor to touch a specific place & offset to a desired height offset ? At only one point. Thanks

  46. Tom if I have a sensor that states 5-60vdc would you try using it at 5v or still go straight to the 12v for a better result?

  47. Thank you for the video Thomas, very helpfull indeed. Got it working on Anet A8 with latest Marlin firmware 1.1.9 at the moment. 🙂

  48. Thomas, I use PLA to print my hotend fangs all the time… it doesn't melt lol the only reason I've had to replace them is upgrades and because the design made them easy to break from where they were mounted.

  49. hey Thomas the version in the page is CR-10 BLTouch (Marlin 1.1.6) and is quite different at the video, I dont know what to do for calibrate the BLtouch correctly

  50. I have tried using the LJ12A3-4-Z/BX sensor which requires 12v. I have wired according to the video posted (using the 15k and 10k ohm resistors) to reduce the voltage. When the sensor is not being triggered I am getting 5v, and when the sensor is triggered (bright red light) I am getting 4v but its not triggering the z endstop. Any ideas? Thanks!

  51. can some1 make a picture of how they wired all the wires up? im confused, dont know where to put the resistors and which cable to combine with wichother

  52. tom, i need help, im having real problem with variation of the reading of my inductive sensor with temperature… i use to print ABS, and if i print at 80º i got one z offset, if i print at 105º another… what can i do?

  53. I have following problem: I use 24V so i had to use different resistor values. In my case 100kO and 390kO. I tried the signal and the output voltage between the Signal and GND Pin is 4.89V and when switching it is 0V. But when I connect this to my arduino, it is not able to pull the signal to ground! So when triggered, it only pulls the signal down from the 4.89V to 3.4V wich is still above the range as "high". So what can I do?

Leave a Reply

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