Stepper.h / A4990 Issue

I’m trying to get a pair of A4990’s to drive a pair of stepper motors.

When I load a minimal bit of code, I can get the motors to lock up exactly the way you would expect. However, when I include a line from the stepper library to get the motor to actually move, the motor neither locks nor freewheels. It acts as though it’s getting strange signals. Resistance feels “grainy”.

Reading through this thread: A4990 Pin Question, I’m led to believe the stepper library would need to be edited to feed the proper sequence of signals to the A4990.

Am I way off base here? Opinions? Suggestions?

Isn’t the A4990 a “Step and Direction” driver? If so, the built-in ‘Stepper’ library can’t handle it.

I would recommend the third-party AccelStepper library. The “DRIVER” interface is used for stepper drivers with Step and Direction pins:

AccelStepper myStepper(AccelStepper::DRIVER, StepPin, DirectionPin);

No, the A4990 is an H-bridge. I chose that because I had an old h-bridge that worked well but was really ugly. The wiring in particular ran all over the place. The A4990 really makes for a tidy install but that doesn’t help if the motors don’t go round.

I did make a bit of progress since I posted and I think this thread really belongs in the software section. But, I have no idea how to move it.

In the way of progress, I edited the stepper.cpp file to change the truth table.
Originally, it read like this:
1010
0110
0101
1001
Since the 2 and 4 pins are reversed, I rewrote the table like so:
1111
0011
0000
1100
The motor does rotate but it’s a far cry from being correct. It misses steps at anything over 20 rpm and sounds horrid.

At this point, I’m in way over my head and I’m ready to put the old boards back in unless someone can give me a good guess as to what I should try next.

https://www.arduino.cc/en/Reference/StepperBipolarCircuit

This is the H-Bridge wiring diagram from the documentation for the Stepper library. Maybe it will help?

Hi. Pololu provides good wiring diagrams with their boards:

So, that’s not an issue.

It finally occurred to me that I could simply write a bit of code and measure the output of the board with a VOM.

Turns out, the truth table I had puzzled out was correct. The board simply isn’t up to driving my motors. My guess is that they are drawing more current that I thought they did.

I think it’s time to cut my losses and put the old board back in.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.