top of page

CNC Tool Length Sensor Install

  • Cody
  • Oct 28, 2024
  • 8 min read

Updated: Nov 1, 2024


When you start something new, its easier to get started by using the stock components (obviously). In this specific case I'm referring to my CNC router and even more specifically, the Sienci Labs Longmill MK2 CNC router. In this blog, I will discuss installing a tool-length sensor on this specific machine and talk about issues I encountered and offer advice to those wanting to do something similar. This is not a stock component for the Sienci Longmill MK2 and requires programming to complete. Also, this installation only sets us up to quickly set Z-axis zero only. You will have to manually set the workpiece XY-zeros before running a carving program.


How is this more efficient? Many carving projects use multiple router tool bits that are different lengths. Even if the tools were the same length, its not likely that you would install the tool bit in the exact position in the spindle/router collet as the previous bit. Thus it would end up carving too shallow or too deep, or even cause clearance issues during movement and could damage the workpiece and/or break a router bit. Our goals are to program buttons (macros) to enable:


Goals:

  1. Homing machine, setting machine XYZ zeros

  2. Move spindle to a specific point we set that we can quickly change out tool bits

  3. Set initial workpiece XY-axes zeros (make sure CAD/CAM datum position is set to the same point that you plan to set the workpiece zero point)

  4. Run carving program 1, program finishes

  5. Maintaining same XY-axis zero settings, press "Tool Change Position" and the CNC moves spindle/router to specified position, change to next tool

  6. Press "Tool Setter Run" button and the CNC runs to the tool-length setter to set the new Z-axis height for the new tool, and finally

  7. Load next carving program 2 which uses the new tool; press stock "Start" button to start the carving process.

  8. Press "Tool Change Position", and continue process until all carving programs are run to complete the project.


gSender CNC Control Software


Programmable Macros: to edit, click "..."


Editing Programmable Macros



Goals:

-Improve workflow efficiency

-Create buttons (macros) that automate processes

-Eliminate problem of router bits crashing into stock auto-zero touch plate (possibly breaking)


Components:

-Tool-setter from PWN CNC or similar. Amazon has another similar tool-setter which is in a "normally closed" configuration with 4 wires.


Tools needed:

-Phillips head and flat head screwdrivers or impact drivers

-Accurate calipers


CNC Software Used:

-gSender version 1.4.7; GRBL g-code


First, lets discuss some basics for people who may be unfamiliar with CNC movement and zeroing.


Considerations:

-Be consistent with measurement units; otherwise your results may not be what you expect

-if you want to use millimeters (mm), use G21 grbl command

-if you want to use inches, use G20 grbl command

-accidentally using G20 when you wanted to work in mm, X1 = move X 1 inch (25.4 mm), this could cause damage given the right situation. Keep E-stop close!

-Keep CNC emergency stop button (E-stop) close so you can stop machine if it does something undesirable

-Troubleshoot by trying certain sections of code at a time so you can pinpoint the problem line of code

-This is not an exact science. Adapt this to fit your needs


CNC Zero Background:

A key component of making a computer numerical control (CNC) machine work is understanding where the spindle is located in space, workspace movement capabilities, as well as the location of the work piece which will be carved. Typically, a CNC machine will learn it's location in space using a homing function and firmware settings that define the size in the workspace it is capable of working. The homing location will be set to a specific point in the machine's range of motion. In space (in a 3-axis CNC machine), the gantry which holds the spindle/router can move left or right (X-axis), forward or back (Y-axis), and vertically/up or down (Z-axis). When using travel limit switches, a typical homing program begins with lifting the spindle vertically on the Z-axis to clear obstacles and to set the zero on the max height off of the limit switch, then to move the spindle gantry to the front left corner via the X and Y-axes until reaching the limit switches for those axes. Its location is then automatically updated with X0Y0Z0. Similar to setting a weight scale to zero, the CNC is now set at zero. From this point, the CNC knows where it is at. Without limit switches, you can easily jog (move) the machine via remote control to the location of the carve and then set the zeros in the program. This works fine as long as no problems occur and you don't have to restart any equipment due to malfunction. What's the point of homing? With the homing capabilities of limit switches, if a malfunction occurs and positioning is lost, a simple rehoming command will regain its accurate location in space and it can accurately return to the workpiece to continue working. However, we still have to set the height of the workpiece to be carved.

For this to work correctly, the computer-aided design and computer-aided manufacturing software (CAD/CAM) which is typically in one package like VCarve Pro (shown) and Autodesk Fusion 360, must be configured correctly so that the movement programming is correct and therefore everything is on the same page. In the picture, you can see how Z-zero is set from the machine bed which is what the workpiece sets on. The CAM software accurately generates the carving file so long as the workpiece thickness is measured accurately using calipers. This is input in "Thickness (Z):" in the Job Size block. If this is not set accurately, clearance issues can occur and may cause breaking expensive router bits and workpieces being ruined.

XY Datum Position shows the XY zero point of the workpiece. Similar to the homing location, this specific left-front position refers to the starting point of the carving program. Many things come into play when it comes to setting everything up correctly! Now that the CNC knows its position due to homing and we agree in its knowing (because it positioned correctly), we need to install the tool setter hardware and connect it to the Sienci Longboard/Super Longboard (the CNC brain) and then learn what commands cause movements so that we can program some movements.


Tool Setter Install

The downside to having a fixed-position tool-setter is that you will lose some available carving space. Personally, I find that the benefits outweigh the downsides as I rarely use the full carving space, including when creating very large projects. So first, figure out a space you are happy with and screw the tool setter in place. I decided to install mine in the base support that the consumable MDF boards sit on. This way I can replace the MDF strips as they become damaged (as you can see in the first picture). I then drilled a hole and then ran the wiring through the table frame and to its connecting position on the Sienci Longboard/SLB (Super Longboard). When I first completed this install, I was using the original Longboard. Currently, I'm using the Super Longboard and thus I can show how the wiring is connected to both.


Standard Sienci Labs Longboard Connection (orange wire to "Probe", brown wire to "GND")


Sienci Labs Super Longboard Connection ((orange wire to "Probe", brown wire to "GND")


Wire-to-Connector Install (notice that we are only using the orange and brown wires). This specific picture is from the connection to the Super Longboard. These connectors can only be inserted into their respective sockets one way. So, ensure that orange goes to "Probe" or "PRB" and brown goes to "Ground" or "GND".


Now that installation is complete, lets do some programming! This is the programming set specifically for my CNC machine. You will have to adjust your values to your specific machine but I will show you how to do this. The Sienci Labs Longboard uses grbl G-code and the Super Longboard uses grblHAL. Thankfully, I didn't have to adjust these programs when I swapped to the Super Longboard.


Macro Name: Tool Setter Run



Personalized Settings:

With router bit with a fine tip such as a V-bit or tapered ball nose bit, find the center point of the tool setter. This is the position that the CNC will run to when pressing the programmed button. As always, ensure that machine homing was completed successfully first. Once you have found the center point through jogging the machine manually, update X and Y:

Z distance you may have to play around with. Initially I set this at around 2.5 inches. But when I had move the spindle up in it's mount due to needing clearance for the workpiece, the probe program failed because it didn't reach the tool setter in the -2.5 inches. So I changed it to -4 inches and haven't had any problems since.

This measurement is critical to obtaining an accurate final Z setting. This is where we must use the calipers to try and get as close as possible to the exact height. Since the tool setter is set below the spoil board (which is what the workpiece rests on), the height is going to be

I measured this with the calipers from the top of the spoil board to the top of the tool setter. Then set the Z number:

I am using the reasonably priced Shars caliper to take my measurements.


Note: if you mounted the tool setter to the spoil board, Z would be the total height of the tool setter.


Finally, if you want to move the spindle/router location after the new tool has been set, you can make your adjustments in this last line. This is optional, but is a rapid move (G0) to XY coordinates


Firmware Changes

This is an important part of finishing the programming for the tool-setter. In the firmware tool, change the default setting of number 6 to turn off "Invert probe pin" as shown below. This should be the final step to ensure there are no errors received and that the machine acts how it is supposed to.



What did all of this code actually accomplish?

We moved the spindle/router bit directly over the center of the tool setter. Then the spindle slowly moves down until the tool makes contact with the tool setter which is acting as a normally closed switch. When we make contact with the tool setter, we open the switch signaling for the probing process to stop, raise spindle/router to a specified height, and then probe one more time at a slower rate. Here, the Z-axis zero is set for the tip of the specific tool that is installed in the spindle/router. This Z zero subtracts the height we measured with the calipers. Then, in the final optional command, the CNC moves the spindle to a specified location. At this point, if we press gSender's Z-axis command "Go to: 0.0", the spindle will move down the Z-axis until the tip of the router bit touches the spoil board. If you remember that we set the CAD/CAM software' "Z Zero Position" to "Machine Bed". Now, as long as we measure the workpiece thickness accurately (preferably with calipers) and input that value in the CAD/CAM software, we are good to go! After you set your XY-zeros and run your first carve program, you simply change the tool bit to whatever is next and then with the click of the button we programmed, you let the CNC set the new Z-zero. Then you can upload your next file if you haven't already and press "Start" to begin the next carving toolpath. Rinse, wash, repeat!



****Ensure the CAD/CAM software is set to "Machine Bed" in the "Z Zero Position" block as shown above.

****For safety, when testing, keep your hand close to the Emergency Stop or E-Stop button in case something goes wrong


Tool Change Position


Move spindle close to you for easy tool bit change. Refer to "Tool Setter" programming for details on each of these commands.


Spindle Out of Way


Same as Tool Change Position, only this time moving the CNC to a position that allows you to have full access to the workpiece and the spoil board.


Spindle Warmup (Bonus)


If you are running a spindle on the Sienci Labs MK2 CNC, here is a variation of PwnCNC's recommended spindle warmup procedure that works with this specific CNC. If you are running a standard router, disregard as you must manually set the router speed.



Code:

M3

S6000

G4 P600

M5

M3

S12000

G4 P420

M5

M3

S18000

G4 P180

M5



Thanks for reading!


Recent Posts

See All

Comments


bottom of page