Custom G-Code for Slightly Unusual Application... MK4
Hi All,
I have a slightly unusual question/quest and I'm hoping to get some guidance from you fine folks here. If I am posting this in the wrong place, sorry, and please feel free to move it or let me know!
Basically I want to use my Prusa MK4 to do something completely unrelated to 3D printing, namely, simply taking advantage of the Y carriage movement in order to pull on some test samples at a specific rate. I am imagining an incredibly simple g-code program that helps me do this quickly and repeatedly.
I'll try to explain this briefly... I am doing adhesion peel tests of heat-sealed plastic films - basically, at what force do the samples peel apart? I have a dynamometer with a peak-hold function, and the peeling/break forces I will be measuring are very low - in the 0-5N range, which is at most 500g of force.
In order to replicate the ASTM peel test, I need to pull these samples at 200mm/minute. I can try to do this by hand, but then I look over at my 3D printer and think, hey, I've got a CNC pulling machine right here! How can I do this?
My plan is to fashion a hook on the Y-carriage to hold one end of the heat-sealed strip pair, and attach the dynamometer to the other end of the connected pair. Then, press play on my little program and have the Y-carriage move towards the back for 200mm or so. The required force for the break would then be recorded on my dynamometer.
So... I am not (yet) versed in g-code, and my knowledge-base currently consists of a basic understanding, and the Youtube videos by CNC Kitchen and Maker's Muse on this topic.
I would imagine something as simple as this...
The program starts by disabling motors for 5 seconds, allowing me to move the Y-carriage all the way to the front by hand. Then, perhaps accompanied by a beep, it starts moving backwards at a rate of my choosing (i.e. 200mm/minute). It probably wouldn't need to actually move more than 100mm before my samples would peel apart. The program ends and I can repeat as needed.
I am just at the beginning of working this out, so I have endless questions, though I think I can work through a lot of them with some more research, but basically I'd like to ask...
Is such a slow movement attainable with the Y-carriage? 200-300mm/minute is my target range and this is "mission critical". How do I set the transport speed of a G0 Y-axis movement like this? If I write the g-code in a simple text document, what's the easiest way to get this onto my MK4 as a g-code program that will allow me to execute it, just like I would normally do a print?
Thanks in advance and please let me know if something is not clear, though honestly this seems so simple, it would be a great 1st day project in a g-code class. That said, I need some assistance!
All the best,
holmburgers
RE: Custom G-Code for Slightly Unusual Application... MK4
I just want to add that a few of my answers (especially the feedrate question) are easily answered here... https://help.prusa3d.com/article/prusa-firmware-specific-g-code-commands_112173
RE:
Ok, can't actually test anything (nor do I know how yet...), but here's my first go at this simple program I've described.
M300 ; sequence begin
M117 Motors Disabled (5sec) ; LCD message
M84 S5 ; motors disabled, manually set Y-carriage fully forward
M300 P100 ; signal beep(s)
M300 P100
M300 P100
M300
M117 Pulling Start ; LCD message
G91 ; relative positioning mode
G0 Y-175 F200 ; move Y-carriage backwards 175mm at 200mm/minute
M300 ; sequence end beep
M117 Motors Disabled (5sec) ; LCD message
M84 S5 ; motors disabled, manually set Y-carriage fully forward (optional)
M300 P100 ; signal beep(s)
M300 P100
M300 P100
M300 ; program complete
RE: Custom G-Code for Slightly Unusual Application... MK4
OK, just in case someone else stumbles upon this thread, I tried something and it worked!
Basically, I wrote my ~10 lines of Gcode in a MS Notepad document, then saved it with ANSI encoding and manually wrote a .gcode suffix when I saved it. This was all possible in the normal windows dialog box.
Then, I had to manually put it on a USB drive (PrusaConnect wouldn't let me upload it to the server...), and lo and behold, it worked!
I'm shocked and happily surprised how easy that was!
It would be super cool if I could upload this via PrusaConnect, but I can certainly live with this little inconvenience.
RE: Custom G-Code for Slightly Unusual Application... MK4
Well done. I never thought of using the printer this way. It is all controlled by Gcode so I don't see a problem. Again, well done.
RE: Custom G-Code for Slightly Unusual Application... MK4
Thanks!
I still will work on optimizing the gcode program. I believe there must also be a way to have a built-in "pause", which then requires pressing "resume" to go on? This would be handy for my tests.
Anyways, pretty fun and glad it worked. If anyone knows of a slicker way of doing this, and also how to upload it via PrusaConnect, that would be great!
RE: Custom G-Code for Slightly Unusual Application... MK4
PrusaConnect and PrusaLink both accept files on their respective dashboard page. Check your file to see that Notepad isn't putting a hidden '.txt' file extension on the file name?
RE: Custom G-Code for Slightly Unusual Application... MK4
Some resources for you (if you don't know them already) to find and/or look up usage for different commands:
https://help.prusa3d.com/article/buddy-firmware-specific-g-code-commands_633112
https://reprap.org/wiki/G-code
https://marlinfw.org/meta/gcode/
The pause you are looking for may be any one of: M0, M1, M25, M125, M226, or M601
See my (limited) designs on:
Printables - https://www.printables.com/@Sembazuru
Thingiverse - https://www.thingiverse.com/Sembazuru/designs