I've been trying to install an inductive sensor for auto-bed levelling into my Anet A8 and I'm having a few issues.
I have been using the wiring diagram provided by Solid Ground Electronics in one of his videos (Cheap 3D Printer - Anet A8: Upgrades, Experience & Thoughts), which I decided to follow as it still uses the Z limit switch, in case the inductive sensor fails to work.
The sensor seems to work when I power the printer on, the red LED is constantly on and when it comes into contact with metal, the LED turns brighter (as shown in the photos).
However, when I set it to auto-home, the Z axis does not move down like it usually does (until it hits the switch), but it moves up a bit. Although when I auto-homed the printer with a piece of metal under the sensor, the Z axis moved down, like it should do. So the sensor is acting in an opposite way to what it needs to.
I believe that it's been wired up correctly with a 10k ohm resistor connected to the base of the transistor and the signal wire of the probe. However the NPN transistor shown in the diagram is '2N4401' and the one I used is 'PN2222A', but I believe this should have no difference in the function of the transistor (only the voltages it can handle).
I initially thought that as the NPN transistor is slightly different, perhaps the polarity of emitter and collector is incorrect, so I switched them around but the problem still occurs.
I would thoroughly appreciate it if anyone can help!
The sensor is working correctly, but the signal is inverted.
Take the obvious solution: invert the endstop from being normally open to normally closed or vice-versa in your firmware.
If you still want to use your existing limit switch in parallel with the sensor (as shown in the video), you will need to switch that one over as well (usually limit switches have 3 contact points, one common, one NC, one NO, so you'd need to move the wire from the NC contact to NO or vice-versa).