I am working on designing and building a CNC machine for laser processing and am interested in using Granite products for driving the motors. I plan to use the SimpleMotion V2 buffered motion API for CNC motion.
In order to be able to turn on and off the laser at the right time I would like to ask if there is any way to use the SimpleMotion V2 buffered motion API to control a GPIO in a way that is synchronized with motor motion (ideally as a fourth control channel)?
If necessary I can buy another IONI or Argon drive just for this GPIO pin. If it is not possible at all to control a GPIO pin in a way that is synchronized with buffered motion, is there a way to make a GPIO pin go high exactly when buffered motion begins?
I have not yet bought the motor drives, but my planned hardware configuration is:
Drive type: IONI
Motor type: It’s an XYZ translation stage with a Brushless DC motor for the Z axis and linear motors for the X/Y axes.
Interesting project. Honestly, I’m using similar setup myself on my CNC router (buffered commands being used for multiaxis motion). I think IONI would be good choice for your setup.
But the answer to your actual question: yes, it is possible to control output pin thru buffered motion in syncronishm. The buffered operation of SimpleMotion V2 allows inserting any kind of commands in the buffer, not just setpoint commands.
And luckily there is a SM parameter SMP_AUX_OUTPUT_SOURCE_SELECT to control one output pin on IONI (one pin per drive, and you can drive motor with the same drive simultaneously). See:
So the trick here would be to send just stream of setpoint commands to all drives, and on-demand insert a write commands of SMP_AUX_OUTPUT_SOURCE_SELECT to the buffered stream.
However, unfortunately there is no ready-to-go example project of that (at least yet), and the buffered motion API of SM library currently only manages setpoint commands. So it might require some hacking on SM lib to add support for inserting non-setpoint commands to the buffered stream.
Thanks Tero for your response! This sounds promising.
After posting this question I found out that another requirement of this system is to use a dual encoder feedback loop (the system has rather strict accuracy and resolution requirements), and reading your documentation it seems that this is not currently supported by any of your drives. I’m afraid that this renders this discussion moot for the purposes of my current project, since I will not be able to use SimpleMotion anyway…