I have spent the last couple of months designing and building a star tracker. The purpose of this is to take photos of the night sky, without the stars turning into streaks, as the sky rotates. Without getting too technical, in it's current state it consists of a high-gear stepper motor, which I have mounted a camera to. To test this setup some time ago, I ran it while connecting everything together using a breadboard (component list further down). I used the AccelStepper library to configure 16x microstepping and the correct direction for the motor to spin in. This worked wonderfully. After this test, I soldered everything to a perfboard. I remounted everything, and tested it again. This time however, the motor acted erratically. Sometimes it acted as if the motor wasn't even on, sometimes it would work for one picture, but not for the next.
The conclusion I arrived at was that for some reason, the rotational direction seems to have been reversed! Now when I reverse the direction in my code, and raise the speed, it works as intended!
I am completely stumped as to why this is. Have I reversed the polarity somewhere? Would that even give these results? What could possibly have caused this behavior?
The components I am using are:
Arduino Nanon (old bootloader)
A4988 stepper driver
Nema 17 stepper motor
Accelstepper stepper library
Any suggestions or tips would be greatly appreciated.
This is the specific motor I use: https://www.omc-stepperonline.com/precision-planetary-gearbox/nema-17-stepper-motor-l39mm-gear-raio-1001-high-precision-planetary-gearbox-17hs15-1684s-hg100.html
It seems I most likely just reversed the polarity of one stepper coil. It's fine as it is now, but if there could be other explanations to the problem I'd love to hear those too. Thank you to those who answered already!