Z nut backlash bed probing

27 views
Skip to first unread message

Ryan Carlyle

unread,
Nov 15, 2019, 3:52:05 PM11/15/19
to 3DP Ideas
Lead screw Z nuts are preloaded by gravity. In nozzle-lift printers (like i3s) nozzle collisions with the bed will lift the nut up through the backlash zone. You could use this to sense nozzle/bed contact for Z probing.

Implementation seems tricky... two thoughts that come to mind:
  • Use an electrically conductive Z nut (graphite-impregnated metal maybe) and detect breaking a circuit with the screw. You would need really good concentricity to make this work since you won't lose contact if the nut is side-loaded to keep the thread flanks touching.
  • Put a second nut on the screw (lightly preloaded) and detect distance change between the nuts via limit switch or whatever.
Main downside is the same as any other nozzle-contact bed probe, you need to apply some force (=overtravel) before the contact will register. Could be easier to implement than a hot end mount type system though.

Whosawhatsis

unread,
Nov 15, 2019, 5:09:08 PM11/15/19
to Ryan Carlyle, 3DP Ideas
You know how Ultimaker's bed sensor works, right? If I understand correctly, they're just using a pin wired to the nozzle, which can be used to do capacitive sensing quickly with any analog pin, or in a time-variable way with a digital pin, with no additional hardware. It capacitively senses distance to the bed, but they don't rely on this "sensor" being able to discern absolute distance. Instead, they watch how the reading changes as they approach the bed. Once the readings stop changing, they know that the nozzle is touching the bed, and has started to compress the springs under it.
--
You received this message because you are subscribed to the Google Groups "3DP Ideas" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 3dp-ideas+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/3dp-ideas/2e5c1ca6-ae51-441b-afcd-c8e618a7846b%40googlegroups.com.

Ryan Carlyle

unread,
Nov 15, 2019, 5:46:07 PM11/15/19
to 3DP Ideas
How do you do capacitive sensing with MCU pins?
To unsubscribe from this group and stop receiving emails from it, send an email to 3dp-ideas+unsubscribe@googlegroups.com.

Whosawhatsis

unread,
Nov 15, 2019, 5:58:13 PM11/15/19
to Ryan Carlyle, 3DP Ideas
The way I do it is I first pull the pin low in output mode (low impedance), then I switch it to input mode, then turn on the internal pull-up. This is a fairly high-value resistor (200K on most arduinos, IIRC), so if you read the voltage immediately after turning it on, the pin will not read high, especially if there is a significant capacitance on it. For an analog pin, you can check the voltage after a few microseconds (depending on the range of capacitance you're trying to measure), and the value will tell you how fast the voltage has been changing. A series of readings will, of course, show the voltage initially rising quickly and then leveling off as it approaches VCC.

You can do it with a digital pin as well, but the time is the variable. When you switch on the pull-up, you immediately begin polling the digital input in a loop until it reads high. How many times the loop runs before the voltage passes the threshold again tells you how fast the voltage was rising, though in this case, a large capacitance will lock up your program until the threshold is reached. It's usually not a problem, but if you're trying to do other timing-critical things (like run steppers, or animate LEDs), you will notice that the control loop slows down. I'm sure an interrupt-driven version of this code could be built, but I've always just used the fixed-time ADC-based version in programs where the timing matters.
To unsubscribe from this group and stop receiving emails from it, send an email to 3dp-ideas+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/3dp-ideas/da32135c-7e53-4561-b508-c50beff8bd51%40googlegroups.com.

Ryan Carlyle

unread,
Nov 15, 2019, 11:06:32 PM11/15/19
to 3DP Ideas
That makes sense. Why isn't everyone doing that? Any mainstream firmware support?

Whosawhatsis

unread,
Nov 16, 2019, 12:03:41 AM11/16/19
to Ryan Carlyle, 3DP Ideas
I assume others have done it that way, but all of the libraries I've looked at for doing it use separate pins for changing the voltage and sensing. There are also, of course, chips that have hardware support for capacitive touch sensing, which I assume work in a similar way (they might use an ADC with a nonlinear voltage scale to provide more useful resolution on the reading... at least that's how I would do it).

There is the timing downside. You need some finite delay between switching the pull-up on and reading the pin. The value of the built-in pull-up determines the minimum capacitance you can sense, and how long it will take to get a useful reading for larger capacitances. If you want to use a digital pin, your code can't be do much else at the same time unless it's interrupt-driven, though it shouldn't be hard to run several such sensors in parallel, polling all of them in sequence so that you can compare their capacitances, or wait for one of several buttons to be touched.

Of course, I'm sure hardware implementations can do this in the background, and probably even use touches to trigger interrupts. Still, for this purpose, as long as stepper timing doesn't become a problem, an implementation like this one works. Actually, since the time taken for the digital-pin version increases as capacitance increases, using it with non-interrupt-driven stepper code would mean that the stepper would automatically slow down at it approached the platform, which could be beneficial. There's also the issue that the voltage at which digital pins flip from high to low has some uncertainty, but a given pin seems to have a pretty consistent response to a steadily increasing voltage in my experience. Watching for a the derivative of the measured capacitance to suddenly drop to zero is also relatively simple and error-tolerant compared to trying to get an absolute measurement and thresholding.

I haven't heard of anyone other than Ultimaker implementing this method for bed sensing, though. It does, of course, impose certain requirements on the construction of the Z axis, the gantry, and the bed mounting. Using bed springs that are too stiff, for example, could cause bad things to happen when you try to measure this way. Failing to detect contact would also mean that you would continue to drive the nozzle into the bed, and you can't have have a system that allows the axis to lift off of its nut if you want it to work consistently. This all means that the code and hardware need to be tuned to one another, which is probably more appealing for a big manufacturer with a lot of machine-to-machine consistency than a more DIY or DIY-friendly operation.
To unsubscribe from this group and stop receiving emails from it, send an email to 3dp-ideas+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/3dp-ideas/04368d27-a777-4e6e-b598-9ed7ad5e648b%40googlegroups.com.

David Crocker

unread,
Nov 16, 2019, 9:10:20 AM11/16/19
to 3dp-...@googlegroups.com

There's a better way to do capacitive sensing based on charge transfer, at least for ATTiny and Atmega microcontrollers that have a built-in analog comparator. It works discharging a reference capacitor, then repeatedly charging the sense capacitor to Vcc and transferring the charge to a reference capacitor. Repeat until the charge on the reference capacitor triggers the comparator. Apart from the microcontroller, it needs just 1 external capacitor. Using this, I implemented a capacitive sensor that could measure a change in a capacitance of a few pF, and I made a prototype Z probe using it.

I didn't put it into production for 2 reasons. It needed about 1 sq cm of copper close to the nozzle and parallel to the bed in order to provide enough capacitance to measure; and capacitive sensing is sensitive to air temperature and especially humidity. That second point is obviously less important if the firmware just looks for the capacitance to stop increasing.

David Crocker, Duet3D Limited

www.duet3d.com
duet3d.dozuki.com
forum.duet3d.com

Ryan Carlyle

unread,
Nov 16, 2019, 10:43:13 AM11/16/19
to 3DP Ideas
Yeah, that’s what I like about the UM system WW describes, triggering off the inflection point rather than a capacitance magnitude threshold. When you change bed surfaces a lot, tuning trigger thresholds or Z height offsets gets irritating.
Reply all
Reply to author
Forward
0 new messages