Another problem with Stepper Motor and A4998

Hi everyone,

I'm trying to make work a simple code for a stepper motor like this : Nema 17 stepper motor. Whose specifications indicates a 0.9A rated current.

So I bought A4998 drivers A4998, as it says it could drive up to 2A per phase.

I have a 30V/10A power supply for the motors and I control the driver with an Arduino UNO.

I already tried to power the logic voltage of 3.3 to 5V of the driver with both the 5V of the Arduino and with a LM2596 step down to 5V.

I also have several stepper Motors and several drivers of the same type.

My problem is the motors won't turn despite making some noise as if it were turning, so I did some research and the main causes could be :
-> Not enough power : It couldn't be that as I use a 30V/10A power supply
-> A software problem : I don't think either, I tried with both Accelstepper library and to control directly the step and drive pin
-> A wiring problem : I checked multiple time compared to the resources found on the internet, so I hope it's not that (I also tried changing all the wires) : Example of tutorial
-> Phase Inverted of the motor : I measured with a multimeter what phase of the motor are connected and also tried with a LED to turn the shaft (to be sure :slight_smile: )
-> Limit current of the driver not properly set : I follow the tutorial and also try to turn the potentiometer on A4998 to increase the limit current.

So, When I try the simple code it makes some noise but won't turn:

digitalWrite(DIR2,HIGH); //Enables the motor to move in a perticular direction[/color]
 // for one full rotation required 200 pulses[/color]
 for(int x = 0; x < 200; x++){
           digitalWrite(STEP2,HIGH);
           delay(250);[/color]
           digitalWrite(STEP2,LOW);
           delay(250);
}

When I connect the Arduino with a separate source not linking the Arduino Ground and power Ground, the motor turns but irregularly.

In conclusion, my only guess is that the A4998 driver is not able to provide enough current to the motor so it can't turn. So I require your opinion on my situation, if you see another problem. And if I need to replace the driver will a DRV8225 be enough for the motor.

[UPDATE] Don't buy HALJIA A4998 on Amazon they were the cause of all the troubles. I received 5 new A4998 from a different brand and 4 of them are working (I start thinking stop buying on Amazon).

Thanks for your response

The A4988 will have no problem supplying 0.9 Amperes/phase, but you may not have set the current limit correctly on the driver.

The procedure to set the current limit (see the A4988 data sheet) requires you to know the value of the current sense resistor on the A4988 board. Tutorials like those on the Pololu site assume that you have the board that they make.

So, what is the value of the current sense resistor, and what procedure did you follow to set the current limit?

Hi thanks for your awnser,

The Rsense was not specified in the description of the product, so I assumed it was 0.068ohms as for polulu driver and then applied the formula :
Vref = 8 x current_limit x Rsense = 8 x 0.9 x 0.068 = 0.48 V
However, even if this is not the right value I tried to turn the potentiometer and the motor was just making more noise.
How could I measure Rsense to be sure otherwise?

You can read the value of Rsense off the board. It will be large (as SMD resistors go), but post a clear, focused picture of the board if you can't recognize it.

For more informed help, please post a clear, hand drawn wiring diagram of your entire setup, with all pins clearly labeled, and post the code, using code tags. Are all the grounds connected?

When I connect the Arduino with a separate source not linking the Arduino Ground and power Ground, the motor turns but irregularly.

A schematic would be better than a written description.

The A4988 motor power ground and the digital ground are tied together in the A4988.

Hi thank you both for your awnser,

In the 1st version, the power supply powers every parts with 1 LM2596 to step down to 9V for the Arduino Vin and 1 to step down to 5V for the logic power supply of the driver, all grounds are connected. In this case, the motor makes noise but won't turn.

In the 2nd version, I used a 9V external power to power the Arduino and the 5V source of the Arduino for the logical power supply of the driver. In this case the motor turns irregularly. I also try this version with the ground of the Arduino connected to the ground of the 24V power supply and it behaves the same as 1)

arduino_shematic.pdf (558 KB)

Sorry, I couldn't post all in one time

As for the code,

#define STEP2 5
#define DIR2 6

pinMode(STEP2, OUTPUT);
pinMode(DIR2, OUTPUT);


void setup(){
    pinMode(STEP2, OUTPUT);
    pinMode(DIR2, OUTPUT);
}

void loop(){
    digitalWrite(DIR2, HIGH);
    for (int x=0; x<200; ++x){
        digitalWrite(STEP2, HIGH);
        delay(250);
        digitalWrite(STEP2, LOW)
        delay(250);
    }
    delay(2000);
}

jremington:
You can read the value of Rsense off the board. It will be large (as SMD resistors go), but post a clear, focused picture of the board if you can't recognize it.

For more informed help, please post a clear, hand drawn wiring diagram of your entire setup, with all pins clearly labeled, and post the code, using code tags. Are all the grounds connected?


A picture of my module sorry I couldn't get a better result :confused:

Very poor quality picture. I can't see the chip markings, and suspect you have a counterfeit or reject chip. Any cheap module you buy on eBay, Alibaba, etc. is very likely to be a waste of money, for that reason.

A guess for the current sense resistors would be the two that might be marked "100", but the corresponding value (10 Ohms) makes no sense.

Measure the resistance with your multimeter. If it is 10 Ohms, that is a(nother) problem.

If you buy parts from Pololu, you know what you are getting, they are worth what you pay, and you get excellent product support.

jremington:
Very poor quality picture. I can't see the chip markings, and suspect you have a counterfeit or reject chip. Any cheap module you buy on eBay, Alibaba, etc. is very likely to be a waste of money, for that reason.

A guess for the current sense resistors would be the two that might be marked "100", but the corresponding value (10 Ohms) makes no sense.

Measure the resistance with your multimeter. If it is 10 Ohms, that is a(nother) problem.

If you buy parts from Pololu, you know what you are getting, they are worth what you pay, and you get excellent product support.

Hi,
So, the 2 resistors on the right are indeed marked with R100 (0.1 ohms), however when I measure both resistors I obtain 0.7ohm or 10 times greater the one I choose for my calculation :angry:. I bought the part on amazon so I don't think they could be counterfeit but they are probably poor quality.

I bought the part on amazon so I don't think they could be counterfeit but they are probably poor quality.

Sorry, lots of people report buying counterfeit parts on Amazon, even counterfeit ATmega chips that don't work properly.

At least you can send it back.

In your photo of the wiring I see no capacitor on the Vmot input. This is from the Pololu A4988 page.

Warning: This carrier board uses low-ESR ceramic capacitors, which makes it susceptible to destructive LC voltage spikes, especially when using power leads longer than a few inches. Under the right conditions, these spikes can exceed the 35 V maximum voltage rating for the A4988 and permanently damage the board, even when the motor supply voltage is as low as 12 V. One way to protect the driver from such spikes is to put a large (at least 47 µF) electrolytic capacitor across motor power (VMOT) and ground somewhere close to the board.

groundFungus:
In your photo of the wiring I see no capacitor on the Vmot input. This is from the Pololu A4988 page.

Hi,
Thanks for the remark, actually I removed it to check the value of the capacitor for the schematic.
So I ordered new A4998 and I will update this thread when I will receive them.

I removed it to check the value of the capacitor for the schematic.

Bad data is worse than no data.

Hi,
Can you please post a circuit of your project.
A hand drawn schematic will be fine.

Please label your connections and show your power supplies.

I hope you are aware that these breaks in the blue and red lines mean that the bus connection along the edge of the protoboard is also broken and is not continuous.

breaks.jpg
Tom... :slight_smile:

breaks.jpg

TomGeorge:
I hope you are aware that these breaks in the blue and red lines mean that the bus connection along the edge of the protoboard is also broken and is not continuous.

Hi,
Thanks for your response, I already new that power line were not connected all along the breadboard ;). The problem was effectively the A4998 drivers that were not working in accordance with specifications. For the record here is my circuit.

schematic.png

schematic.png

It very very easy to blow up a stepper driver chip if you connect/disconnect the motor wires while
the stepper driver chip is powered up - you must never do this, if you do the chip is very likely
to be damaged. You need to make sure the wiring between chip and motor is rock-solid - a breadboard
can be problematic for this reason.

I always get a few spare DRV8825 modules in case I damage one this way. DRV8825's are more
capable than A4988's so I always get DRV8825's.

Ive never recommend buying bare chips from unknown suppliers on eBay or Amazon, and there
may also be counterfeit modules out there (seems less likely as the scammers are too lazy to
do anything but re-label chips). I've had several DRV8825 modules from eBay that seemed OK.

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