Grbl control input buttons.
A customer's question got me thinking about this topic and I realized there needs to be a guide. A lot of machines do not use the control input buttons of Grbl and many low end breakout boards don't even have connections to them. This is specifically for grblHAL and our breakout boards but is broadly applicable to any Grbl system. First, we will do a quick tour of Grbl states. Grbl boots into the Idle state which basically means it is waiting for something to do. Loading a GCode program in your GCode sender application makes it ready to run a job. Pressing Cycle Start in your sender causes Grbl to enter the Run state (sometimes called the Cycle state) and start executing the GCode commands (called blocks). Pressing Feed Hold in the sender, causes the job to pause and Grbl to enter the Hold state. When the job finishes, Grbl returns to the Idle state to await new commands. Pressing the Stop button in the sender while a job is running causes the job to end and Grbl to also return to the Idle state. The full state machine diagram for Grbl is quite a bit more complex and perhaps I will explore it in another blog but for now, this is enough to get the point across.
One feature of the Grbl design is the use of physical switch/buttons to control Start, Hold, Door and EStop. On my breakout boards, you can wire up a switch to each input and use them to control a job. Start and Hold should be momentary push buttons, Door should be a lever micro switch or sensor (similar to a limit switch) and EStop should be a latching switch (more on this in a bit). You can use either Normally Open (NO) or Normally Closed (NC) switches. NC tends to be a bit more EMI resistant though NO will work fine if you have isolation. NC is also better in that a broken wire or bad connector will look like an open switch and thus inform you of a problem that needs correction. This is particularly important for an EStop switch. Use good wiring practices including shielding to ensure no stray EMI gets in to do mischief. When using NO switches with grblHAL, you will need to invert the sense in Grbl Settings. The setting register is $14 and the value (70) shown in the ioSender screenshot below will invert Start, Hold and EStop. Note that in this case, Door has not been configured and is unavailable. The value for 8-bit Arduino Grbl settings may be different.
You use these button exactly as you probably suspect. Load a GCode program. Press the Start button and the job starts running. Press Hold and the job pauses. When you press the EStop button, the job stops, Grbl enters the Alarm state and basically shuts down. You have to reset and unlock to be able to use Grbl again. See below for more on Estop.
Here is a wiring diagram for these switches. A PicoCNC is used but the T41U5XBB would be wired exactly the same. To wire an 8-bit Grbl board, you need to find the corresponding pins for the control inputs.
Another control input that a lot of people are unaware of is the Safety Door input. This is a safety feature that pauses the running job. It also turns off the spindle. This is intended for fully enclosed machines with a door interlock switch. It is particularly useful for lasers, enclosed milling machines and any machine in an area that allows uncontrolled access. Most Grbls do not have this as a default feature so you will need to build a version that has it. In gbrlHAL, you can select this in the Web Builder. For Arduino Grbl, you need to edit the config.h file and enable safety door.
Here is the little control panel I create for my Avid Pro4848. It has Start, Hold and EStop. It also has a power switch for convenience. I have it mounted on the front of my machine where I can hit the EStop button. I have an older blog where I describe making the panel. Typically, I load a job in the sender and then press the Start button on the panel when I'm ready run the job. I spent way too much time thinking about the placement of the various buttons. I decided that the 2 most needed buttons should be at either end to make them easy to find and press. EStop is kind of obvious but I decided Hold is more important than Start. At least, I might press Hold more than once per job. Note that I am thinking of changing hold to be Door because it powers the spindle down.
About EStop. This is a crucial safety mechanism. Even if you don't use Start and Hold, you really, really, should have an EStop button. I recommend using a "mushroom" style EStop button mounted in a prominent, easy to access location on your machine. In an emergency, seconds matter. Even if your CNC machine is a tiny little under powered beast, you need it. The mushroom buttons have a rotate to unlock feature that requires intentional effort to reset once you have cleared the problem. You can find these switches on Amazon, eBay and similar sites and they are surprisingly affordable. Some cost less than $10 USD. If I recall correctly, the EStop button on the above panel was $8 USD from China. I really like it - mostly metal and very solid. It will take a lot of whacks - let's hope I don't have to though. I have a blog on EStop that you might find informative. In addition to EStop, you should also have a switch that will cut full power to the machine. While I have never needed mine in an emergency, I would never have a machine without one. If the machine goes crazy and the EStop button doesn't work, you really want to have a backup.