Connecting the Z probe



  • well… i want to use my probe to do both things as I'm using with my ramps now. ( probing for ABL and act like an endstop when I home the Z axe ) I'm very sure it's an NPN, it's also written on the label. I did not had any problems by using it with a voltage divider on my ramps. As thomas said in his videos, ,,the sensor needs to run on 12V but your electronics needs a 5V signal". I don't want to fry up something but what you just said is interesting. Maybe you can help me understand why can I use it without a voltage divider.



  • I'm quite keen, academically, to know the answer to this one as all the circuit diagrams state that the VCC to the sensor is connected to signal on trigger. So surely this means if you're running the sensor on 24v when triggered it sends 24v into the z probe (or e0/z endstop) signal pin, surely not good even if the latest boards are built to survive it.

    The pnp types state they're wired to connect signal and ground on trigger which would be quite safe even on 24v as long as signal had a pull up to 3.3v and was grounded on trigger.



  • ok but it's not my case. I'm using +12V for powering my board and I use an NPN inductive sensor (this one)
    https://www.aliexpress.com/store/product/3D-Printer-LJ12A3-4-Z-BX-Inductive-Proximity-Sensor-Detection-Switch-NPN-DC6-36V-4mm-normally/837425_32687792678.html
    So what I want to know is, it is safe to connect my OUTPUT cable from the inductive sensor to the E0 STOP pin from the Duet Wifi? As I said, I don t want to fry something. Next week I'll order my motherboard and I want to have everything clear for a fast and easy setup when it comes.


  • administrators

    This is how an NPN output sensor works.

    • You need to power it from a supply of typically 6 to 36v. So you connect its Vcc pin to VIN (i.e. normally +12V or +24V) and its ground pin to ground. A few types can work from +5V, so for those you can connect its Vcc pin to +5V instead.

    • When the sensor is not triggered, its output pin is essentially not connected. When the sensor is triggered, an NPN transistor connects its output pin to ground.

    • The E0 endstop input on the Duet includes a pullup resistor and LED to +3.3V. So in principle, you can connect the output of an NPN sensor directly to the endstop input. RAMPS doesn't have the LED but it does have a weak pullup resistor if you enable it, so this works for RAMPS as well.

    • The complication is: what happens if the ground wire to the sensor breaks? If that happens, then the supply voltage to the sensor (5V, 12V or 24V) gets fed through the sensor electronics and the NPN output transistor to the output pin. If the supply is greater than 5V and you are using Arduino/RAMPS, I think this will likely fuse the endstop input pin of the Arduino. If you are using a Duet then it almost certainly won't fuse the Duet processor's endstop input because of the protection mechanisms we included. But we can't guarantee that because these mechanisms rely on ESD protection diodes inside the SAM processor, which don't appear to be guaranteed by the manufacturer. Also the LED will get reverse biased and may fuse.

    • I am a safety engineer, so I am not prepared to accept that the Duet (or even a cheap Arduino) may get damaged because of a loose wire or a faulty crimp connection. Call me a pessimist if you like.

    • If you connect a diode between the sensor output and the RAMPS or Duet input (cathode to sensor output), this prevents excessive voltage being fed to the endstop input if the ground wire breaks. Perhaps we should include diodes in the endstop circuits anyway, or greater protection. But there comes a point at which including additional safety precautions saves so few Duets from damage that the cost/benefit ratio is less than one.

    That's why I recommend using the diode. But you are using a sensor that can be powered from 5V and you do use 5V to power it, then I think the risk of damaging the Duet if the ground wire breaks is very small even without the diode.

    The above relates to NPN-output sensors only. PNP-output sensors connect their outputs to the supply voltage when they are triggered, so those definitely do need a voltage divider on the output.

    HTH David



  • And that is why I love visiting this forum.
    I learn something new every single time I come here!

    Thanks David.



  • Thanks David that's a great explanation but why do almost all of these sensors have this diagram on them?


  • administrators

    Because they assume that you will connect the output to a relay coil or some other load connected between the output and the +ve supply.



  • Thank you that does make sense, but is very confusing on the face of it.


  • administrators

    Bear in mind that these sensors were not designed for measuring the Z height of a 3D printer accurately, or to be interfaced to a microcontroller. They were designed to switch electrical equipment on or off when a lump of metal is detected in the vicinity.



  • Niiiice. Very nice explanations. Has duet wifi been tested with these types of probes? And do you think they will do a good job in case of using them for ABL? Thanks.


Log in to reply