- March 30, 2016 at 5:41 am #9846
How i can control my cnc mostly with a joystick (swich only)April 2, 2016 at 11:48 pm #10113
I believe estlcam can do that if you use a arduino uno and a grbl shield. I would love to find a was to do this with a ramps 1.4April 15, 2016 at 2:43 am #10764
I was working with Karl Tinsley on a joystick controlled cnc pendant for Marlin but stopped development when I decided to switch back to Mach3 for my control software. I had written some code to allow joystick jogging and also to use a laser pointer to plot points on a round surface and use them to calculate and jog/set origin to center of the circle. Karl added code to have a variety of push buttons control functions like laser, zero touch plate, etc… I haven’t seen Karl on the forums for a while. Wondering if anymore progress was made on this. The pendant was driven by a seperate arduino nano communicating with the mpcnc mega 2560 over a serial connection.April 15, 2016 at 6:11 pm #10801
Seems like it would be pretty easy on Linux, with python. I don’t have much windows sotware experience, so I have no idea how to read joystick input there.
The problem would be the lag, because marlin likes to take your serial command, and say, “OK, thank you” and just store it for later processing. It keeps a pretty long cache, so you’d overshoot your goals by a lot, I think. The same thing happens with the LCD, since it’s sending commands over serial as well. If you try to use the knob to move the z axis up and down, you can get a lot of commands buffered up, stop moving the knob, and the axis will move up and down several more times.April 15, 2016 at 7:06 pm #10802
You’re absolutely right.The timing is a big issue with the Marlin planner buffering incoming commands. There are a few options with PC host software but one of the requirements for the pendant project that I was working on with Karl was to do this on a marlin set-up with no PC connected so the only option was to use a second Arduino and send the commands through the serial connection between the two. The buttons were simple to program because they only needed to send one Gcode command at a time while the joystick had to be controlled by an interrupt to make sure it wasn’t buffering commands too fast(overshooting the target) or too slow (stuttering). I also added code to update a display with current axes position and that had to be done in a way that wouldn’t interfere with the joystick jogging too. I think Karl continued to work on the project after I moved on but I haven’t seen him on the forums for a while. Here’s a video of an early test that demos the axis position display and the joystick jogging plus a center-circle function that would calculate the center of a circle after jogging to 3 points along the circumference. Karl had programmed quite a few buttons to perform functions like zeroing all axes, homing, laser on/off, etc… I was planning to etch a PCB and work on a cool handheld housing next but I lost interest to work on other things
If you really want total remote control then mach3 is the best control software. Lots of aftermarket products like MPG pendants out there.April 16, 2016 at 12:34 pm #10814
That is cool. Very low latency. I wonder if it’s if you send short commands, just a few mm ahead of the current position.
I plan on getting my raspberry pi connected to the Marlin pretty soon. I wan TT to add some features, probably starting with octopi or the web grbl. I have no experience with CNC or even manual milling, so I don’t know what kind of features or controls I even would want.
Are these pendants pretty common in larger machines? Like do most large machines have them? Maybe I can read the manual for one and find some of the most common things to integrate.April 16, 2016 at 4:44 pm #10822
So the pendants are good for large machines that you can’t move by hand. I have not felt the need for one because you can simply move it. large machines have to have a controller and can’t be moved by hand. A pendant might be good for really small moves, maybe but not really necessary.April 17, 2016 at 5:49 am #10829
Sorry I have been away with some family emergencies. Leo messaged me about this thread, so I thought I’d give my two cents.
I initially brought up the question of creating a pendant a few months ago, and luckily Leo turned out to have the skill to help make it a reality, or at least get it most of the way there, so big thanks to Leo for his work and continued help on this.
My main desire with this project is having direct access to items that are buried in the menu structure of the LCD (I run my MPCNC from the LCD). Ryan is right, this machine doesn’t need joystick jogging like a big machine does, but there are times when you want to move the tool head without losing where your zero point is currently set. Using the LCD menu to jog the machine is a pain because of how far into the menu you have to go each time. Other deep-menu functions I wanted to access directly included locking and unlocking steppers, setting the home offsets, and turning the cooling fan on low power (to activate the laser for aiming).
In addition to the above menu access, Leo and I discussed having functions that could calculate a position, such as the center of a circle, based on other positions, or saving the current x,y zero position for later use in case the machine loses registration. These additional functions haven’t been coded yet, but I mention them so folks will have an idea of what might be possible.
So here is a picture of my pendant as it is right now. I use it every time I use the machine, particularly for turning on the laser for aiming, and for setting the home offsets. There are six black buttons that are unlabeled (and hard to see), that are meant for future functionality. The zero touch button is supposed to trigger a touch off but isn’t currently working. I plan to fix it when I finish incorporating Leo’s new joystick code with my button code. The original code was not as smooth as the video shows now. This takes me a while because I’m not a programmer. I’m sure some folks will have some questions about how this all works. I’ll do my best to answer. I’m sure Leo will jump in too – he’s really the technical expert on this.April 17, 2016 at 6:45 am #10832
Thanks for taking time to share this. This is very well thought out.
I have only cut 3 boards on my MPCNC, and I am finding myself using the LCD menu “prepare” functions all the time. I would probably have a button just for bumping the Z up 2mm. I don’t want to rewrite the LCD, but it’s definitely focused on a printer’s point of view. Having some discretes for some of these functions would be really nice, even though the MPCNC is easy to move. I would agree that it is definitely not a requirement for this CNC though.
I’m not sure if I want to do the pendant with the arduino the same way you guys are. I like the idea of having a raspberry pi connected to my MPCNC, and that opens up the possibility of using a wired or wireless XBOX like controller for many of the functions. I also want to get to the point of having unattended jobs, and a web interface makes that way better.
I don’t like to promise work on the Internet, because I know I’ve forgotten about projects before (I have a low success rate at finishing projects, I’m much better at starting them 🙂 ). I think this is a project that I would enjoy though. This is moving right to the top of my list.
Some clarifying questions:
1) The Jog XY/Z, does that switch between jogging XY or jogging Z? Or does it enable any jogging?
2) w.r.t. The ability to save a home position: You would have endstops installed, and you would home all axes, then you would move to some other origin, say the corner of where you want your drawing, and then hit the save button. The software would record that center x,y,z, and then if you lost the home for some reason, you could rehome, and hit load, the software would go to the same x,y,z, and set origin there? That seems like a good idea. Then you would just never move the endstops.
3) The circle centering: That would be useful for rectangles as well, I would think. Just so I’m understanding, you’re saying you move to three points on the circle, hit the button, and the thing will then move to the center? Once at the center, it could be combined with the set origin button, or you could just write down the coordinates for something else?
4) The z touch off, is that also related to the touch stop? What is that like? I’m picturing hitting the Z touch button, and then touching the touch stop when you are at the right height.
I would love to see the code, if you are willing to share it. On github, gist, or just a zip file even.
I was also thinking of some blue sky functions that would help you set up for a gcode print. Something like loading a gcode file, and then having the CNC move around to the extents to make sure you have it laid out correctly, with no interfering clamps. Then things like a “safe Z” button would make more sense, because it could just go to the highest Z in the file. It would also be pretty cool if you could point to two corners of the area you wanted to cut, and the software could scale and rotate the design to fit. Useful when clamping isn’t easy to do in a square way. A function to just clear out an area by defining some corners for a polygon, and a depth would be nice. These functions would be tough to use if you only had a gamepad. I might have to also incorporate a piTFT screen, or just make the complicated things part of the web interface (which could be used from a phone or laptop). Seems like I need to spark a community effort. There is a lot of neat stuff to do here!April 17, 2016 at 9:29 am #10838
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: https://www.vicious1.com/forum/topic/auto-homing-without-setting-origin/ 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!April 17, 2016 at 12:34 pm #10846
LOL, my coding is FAR from elegant but I get by and it works for me. Karl, if you want to post the code then I’m ok with it but I’m sure more experienced coders will find flaws so I don’t want to hear about them:) Just fix them please:)
The center circle function calculates center x,y point given 3 points around the circumference and then moves the tool to center x,y and sets that x,y point to origin. There were plans to code center ellipse and center rectangle/square functions as well as zero/touchplate for z axis but like Jeff, I tend to move on to the next project before completing the current one. The display updates x,y,z position every time the stick movement is idle. This is done by parsing a response from an M114 call to the Mega board as Karl mentioned.
The total cost for parts is around $10 or so if you order from Ebay(China).
The OLED display uses the U8G library and I haven’t examined the U8G code but i’m pretty certain that it uses interrupts because it tends to interfere with stepper timing when the display refreshes which is why I avoid refreshing the display during jogging.
@Jeff: If you aren’t planning to do any 3d printing then you should consider a USB motion control board along with a windows 10 tablet running mach3. The cost wouldn’t be much more than a raspberry Pi set-up but you’d have a dedicated touchscreen interface running Mach3 with USB camera support as well as probing/point cloud generation , MPG pendant support, and a host of other cool features. Mach3 also supports vbscripting to create custom macros that can be triggered by a button on the keyboard or pendant and also supports customized display templates.April 17, 2016 at 1:38 pm #10851
I’ve seen quite a lot of less-than-elegant code. I’m becoming quite fluent in it. 🙂 .
I probably have all the parts in my bins. I have been looking for an excuse for the OLED screen. I could always start there.
I guess I don’t see the costs of a Linux/OctoPrint/Raspberry pi solution comparing to a windows tablet. I should be able to get everything I will need in terms of hardware for $100 max, including a small touchscreen. All the software would be free. Obviously, I still have to write some of it.
I’m a Linux fan, and a python fan, and a raspberry pi fan, so I suppose that’s just where I’m going to land. If no one else wants to use it, that’s OK. There are still the windows options out there.April 17, 2016 at 2:13 pm #10852
I totally understand your devotion to the Linux platform. You sound like someone that knows how to bring it all together and get the most out of the hardware.
I think I spent $50 on a used windows 8.1 tablet with 10 inch screen on ebay which still qualifies for the free Win10 upgrade. They’re pretty easy to find at that price.The Sainsmart motion controller board that I’m using was $35 but it replaces the mega2560/Ramps combo and I’m using TB6560 3 amp drivers at $4 each and my USB borescope camera was $10 so I’m at about $100 for a full touch screen set-up and that’s including the control board and stepper drivers. The Sainsmart motion controller came with a Mach3 license (legality questionable) so I’m all set. The only drawback is no PWM output for my laser from that motion controller. It does provide a 10v ADC spindle output so I’m working on using an Arduino board to take the 10v analog signal and convert it to 5v PWM (with 10-bit resolution for grayscale improvement). I’m also printing pieces to build a digitizing probe to add on so it’ll be really cool . Don’t know how much I’ll use the probe but building it and figuring it out is the fun part anyway right?
You must be logged in to reply to this topic.