How does probing work?

Look here to see if your question has already been answered.
User avatar
Doug
Posts: 343
Joined: Fri Feb 02, 2018 4:56 pm

How does probing work?

Post by Doug » Mon Jun 03, 2019 2:26 pm

Overview
Probing in the Buildbotics Controller requires that you connect the probe to the controller and configure the controller to recognize the probe. When that's done, you can issue g-code commands from the MDI interface or from your G-Code program that cause the controller to search for the probe and stop when it finds it. Finally, you can configure the controller to automatically execute a sequence of g-code commands that can cause the machine to probe every time a tool change is encountered in your g-code program.

Connecting the probe
The Buildbotics Controller uses probes that either close or open a contact when the probe finds its target. To connect the probe to the Buildbotics Controller, you simply connect one side of the probe to the probe input (pin 22 on the DB25 connector) and the other side to ground (pin 7, 19, 25, or 26 on the DB25 connector).

Note - Many probes that are available simply provide one wire to a touch plate and another wire to a clip. To initiate a probing action, connect the clip to the spindle bit. When the bit touches that plate, contact is made and sensed by the Buildbotics Controller. In some cases, the bit on the spindle already has continuity to ground. If this is the case, the probe input will trip as soon as the user attaches the clip to bit. If this happens, the clip is not needed, simply connect the plate to pin 22 and leave the ground pin disconnected.

Configuring the probe interface on the Buildbotics Controller
Configure the probe by setting the "probe" pull-down menu on the "Settings" page to either "normally-open" or "normally-closed" depending on whether the probe makes or breaks the contact when the plate is touched. In most cases, contact is made when the bit touches the plate, so "normally-open" will be selected. Click "Save" after making the change.

Probing with G-Code Commands
Probing actions are controlled through G-Code commands, which are found in G-Code programs. G-Code commands can also be entered manually through the MDI interface on the "Control" page.

G38.2 is the probing command. When G38.2 is executed, the machine will begin to move towards the location specified by the argument at the current feed rate. For instance G38.2 Z-50, will cause the machine to move towards Z=-50 at the current feed rate. If no feed rate has been specified, the probe will not happen and an error will be presented. There are a few things to consider when issuing a G38.2 command:
  • Movement will move towards the location specified in the argument. For instance, if G38.2 Z-50 is issued, the spindle will move towards Z=-50. But if the current Z-axis location is below Z=-50 (e.g. Z=-100) the spindle will actually go up rather than down. Of course, it will not find the touch plate by moving up and the probing action will stop when it reaches Z=-50. You can avoid this confusion by putting the machine in "incremental distance mode" (G91) before issuing the G38.2 command. That way, the spindle will move in the desired direction regardless of the current position of the axis. For instance, if the machine is in "incremental distance mode" and the spindle is currently at Z=25 and G38.2 Z-50 is issued, the spindle will move down until the plate is touched or the spindle has moved by -50 (to Z=-25) and stops.
  • G38.2 movements occur at the current feed rate in the machine. Often times this feed rate is too high and will cause the bit to hit the plate too hard. This could cause the probe to be inaccurate and it could damage your bit and/or the probe plate. You should set the feed rate to a value that allows the bit to slowly approach the plate.
The physical height of the bit will be equal to the height of the probe plate when it touches the plate and stops. After this happens, you will set the current location of the axis using a G92 command. For instance, G92 Z19.05 sets the Z axis to 19.05.

The following sequence of commands can be used for probing on the Z axis. Comments are provided to explain each command:
  • G21 (Use metric units)
  • F100 (set the feed rate to 100mm/minute)
  • G91 (put the machine in incremental distance mode)
  • G38.2 Z-50 (probe downward. Stop when the plate is touched, or when Z has moved down by 50mm)
  • G92 Z19.05 (set the Z axis to +19.05mm)
Configuring the Buildbotics Controller to execute a probe sequence when tool changes are encountered
The Buildbotics Controller can be configured to execute a predefined sequence of commands whenever a tool change command (M6) is encountered in a g-code program. The commands are entered into the "tool-change" text entry box on the "Settings" page. The following bits of information will prove useful when entering g-code commands in the "tool-change" field:
  • The commands are not saved and do not become effective until the "Save" button is clicked.
  • You will have to make some state changes in your program (e.g. metric vs. imperial units and feed rate). You will not be able to predict the state of the G-Code program when the tool change is encountered. Therefore, you will have to save the machine state (M70) at the beginning of the probing sequence and recover the saved state (M72) at the end of the sequence.
  • Comments that begin with "M0 (MSG," cause the Buildbotics Controller to pause operation and present a dialog to the user. The dialog will contain the remaining text in the comment. The machine will remain paused until the user clicks "Continue".
  • You may not be able to count on the machine calling for a tool change when the spindle is sitting above a smooth, flat surface of a known height. Therefore, you will probably want to designate a place on your machine where probing will occur. Your probing sequence will have to move the spindle to that location to do the probing.
The following sequence of commands are an example of a probing sequence that can work in the "tool-change" field on the "Settings" page. Comments are provided to explain each command
  • M70 (save the current machine state. (e.g. feed rate and units)
  • G21 (metric units)
  • G90 (set the machine to "absolute distance mode")
  • G0Z50(raise the spindle to a height that makes it easy to change the bit)
  • G0 X-50Y-50 (make a rapid move to a good place to sit the probe plate)
  • M0 (MSG, Change bit and attach probe) (prompt the user to change the bit and attach the probe)
  • G91 (put the machine in "incremental distance mode")
  • F100 (set the feed rate to a slow speed for probing)
  • G38.2 Z-100 (probe down until the plate is touched or until Z has moved by -100mm)
  • G92 Z19.05 (set the Z axis to the height of the probe plate)
  • G90 (set the machine to "absolute distance mode")
  • G0 Z50 (raise the Z axis to a safe height where it is easy to remove the probe.)
  • M0 (MSG, Remove the probe) (prompt the user to remove the probe)
  • M72 (recover the original machine state(e.g. feed rate, distance mode, and units))
Hope this helps. Comments welcome.

Doug

jefflangendoerfer
Posts: 12
Joined: Tue Jun 04, 2019 1:56 pm

Re: How does probing work?

Post by jefflangendoerfer » Fri Jun 21, 2019 9:47 pm

Hello Doug I am having some issues probing.

Can you review your notes again below and confirm they are correct?

When I read your explanation above, you note that G91 sets the machine to absolute distance mode, however when I search this, I find that G90 is the code for absolute distance mode..

My issue is that when I probe the Z and have the controller set the offset for my probe sensor to .75 inches and then move 1 inch above 0, the end mill moves to a position slightly less than 1inch (.905) and the controller reads the Z position as:

Z position= 1"
absolute = .905
offset = .095

Here is what I have typed into the tool-change box which is what you had originally given me.

M0 G0 Z1 X1.5 Y1.5 M6 (MSG, CHANGE TOOL AND ATTACH PROBE)
F5
G38.2 Z-1
G92 Z.75
G0Z1
M0 (MSG, REMOVE PROBE)


I would like to switch to what you have posted here, however when I do it doesnt function correctly, so hence my question here in my post. Any assistance would be great!

Thanks

User avatar
Doug
Posts: 343
Joined: Fri Feb 02, 2018 4:56 pm

Re: How does probing work?

Post by Doug » Sat Jun 22, 2019 12:02 pm

Thanks for pointing out these mistakes. In the original post, I was mistakenly saying that G90 was incremental mode and G91 was absolute mode. The reverse is true and I made those corrections in the original post. I also tried to use G70 to push the program state in the example program. M70 is the correct command. I corrected that in the original post as well.

Thanks again Jeff and sorry for the confusion.
Doug

Beefypen
Posts: 4
Joined: Wed Jun 03, 2020 12:22 pm

Re: How does probing work?

Post by Beefypen » Wed Jun 10, 2020 7:16 pm

Doug thanks for the post,
Is buildbotics able to do simple arithmetic and trigonometry? If so, does it possibly possess the capability to calculate angles of objects not square with the x and y axes, and apply those corrections to the gcode For milling?

If not I imagine itd be a nice feature to have down the road.

Honestly simplest way of probably doing that is probe two spots on each corner of a touch plate, measure that angle ( and here's the complicated part) apply that angle to every x and y coordinate...

BiuTse
Posts: 22
Joined: Tue Mar 03, 2020 8:57 pm

Re: How does probing work?

Post by BiuTse » Thu Jun 11, 2020 4:26 am

Yeah your are not the first user asking this ;-)

I don't know who many people could live without this function ;-)

Maybe this evening I will try an idea.
Don't know if the controller supports the G10 L2 Code but I will try something like G10 L2 R45 (to get 45° of rotation)
Maybe I am totally wrong but we will see

User avatar
Doug
Posts: 343
Joined: Fri Feb 02, 2018 4:56 pm

Re: How does probing work?

Post by Doug » Fri Jun 12, 2020 11:24 am

The Buildbotics Controller is able to do arithmetic and trigonometry. This is described in the linuxcnc documentation at http://linuxcnc.org/docs/html/gcode/overview.html . In particular, look at the paragraphs on parameters, expressions, and functions.

Those functions and parameters are available for use in your gcode programs, but the controller is not able to apply them on the fly to change the target positions in your gcode. For instance, even if you determine that your work piece is not square on the table, the controller cannot use that information to rotate your gcode program to compensate. You might be able to write gcode that would use those values and calculate the rotation in each gcode move.

G10 L2 P <axis> commands appear as described in the linuxcnc documentation at http://linuxcnc.org/docs/html/gcode/g-c ... ode:g10-l2 . However, that documentation says that the R option is optional and as near as I can tell the BB Controller accepts the R option, but it doesn't so anything.

robert
Posts: 3
Joined: Sun Aug 23, 2020 8:17 pm

Re: estop

Post by robert » Thu Sep 03, 2020 7:10 pm

when I start to prob with my xyz it runs then stops error E stopped switch not found????? can you help how to fix this is on the z axes trying to 0 it.
Thank YOU p.s can't use.

User avatar
Doug
Posts: 343
Joined: Fri Feb 02, 2018 4:56 pm

Re: How does probing work?

Post by Doug » Fri Sep 04, 2020 4:39 pm

If the probe is not contacted before it has reached the maximum probing distance in the G38.2 Z-XX command, then the controller will go into estop. Keep in mind that the G91 command puts the controller into incremental mode, so the Z movement is the distance that it will move down from the current place, not the absolute distance.

PNSNengineering
Posts: 16
Joined: Tue Jun 01, 2021 5:15 pm

Re: How does probing work?

Post by PNSNengineering » Fri Jun 04, 2021 4:33 pm

Hey all,

Sorry if this is a silly question - I'm very new to writing any sort of gcode as I'm used to having CAM do all the work for me. Trying to get my tool height probe set up but I'm a little confused about how to get it to work the way I'd like (or if it's even possible with the Buildbotics control).

If I'm understanding the gcode Doug shared to run on tool change, this will only update the Z height to reference the surface that the probe base is sitting on (e.g. if I want the top surface of my part to be Z0, I set the probe on that surface and call the G38.2 command, then set Z equal to the thickness of the probe base).

While this is great for when the probe is easily movable, I'd like to have a toolsetter that 'lives' on my mill's table. What I'm trying to do is touch off every tool change and just update the Z location to the difference between the current tool and the last tool's heights. This way the probe can rest on my table while Z0 can be wherever I need it. If this is possible and someone could point me in the right direction that would be fantastic - I have most of the gcode written, I'm just not sure how to handle the last part with updating the Z height to the difference between tools. I also have a BT30 spindle so if there's a way to utilize the LinuxCNC's tool table (like PathPilot on Tormach, but I know the tool offsets table at least isn't visible from the Buildbotics GUI) so I don't have to touch off quite every time that could work as well.

Thanks!
--
Alex Pinson
IG: pnsn.engineering

rtkracht
Posts: 11
Joined: Tue Mar 23, 2021 2:36 pm

Re: How does probing work?

Post by rtkracht » Fri Jun 04, 2021 5:19 pm

Hey Alex, my situation is nowhere near as complicated as yours but I did want to be able zero off the material or machine bed whenever I needed to. I'm learning gcode just like you but I started with Doug's code and added a few lines that seem to get the job done. All the code below assumes I'm zero off the left side of my material. Here's my code and please feel free to make constructive comments:
In program-start I have:
G17 (Select XY plane)
G20 (use inches)
#<_skipzprobing>= 0 (0 to run, 1 to skip)
#<_zero.off.bed>=1 (0 = NO, 1 = YES)

In tool-change I have:
(Runs on M6, tool change)
M70 (save the current machine state)
(DEBUG, parameter is #<_skipzprobing>)
o101 if [#<_skipzprobing> EQ 0]
o102 if [#<_zero.off.bed> EQ 1]
G1 X -1 F30 (move the z axis off the material)
o102 endif
G90 (set the machine to "absolute distance mode")
#50=#<_z> (capture initial z height)
M0 (MSG, Change bit and set the probe)
G0 F5 (set feed @ 5 inches/min)
G91 (put the machine in "incremental distance mode")
G38.2 Z-2.5 (probe down until the plate is touched)
#51=#<_z> (capture the touch plate height)
G92 Z.501 (set the Z axis to the thickness of the touch plate)
o101 endif
#52 = ABS[#50-#51] (total before & after z travel)
G1 Z #52 F30 (set z back to height prior to probing)
o103 if [#<_zero.off.bed> EQ 1]
G1 X+1 (move the z axis back over the material)
o103 endif
G92 X0 (zero X)
G92 Y0 (zero Y)
G90 (set the machine to "absolute distance mode")
M72 (recover the original machine state)
M0 (MSG, Remove Probe from cut area)
M7 (turn the router ON)

In program-end I have:
(Runs on M2 or M30, program end)
M2
M9 (turn the router OFF)

It ain't pretty but it seems to do what I want it to do. Any ideas for improvements are welcome and please post your code when you have something working.

Thanks
r
Last edited by rtkracht on Mon Jun 07, 2021 9:41 am, edited 1 time in total.
R.T.Kracht
Huffman, TX

Post Reply