Check me on this: inductive probe connection

So, I’ve been thinking about finally using an inductive bed probe. Not for tilt compensation, which I still think is a stupid idea, but I think it will speed up some of the work I’m doing with interchangeable platforms and hot ends. I know some of them supposedly work fine at 5v, even though they’re rated for 6-36v, but I really want to make it safe for a 3.3v logic level, which means I need to put something on the output.

The output on these is driven by, in this case, an NPN bipolar transistor, which should give you ground when activated and nothing otherwise, which would be great, but they apparently DO put out the input voltage (or something close to it) when the normally-open switch is open, presumably because of the load from the indicator LED, and we don’t want our MCU pin to ever see that voltage.

A voltage divider is one obvious solution, but for that to work, you need to know exactly what voltage is coming out (which is dependent on your supply voltage (which is sometimes turned up a little above 12/24v, and of course you’d need different resistor values for those two supply voltages). A better solution I came up with was to put a current-limiting series resistor on the output, then a zener diode to ground. It occurs to me as I’m writing this that a blue/white LED might work too. This way, the microcontroller would see exactly the current dropped across the diode (forward voltage drop for the LED, breakdown voltage for the zener).

I wanted to find a solution that would work with only one component though, and the ideal actually isn’t switching between 0v and 3.3v (or whatever logic voltage the mcu is using). What you really want is a ground connection that switches between high- and low-impedance, so that the controller’s internal pull-up will switch you between a high and low signal.

My thought was to use a MOSFET. This will invert the signal, and should give exactly the signal I want. It’s also easy to wire up. I can send the sensor’s power/ground to the 12/24v line on the board, and run the signal to the gate pin of a mosfet, with its source pin crimped directly into the ground pin of the endstop connector, and its drain pin crimped into the connector’s signal pin. I’m thinking that a 2N7000 would be ideal, but since the high signal would be greater than 10v and almost no current needs to flow through, almost any N-channel MOSFET should work.

I’m not an EE though, and I’m sure there are people here who understand how these components work better than I do. So, is this a stupid idea?

I just took the cheap/easy way out, and used one of the small blue screw adjusted variable pots on my setup. Then I just adjusted mine with a voltmeter before I plugged it in to the input. Not the most elegant solution but it worked for me, and could be adjusted to whichever power source I used.


I hadn’t thought of using a potentiometer as your voltage divider, but it’s a good idea. It doesn’t solve the problems I’m trying to solve here, but it as least saves you from needing to calculate values for your voltage divider, and replace them if you mess with your power supply or switch between a 5v and 3.3v controller.

So are all the (interchangeable) platforms equally inductive? If I were trying to switch out platforms and probe them, I’d think that a bltouch would be more repeatable for finding the surface. Am I confused about what you mean?

The way I ended up doing this was to put a diode on the output wired toward the NPN transistor.

As the NPN goes high (doesn’t matter WHAT voltage, could even be 36v if you want, you can feed it anything) – then it gets blocked, and the internal pullup of whatever microcontroller you’re connecting it to will pull it up to the needed 3.3v or whatever.

When it goes low, the diode lets everything shunt to ground. This works to make the sensor wide-voltage ranging; you can feed it whatever it’s happy with AND you can hook it up to any microcontroller without worrying about voltage differences.

Like dis:


I thought of that too, but I thought I came up with some reason it wouldn’t work. Something about forward voltage drop maybe? I can’t remember now…

0.7V is standard silicon diode drop with high reverse breakdown voltage; 0.3V is more typical for schottky but also lower breakdown voltage.

I’ve been simulating the various options with - - Circuit Simulator. Interestingly, when I try the single-diode solution there, I’m seeing 12ish volts on the digital pin when I leave my (internal) pull-up disconnected, which means that it’s acting as a pull-down in that case. I think this was the solution I had worked out in my head as well. While no current to speak of would flow across the diode, you would still technically have a 12v potential there. This is the state it would be in during boot, and theoretically it would fry the pin. The sensors I have are also all the normally-open variety, so it will be in that state most of the time. Normally-closed would be safer. Of course, you could make it all safe with a hardware pull-up resistor, but then we’re back to two components in a voltage divider configuration.

In practice, internal resistances and parasitic capacitances and whatnot are probably enough to make it safe, which is why you haven’t fried anything using it that way, but I’d be interested to see what voltage a DMM would report on that pin during boot on the machine where you’re using it that way. Of course, the DMM’s own impedance isn’t infinite, so it might be enough to pull the pin to ground until the mcu’s internal pull-up kicks on.

The 1N400x series diode datasheet:

You’ll see under 0.1µA leakage in any reasonable domain. 24V is .24% of 1000V breakdown on a 1N4007, at which even Tj of 150°C the leakage graph doesn’t extend. At Tj 25°C you have to get to something like 80V before you even hit 0.02µA and the graph goes down steeply at the end.

Even with a 1N4002 with Vrrm of 100V you just divide those voltages by 10, so at 24V and 25°C you would see about 0.07µA leakage.

I see that lists Vf as 1.1V not 0.7V; not sure why it’s not typical silicon diode 0.7V drop. Maybe someone else here knows?

Btw, here’s a link to my simulation, in case anyone else wants to play around with it too.

1 Like

Oh, and to answer the question about platforms, they’re all using a steel substrate, so they should (in theory) trigger at the same distance. I just have some that are double-sided, so they’ll sit slightly higher on top of the heater.

I considered a bltouch too, but I’ve never liked those, and I want to avoid moving parts if I can.

Edit: I’m also experimenting with swapping out different hot ends, some of which are a millimeter or two shorter/longer than others, and I figure the compensation for this (which I have both software and hardware ideas for) will be easier with a non-contact sensor.


I bought an official (not knock-off) bltouch and then never used it because I switched to cast aluminum beds. I then thought about it if I ever wanted to print on glass for the glossy finish, but decided that calipers to measure an offset would be good enough and chose not to carry the additional mass—and then have never done that anyway so far, and as it happens I haven’t been swapping substrates anyway. The very few times I’ve used the textured side of my double-sided substrate I’ve just used babystepping to accommodate the resulting lower average surface. :relaxed:

While MOSFETs are useful for level shifting, I think that practice beats simulation for whether diode leakage will actually damage the CPU. I don’t have experience with lushprojects circuit simulation so I don’t know what they are simulating for the diode solution; maybe some sort of generic worst-case leakage? Obviously your call on what you’d want to attach, but if it were my hardware I’d place my bets on using @ThantiK’s solution. Personally I’d probably just grab a 1N4004 because I think that’s what I have the most of in my grab bag of diodes, but if I were worried about leakage I’d go with a 1N4007 since leakage is proportional to breakdown voltage. You could add a bleeder resistor (1M? 470K? hard to calculate what would be required since the leakage current isn’t even graphed in the relevant domain) and then you basically end up with a voltage divider between the characteristic resistance for the leakage current (whatever it is) and the bleeder resistor. If I were making a breakout board, for this, I’d probably add pads for a bleeder just in case but leave them unpopulated…

If you want a single device that is in some ways the best of both worlds, you can get an “ideal diode” which is actually an active device built from a MOSFET, e.g. MAX40200 Ultra-Tiny Micropower, 1A Ideal Diode with Ultra-Low Voltage Drop - Maxim Integrated — but those, including the MAX40200, often have lower voltage limits (the MAX40200 is max 6V above GND) so would not work with 24V, and as they also require VDD and GND to power their “ideal” electronics, they are devices with 4 or more connections. Also, some are just controllers to use an external MOSFET as an ideal diode. So that seems theoretically interesting but practically not what you are looking for.

1 Like