For a temporary optical measuring project, I would like to use the XYZ axes of my K8200 3D printer as a 3D positioning system - the extruder, heating etc. will not be used for this task and will be replaced by an optical sensor on the bridge where the extruder resides.
Since the optical mesuring device is operated and evaulted from within LabView, I need to position the XYZ axes of the K8200 from within LabView as well.
Could anyone be so kind as to point me in the right direction on how to set up communication between the K8200 and LabView programming environment? Once I know how to operate and “speak” to the K8200 from within LabView, the further steps will be quite straight forward.
I currently do not know:
how to interface to the K8200 via software code from within LabView
which commands/programming language will be necessary to use (is it G-Code?)
The manual entry of G-Code from within the Repetier-Host software is a fully sufficient way of controlling the axes; basically I need to achieve to pass these commands to the K8200 from within LabView.
Any qualified hint would be gratefully appreciated. Thank you.
do you know how to communicate from within LV with a (virtual) COM port, or, for that matter, via GPIB, USB, RS232, or anything likewise?
If not, the short answer is: look into LV’s tutorials and help files, and perhaps a LV forum if you wish to get going. Pretty much everything besides that is, as you pointed out, quite straight forward: since your Repetier Host seems to communicate well with your K8200, the port settings in RH will give you the parameters you need to set up the port in LV.
As for your second question, yes, you will have to teach LV to use G-code. You probably will want to have a look into Slic3r’s settings to get some hints on possibly useful init codes, e.g. homing, set units to …, abs/rel positioning, etc.
Depending on the intended mode of operation, point by point / stop and go mode or measuring while continuously moving, checking the acceleration setting in the Marlin firmware might be mandatory. That goes for the precision of the axes, too: keep in mind that the original M8 z-axis rod will have backlash when moving downwards. But that’s pretty much it - send your desired coordinates (and feedrate) to the printer and watch the magic.
Yes, I do know how to communicate to RS232 and similar devices from within LabView, once they are “visible” within LV.
I have been travelling and have not yet had the chance to take a closer look into LV.
Next step after my return: I guess my question basically is at the moment how to access the K8200 from within LV. Is there a device driver that can be loaded inside LV, will it be sufficient to write serial commands to the virtual COM port? I don’t understand yet how the K8200 will “appear” within LV. Could you or anyone else give me a hint on this? Thank you.
the printer itself is not visible to LV at all - at least as long as you don’t write your own “instrument driver”. I did not search whether there are ready-to-use CNC or G-code libraries to be used in LV, but I reckon the chance is slim due to several somewhat special features and code interpretations in the Marlin firmware. Even within the RepRap world, some basic commands produce different e.g. movements, depending on the type of firmware used.
The bright side is, it’s not hard to write this driver. It won’t be done in five minutes, but within a day you should see good progress.
Communication with the printer worked in a q’n’d test in the second try (first one was without term char, stupid me). I used the VISA VIs (V. Configure Serial Port, V. Write, V. Read, V. Close). Just add your virtual COM port and those 250000 baud as resources to open the connection, send e.g. ‘M105\n’ (enable -codes display for debugging or hard-code the term char to be appended to the write buffer). As for the mandatory read count, you can enter a large number, maybe some hundred bytes (e.g. M115 produced a 174 bytes response). Voilà, you have a manually operated single command printer control VI. Send a M105 and see whether you get back the temperatures of extruder (if present?) and heatbed, or G1 X10 Y10 F1200 for a first move.
Next steps: expand the whole thing and split it up, perhaps you like something like an init VI (configure port, send basic commands like home etc., see previous post), some VIs for moving etc. (each with write and read), and a cleanup VI (port close). If you want to work bottom-up, first spend some time on subVIs you will reuse multiple times in those other VIs, like evaluating the responses (ok, rs, !!, variables/values; see the G-code page in the RepRap wiki), generating the line numbers and checksum if you want transmission control, etc.
I finally found the time to follow your advice. Serial communication with K8200 from LabView worked like a charm. The further procedure is straight forward from now on.