loading

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

<p>I have made my sensor with a voltage divider and it triggers good, but I have a problem with the homing. Home position of the x axis is in my case -33 and of course in this case when the z is going home, the sensor can't trigger because it is in empty space. How can I solve this problem?</p>
Does anyone know what the Vcc on the atmega1284p on anet a8 controller board is? I need it to work out the logic voltage levels. I currently get a signal at 3.45 V going into the controller board but I'm worrying it might be too little to properly register as a high. What do you guys think?
<p>The 7805 voltage regulator brings the 12V input down to 5V, so the logic of the board is 5V. Try to measure the voltage between the red and black wire of the z-stop connector, you should get 5V. Now keep in mind that there is a 10k pull up resistor, so the pin on the chip is set to high by default. When you bring it to ground, it goes down to 0V. </p>
<p>Many Thanks for your help. I am however facing another issue now :&lt;.</p><p>I am attempting to setup auto leveling on my A8 with the LJ18A3-8-Z/BX. I tried the potential divider approach with 10K and 15K resistors first. Before hooking those up the output from the sensor was 12V and theoretically my potential divider should drop this down to about 4.8V. This however was not the case as I was getting 3.45V. I checked the output voltage from the sensor after connecting said resistors and it dropped down to 9.12V O.o .Effectively making my potential divider not valid anymore. I tested the potential divider by itself in a separate circuit and it worked great.</p><p>I had some L7805's laying about so I also tried it with those instead of the potential divider approach. In a regular circuit without the sensor it worked great as 12V got converted to about 5V. As soon as I changed the input to the L7805 to be from the sensor output, I was only getting out just over 2V.</p><p>To summarise it seems that as soon as I connect anything on the sensors output it drops in voltage which breaks the setup that was hooked up. I ordered some optocouplers as suggested in this instructable however I can't get over why the above is happening in the other approach. Any ideas? Thanks.</p>
<p>I did this instructable because I went through the same kind of issues. In the end, I realized that the 12V output from the proximity sensor has a very weak intensity, a few milliamps from what I recalled. So I tried connecting a LED directly to it, to see if it would light up like crazy (and burn) and it did not, it was pretty dim. That made me think that I could just hook up the optocoupler without any resistor, because the internal LED of the optocoupler would not burn if the voltage is dropped by the internal resistance. So far it still works. So in the end, I think the proximity sensor is just sending a weak signal. V = R * I could be helpful to figure out what is going on, but first we would need to understand how the proximity sensor really works and why is the output so weak. I am no expert in electronic, just a guy trying to print! If anyone can dig into this, that would be awesome!</p>
Well. I'm glad I wasn't the only one going crazy. Had resistors laying about so I thought I'd go with the potential divider approach. If I knew I would have ordered the optocouplers earlier. As for the reason to all this I have my suspicions as to whether the stock PSU is powerful enough.
<p>what kind of specification are acceptable for thes octocouplers? because i am not familiar with the kind of electronics.</p>
<p>Most sensors like these will accept the 12V from the power supply, however, a resistor is needed to drop the voltage from the proximity sensor to the MAX voltage of the input side of the opto-coupler (this can range from 1.5V - 5V depending on the opto-coupler being used. Make sure to read the specs properly). The output side to the control board is (for the most part) just an open/closed switch for the microcontroller &quot;switch&quot; port to use. So imagine the output of the opto-coupler is the mechanical switch in this case.</p><p>The case where a resistor is not needed is if the opto-coupler is mounted on a board you can buy that already has the circuitry built in to use 12V off the bat and hook up the wires to the control board.</p>
<p>I like your idea of using an opto-coupler to protect the device, which would be helpful if it ever goes internally short. But, opto-couplers should normally have a resistor at the input, which is basicaly like an LED. Just like an LED, without that resistor, your shorting out your PSU, or at the very least overloading it. Example of a resistor on your opto-coupler can be seen in the circuits on google:-</p><p>https://goo.gl/k7jfqJ</p>
<p>Wouldn't be better to fix the issue that is causing the printer to be out of alignment? My Prusa i3's have a simple z-axis adjustment that only needs a tweak after many prints. Having z-axis movement during the x &amp; y movement can't be a good thing, the CPU has to work harder, the printing will be slower and really it's compensating for something that isn't right in either the design or build of the printer. Yes I know Jozef Pruda has added leveling to his new MKII i3.</p>
i have skynet v2 on anet a8 with sensor. new version of skynet v2.2
<p>This would be really neat for the one at our library :)</p>

About This Instructable

18,312views

111favorites

License:

More by Kev_MTL:Anet A8 (Prusa I3) Auto Leveling Using NPN NC Proximity Sensor and Skynet3D V2 Firmware 
Add instructable to: