This is the part of the project, controlling 2 axis CNC with a touch screen.
i am trying to use pot to give input to the stepper motor for its positioning of one of its axis, using a pot for testing purposes to replicate a touchscreen
the code works as it is supposed to and stepper motor sits in its position whenever i rotate the knob of the pot slowly.
but when i rotate it a bit faster the positioning is lost, ie. whenever knob is at lowest position the stepper does not return to the original position
i know the stepper motor takes time to reach its position and it cant keep up with the knob position, but atleast the motor should not lose its position right?? what part of code do i have to edit ??
It sounds like the stepper can't actually do 60 RPM. When you ask it to move a few steps that isn't tested. But when you ask it to move by a large enough increment the limitation appears. Try lower speeds to see if the problem goes away.
I haven't used it, but you might look at the accelstepper library which includes the ability to ramp speed up and down.
How are you powering the stepper motor? What stepper driver board are you using? What voltage is the power supply?
Steppers cannot accelerate instantly - particularly here as you have significant
driven mass.
AccelStepper, not Stepper, is the library to use, as you can set the max speed and max
acceleration.
If you set the acceleration conservatively then you can experiment to find the
max speed for reliable operation, then up the acceleration until it miss-steps and
back-off 20% or so.
Miss-stepping can be caused by overload (the motor cannot pull hard enough
for the load / acceleration), or by resonance. Mechanical load will both
affect the resonant frequency and add some damping, so you can only tune
a stepper under load. Micro-stepping drivers reduce the amplitude of resonance.
Have you measured the resistance of the motor coils?
The problem with using an L293 for a driver is that you have no method of limiting the current through the motor. If you use a proper stepper motor driver (see, for example the Pololu A4988) you can limit the current and drive it with a much higher voltage for better high speed performance.
Does the motor have a part number? Have you measured the winding resistance? bipolar
steppers come in two categories, low-impedance designed for constant-current drive
and high-resistance designed for fixed-voltage drive.