I am using a Nema 17 Planetary Geared Stepper Motor with 1.8 degree steps. Below is the simple code I have for it to rotate. It is programmed to go clockwise almost 180 degrees and pause, then slightly more clockwise and pause, then return to its original position by turning counterclockwise.
This was the only configuration I set up where the motor would be consistent. Any other change and the motor would vary its rotation for no reason. I even just changed the length of the second delay (underlined above) to delay(5000) and the rotation was different each time. I changed boards, I rewired several times, I played with the rotation values, and nothing has worked.
nathanc122:
This was the only configuration I set up where the motor would be consistent. Any other change and the motor would vary its rotation for no reason
As well as what @jremington said, you need to post the program that does not work properly - no point fixing a working program
Hey. c'mon. Give us a break - don't post a picture of a crumpled piece of paper. Just post the relevant data. Better still, post a link to the website with the datasheet.
Also the program works but the motor operates inconsistently. That's my problem. I wish everything would work how it should, but I can't understand what is going wrong. Sometimes the motor will overstep at an increasing rate, so each cycle gets more and more off course.
The power supply is rated as 12V and 2.0A which should be plenty for the motor (2.8V and 1.68A).
jremington please do not be angry with me. I am trying to figure out my problems. I was just looking for some help. Since posting this I found out that the motor driver is L298N, which seems to be the source of my problem. Thank you
The motor in the link in Reply #7 draws 1.68 amps. A Pololu DRV8825 stepper motor driver should be suitable - but make sure to set the current limit correctly so as to protect the motor.
And use the AccelStepper library, not the Stepper library, you get step/direction interface support and
acceleration/deceleration which is essential except for very low speeds only.
Robin thanks for the help. I read through your stepper motor basics and purchased a Pololu a4988 motor driver before I saw your most recent reply. Is this fine? Do you foresee any issues with this driver over the DRV8825?
The A4988 will probably struggle to deliver 1.7 amps - the DRV8825 has greater capacity.
Try the A4988 - you should certainly be able to get the motor working - maybe with the current limit set to 1.3 or 1.5 amps - but with less than full motor torque. If you have a heat sink for the A4988 you may be able to get more current through it.