G-code for Copper-Ring-over-Crosshair CenterFinder

More
18 Jan 2014 23:58 - 19 Jan 2014 00:20 #42973 by clunc
Here's a commented program I wrote (that works... :) ) for a centerfinder I made based on someone else's design, using a piece of copper pipe centered over a crosshair inscribed on a piece of clear plexiglas. I machined it, but looking back, I wonder why. The accuracy of my homemade CNC could certainly have tolerated a more homey approach, like whacking off a piece of pipe with a hacksaw and epoxying it onto a piece of plexi and eyeballing the center, but if you have a mill or a lathe, you must do what you must do.

You'll have to tweak it for the diameter of your pipe, but it works on my machine, and quickly enough--if I start it in the "right" position (southeast quadrant). The reason it works quickly is because I know the inside diameter of the pipe, and if I also know which quadrant I'm starting in, it takes only two points on the wall to get a rough idea of where the center is. After you know that, you can move quickly to positions "near" the inside wall for slow probing.

At the last moment, it occurred to me that it is possible to determine from the first contacts, and the known diameter, which quadrant the probe originated in, but I leave that to another day. (In fact, my high-school sophomore son opines that it could be done taking only three measurements.)

(Now which one of these button thingies does one use to insert code?...)
This one, the "page" icon with the little blue angle brackets? (Yes, but it's a lot of code so I'll attach as a zip instead.)

I had to modify my controller box (which connects to the computer over the parallel port) to add a new connector (in this case a simple RCA phono jack) wired to an unused pin on the parallel port breakout box inside the controller which LinuxCNC will accept as an input.

I wired it with a pullup resistor so the voltage on the pin would be 5V (High) unless and until the grounded (inside the controller) clip connected to the (steel) "probe" (just an 1/8" bit reversed in the collet so the fatter--and round--1/4" end sticks out) shorted with the lead connected to the copper ring (and connected to the non-5V end of the pullup inside the box) which shorts out the pull up resistor, causing the voltage on that end to go to 0V (Low) which is detected by LinuxCNC on the parallel port pin.

To give a little visual feedback (although it happens so fast it's still hard to see) I connected a red LED (red indicating NON-contact) between the two alligator leads so it's ON all the time, UNLESS contact is made (which shorts it out). (For completeness' sake, I'll say that I put another, green, LED in series with the pullup resistor at the controller box, which also is ON all the time (because it's in series with the red one), but it glows BRIGHTER when the red one shorts out (because its 2V Vf is replaced by a short 0V).

One last tip: I found the 1/4" diameter of my probe a little too large for the alligator clip, which opened widely enough but just couldn't get a solid grip. Same thing with the machine screw I had protruding through the base of the copper ring. I improved the grip tremendously by holding the probe (or screw) inside the closed "mouth" of the alligator and gently CRUSHING the teeth of the clip on top of the probe (or screw) creating a relatively large-ish depression in the teeth. The clips "find" their grips easily now, and stay put during all the movements.

Cheers!
--
CluNC
Attachments:
Last edit: 19 Jan 2014 00:20 by clunc.

Please Log in or Create an account to join the conversation.

Time to create page: 0.099 seconds
Powered by Kunena Forum