Alright… before this thread closes, I want to spell out in detail how I did this. It wasn’t too complicated, but this way it’s documented.
Feed hold, which will stop movement of spindle when activated, and resume when disengaged:
*For this to work, you need to first have gone through the steps of @Julien’s topic here.
(Minus the pendant if you do not want/need)
Necessary preliminary actions:
-Must use CNCjs for this
-Must be using a Raspberry Pi
-Must have Julien’s code, from thread linked above. (Or make your own)
Necessary parts: (Parts with are only if using a switch with a light, like mine)
-Latching push button switch (Or 2x momentary switches, explained in step 3)
-Wiring (18-24AWG should be fine)
- Mechanical relay
- 12V power supply, I used this transformer
I decided to go fancy and use a latching push button switch with a red LED light when activated. This is what I bought. Not necessary, and adds some extra parts, complexity, & steps. If you do not want this, skip to step 3 for a regular switch w/out LED.
- You need a 12V power supply for the light on the switch (Or whatever voltage for the switch you may purchase with a light). What I did for this was to purchase this 120VAC to 12VDC power transformer. Here is my setup:
- Run your 12V output wires to the switch wiring, then run that output to the relay.
See the following simple wiring diagram: (Based on my setup)
**Make sure you wire the output wires of the relay to the normally open(NO) side… DO NOT use the normally closed(NC) side. I initially used this, but due to the function of the relay, It doesn’t perform reliably. When I released the switch with it wired to normally closed(NC), the spring back of the contact would ever so slightly “bump” or “bounce” off the contact, creating a moment where it would “double switch” and not properly function. Keeping it on normally open(NO) does not have this issue because the coil pulls the contact with enough force that there is no bounce back. When it is released, it doesn’t matter because when it bounces off, it is open either way.
- This is where you can begin if you don’t bother with a lighted switch, making it much more simple.
Whether you are using a lit switch or not, you have 2 options:
- Use a single latching switch (feed hold on activation, resume on release)
- Use two momentary switches (One for dedicated feed hold, the other for dedicated resume)
I actually purchased these for the second option, but decided to opt for the first option in the end.
The code I posted in step 4 is only for the latching switch. If you would like the option for the momentary ones, you will have to modify the code to meet your needs.
For the latching, you will simply need to attach one wire to GPIO6 (or whichever pin you choose, see step 4 for elaberation), then the second wire to any ground(GND) on the raspberry pi pins.
- Now, the coding… I must admit that I am not at all proficient with coding, and I can only really modify existing code by staring at it and figuring out what the variables/functions do
With that being said, you need to follow Julien’s steps to get CNCjs to communicate with this code, so I will not spend time explaining how to get that working. In case you missed it, here is a link to his thread on that.
Here is my modified code:
cncjs-pendant-raspi-jogdial - KevinCarr1996 MOD.zip (5.4 KB)
This code if has been modified from Julien’s original code to be in inches, and other slight changes to meet my preferences.
If you already have his code, and don’t want to change anything else on how it works, just cut and paste the “buttonEStop2” variable and functions to put in your existing code. (Use find command to search all locations in the document)
You must also add a “6” to the /boot/config.txt file on your raspberry pi from what Julien had mention in his post —> gpio=17,27,22,10,9,11,0,5,6=pu
Any GPIO pin can be used; I just happened to use GPIO6.
Here is my wiring:
I think that just about covers everything I did! Here’s a little video of when I got it working:
Here’s a ZIP file including STL’s with the following associated 3-D printed parts:
- 12V power supply mounting plate
- 7" R-Pi touch screen case back plate for pendant wires
- simple feed hold switch housing
Shapeoko 3 Feed-Hold 3-d print parts.zip (938.5 KB)
Hope this helps some of you guys!!
I’d love to see other’s work on this and especially if someone decides to work off of it to create further conveniences!