Project Overview

Besides a couple hand held power tools, most of the tools in my shop are ill suited to work with metal. My go to materials have been plastic and wood. I can 3D print the plastic and carve up the wood with my cnc routers However, it has been a longstanding goal of mine to expand the metalworking capabilities of my shop because the ability to make custom metal parts would allow me to build some projects that otherwise would have been impossible. I am getting closer to fulfilling this goal with the acquisition of a Precision Matthews 833TV mill. To expand the capabilities of this benchtop mill, I have decided to convert it to CNC.

The Precision Matthews 833TV. It is an imported Taiwanese benchtop mill that is of slightly higher quality than the average mill of this form factor. Before I get into why this mill stood out to me, I have to be honest with you. My first plan was to buy a commercially available CNC mill from Haas or Tormach to avoid the hassle of converting a manual mill, but these CNC mills are just too expensive for someone like me that doesn’t plan to use his mill to turn a profit, especially when you start to add on fancy features like rigid tapping and work probing. Ultimately, I am happy with my purchase as this will be a great little machine to hone my machining skills on.

Why the PM-833TV?

So why did I pick this mill and not a more common model like the Grizzly G0704? Three reasons: The first is that this mill has a one shot oiler installed. This oiler will make the motion smoother and improve the longevity of this mill. The second reason is that this mill has hand scrapped ways. If you are not familiar with the process of hand scraping then basically it is a process of making the surface of the ways super flat, which allows for a better fit and smoother linear motion. The third reason is that this is one of the few mills at this price point and formfactor that comes with a spindle that is directly driven by the motor. This direct, belt drive will not only spin the spindle at almost twice the speed of the geared motors found on other benchtop mills, which is great for me because I plan to cut a lot of aluminum, but it also is quieter. This house that I am in is on a zero lot, so my neighbors are feet away.

Resources

Mechanical Parts
# Part Name Vendor Part Number (SKU) Unit Quantity Link
1 833-TV Precision Matthews N/A Benchtop Mill 1
2 CNC Conversion Kit for 833-TV Heavy Metal CNC N/A Kit 1
Electrical Parts
# Part Name Vendor Part Number (SKU) Unit Quantity Link
1 Nema 34 Stepper Motor Amazon N/A 6A 8.5Nm (1200 oz-in) 2
2 Nema 42 Stepper Motor Amazon N/A 2830 oz-in 6.0A 1
3 Stepper Driver StepperOnline N/A 2.4-7.2A at 36-110VDC 3
4 Unregulated Power Supply Automation Technology N/A 72VDC and 20A 1
4 Unregulated Power Supply Automation Technology N/A 72VDC and 20A 1
5 Triple Output Power Supply Amazon N/A 24V, 12V, and 5V at 5A 1
6 7i76e Mesa N/A Controller Board 1
7 Proximity Switch Amazon N/A PNP, NC, 6-36V 1
8 Intel Nuc 5 Amazon N/A Core i3 - Mini Computer 1
9 Electrical Cabinet Ebay N/A 20" x 16" x 7.5" 1
Accessories
# Part Name Vendor Part Number (SKU) Unit Quantity Link
1 Jog Pendant Amazon N/A 4 Axis MPG Handwheel 1
2 CNC Work Probe Drewtronics N/A 3 Axis Digitizing Probe 1
3 Touch Plate Ebay N/A Tool Height Setter 1
4 Touchscreen Monitor Amazon N/A Tool Height Setter 1

The BOM may contain affiliate links that provide monetary kickbacks to Dr. D-Flo. These funds are used to pay for this website and future projects.


Affiliate links may be present.
  •   A little self-promotion here, but if you are new to CNC motion, then checkout my written guide and video on how to build a 3D printer. Many of the concepts that go into building a 3D printer translate over to a mill conversion (just on a larger scale).
  •   The LinuxCNC Wiki and forum are invaluable resources if you use this open-source software to control your mill.
  •   The book CNC Milling in the Workshop is great for beginners


Walk Through

The video covers most if not all of the mechanical CNC conversion. However, if you want to learn more about the installation of the ball screws and motor plates then checkout the documentation on Heavy Metal CNC (where I bought the conversion kit from). This walkthrough is going to focus on the electrical and software portions of my mill conversion. Whether you are converting an RF-45 clone (e.g. Grizzly, Precision Matthews, etc.) or an old knee mill, most of the information presented here will translate to your conversion. Finally, if you are new to CNC motion, then it would be worth your while to check out my How to Build a 3D Printer Video, which covers a lot of topics needed to successfully build a CNC mill.

  Electrical Setup

  Disclaimers:

  Electricity is dangerous. Mistakes can cause injury and be expensive. Find out how to work on electrical components safely...

I also want to point out that I am NOT an electrical engineer, so the way in which I wired my mill may not be the best or safest way. If you have a safety concern with any of the information provided in this guide please email me directly at [email protected], so that I can make the appropriate changes. With that said, I accept NO liability for any harm or loss resulting from following this guide. Proceed at your own risk.

  A Computer Controlled Milling Machine

Nearly every aspect of the milling process can be computer controlled. Entry level CNC mills will have computer controlled linear motion (i.e. stepper motors) and maybe some homing switches. More sophisticated mills will have robotic arms that load and remove parts, automatic tool changers, and many sensors that monitor the cutting process. A lot of these industrial technologies can be added to DIY CNC mill conversion/builds, so really the only limit is your budget.

The current configuration of my mill is relatively simple. It has three stepper motors, three limit switches, a tool length probe, a work offset probe, and handheld pendant for jogging the axes. In time I will add a power draw bar, automatic tool changer, and coolant, so check back on this project if you want to learn how to expand the capability of your mill. But first let's start with the basics.

Examples of electrical components that can be interfaced with a CNC controller board.
Figure 1: Examples of electrical components that can be controlled by a computer.

  The Controller Board: Mesa 7i76e

The controller board is the bridge between the computer and the CNC hardware (e.g. the stepper drivers, limit switches, coolant pumps, etc.). There are many different controller boards on the market, but usually, you pick a board based on the CNC software that you plan to use. Most boards are designed to be compatible with a certain software. For example, a controller board that is compatible with Mach3 or Mach4 would not work with LinuxCNC.

Pick your software then your board. Unfortunately, I have only ever used LinuxCNC, so I can’t help with your software decision. I decided to use LinuxCNC due to its flexibility, but the cost of this freedom is complexity. If your Linux knowledge is limited and/or your short on time then I would go with Mach or Centroid. On the forums, people overwhelmingly recommended the Mesa family of boards for LinuxCNC. I went with the Mesa 7i76e for maximum upgradability and ethernet connectivity. The ethernet connection was important to me because I wanted to use a smaller computer like a Raspberry Pi 4 or Intel Nuc, which have an ethernet port but do not have PCI/PCIe connections.

While the 7i76e has been working smoothly ever since I got it up and running, the setup was anything but smooth. Let’s just say that the documentation for the 7i76e is not written for the layman. A user over on the LinuxCNC forum posted the pinout for the 7i76e board, which helped in making the following diagram (Figure 2) as well as understanding the role of all the different jumpers on the board.

Mesa 7i76e pinout and wiring diagram.
Figure 2: The pinout of the Mesa 7i76e.

  Wiring the Mesa 7i76e

You can click through the tabs below to see how I wired up different components to the Mesa 7i76e. I included some tips like how to wire an NPN vs PNP switches to the Mesa board and what is going on with all the different jumpers.


The 7i76e has 13 jumpers that handle an array of settings from the pullup voltage to the IP address of the board. Study the diagram (Figure 3) below and adjust the jumpers of your board to match. Jumpers W7, W10, W11, and W13 differ from the default jumper configuration. Make sure your board matches the orientation of the schematic below (ethernet port is on the left).

Mesa 7i76e jumper locations for the Mesa 7i76e
Figure 3: The recommended jumper locations for the Mesa 7i76e.

  Which Computer?

Obviously, to run LinuxCNC you need a computer running Linux. However, the requirement for the Linux realtime kernel makes it little confusing which computer is the best for running LinuxCNC. Is a fast multi-core CPU required? No. In fact, raw CPU power is really not that important. Low-end Atoms and Celerons CPUs are more than sufficient for running LinuxCNC. The most important factor is the PC’s latency. Latency is defined as “how long it takes the PC to stop what it is doing and respond to an external request.” With LinuxCNC, the computer’s CPU handles the step pulses, so any delay (i.e. latency) between when a step pulse needs to be generated and when it is actually generated will directly affect the motor's performance. A computer's latency is a sum of all the components from the wifi card to the usb devices connected.

Because latency is not a specification that is reported by manufactures, I believe that it is best to purchase a computer that other have had success with. I used an Intel NUC 5 in my build, but I had to disable the WiFi card before I had a low enough latency to run LinuxCNC without my steppers stalling. There is a database of the realtime performance of various computers/CPU found here.

It may be helpful to point out what computers are not ideal for running LinuxCNC. Laptops are rarely a good fit. All of the power management software that is running in the background to prevent the laptop from overheating eat into the realtime performance. There is more information on what hardware is not ideal for LinuxCNC found here.

My last recommendation is to stay away from the Raspberry Pi 4. There’s a forum post over on LinuxCNC.org that describes how to get LinuxCNC running on this little device. This caught my attention because I had a Raspberry Pi 4 on hand, and I was actually able to get some low latency out of this device. The fatal flaw was that the Raspbian 10 / Debian 10 OS that runs natively on the Pi 4 no longer supports some of the software packages that are commonly used to run many of the LinuxCNC GUIs and widgets that users have created to speed up processes like work and tool probing. Ultimately, this forced me to switch from the Pi to the Intel Nuc, so that I could run Debian 9 as my OS.

  LinuxCNC Setup

I’m more of a hardware guy, so learning how to adapt LinuxCNC to my custom milling machine was definitely a challenge. The amount of information that is available on the LinuxCNC Wiki is overwhelming, but I strongly recommend putting the time in upfront and reading through as much of this documentation as possible because it will save you a lot frustration when setting up the software side of your mill.

  Picking a GUI: Probe Basic

LinuxCNC has different graphical user interfaces (GUIs) with some being more optimal for touch screens and others giving the user access to complex probing macros with a push of the button. There is not going to be a performance difference between the different GUIs, but some designs result in higher productivity than others. My favorite GUI is Probe Basic (Figure 8). Probe basic is the only LinuxCNC GUI that looks like it is from the 21st century, and it doesn’t just have the looks. It is chalked full of probing subroutines that allows you to accurately set the work coordinates with a push of a button. Here is a list of some of the other GUIs that are avialble.

GUIs require different packages to be installed and may require a special distribution of Linux, so I recommend picking out a GUI prior to installing LinuxCNC.

How to wire an MPG Pendant to a Mesa 7i76e
Figure 8: Probe Basic: A graphical user interface for LinuxCNC that is user friendly and greatly reduces set up times through its many subroutines for probing

  Download, Install, and Setup LinuxCNC

If you are going to use Probe Basic as your GUI of choice then you can follow the full installation instructions provided by the Probe Basic team found here. If you are using a different GUI and/or prefer a different Linux operating system, like Mint or Ubuntu, then follow instructions found here.

If you are using a Mesa ethernet card, then after installing OS and LinuxCNC it is very important to configure the network adapter to get along with the Mesa card. Configuring the network adapter is slightly different process for Debian 9, Linux Mint 19, and Lubuntu 19.04.   This is a very important step - do not forget!

  Run the Mesa Configuration Wizard

The Mesa boards and LinuxCNC go together like peanut butter and jelly. The best example of this compatibility is the Mesa Configuration Wizard that is automatically installed when LinuxCNC is installed. The Mesa Configuration Wizard is better known as PNCconf. A great step-by-step guide for how to use PNCconf is found on the LinuxCNC website. You can test your latency and motor wiring in PNCconf. Try and fill in as much information about your CNC machine into the configuration wizard as possible. Use the 7i76e wiring diagrams I made above to accurately tell PNCconf which components (stepper motors, limit switches, etc.) are plugged into which pins. Next I will go over how to customize the files that are outputted by PNCconf to match the LinuxCNC configuration files exactly to your mill’s setup.

After completing PNCconf, there will be new folder located in your LinuxCNC/configs folder. This folder, named after your mill's configuration, will contain a couple different files but the HAL and INI files are the most important.

  Tweaking the HAL File

The Hardware Abstraction Layer or HAL file is the most intimidating file for those who are new to LinuxCNC. While the Mesa Configuration Wizard gets you pretty close to a completed HAL file, manual edits are needed if you are looking to add complex features to your CNC mill like a jog pendant or multiple probes (e.g. work and tool probes).

I am not going to pretend like I fully understand the intricacies of the HAL file. I have yet to finish reading the 100 page manual on how the HAL file works and all of its components. Everything I know has been from trial-and-error, so it may not be 100% accurate (just a heads up).

In my eyes, the main role of the HAL file is to act as a link between hardware and digital components. For example, let’s say you have the limit switch for the X-axis plugged into digital input pin 4 on the Mesa board. How in the world will LinuxCNC know that? Well, that information is defined in the HAL file, and it looks like this:

net home-x <= hm2_7i76e.0.7i76.0.0.input-04-not

The net command creates a connection between the Mesa pin, which is input 4 in this example, and the digital X-axis limit signal (home-x). This is the limit switch that will be triggered when the mill is instructed to home, which is why it is home-x. The "<=" syntax is optional, but it makes the code easier to read. Following input-04 the word "-not" inverses the signal. This limit switch is normally connected (NC), and therefore input-04 will be at 24V until the limit switch is tripped. Therefore, when input-04 is not connected to 24V the limit switch has been tripped (i.e. home-x should be true).

Setting up a probe is just as easy as setting up a limit switch:

net probe-in => motion.probe-input <= hm2_7i76e.0.7i76.0.0.input-20

Here we have tied together three items: 1. the probe-in signal, 2. the state of the input-20 pin, and the digital motion.probe-input pin. During a probing move if the state of input-20 changes from false to true then so will the motion.probe-input, which signals to LinuxCNC that probe has been tripped during a move.

While setting up one probe was somewhat trivial, connecting two probes (tool height probe and work offset probe) is a trickier example because LinuxCNC only recognizes one probe signal. There is not a probe-in-2 signal. This isn’t a huge deal because we will never use both probes at the same time. You could wire both probes to one input and then net that single input from the 7i76e to the probe signal in the HAL file. However, there can be issues with this approach depending on the type of sensor/switch the probes act as. In the HAL file we can connect two inputs to the single probe signal digitally through an or2 component. The or2 component takes input from two pins (say from a work probe and tool probe) and outputs a true/false value similar to how or statements are used in other programming languages like Python. If either the work or tool probe input is true, then the output of the or2 will be true. The output of the or2 can then be connected to the probe signal via a net. To initialize the or2 component you have to both load the component by using a loadrt command and add it to the "thread" so that the component is updated (i.e. constantly checking for changes in the state of the inputs) through the addf command. The loading and adding commands precede the use of the or2 function. This can be a little confusing. I had to read the Basic HAL Tutorial a couple of times before everything clicked. Below is everything written out.

loadrt or2 [count=1]
addf or2.0 servo-thread	

or2.0.in0 <=hm2_7i76e.0.7i76.0.0.input-20
or2.0.in1 <=hm2_7i76e.0.7i76.0.0.input-21

net probe-in => motion.probe-input <= or2.0.out

This definitely looks more complicated than the previous probing example, but I hope it makes sense. Notice the .0 in the or2.0. If you need another or2 component later on then you will have to load and add another or2 statement, which is accomplished by modifying the top code code to:

loadrt or2 [count=2]
addf or2.0 servo-thread
addf or2.1 servo-thread

Your next use of or2 will be or2.1. Don't forget: in computer programming counting starts at 0!

  Configuring MPG pendant in HAL

One of the hardest parts of this entire build was configuring the HAL file to read the inputs from a pendant with a jog wheel. All of the HAL examples online did not seem to work with my setup, which was very frustrating. However, after I got everything set up the pendant has worked flawlessly. I hope my code, which is below, speeds your build along! Read through it and the inline comments then I will discuss how it works below.

# sserial_port_0 needs to be set to 2xxxx. This changes the 7i76e to Mode 2
# and allows it to accept two seperate MPG inputs on pins 16/17 and 18/19
loadrt hm2_eth board_ip="10.10.10.10" config="firmware=hm2/7i76/7i76e.BIT num_encoders=1 num_pwmgens=0 num_stepgens=3 sserial_port_0=2xxxx" 

# The mux4 component will be used to switch jog increment
loadrt mux4 count=1
addf mux4.0

# --- MPG --- 
# In linux 2.8 "joints" (i.e. your motors) and axes (your directions x, y, z) are seperated.
# However, for my simple three axis mill with one motor per axis this is not particularly 
# useful. We need to tie the joints to the axes (joint.0 = axis.x, joint.1 = axis.y,
# and joint.2 = axis.z)

# When jog-vel-mode is set to 0 the axis will move jog-scale
# When jog-vel-mode is set to 1 the axis will stop when the 
# handwheel stops turning 

setp joint.0.jog-vel-mode 0
setp joint.1.jog-vel-mode 0
setp joint.2.jog-vel-mode 0

setp axis.x.jog-vel-mode 0
setp axis.y.jog-vel-mode 0
setp axis.z.jog-vel-mode 0

# This sets the scale that will be used based on the input to the mux4
# This mill reads in metric units so jog scale is 1mm, 0.1mm, and 0.01mm
setp mux4.0.in0 1
setp mux4.0.in1 0.01 
setp mux4.0.in2 0.1

#The inputs to the mux4 component
net scale1 mux4.0.sel0 <= hm2_7i76e.0.7i76.0.0.input-10
net scale2 mux4.0.sel1 <= hm2_7i76e.0.7i76.0.0.input-11

#The output from the mux4 is sent to each axis jog scale
net mpg-scale <= mux4.0.out
net mpg-scale => joint.0.jog-scale => axis.x.jog-scale 
net mpg-scale => joint.1.jog-scale => axis.y.jog-scale 
net mpg-scale => joint.2.jog-scale => axis.z.jog-scale 

#The Axis select inputs
net mpg-x joint.0.jog-enable <= axis.x.jog-enable <= hm2_7i76e.0.7i76.0.0.input-07
net mpg-y joint.1.jog-enable <= axis.y.jog-enable <= hm2_7i76e.0.7i76.0.0.input-08
net mpg-z joint.2.jog-enable <= axis.z.jog-enable <= hm2_7i76e.0.7i76.0.0.input-09

#The encoded output counts to the axis. Only selected axis will move.
net encoder-counts <= hm2_7i76e.0.7i76.0.0.enc0.count
net encoder-counts => joint.0.jog-counts =>axis.x.jog-counts
net encoder-counts => joint.1.jog-counts => axis.y.jog-counts
net encoder-counts => joint.2.jog-counts => axis.z.jog-counts

The 7i76e has three software modes (0, 1, and 2). Mode 2 “activates” the 2 MPG encoders on inputs 16,17 and 18,19, which is how the board will measure how far the handwheel on the pendant has been rotated. Switching to Mode 2 is accomplished through setting the sserial_port_0 equal to 2xxxx . I don’t want to get in too much detail, but basically this sserial_port_0 is an entry in the configuration string that is passed to the Mesa 7i76e on start up.

I want to quickly point out that LinuxCNC 2.8 can be used to control many different CNC machines, including complex robotic arms. To make LinuxCNC work with all of these different applications they have separated the motors, which are known as “joints”, from the cartesian coordinates, which are known as “axes.” If you have a CNC machine where you need to move multiple motors to get movement in one direction (or axis), then you can assign all of these “joints” to a single “axis.” This mill is hardly a complex CNC machine and each axis is driven by one motor. You will see throughout the code that I have tied the X, Y, and Z joints to their respective X, Y, and Z axes.

Most pendants have one hand wheel and at least two knobs that allow you to select which axis you want to move and at what step size. Let’s focus in on the step size. The step size is referred to as the jog scale. Each click of the handwheel will correspond to whatever jog scale is active. Most pendants let you choose between three or more different jog scales. My mill reads metric units, and I found 1mm, 0.1mm, and 0.01mm to be good range of jog scales, where 1mm is sufficient for moving the mill quickly to a rough location and 0.01mm being adequate for precise movements.

If you reviewed the wiring diagram for connecting the MPG pendant to the Mesa 7i76e (above), then you may have realized that the jog selector is a simple switch that connects the active jog scale to common (in our case 24V). Therefore, a pendant with three jog scales will have three wires for each scale as well as a common wire. You would think that the 7i76e would look to see which wire is at 24V to figure out which jog scale LinuxCNC should use when moving the mill. You would be right, but there is a small caveat we need to concern ourselves with. LinuxCNC likes 4-to-2 bit binary outputs from its switches. I know I am going to lose some people here but as its name suggest, a 4-to-2 bit binary outputs takes four inputs and distills them down to two outputs. How is this possible? Well, it’s based on truth table, where the absence of signal is also a signal. You can read more about them here. These 4-to-2 binary outputs mean you only need two pins on the 7i76e to read 4 inputs, so this conserves those limited number of digital inputs.

The LinuxCNC component that reads these 4-to-2 binary outputs is known as mux4. If you are wondering where this name comes from, multiplexing is also known as muxing. The conversion of 4 inputs to two outputs is multiplexing. I strongly recommend you read about how the mux4 component works here. The mux4 is initialized just as the or2 was in our previous example.

So most cheap pendants don’t have this 4-to-2 binary output, so what dcan be done? Well, we can kind of pretend. If you think about it we technically only need two wires for three inputs. Because if neither wire one nor wire two is connected to common then by default wire three must be (assuming there is no faults in the wiring). This is why I was able to get away with only two pin inputs for the mux4 (hm2_7i76e.0.7i76.0.0.input-10 and hm2_7i76e.0.7i76.0.0.input-11). When you read the truth table on the mux4 documentation this will hopefully make sense. The output of the mux4 is outputted to the jog-scale of each axis/joint.

If your pendant has 4 jog inputs, then you will have to use a mux8.

Perhaps confusingly, the selector for which axis you want to move does not require a mux4 component. This is because of the way the jog-enable signal works. Technically, you could enable and move multiple axes at once (not recommended), so we only need to net together the enable signal with the input pin on the 7i76e that corresponds to the appropriate axis/wire on the selector.

Finally, we net the input from the encoder that the MPG is plugged into to the axis/joint jog-counts, which results in the moving of the axis that is enabled by the jog-scale.

If you are able to successfully hook up and run an MPG, then no task involving the HAL file is too difficult. Similar methods are employed to setup coolant pumps and even automatic tool changers.

Download my HAL file and adjust it to your needs.

  The .INI file

The INI file is also outputted by PNCconf. If you have ever set up a configuration file below when building a 3D printer, then the INI file will have a lot of variables that look familiar, like the maximum acceleration and velocity of each axis and the location of the limit switches. If you fill out all of the fields in PNCconf then almost no adjustments to the INI file are necessary. However, if you find that you inputted the wrong steps/unit because you actually have a 20 tooth pulley instead of a 30 tooth pulley you can quickly change that in the INI file.

Download my INI file to see how my mill is setup. Note: most of my acceleration/velocity values are conservatives, because I havn't stressed tested this mill yet.

Discussion and Feedback

Let me know in the feedback form below if you found this small LinuxCNC tutorial helpful. I saw a need for a LinuxCNC guide that was more digestable to newcomer. If there is enough interest I can expand on this content.

Do you need more help? The best way to get your questions answered by Dr. D-Flo and other DIYers is to post a question on the forum. Click here for the forum topic specific to this project.

Rate this Project: or


Did you encounter broken links or misinformation while reading this article? Please bring these issues to our attention by providing your feedback below.

We'll never share your email with anyone else.