How to control a NC-Drill?

29 Jul 2016 08:08 #78128 by bkiepke
Hi all,

I've managed to build a CNC-coordinate table using a BeagleBoneBlack with machinekit-image and a Proxxon KT70. The machine only has x- and y-axis. So far everything runs. The goal of this is to have a "nc-drill". Currently I can't implement a third axis (z-axis), so I want to move the drill down and up manually. I'm an absolute beginner to this topic and I'm not quite sure what I'm looking for (so no search done, because I just have no clue what to search for).

My goal to achieve:
The machine just should position the workpiece, executing one line of G-Code and wait for user input to execute next movement or go back to last position. The user would have some kind of buttons for input. One button to go to "next" position and one button to go to "previous" position.

I guess I can use "M66 P0 L1" after every line of G-Code, assuming the physical "button" is linked to "" for "moving" forward. But how can I move a g-code line backwards? Also the example below should work (forward only), it seems "complicated" to insert "M66 P0 L1" (and possibly more code for backwards) after every line of code, when the described is the only mode of operation of the machine.

// just position the workpiece
N100 G00 X100 Y50
N110 M66 P0 L1
N120 G00 X100 Y48
N130 M66 P0 L1


My configuration for this in NCDrill.hal looks like this:
# create internal variable
newsig next-gcode-line bit
# link to physical input
net next-gcode-line <=
# link variable to M66
net next-gcode-line =>

I also read about user defined commands. So maybe this would be achievable with a M100 command, where I could insert a macro? But how would that look like? How would I link the physical button to some "variable"?

best regards
Benjamin Kiepke
29 Jul 2016 09:20 #78131 by andypugh

bkiepke wrote: I guess I can use "M66 P0 L1" after every line of G-Code, assuming the physical "button" is linked to "" for "moving" forward. But how can I move a g-code line backwards?

You can't, really. G-code implicitly runs forwards.

There is a development version of LinuxCNC that allows negative adaptive feed, and that will retrace a path, but it not quite what you want.

Note that I am talking about LinuxCNC here. Machinekit may be different, and you should ask there.

You don't need real-time motion control for your machine. So I suggest that you could consider not running G-code at all. You could have a simple Python GUI program that loads an Excellon drill file (or whatever you fancy) and which creates X/Y output HAL pins for connecting directly to stepper motor position commands in HAL.
import hal, time
h = hal.component("passthrough")
h.newpin("FWD", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("BACK", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("x-pos-cmd", hal.HAL_FLOAT, hal.HAL_OUT)
h.newpin("y-pos-cmd", hal.HAL_FLOAT, hal.HAL_OUT)
30 Jul 2016 07:26 - 30 Jul 2016 07:27 #78155 by Rick G
With linuxcnc you could start with position.ngc which is a ngcgui program.
If you are not using ngcgui you can try it from one of the sample configurations included with linuxcnc.

With it you enter the coordinates you want to work at and when run the machine will go to the first set of coordinates and pause, then you can drill, then the machine will go to the second set of coordinates, pause, etc.

Rick G
Last Edit: 30 Jul 2016 07:27 by Rick G.
Time to create page: 0.118 seconds
Powered by Kunena Forum