RpiMotorLib
RpiMotorLib copied to clipboard
Stepper motor runs for ever
Hi, I am currently trying to drive a Nema 17 stepper motor with my Raspberry Pi using an A4988 Stepper Motor Driver. When I run the python scripts they work so far, but when the script is terminated with GPIO.cleanup() the motor slowly rotates forever in one direction. I am quite new to this, what am I doing wrong? Best regards Valentin
Hi
I would have to see your complete software and hardware setup.
I have set up everything exactly as described in the documentation for Nema11 A4988 and have so far only executed the script for the motor test. What I just noticed is that I ordered an A4988 stepper driver and it says so on the package, but on the microprocessor it says HR4988. Does that make any difference?
I am a little closer to solving the problem. GPIO.cleanup() sets all ports back to input, I think the stepper driver can't handle that.
Hi
I have never heard of the HR4988 until now. By doing research The HR4988 appears to be not 100% the same as A4988 Its a Chinese clone chip not an Allegro microsystems product(A4988). It appears to have a bad reputation for noise and vibration going from some posts I have found. It is designed to operate bipolar stepper motors in full-,1/2-, 1/4-, 1/8-, 1/16-,1/32-,1/64- and 1/128- step modes, with an output drive. The A4988 only goes to 1/16.
I still don't know why it would not stop? Are all grounds connected to each other ? Is the power supply filtered by a capacitor? Do you only have one part? Have you tried at different microsteps settings?
I confirm the problem with A4988 on Pi Model 4B v1.4 (Linux raspberrypi 5.15.32-v7l+). Removing the GPIO.cleanup() line in the A4988_Nema_Test.py script for example solved this issue.
Hi
I am NOT seeing this on my setup which is ::
'0.7.0' and '0.7.1' RPi.GPIO ( I tested both , 0.7.1 is latest PyPi 02-2022) OS: Raspbian 10 buster Kernel: armv7l Linux 5.10.103-v7+ Python 3.7.3 Raspberry pi model 3B,
I need to get a more modern Pi at some point in near future, to investigate fully. I cannot see any relevant modern issue ticket on the RPI.GPIO library, website.
Is it possible that people seeing the issue have an old version of RPi.GPIO installed? Or maybe its related to pi model-4 or Kernal, either way its not directly related to this libraries internal code I leave the issue open for now so people can see it.
Hi
I have added "Note 2" to the readme to inform users, I will leave it in test scripts for the moment.
Regards