Anet A8 (Prusa I3) Auto Leveling Using NPN NC Proximity Sensor and Skynet3D V2 Firmware





Introduction: Anet A8 (Prusa I3) Auto Leveling Using NPN NC Proximity Sensor and Skynet3D V2 Firmware

Manually leveling the bed is getting annoying after some time. Most people will want to add auto leveling for this reason and also to gain more precision when printing larger parts. The surface of the bed can change when heated...

You will need very few material for this :

  • the proximity sensor: 4mm is a pain, get a 8mm! Now this instructable is going to concentrate on the 4mm NPN normally closed (NC)
  • optocoupler FL817C (or anything you can find in the electronic trash)
  • soldering iron, solder
  • multimeter (important to test that everything is working)
  • Firmware : skynet 3d v.2 or whatever you think may be better (see facebook page)

Warning : do not "auto home" on your printer before you are absolutely sure the sensor is working! Otherwise you will most likely brake something, the little steppers for the z axis are pretty strong. In doubt, stay close to the power cable.

Please take the time to read the official documentation before you do anything. You may also want to take a look at peoples comment. While this worked for me, depending on the new revisions and the kind of probe you get, you may have to adjust this procedure.

Step 1: Printing the 3d Holder and Fixing the Probe

Get it from thingiverse : OR

(or search for variants)

Now if you have the terrible 4mm probe, you are up for some fun. The probe and the extruder nozzle need to be close in height. I recommend having the nozzle 2mm lower than the probe. Using the Anet A8 menu, lower the z axis by 0.1mm to find the perfect adjustment. Make sure the probe wont touch the print (that is why it needs to be a little higher).

Step 2: Doing the Electronics to Replace the Switch

The switch comes normally openend (NO). If you have a normally closed (NC) sensor, than you will have to change some settings in the firmware to say "STOP" when the circuit is opened. I will assume it is your case also.

Connect the probe

The brown wire goes directly to the power supply 12V (+).

The blue wire can be connected to the board's old switch black wire, which is a common ground.

The black wire will output 12V when the sensor is far from any metal and 0V when it is close to a metallic object. Test this with a multimeter to be sure you have the same kind of sensor I have and adjust accordingly if it is the opposite. Connect this to pin 1 of the optocoupler.

Now from my (only one) experience, the intensity of that 12V is pretty low, just enough to light an LED. That is why I decided to connect the probe's output directly to the optocoupler without any resistor to lower the voltage. Again, measure what comes out with a multimeter in case you have a different sensor and add a resistor if you need!

The role of the optocoupler is to use the 12V from the sensor to close the 5V switch without risking sending some 12V in your Anet controller (that would fry it).

For the rest, just follow the figure above.

Step 3: Optional : Add a Safety Switch

If something goes wrong with the sensor, the steppers may try to lower the z-axis completely, damaging your printer for sure. For example, if something is restricting the plate from moving, or it skips a turn, the probe may be left in the void and won't detect the plate. That is why I recently added a safety switch as a precaution.

This is super easy to do. Cut the red wire from the Z-Stop connector in two parts and connect them to the switch ends so that it is normally closed. The switch will be a little lower that the sensor and if something goes wrong it will trigger the z_min.

Step 4: Testing the Sensor With Cura

Board must be connected to USB and you will need Cura software for this step, with Pronterface UI selected.

Bring the print interface (file, print). Issue the command M119 to see if z is TRIGGERED or opened. Try this a few times with a metal object in close proximity.

If it doesn't change, that is bad! Try testing with a multimeter. Test on the collector/emmiter side of the optocoupler. You should measure 5V when the optocoupler is not triggered and very close to 0V when it is triggered. On the anode/cathode side, you should measure 12V when the sensor is far from metal and 0V when in proximity (that is with no optocoupler connected). Review datasheet if needed, maybe the optocoupler is fried or not triggered? Test it in recommended conditions or try another one...

Step 5: Install the New Firmware and Adjust Z-offset on the Printer

Now I am just going to cover this very quickly for skynet3dv2.0. Follow instructions from skynet or whatever other firmware you choose for more details.

Ok, so you are in Arduino IDE and you need to change a few parameters in Configuration.h :

  • The sensor offset x and y from the extruder nozzle. Measure the distances with a ruler.
  • Invert the value for the z_min position (if applicable).
  • Choose the LCD display (this firmware supports a better display or the regular one, you need to choose).

Once it is changed, upload it. If you did it right you should have the display updated with the new firmware logo...

Adjust the z-offset on the printer

For this, simply lower the z-axis with Cura Ponterface UI. Home All and then manually lower z by 1 or 0.1mm steps with a piece of paper underneath the nozzle. When you feel some resistance, issue a M114 command to know the position of the z-axis.

Now on the printer, go to the motionmenu and select z-offset. Enter the value you just found. Go to control and store memory. Try to Home All again and lower the z-axis by 10mm (by default at the end it will be raised 10mm above the plate). Check if you see some resistance.

Adjust the start G-code

Simply put G29 just after G28, this is for the auto leveling.

That's it, you did it, hopefully! Let me know how it goes in the comment section :)



    • Epilog Challenge 9

      Epilog Challenge 9
    • Paper Contest 2018

      Paper Contest 2018
    • Pocket-Sized Contest

      Pocket-Sized Contest

    We have a be nice policy.
    Please be positive and constructive.




    Hi, thanks for the guide.

    According to the wiring "diagram" i need to link the ground to the optocoupler cathode and then it goes form the emitter to the board ground, but do i need to link them directly too?

    They should be the same ground already, so just use the one from the board.

    So i can't understand the meaning of that "blue bridge" between cathode and emitter

    It only means that you can use the GND from the board or from the power supply, or both, they are the same actually (test it with a multimeter using the continuity mode: it will go beeeeeeep!). If you use the one from the board then you only have one wire to connect to the power supply... for me it seemed easier at the time. You are right, I could change the diagram if it is confusing, but I am too lazy ;-)

    it doesn't work... the led which show if circuit is closed is always on and I can't get any output from pin 4

    You mean the LED on the probe? If that is the case, it is either a bad probe or the wiring is not ok. Don't trust the color of the wires, verify the spec sheet (or the ebay page if you bought it there). Now if it was connected to a 12V source, it may be fried. Get a multimeter and test the probe alone before going any furether.

    Hello, thank you for the guide.

    i have one question before start with the installation. I'm not sure if the components that i have are compatible with your guide.

    i have this sensor: LJ12A3-4-Z/BY, Capacitive proximity switch, blue cap, PNP NO

    and i have also a set of STK. 10 x EL 817 Optoisolatore/Optocoupler

    i can use those components, or i have to order a new one?

    thanks in advance!

    It should work, but always test every step of the way to be sure. With a multimeter you can verify the 12V output of the probe when it is in proximity of a metallic object or not. As for the optocoupler, you can cheat with a higher input voltage if the current coming out of the probe is very low, 12V won't be a problem (so far for me it has always been the case, tried with two different probes). Try to light a LED if you have one (make sure to check the polarity) and if it lights up just a little you are good to go. Next step, connect the optocoupler and measure the output while playing with the probe. Let us know how it goes! One advice I can give you is that with a 4mm probe you better always watch your printer (at calibration time) and make sure the probe is perpendicular to the plate on every corner (there is no room for errors when you only have 4mm). Make sure to put back the switch as a safety measure, in case the head crashes on the plate. After awhile, I have upgraded one of my printer with a 8mm, both are working fine, but I prefer the 8mm one.