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 :

http://www.thingiverse.com/thing:1907394 OR http://www.thingiverse.com/thing:1745261

(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 :)

First Time Authors Contest 2016

Participated in the
First Time Authors Contest 2016