Bipolar 36pa5.18g servo and a4988

Hi, looking for help getting the bipolar servo motor working with arduino, I can currently only get the motor to shudder without actually moving in any one direction. have the a4988 board and 36pa5.18g motor. I have connected the red wire to 2b, blue wire 2a, green to 1a and black to 1b. I have 8volts coming in on VMOT using a 100uF capacitor. I have connected arduino d2 to DIR and d3 to STEP. Ground is connected to both arduino and external ground. I am using the arduino 5v connector to VDD. Any help appreciated

Hi David,

This is usually a sign that the motor is wired up wrong. I’d start with ensuring you have everything hooked up right, check the wiring diagram for the motor you have purchased.

From there, double check your Arduino code and ensure you are not stepping too quick, check the reset/sleep wiring, etc.

There is a great write-up on this product page, and you can fully test without the Arduino in use to isolate your code from the equation.

Hi Graham, I have been using that page to check what I have done. Am I right in assuming that it does not matter what way 2a and 2b go and likewise 1a and 1b as long as I have the wires paired right. I have also connected sleep and reset pins together.

The phase of those coils does matter, it would invert the polarity of the magnetic coils if hooked up the other way.

What did you set the current limit to?

8volts, which way should the wires be coming from the motor?

Hi David,

The current limit should be in Amps and is settable by the onboard potentiometer. You use that pot to control the VREF value and it’s a good idea to work backwards from the stepper motor datasheet to understand what limit should be applied. If you haven’t set this properly, it’s possible that you’ve cooked something.

Hopefully all going well, you have applied a safe current limit. Regarding what wires go where - perhaps check the datasheet or manufacturers notes for the motor you have purchased. If you have one coil out of phase with the other, then it’s not going to move well. Normally you just need to swap one of the coil phases around and it will work as intended (albeit the wrong direction). Once you have movement, you know you have the phases correct. If the direction is wrong then swap the polarity of both coils or invert the DIR pin value.

It’s worth noting that disconnecting a stepper motor while it is powered could damage the stepper motor or driver.

Consider this product:

Current Limit = 350mA
1A - Red
1B - Yellow
2A - Grey
2B - Green

You can’t rely on motor wire colours - they change between models. So checkout yours and remember to remove power when making changes.

1 Like