Guide: How to Setup Auto Bed Leveling (Ender-3)

Auto Bed Leveling Parts

Auto Bed Leveling (ABL) is one of those convenience features I’ve heard about for years, but it seemed complex and unnecessary for most 3D printers. My thoughts changed when I picked up the Ender-3 a few months ago, the build plate was warped in the middle and raised several millimeters higher than the outer edges, forcing me to work around it with each and every print.

While there are several decent aftermarket solutions, such as borosilicate glass and magnetic flex plates, I took the opportunity to setup Auto Bed Leveling instead. As this feature maps the build surface and compensates for minor variations, it seemed to be the perfect option for my uneven bed.

Unfortunately my electrical knowledge leaves something to be desired, and most guides assume a moderate level of expertise. From resistors to diodes, there is no shortage of ways to solve this problem, but my goal was to find a cheap, simple and clean method to make the project as easy as possible.

Purchased Parts List

SN04 Inductive Sensor (3 Pack) - $12.00
12V Optocoupler - $0.00
14 Gauge Silicone Wire - $6.88
14 Gauge Spade Terminals - $7.29
5 PCS JST-XH 2-pin Female Connectors w/ 100mm Wire - $8.99

Printed Parts List

Optocoupler Case
ABL Sensor Mounting Bracket


Most Auto Bed Leveling sensors require 6-36V to operate, but the board is only able to provide 5V. This may be enough for some probes, but it will greatly reduce the maximum detection distance. The advertised range is also rated for iron alloys such as steel, so our aluminum bed will reduce that distance even further, losing at least several millimeters.

To provide adequate voltage for the sensor, we will connect it to our 24V power supply instead. This voltage is perfect for the probe, but too much for other electronics and can fry the board, meaning we can’t just wire it up directly and start using it. To solve this problem, we will use an Optocoupler, a small circuit board which isolates the connections. It will provide the full 24V to our sensor and limit the output to our board at 5V.

Preparing the Optocoupler

I can’t solder to save my life, it brings on an instant anxiety attack and my hands start to shake like crazy. Unfortunately we have just 2 options, purchase a 24V Optocoupler from China and wait months for it to arrive, or buy a 12V Optocoupler and solder a different resistor in place. I’m not a patient man and I wanted this done, where I opted for the quicker (albeit more painful) route.

Note: Skip this step if you have a CR-10 or other 12V machines, it is only necessary for 24V power supplies.

So what do we have to do? There are 2 resistors on the Optocoupler board, labeled as R1 and R2 respectively (see image below). To make this compatible with 24V electrical systems, we need to remove the resistor located at R1 (below the LED light) and solder a 4.7K ohm resistor in its place. As far as soldering projects go, it is very straight forward and that is all it takes to prepare it for a 24V machine.

Auto Bed Leveling Probe

Since the Ender-3 uses the same X-carriage design as the CR-10, there are already dozens of printable brackets to choose from. The box style SN04 sensor is cheap, compact and looks like it would mount on the carriage without additional hardware, but it sits just a bit too far from the build plate to get triggered.

Although my initial plans didn’t work out, the Ender-3 SN04 Mounting Bracket on Thingiverse ended up solving the problem. It fits around the hotend cover and bolts in place using the existing screw holes. This particular probe also has elongated mounting slots that support height adjustments, making it easy to tweak the position as needed.

This particular design does however need longer screws to account for the thickness, where I used (2) M3x12mm bolts for the bracket and (2) M3x25mm bolts for the sensor. The sensor screws were actually a bit too long, but I placed M3 nuts below the head to act as spacers and reduce the total length.

Once the sensor bracket is printed, insert (2) M3 nuts in the back to give the bolts something to thread in to. To install it, just remove the 2 screws holding the hotend cover in place, one above and one to the left, then run the longer M3x12mm bolts through the bracket and in to the carriage. From that point, just screw the probe to the mounting bracket using the M3x12mm bolts, we will do the height adjustments once we have wired it to the machine.

To keep the sensor wires out of the way, use a few zip ties and attach them to the existing hotend cables. This will prevent the wires from getting caught on anything while printing and makes the setup look a bit more organized as well.

Wiring Instructions

At this point, we can start wiring up the Optocoupler board and connect it to the power supply, electronics board and bed leveling probe. We will need 2 sets of cables to get started, one for power and one for the sensor signal. While these can be bought prefabricated from online vendors, I would suggest making them yourself.

Sensor Signal Wires: Use somewhere between 22-26 gauge wire with a female 2 pin JST-XH connector on one end. These are common across many 3D Printers, often used for endstops and fans, where it is nice to have a kit on hand to make them as needed. If you have old 3D Printer electronics laying around, you may even be able to cut the wiring off a spare part to use for the signal wires.

Assuming this is a one time project and you don’t need an assortment of options, you can just grab a pack of wires pre-made, like these 5 PCS JST-XH 2-pin Female Connectors w/ 100mm Wire.

Before ordering, make sure to measure the distance between your control box and Optocoupler location to confirm they will reach. Otherwise, if you have an infinite list of DIY projects ahead, I would advise picking up a JST-XH Connector Kit and some 22 AWG wiring to have on hand. The following are what I used…

720 PCS JST-XHP Connector Kit - $10.99
22 AWG Stranded Wire - $15.19

Power Supply Cables: Generally speaking, power supply cables are made from 14 gauge silicone wire with spade connectors crimped on the ends. This is what I am going to be using and would suggest doing the same, however the power draw will be quite low and smaller cables such as 16-18 gauge should work just fine. All you will need is a cheap crimping tool, I picked mine up from Home Depot a couple years ago for $7 and change.

14 Gauge Silicone Wire - $6.88
14 Gauge Spade Terminals - $7.29

Wiring Diagram

There are several existing diagrams floating around online, but they are either difficult to follow or misconstrue the information. To keep things simple, the illustration below aligns with the colors used in this guide and should make it easy to understand what wires go where.

To get started, use a small flat head screwdriver and loosen the two set screws on top of the 3 port connector, labeled OUT and GND. Strip about 5mm off the ends of both wires, then insert the Z-Endstop Signal Wire in to OUT and the ground wire in to GND. Tighten the set screws back down and clamp the wires in place.

The electronics box has a large opening on the back side, giving us space to run the wires from behind. Go ahead and unplug the original Z-Endstop and replace it with our 2 pin connector instead. As pictured below, the left side (green wire) is SIGNAL and right side (yellow wire) is GROUND, so depending on the color of your wires, make sure this is in line with your Optocoupler connections.

Next up, we will need to run the cables from the power supply to the Optocoupler board. To access the terminals, remove the cover that is held in place by 2 bolts on the back side, and mounted to the frame with 2 bolts on the front. Once these are out, the power supply can be taken off the machine and the cover should slide off the bottom.

The power supply has a total of 3 positive (V+) and 3 negative (V-) terminals with 2 of each available. Using the 14 gauge power cables, feed the ends with crimped connectors through the cover until they can reach the terminals. For the sake of consistency, the red wire (positive) goes to V+ and black wire (ground) goes to V- terminals.

Once finished, we are done with the power supply and can reassemble the unit before mounting it back on the frame. Next up we need to run these cables from our Power Supply over to the Optocoupler.

Using the wiring diagram above, start with the black V- power cable and the blue ABL sensor wire, these are both neutral and will connect to GND on the Optocoupler. Since we already installed one of the signal wires here (yellow in my case), we now have a total of 3 wires running to the port. It will be a tight squeeze, but loosen the set screw until the clamp is completely open and it should fit without any problems.

We will do the same thing with the red V+ power cable and the brown ABL sensor wire, which are both positive and will connect to the 2-pin INPUT+ connector on the other side. Loosen up the clamp, insert these wires together in to the port and clamp it back down.

That just leaves us with the black ABL sensor wire which provides the signal input to the board. Connect this to the 2-pin INPUT- connector next to the red/brown wires and clamp it down as well. When you are finished, it should look like the photos below.

To keep things looking nice and clean, we can print out a case for the Optocoupler module and mount it to the frame. I used Hatchbox Black PLA which matched the Ender-3 quite well, placing it directly behind the control box. This reduced the amount of visible wires and everything else is hidden in the back of the machine.

This particular case is not a perfect fit, there is quite a bit of spare room inside and the mounting holes are too far apart for 4040 extrusion. It is however a great design and still usable, so I opted to secure it using (2) M5x10mm bolts and square nuts that I had on hand. I believe the Ender-3 comes with spare T-nuts as well, which can be used as a substitute.

Carefully tuck everything inside of the case, making sure not to put any stress on the wires.  Put the lid on top to keep everything in place and you are finished with the Optocoupler wiring. Go ahead and turn the machine on and use a piece of metal to test the sensor, which should light up when it is detected.

Assuming everything works, now is a good time to go ahead and do a rough calibration of the probe. Slowly lower the X-axis until the nozzle is right above the bed, using a piece of paper to test distance as you normally would when leveling. With the nozzle at the proper height, adjust the Auto Bed Leveling sensor until that is the exact point it triggers and the LED light comes on. This can take a few minutes to get perfect, but only needs to be done once.

Marlin 1.1.9 Firmware Changes

While the official Ender-3 firmware is open source and available on Github, it’s an outdated version of Marlin, lacks several basic safety features and has no support for Auto Bed Leveling. In fact, most of the Auto Bed Leveling code has been stripped from the configuration file, making it a headache to implement after the fact.

As of Marlin 1.1.9, a sample Ender-3 configuration file is now included with the files. This has been used as a base for the modified firmware below, documenting each specific change made in the description. For those that wish to setup the latest Marlin firmware from scratch, these can be used as guidelines.

My biggest concern with enabling Auto Bed Leveling was that many owners reported it would require a trade-off of features. The Melzi board only has 128k flash memory, and ABL uses a good chunk of this to operate. Hell bent on keeping the LCD screen and SD Card support, 2 options that are most often sacrificed, I managed to fit BILINEAR Auto Bed Leveling by disabling just the SPEAKER, ARC_SUPPORT and EEPROM_CHITCHAT (EEPROM is still enabled). When everything was said and done, it worked out to a total of 98% flash memory usage and 29% variable memory usage, leaving enough wiggle room for later adjustments.

LP3D Ender-3 Marlin 1.1.9 ABL Firmware

This custom firmware has been specifically made for the Ender-3, uses the default printer settings and the Auto Bed Leveling configuration we setup above. If you used a different sensor, mounting bracket or even some other machine, it may be necessary to adjust the probe offsets and other values to reflect your specific 3D Printer. The full list of my changes are documented in the description on Github, so feel free to use those as needed.

Lastly, if you haven’t done so already, you will need to flash a Bootloader on the control board. This is a necessary, one-time precursor that will allow you to flash your choice of custom firmware on the Ender-3 or CR-10. My previous guide covers this process from start to finish and is available at the link below.

Guide: How to Flash a Bootloader on Melzi Boards

67 thoughts on “Guide: How to Setup Auto Bed Leveling (Ender-3)

    1. No problem, I hope it helps! I plan to polish things up a bit tomorrow and add some more info about the firmware, then share it with the Ender-3 community in hopes it can assist others to do it cheap and easily.

  1. Great guide! I’m just sorry I spent so much money for a kit. The way you laid it out makes it seem simple.

    1. Thanks for the feedback! The kits are nice but I had a hard time justifying the price when it comes to about 1/3rd the cost of the entire machine. When I realized you can do the same thing for less than $20 and have almost identical results, I was bound and determined to go that route and share what I learned.

  2. Tha k you for this excellent tutorial.

    This my be a stupid question, but will this work with a mirror glass bed? Also, could you please point me in the direction of how to level the bed going forward? Is there a gcode you run on the machine before printing to auto level? Or does it just sense the surface of the bed and compensate as it prints?

    Thank you!

    1. It would depend on the thickness of the glass/mirror, but I probably wouldn’t use this particular sensor on them. For an inductive probe, I would probably go with one of the options that have 8mm sensing distance, or just a BLTouch that uses a pin to probe the surface instead. The rest of the guide is pretty much universal across machines (Ender-3, CR-10, etc) and sensors, but the probe I used is pretty specific to a metal build surface.

      As for the G-Code, I am actually going to add a bit at the end of the guide to cover this. As a very general idea, you just add a couple commands to your Startup G-Code. “G28;” will home all of the axis, followed by “G29;” which will run the Auto Level process. Other commands like “G92” can be used to raise/lower the nozzle after the leveling is done, but I will delve in to that more on the next update.

      1. Would a sensor like this work for those using glass beds?

        They’d need to print a different mount to attach it, but I think it would otherwise follow your guide as-is?

        Do the 24V optocouplers have a longer footprint than the 12V you modified?

        1. That should work better on a glass bed, powered from the PSU I would expect it to have somewhere between 4-6mm range for aluminum. You will need a different mount but otherwise will follow the guide as-is. When picking out a bracket, just make sure to find one that is easily adjustable, that will make things much more simple when fine tuning the position of it.

          I have only seen pictures of the 24V optocouplers, they definitely look longer but it is hard to gauge by how much. The case I used is pretty spacious inside, so I would expect it to fit but may be a bit more snug length wise.

  3. A silly question, actually how the auto bed leveling works? I mean let’s assume i have a 8mm sensing distance proximity sensor mount on it…should the sensor same level as the nozzle? If yes, how the system knows that it should leave some gap(0.2mm? is this adjustable?) between the nozzle and the surface (eg. aluminium base + 4mm glass thickness). Hope to learn some theory behind the mechanism…

    1. I think you set the nozzle the height you want it from the bed (using a piece of paper to check for clearance between the nozzle and bed), and then adjust the height of your proximity sensor so that it JUST triggers (so the sensor in reality may sit further away from the bed then the nozzle).

      1. This is definitely it in a nutshell. If your sensor has a greater detection distance, it will be mounted further away from the build plate. You want the sensor’s trigger point to be exactly the same as when the nozzle is the correct distance from the bed. For a 4mm detection distance, this may mean the sensor is 1-2mm higher than the nozzle. For an 8mm detection distance, it would be a bit more than that.

    1. Hi Jimmy,

      That one will work fine for 24V 3D Printers like the Ender-3. The only reason I didn’t recommend it is due to the longer shipping times from Aliexpress. Other than that, this would absolutely be the preferred Optocoupler to use. If you plan to print a case similar to mine, just make sure to measure it first as the photos of that one make it look longer than the 12V I am using.

    2. No, this won’t work seamlessly. The reason is there is one more component (Mosfet) that needs to be powered (from the isolated circuit, ie the printer board) at all times for this optocoupler board to be operational. And the Z-endstop is only 2 wires, signal and gnd, no power. So you’d need to get power somewhere else on the board and run a separate wire to this optocoupler board.

      Finally, and I am not an expert on this, but it may even have a different functionality than what is needed, specifically, it may take a pulse on the input and open the circuit and keep it open until another pulse comes in and closes it (ie touch to toggle on and off).

      1. Hi Frantisek, Are you sure about that? Have you tried that ?

  4. Thanks brett for the great guide, but ive noticed that changing the z offset does nothing, do I need to disable software endstops? the printer will not go into -ve z values

    1. Hi Jake,

      I’m actually writing a separate guide/article on configuring & calibrating the ABL sensor this week, where I feel this is a more involved subject that needs separate coverage. I will personally need to revisit the process myself, but I do believe I had to disable software endstops to get negative Z values.

      Just as a side note, the most confusing part (for me) when configuring was that the specified offsets didn’t take effect during the homing process. This wasn’t mentioned in any of the guides I found, so I kept making changes that seemingly didn’t take effect until the actual print started.

    2. Hi Jake,

      This is actually something that I encountered myself and took me quite a while to figure out. The Z-offset only affects the nozzle position during printing, not while the sensor probes the bed. I continued to run G29 (probe command) checking the nozzle height and finding no difference. Given it’s a bit too complex to combine in to this article, I am working on a follow-up guide now that covers how to calibrate the sensor properly after setup, should have it available in the next day or two!

      1. I am following your tutorial and I am anxiously waiting for your guide to calibrate the sensor abl.thanks for what you do.

        1. Thank you for the reminder on that, I will have it published later tonight or tomorrow morning at the latest. I ran in to some issues with the initial calibration, which resulted in some delays until I found a better method. After re-calibrating this weekend with a much more effective (and simple) process, I will be writing up the guide today and recap the steps.

  5. hello breed, everything I managed to put into operation according to your instructions.Firmware is super !!! but I do not want to fix the fan. It is still spinning on 100% paja czech republic

    1. ask what number does the pin fan have in the firmware

    1. Hi Fang,

      No problem, glad to hear that you appreciated it! While I haven’t used the 24V Optocoupler from Aliexpress, it should be the exact same except you won’t need to solder a new resistor to it. Just skip the “Preparing the Optocoupler” section and go straight to the “Wiring Instructions”, it is already made for 24V and has the same connectors as the 12V one that I used.

  6. Hi
    At first great tutorial!
    A little question:
    Doeas the z endstop switch put +5v to the board ore 0V ground? At the moment i cant figure out because im the next week not at home. Thanks and Greetings from Austria!

  7. since I can’t find optocouplers here in Canada like you have, can I use any of these instead?

    essentially what I’m asking is, will this work with a regular relay circuit ? where your trigger is 5v and your output is whatever the relay is capable of?

    hmm no, it’d need to be the opposite, where the trigger is 24v and the output is 5v right?

    UGH I don’t know! please help

    1. Hi Marc,

      Honestly can’t say for certain on those, I ordered several similar ones at first and realized they wouldn’t work once they arrived. Do keep in mind the Optocoupler is just the easiest option, you can also use resistors instead. I don’t have many details on that approach, but most of the other guides for wiring up ABL sensors online use them (and offer diagrams).

      It won’t be as quick, but you can get the same optocoupler I am using from Ebay or Aliexpress instead. They will be coming from China, which can take anywhere from a couple weeks to months depending on the seller, but this one looks like it ships pretty quick and is very cheap.

  8. I tried this method, except I used a capacitance-based 24v proximity sensor. It is NPN, NO. When I wired it to the modified optocoupler, I got 0v when activated and 5-6v when off. It’s acting like its normally closed now. Without the optocoupler it outputs 24v when activated and therefore, normally open as it should be. If I’m supposed to be outputting 5v when activated, how am I getting seemingly reversed results, and how do I fix it?

    1. I got it figured out. Thanks for the information and inspiration.!

    1. Hi Robert,

      The one you linked from Aliexpress in your other comment is the right one, or at least the one I would use. I know several people have tried the other versions, but I am unfortunately not familiar enough with them to confirm one way or the other. Using the green 24V optocoupler, you can just completely skip the part that requires soldering a new resistor in place and move on to the wiring instead.

  9. i ordered one of the 12v opto-couplers but the wait from china is gonna take months!! i have some of these and wondered if anybody knows how to wire it up??
    it can be used as normally open or normally closed so seems like it would work. just not sure how to wire.

    1. Hi Jason,

      I can’t say for certain whether that would work or not, but you can grab the one I linked from Amazon for about $5 and it ships in a couple of days. As Rob mentioned though, make sure you either (A) get an Optocoupler with the right voltage for your 3D Printer or (B) follow the instructions in this guide to swap out the resistor. The one you linked would probably work, but I can’t offer much insight since I didn’t use that model myself.

  10. I can’t help you wire, but if you ordered a 12v octocoupler and you have a 24v PSU I don’t think it would work. My Ender 3 has 24v, I think some of the earlier ones had 12v though…

  11. Hi! Thanks for your great work! I want to ask you if you think if this sensor can work as the one you’ve proposed but this only need to connect the two wires for the opened contact:
    It is a simple opened (NO) contact and you put it into the printer header when you want to calibrate without the need of power and more easy to use it.
    I use it with an Anycubic delta printer and it works flawlessly.


  12. Hey, thanks for the guide!!
    I tried substituting LP3D with TH3D’s Unified firmware since I’ve already used it in the past, and whenever I tried flashing with the ABL feature my printer is stuck with a blank screen until I revert to a firmware I compiled without the feature.
    Any ideas?
    Also, changing the SN04 to a 18mm sensor since it’s already tried and tested via EZABL, any reason this should affect something?

    1. Hi Gal,

      While it’s a novel idea and seems to be well implemented, I’ve stayed away from the TH3D Unified Firmware for a few reasons. Most notably due to their attitude towards non-customers and competition, pulling support for certain sensors like the BLTouch a few months ago out of anger/spite, which does nothing but hurt their users. The strong arm tactics (buy TH3D products or no support) are understandable to a degree, but using the open source Marlin Firmware as a base to further their own agenda is tacky.

      With that said, my LP3D firmware isn’t really a full scale package like the Unified Firmware, but rather offered as an example to build your own. The Github documentation lists the exact changes I made to stock Marlin 1.9, where users can download the latest version and replicate those changes themselves if desired (only about 10 or so tweaks to the settings). The version I linked in the guide is the exact one I am using though, so you could of course try it out and see if it works for you.

      As for the issue with a blank screen, my best guess would be that you are pushing the memory limits of the board. Melzi boards are 128k memory and it’s easy to max them out, especially using ABL features. It took a lot of experimenting to find a balance that would fit on the board and support ABL. If you check out the description on my Github page, check the “Memory Saving Options” part for ideas on settings that can be disabled to save memory. When you flash the firmware again, the black status box at the bottom should tell you what percentage of the board’s memory is used.

      1. Oh wow, I see. Thanks for the detailed responses and the advice! The console log says 98% when I flash Unified, so I’m a bit puzzled, but I guess I’ll play with it a bit more and figure it out.
        I see what you mean about TH3D. I also find it kind of annoying that they sell a proximity sensor+optocoupler for 60$, seeing as how most of the community isn’t even aware of it, feels kind of undecent to me… I guess they prize their support and they need to make a living… Idk. Either way I have no actual use to other features offered by Unified other than being pretty plug-and-play (mostly them shipping a version of a arduino IDE with the libraries installed), and the fact that EZABL is a 18mm sensor, same as mine, and figured it’ll save me some fiddling.
        Do you know what necessary modifications would be required to optimize your version for an 18mm sensor?
        Thanks again

      2. OK, nvm, I flashed your firmware and it works fine! I guess there was some issue with their firmware, I really don’t know what it is though (it only happens when I uncomment ABL, works fine with manual mesh bed leveling). Might be memory (even though theirs is 99% memory, think that should be fine..?)
        Still haven’t tweaked with the settings to match the height and sensitivity of my 18mm switch, just trying your stock settings to make sure I wired anything correctly.
        What voltage should I be getting from the sensor when it’s triggered? I get about 0.1V, whereas it seems the stock Z stop outputs around 5V when triggered… is my optocoupler bad?
        When I do “Auto Home” or “Bed Leveling”, the motors never stop as if detecting Z stop pressed, they just keep on rolling (I didn’t let it get all the way to the bed, that would be unpleasant, I just triggered it with my finger and the sensor lights).
        Also, to save myself fiddling with the board, I unplugged the input on the Z switch and hooked it up to the jumper with two male jumper cables. Should this be any different?

        1. Hi Gal,

          Glad to hear that my firmware worked for you! Is the sensor you are using Normally Open (NO) or Normally Closed? You may need to flip the Z_MIN_PROBE_ENDSTOP_INVERTING setting in Marlin if it isn’t being triggered. I had to mess around with this myself, moving the nozzle up +100mm and then triggering it with a steel hex wrench to see if it stopped. If that fixes it, I wrote a secondary guide on calibrating the ABL sensor’s offset position that you can check out here.

          1. I managed to get it to work, thank you so much for everything 😀

          2. That’s great to hear, glad you were able to get it working!

          3. @Gal Gorfit what was the solution you have to the z overstepping for autohoming?

          4. @Mikhail I’m sure it’s too late now, but I’ll put it here anyway, for anyone else to see…
            So, I was using an unmodded 24v optocoupler.
            Apparently the 0.1v my optocoupler was outputting was too low…
            I desoldered the 4.7k ohm resistor from my 24v optocoupler and soldered it onto a 12v optocoupler, so it’s the same one that Brett uses. It was outputting a higher voltage (don’t remember the value), and that triggered Z just fine (and am using it to this day, getting beautiful first layers and didn’t touch the springs in months :D)

          5. bonjours j’ai un problème mon axe Z ne fait que montée j’ai changer le code Z_MIN_PROBE_ENDSTOP_INVERTING mais marlin me le bloque et je ne peut pas le téléverser merci de votre réponse cordialement. il m’affiche #error “Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_ENDSTOP_INVERTING to match Z_MIN_PROBE_ENDSTOP_INVERTING.”

  13. Hi, i followed your guide an wored it up. Im using a Capacative Sensor on an Ender 3 Stock Melzi Board. When i touch the sensor it lights up as well as the LED on the Optocoupler. But the endstop stays open if i touch the sensor or nor. Also switched the Ground from the sensor to VCC on the coupler but than it stays triggered all the time. Any ideas what iam doing wrong? kind regards

  14. Hi,
    So first of all, thank you for your great guide but I have a small problem. The sensor works perfectly when I remove the print plate but when I use the print plate the sensor won’t trigger. Any idea?

    1. Hi Michael,

      I assume you are referring to that black flexible magnetic mat that ships with the newer Creality machines? As that’s just a magnet, there isn’t any metal in it that will trigger the ABL sensor. Once it is removed, it can detect the aluminum build plate and works just fine.

      ABL Sensors have the best trigger range with steel, 4mm or 8mm depending on the probe used, where aluminum cuts that distance in half. If you wanted to continue using the flexible magnetic mat, you could perhaps put a sheet of cheap sheet metal underneath it and clamp it down with binder clips (just as one idea). They do sell various “flexible build plates” for the Ender-3 and Ender-5 that have both a magnetic base and steel plate, although quality varies on those. Another idea is to just replace the sensor with one that has 8mm detection distance, which would give you about 4mm on the Ender-3 and probably be enough to detect the aluminum through the mat.


      1. Hi, brett,
        No, I actually have an older ender 3 with the standard non-flexible build plate. So it won’t work… correct? The sensor just doesn’t trigger with the build plate attached, it only works if I try it without the build plate


        1. Hi Michael,

          Can you show me a photo of what you have exactly? The original Ender-3 setup just had an aluminum build plate with the black BuildTak print surface stuck on top of it, which is what I still use and it works perfect with ABL sensors. That BuildTak surface is only about 0.25mm thick and doesn’t interfere with the detection. When you say it only works without the build plate, what exactly are you removing?


  15. Hi Brett

    Thank you fot this great guide and information.
    I’m new to electronics and ressistors so I have some question about changing the resisstor on the 12V board to 4.7k.

    1.By adding a bigger ressistor would this cause much more heat on the resisstor and board or is the effect so low that it won’t mather in this case?

    2. What is the original resisstors value?

    I hope you have time to answer my questions 🙂

    1. Hi Erlend,

      I’m glad to hear that the guide helped! I’m far from an expert in electrical work so probably the wrong person to ask, I just ended up doing a lot of research before moving forward. After testing out many of the suggestions found online, this happened to be the best approach that worked well for the Ender-3.

      – According to Tim from TH3D, the original resistor value on the 12V Optocoupler boards is 1K, using it on a 24V system would burn it out (needs to be 2.2K or higher). I bought my 12V Optocoupler from them when they were still selling it, but they pulled the product soon after I published this article so I swapped it to an Amazon link.

      – The 4.7K was the suggested choice and has worked well, doesn’t seem to have much, if any impact heat generation. They do sell 24V Optocouplers online via Aliexpress and Ebay, but the board is longer and would take weeks to arrive, so I went this route instead.


      1. Thank you Brett.

        I was planing to do a test run on one of my Enders. I have one running on a 24 to 12 volt converter. It works verry vell but unnessesery equiptment when you can just change the resisstor. But when you are new to electronics you fell to play safe at the beginning and the move on 😉

        I was looking at the board for 24V but they are quite huge in comparement with the 12V one. Any thing special about then that the 12V board doesent do except downscaling the 24 v.

        Thank you for your great information about the ressistors. always godt to know what you are changing. and some times the colours from cheap resistors arent always the best to read out.

  16. i am super, super puzzled.
    ive read guides such as this:

    and was told that capacitive sensors like NPN normally open ones send some voltage to the board when the sensor detects something. Because it’s 24v and to prevent the board from frying, the octocoupler reduces some of these voltage. I learn that it’s probably 5v (or i read somewhere).

    In your drawing, may i know color line is the one that will send voltage back to the board? Thank you so much for writing this guide and i hope sincerely that you can help me out in this.

    super. confused

    1. Hi Peter,

      The Green/Yellow cable is the one that sends the signal to the board, notifying it that the sensor has been triggered. Basically we’re using the “Z-Endstop” port, but instead of the mechanical switch sending the signal when it’s pressed, our Auto Bed Leveling sensor does it instead. In my case, the green wire is actually the signal line, where the yellow one is the ground.

      Hope that helps! Let me know if you have any other questions.


  17. Useful – BUT – tBank : St George
    he Optical Coupler is totally unnecessary – the sensor output is open collector and happily drives a 5v line, the input, whether it’s 12V or 24V is unrelated to the output, which is either high resistance or a few ohms when triggered

    1. So how would I go about wiring this thing up without the use of an optocoupler?

  18. I could use your help. I’ve read through this guide many times. I’ve also compared the picture and wiring diagrams with your 12V optocoupler versus the 24V that I purchased and just want to ensure I’m hooking it up properly. Here’s a link to the 24V optocoupler I purchased. The one I bought has 3 input terminals: DC+, DC-, & IN (input control signal) and 3 output terminals* NO, NC and COM. That’s where I’m confused. Yours has 2 input terminals: DC+ & DC- and 3 output terminals but only 2 are used: V+, OUT, & GND. I’m assuming I need to connect something to the input side, IN terminal (to control the input signal) and then I hook up the output wires per your diagram using the NO and COM terminals? Is this correct? Any and all help is MUCH appreciated. Thank you for your write up and your help! Here’s the link:

    KNACRO 1-Channel DC 24V Relay Module High-Low Level Triggering Optocoupler Isolation Load 30A DC 30V AC 250V for PLC Automation Control, Industrial System Control, Arduino (24V, 1-Channel)

    1. What you have purchased is a relay with and optocoupler. That is not the same thing 🙂

      1. Thank you so much for the reply! I just saw it today. In the interim, I ended up purchasing the same optocoupler in this guide except the 24V version. Took a while to get here but it finally did. I have yet to wire everything up and I’m still hesitant because in this guide, Marlin 1.0 is used. I’ve since switched to an SKR E3 Mini board with Marlin 2.0. Any guidance would be much appreciated. Thank you!

  19. Thank you for this guide. It was what got my probe to work, after several tries using other guides.

    You totally made my day!!!

  20. I seek guidance. I bought a sensor and an optocoupler. But I had to buy a 24-5v double unit. Now, your directions lead me to believe you’re using just a 24/24 optocoupler. But the ender board uses 5v micro switches. That’s why I thought the 24-5 board was best. I wired everything up but can’t get the opto to give me a decent 5v output. What’s my issue here?

  21. Hello,

    Thank you for taking the time to create this super detailed write up. Everything was moving along smoothly for me until I received a missing file warning when attempting to flash your firmware. The file is U8 something. Is there an updated firmware available that you can recommend?

    Thank you!

  22. there is an extra 24v fan header on the creality main board, why not use that to power to octocoupler instead of running a line to the PS? 14 gauge wire seems a bit excessive, how much current does this draw? Also if I have a buck converter already running the hotend fan, which is always on, couldn’t I just run the 12v octocoupler off of that buck converter? this all makes sense to me.

Leave a Reply

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

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top