Pocket NC Touch Probe – Software (Part 4/4)

This is a series, check out the previous posts at part 1, part 2, or part 3. This time, I’m going to make this probe hopefully do something.

I started out just verifying that the Pocket NC would treat the vers.by probe the same as the built in tool setter probe. So I ran a tool measure cycle, and then just tweaked the probe by hand. Woohoo! It stopped the cycle just like normal. Actually measuring a tool worked too if the probe wasn’t activated, or if it wasn’t plugged in. Success.

Probing Scripts

Next, I got a crash course in G-Code. Mostly I used the Linux CNC reference, since that is what the Pocket NC used and all I needed to be interoperable with. Having done no real manual G-Code programming before aside from my limited python auto-generation, I was I guess surprised that there was any real support for in-program scripting. The fun limitations:

  • Variables can either be “numbered” or “named”. 30 of the “numbered” variables are function local, (and are also necessary for argument passing), and all the remainder are global variables. “named” variables can be global or function local.
  • All control flow requires human assigned unique integers for each instance of that control flow construct. i.e., an “if-else-endif” chain requires a human assigned integer that is unique script wide to be applied to the if, and its matching elses and end-if statements.
  • Largely, subroutines need to be in a file by themselves, and all in the same directory.
  • Annoyingly, expression grouping is with square braces “[]”, not parentheses, “()”.
  • “comments” are overloaded to also be used for all “non-machine” operations. If you want a comment to actually be a comment, the best and seemingly standard way is to ensure all comments are prefixed with a space.
  • Some things can be indirected natively, but not for instance, “which axis to move”. That must be specified using a literal character in each command.

The first probing function I needed was to reference the outer diameter of a cylindrical feature. I started by writing a subroutine which would perform a single linear probe in a parameterizable axis. It first probes quickly, then backs off a bit to probe again slowly. To work around the lack of axis indirection, it just uses if-else chains to handle the X, Y, and Z axes.


Next, I used that in an cylindrical feature probing script, where you manually position the probe along one of the major axes at the proper Z probing depth, assuming that the feature is “roughly” at the center of the current coordinate system. It would then probe all 4 axes, finally setting the coordinate system 0, 0 to be the center of the feature. For this, I “simulated” some arrays using the 30 numbered function local variables so that the probing logic could be implemented in a loop.


This did the trick, and now I could reference cylindrical (and square) features using G54.


I ran this around 30 times over the course of a few hours, including remounting the probe a few times and changing the temperature and airflow to get an idea of the repeatability of the probing process.

AxisStandard DeviationPeak to Peak
X0.00031″ (0.0079mm)0.0012″ (0.030mm)
Y0.00044″ (0.0112mm)0.0015″ (0.038mm)
Probing Repeatability

So, roughly around 1 thousandth or 0.02mm of absolute repeatability. I might be able to improve that by tweaking the probing speed or otherwise adjusting parameters, but the Pocket NC itself isn’t a whole lot better so it should be “good enough” for now.

Next Steps

First, all of the work I have so far is publicly available on github: https://github.com/jpieper/pnc_probe

This project is at a functional point for myself, but isn’t quite ready for others to use. The biggest issue is the necessary modifications to the shaft of the vers.by probe, as they aren’t easy to do and require additional equipment. The other pieces also still have some rough edges that should be filed off, including keeping chips out of the RJ45 connectors and getting a PCB in that doesn’t require bodge wires to work.

I also intend to do a little work to demonstrate that the probing can be used to register features across operations properly.

My eventual goal is to eventually get the design to a state where it is nearly “off the shelf” and list it on tindie. To do that will depend upon if I can figure out a better solution for the probe shaft.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s