Reply To: control cnc mostly with a joystick

New Home Forum Software Development control cnc mostly with a joystick Reply To: control cnc mostly with a joystick



Thanks for the thoughtful questions, Jeff. You sound like you are pretty tech savvy. I’m also tech savvy and am used to reading code, and even tweaking it, but not writing it from scratch, which is why it takes me a while to incorporate Leo’s contributions into my code – his is much more elegant than mine, but also much more structurally complex.

I have wifi-enabled Raspberry Pi’s running octoprint on each of my two 3D printers, so I know how useful they can be, but I’m not sure what the value would be with the CNC. I do agree that using a gamepad would be easier than building a pendant like mine, though mine was pretty easy to build. I look forward to hearing more about plans for the RPi and the MPCNC.

Answers to your questions:
1) The Jog XY/Z button switches the joystick between jogging XY and jogging Z.
2) The calculated home idea came from this thread: and was originally John Wells’ idea. What I imagine is to have two endstops, permanent or semi-permanent. You would move the head by hand to your starting point, then press the Store Home button. The code would set the current location to 0,0 (this might not be necessary, it’s just what I imagine) then home the X and Y. It would then calculate how to get back to 0,0 from there (reverse the X and Y values?) and store that in eeprom. Then if something happens, like the power goes out, or you accidentally move the head during a tool change. Another button would home the X and Y, then recall the home position, go there and set it 0,0. I don’t think this would be hard to do – I think Leo was already parsing out data from an M114 call. Again, it’s much more of a hurdle for me, but I’m sure it can be done.
3) The way I understand it, when activated, you would be prompted to go to three points and press the button each time, then the machine would go to the center. I haven’t tried it yet but Leo had it working.
4) The z touch is meant to trigger a z touch-off. I have a zero touch plate that you place on the work and clip a wire to the tool bit. It moves the tool down until it touches the pad, and then sets it (plus an offset for the thickness of the plate) as the z zero. The touch pad is simply hooked up to the z endstop. The touch stop button was meant to stop the process in case I triggered it and didn’t have the touch plate hooked up – otherwise the bit keeps moving down into the work, or lifting the machine, until you kill the power or reset the arduino. I don’t think I need this button now, so I plan to use it for something different.

I’m happy to share my code with you, but the better joystick code and circle centering code are Leo’s, so it’s up to him if he wants to share it. If you’ll PM me your email address, I’ll send you mine.

Thanks again for the great questions, and some really cool blue sky ideas!