I would like to have a shaft driven by a stepper motor work in sync with a main motor. The main DC motor/shaft will have an encoder outputting so many pulses per rev. I'm thinking of using the main shaft encoder to be a sort of 'clock' for the secondary stepper such that the secondary can run 1:1 with the main shaft, or at fractions or multiples of the main. The idea is that if the main shaft/motor slows or quickens a bit, this would be seen in the encoder output and the secondary should follow.
Is it possible to use the output of an encoder with the Ardino timers to produce a PWM signal to drive the stepper in this manner? If so, I could just use some basic direction to get started.
Harrzack:
Is it possible to use the output of an encoder with the Ardino timers to produce a PWM signal to drive the stepper in this manner? If so, I could just use some basic direction to get started.
You would typically use PWM to control a plain old DC motor, but stepper motors are usually controlled by sending a sequence of high and low voltages to their inputs to make them step - there are libraries available for Arduino to take care of the logic for that so that you just need to specify when to step and in which direction. If you used that approach then the problem is simply deciding when to step, which would be a matter of detecting the encoder input events and doing some arithmetic to decide when the stepper needs to be moved to the next step. In the simple case where the number of encoder events per revolution is sufficiently large relative to the number of steps you need to take, this might just mean taking a step after every Nth encoder event.
Thanks! I actually haven't worked with motors or steppers yet... But was sorta aware of the difference. From what you say though, it is def doable. More homework needed!