I was wondering if it would be possible to connect a stepper motor to the digital output so that it can be controlled with the I / O signals. The intention is that the motor always takes the same number of steps in the same direction.
At the moment, the stepper motor is controlled by an arduino that is not (yet) connected to the cobot.
First of all you would need to find a stepper driver handling 24V signal inputs, or have some level-shifting as the typical arduino stepper drivers like stepsticks handle 5v signal only for step/dir pulses. Then it should be easy to implement a naive “set DI0 HIGH, sleep, set DI LOW, sleep” for N number of steps forward or backward. Downside is you wont have any acceleration managment so depending on application it might be very crude or unusable results. Implementing acceleration management might be pretty complex to do since you’ll hit strict timing issues.
To be able to handle that motion planning aspect we are approaching this by developing an Arduino-based device handling stepper drivers like stepsticks with the Accelstepper library and we control them from the UR controller over Modbus TCP. So we can send commands over Modbus to the Arduino for a specific position and then we can handle it on the Arduino side with acceleration planning etc as you are currently doing, and nothing needs to be computed on the UR side, simply send the target position.
In term of hardware it means you only need an Ethernet module for your Arduino to talk between the UR and the Arduino, and there is a Modbus library for Arduino.