(UPDATED 2024.11.13 FOR FIRMWARE V0.85 CHANGES)
A z-probe is a super handy addition to your M4 allowing you to accurately and quickly set the z-home position of your router bit on top of your material anytime that you are getting ready to make a cut. They are easy and cheap to make. This post is intended as a step-by-step walk-through of the process I used to build and configure a z-probe for my M4 (with photos for most steps). (Note, I have tried to make this walk-through as explicit and comprehensive as possible, so please forgive the parts that are very straightforward and obvious.)
Essential Parts: (1) Flat piece of metal long enough to slide under your M4 (I picked up a 8" by 14" metal plate at Ace Hardware for ~$15, but any flat piece of conductive metal should be fine); (2) Wiring (if you want to be resourceful, wires from old broken headphones, RCA cables, or something similar could work); (3) JST-HX connectors, solder, or some other means of connecting wires.
Required Tools: (1) Wire cutters; (2) Crimpers, soldering iron, or other components necessary for you to connect the wires where needed; (3) Allen key included with your M4 in order to unscrew the screws of the M4 control board cover.
Optional Tools: (1) Electric multimeter; (2) Heat-shrink tubing or electrical tape.
Cost: ~$0-$20. You may have spare parts sitting around for some or all of the build.
Time: Less than 30 minutes to build and less than 15 minutes to configure your machine. (It could take longer or shorter depending on your parts and how fancy you want things to be in the end.)
Z-Home/Probe Goal: The ideal goal in setting the z-home is to lower the router bit until it just comes into contact with the work material (no lower, no higher) and set the position exactly there. After that, when the machine is cutting, it will go precisely the depth into the material that you set in your toolpaths. If the Z-home is off, your cuts will be either deeper or shallower than you programmed them to be (depending on what you’re making, this may not be a big deal to you, but becomes very important for smaller and/or more detailed designs and parts). The M4 is different than many other CNC machines in that the sled (and router) ride along the surface of the cutting material rather than hovering above the material independently on a gantry or other support system. For purposes of the z-axis, this means that, when the M4 is resting flat on the material, the bottom/underside of the sled is the same as the maximum height of the material (i.e., the ideal z-home position). Since the bottom of the sled and the position of the material are the same, lowering the router bit and setting the z-home to the bottom of the sled will also set the router bit right on top of the material, precisely where you want it to be.
Build Goal/Mechanics: When a circuit is complete, electricity can flow through the circuit. A basic switch operates by breaking and re-connecting a circuit. With these simple principle in mind, you can build a z-probe that acts just like a basic switch and completes a circuit when the router bit reaches the bottom of the sled. When the router bit is in the ideal z position, the circuit is connected (or switched on) and you can set the z-home right where you want it. To build the circuit here, you will need to slide a flat piece of conductive metal under the machine (any flat piece of metal can work but I recommend something at least a few inches wide so that the machine rests flatly on the metal) this metal acts as our material for purposes of setting the z-home position. For the most basic wiring, simply connect a wire to the router bit or collet and the other end of the wire to the metal plate. A circuit will be completed when the router bit touches the plate. However, with that circuit, we wouldn’t know when the bit touches the plate. Instead, we will be wiring the plate and the bit to pins on the M4 control board and the M4 will tell us when the circuit is complete (i.e., the switch turns on).
Alternate Build/Easiest Build: If you want to avoid taking anything apart on your M4 and/or tweaking the configuration of your maslow.yaml file, you can instead do the same job with a cheap electric multimeter (~$5 at Harbor Freight). The process will be a little more manual but still very easy and cheap and much more accurate than attempting to manually set the z-home. For this, (1) take your multimeter, (2) set the multimeter to check circuit resistance (ohms/omega sign), (3) touch one probe of the multimeter to the metal plate under the M4, (4) touch the other probe to either the bit or a wire attached to the bit (alligator clips can help), and (5) lower the M4 slowly until the circuit is complete. When a circuit is completed the multimeter will read resistance (depending on your multimeter, it may even make a beeping noise to signal the connection). For higher accuracy, you can then raise the bit 1 step, set your z-jog increment to a smaller distance (e.g., 0.5mm or 0.1mm) and lower the bit a step or so until the connection is again completed. Repeat until you are satisfied with the accuracy. Set the z-home at the position where the circuit is complete. (Note, after setting the z-home, I like to raise the z position up a centimeter or so in order to avoid having the bit scratch something if I move the machine around or turn the router on.)
Full Build: The following steps are a full build of the z-probe as described above. This requires connecting the probe to pins on the control board (which requires removing three screws to get access to the control board), a little bit of simple wiring, and making minor changes to your maslow.yaml file (i.e., your M4’s configuration file). I’ve included photos along with most steps to make them as easy as possible to follow/copy.
Building/Assembling Steps (the order of most of these steps can be rearranged or followed in the order presented below):
- Gather necessary materials and tools (see above).
- Remove the three screws on the M4 control board cover.
- Locate the connector on the control board with your auxiliary connections (according to @Bar, only two auxiliary connections are not being used for essential machine functions, we will use Auxiliary 1 which is GPIO pin 48 on the control board). There are 2 identical connectors right next to each other, so be sure you have the correct connector. With the power cord pointing downwards, you are looking for the connector on the right.
- Take 2 lengths of wire (length depends on how you are setting things up but I used ~6"). These wires will be used to connect to the 2 control board pins. I only used ~6 inches of wires so that I could disconnect and store the rest of the z-probe while keeping the wires connected to the control board permanently connected to the board (since my wires hang out the side of the control board, I didn’t want them too long that they would get in the way of anything). A disconnect is highly recommended to avoid having to constantly remove the control board cover every time you go to use your probe.
- Attach some sort of connector to the ends of the 2 wires that will connect/disconnect from the rest of the z-probe. This is not strictly essential and you could just touch exposed ends of the wires together to make a connection, but having exposed wires just hanging out is not a good idea for a ton of reasons. Note: If you use a connector (as I did), it doesn’t matter where the wires are positioned in the connector as long as they match up with the wires coming in. That being said, the other end of these wires (step 6) must be connected to the correct pins).
- Connect a wire to the Aux. 1 pin on the Control board connector (see picture under step 3 for pin layout) and another wire to the 3v3 pin on the connector (3v3 is a 3.3 volt powered pin). I used a 4-pin female JST-HX connector (and some wire from a breadboard kit) in order to match the connector on the board. You could instead solder the connections (if so be careful not to accidentally jump any of the connections together) or use some other means of making a connection to each pin that won’t come loose after using the machine.
WARNING! However, you make the connections, be careful not to permanently jump the pins to each other (especially, the 3v3 pin to the Ground pin). If you jump the 3V3 and the Ground pin, it will cause the board to reboot (though it didn’t seem to do any permanent damage to my board when I accidentally did it).
- Route the control board wires out to the side of the control board (I routed mine next to the USB port), and replace the control board cover and its 3 screws.
- Take 2 additional wires, and put a connector on one end to connect with the wires coming out of the control board. I used a JST-HX connector so that the wires can easily connect and disconnect with the wires going to the control board. You likely want a bit of extra length in these wires (~8"-12" or more depending on your build) since these will be going to the router bit and to the metal plate then connecting up with the connector that goes to the control board. You can use alligator clips for one or both of these wires. I recommend using at least one alligator clip for the wires going to the router bit/collet. To make the connection to the router bit even easier, I glued a couple small magnets to the end of an alligator clip (the magnets have a metal coating so still conductive). (Note, it doesn’t really matter which of the 2 wires connects with which of the wires in the connector going to the control board as long as one wire connects with each (i.e., if the circuit runs from the bit to the wire plate then to the control board or from the metal plate to the router bit then up to the control board–exact same results).)
- Connect one of the wires to the metal plate. For now, I just stripped back about an inch of wires and used some electrical tape to secure the wires to the metal plate. You could solder the wire to the plate, install some sort of screw to secure it, use a magnet, use an alligator clip, or however you want to do it. The biggest thing is to make sure that, however you connect it to the plate, the bottom of the plate stays flat and is not raised above the work surface.
With that, you are done building the z-probe. The next steps are for configuring the M4 to recognize the z-probe.
It is a very good idea to test all of your connections. You can do this with a multimeter in the same manner as described earlier. You just want to ensure that you have a complete circuit when the wires for the metal plate and for the router bit touch. If you’re like me and bad at crimping wires and connectors, then testing your connections is vital.
Maslow.yaml Configuration:
- Connect to your M4 at maslow.local and go to the second tab for FluidNC Settings.
- Make a backup of your maslow.yaml file in case you need to revert back to it for some reason. It is a good idea to make a backup occasionally regardless.
- Make an additional copy of your maslow.yaml file to edit.
- Open the yaml file in Notepad (or a similar file editor).
- Scroll down the yaml file until you find the default probe configuration options:
- Replace the default probe settings with the following:
All lines of code under “probe:” must start with two spaces (creating a small indent before each line). If you use a different GPIO pin than pin 48, simply change the pin number accordingly. The “pd” activates a resistors in order to prevent EMI from causing false positives while probing. - Save the changes to the yaml file and upload the file back to your M4.
- Reboot.
- Go to the “Preferences” tab in the upper-right corner on maslow.local and click to enable the probe settings.
- Go to FluidNC controller tab.
- Go down to the Probe options.
- Adjust the Probe settings to your liking. These can also be set in the Preferences before (see step 9). See the photo below for descriptions of the settings.
- Start your probe. Click the Start Probe button to start the probing. (If clicking “Start Probe” outputs a "G38.6 "command in the Commands info box below the probe settings, update the machine to the latest firmware, and try again.) (Note: Before probing, you can enter “?” into the Commands info box to show the current positioning of the machine and the status of any switches. If the probe is working and a circuit is currently active, you will see “PN: p” in the Commands info box along with the machine’s position. In FluidNC, “PN” means there is currently a switch in the active/connected state, and the “p” after “PN:” is specifically for a probe-type switch. So, “PN:p” is FluidNC saying that it is currently reading a switch as active and that switch is a probe. If you’ve built and configured everything, you can test your probe by touching the bit probe-wire to the metal plate (creating a circuit). If everything is working, you should now see “PN: p” in the Commands box when the connection is made, and, if you break the connection, PN:p should go away.)
- The machine will lower (no farther down than the “Z-” number/distance). If the bit makes contact and the probe triggers then the machine will stop there, set the machine’s z-home position where contact was made (you do not need to manually tell the machine to set the z-home position), and raises back up the “Retract distance” (see Step 12). Based on my own testing, the z-home position set automatically by the machine after clicking Start Probe is accurate to within 0.1mm (I was testing in 0.1mm increments, so that is a lower bound of its accuracy and it very well may be even more accurate than that).
- Disconnect the bit and plate probe-wires from the wires going to the control board, and remove the metal plate. You are ready to make your cut.