Closed HerrFlodo closed 11 months ago
Even though, this should not have an impact, it may be better to throw in a delay(1)
as FastAccelStepper processes changes of speed/acceleration only approx. every 4ms.
This braking is a sudden stop, which may happen, when the stepper gets irregular pulses ? Or is it deceleration to standstill and start again as usual ?
A possible cause may be the potValue. Please check, that the potValue does not jump in value. Either attach a capacitor at the potentiometer or perform SW averaging. For example like this:
int average = 0;
void loop() {
potValue = analogRead(potpin);
average += (potValue - average)/4;
targetSpeed = map(average, 0, 1023, 1, 40000) ;// Targetspeed pro Intervall
stepper->setAcceleration(30000);
stepper->setSpeedInHz(targetSpeed); // the parameter is Hz !!!
stepper->runForward();
delay(1);
}
Please let me know, if this has helped.
Hi Gin66,
Thanks a lot for the very fast response. I will try that in the afternoon. What I am also confused of is the missing deceleration function. The stepper speed follows direkt the potentiometer position. It should not behave like this, right? If I speed up, it works like expected.
btw: which version of FastAccelStepper do you use ?
This could be related: 0.30.4: Fix for issue #178: speed does not decelerate but jumps to lower value
Hi,
so i tested the above code today.
int average = 0;
void loop() { potValue = analogRead(potpin); average += (potValue - average)/4; targetSpeed = map(average, 0, 1023, 1, 40000) ;// Targetspeed pro Intervall
stepper->setAcceleration(30000); stepper->setSpeedInHz(targetSpeed); // the parameter is Hz !!! stepper->runForward(); delay(1); }
Unfortunately it does not bring any improvement. I am using version 0.30. It is conceivable that I have the same error as described in #178, but I could not reproduce it with the code in issue #178.
Thanks for the update.
So there are two possibilities:
While you are at it, perhaps you leave a comment here
Thank you so much. I updated the version and it works! Great job, thank you. Can I help you somehow or donate something?
Hi,
I have a problem with the deceleration in the RunForward command. I change the speed with a potentiometer in the loop as follows:
void loop() {
potValue = analogRead(potpin); targetSpeed = map(potValue, 0, 1023, 1, 40000) ;// Targetspeed pro Intervall
}
The acceleration works wonderfully, but with the deceleration I have errors. There seems to be no acceleration function behind the deceleration, and when I turn the potentiometer slowly the stepper sometimes brakes briefly to a standstill and then accelerates again.
Can anyone help me with this problem?
Greetings
Flo