Need Help! Problem driving a stepper motor using the A4988 reprap driver board and an Arduino


Results 1 to 2 of 2

Thread: Problem driving a stepper motor using the A4988 reprap driver board and an Arduino

  1. #1
    Registered
    Join Date
    Mar 2017
    Location
    United Kingdom
    Posts
    0
    Downloads
    0
    Uploads
    0

    Default Problem driving a stepper motor using the A4988 reprap driver board and an Arduino

    Hi guys

    I am having a problem driving a stepper motor using the A4988 reprap driver board and an Arduino
    I have set up the wiring using an example I found online (Diagram attached: A4988 wiring) .. However the motor does not seem to turn.

    http://www.cnczone.com/forums/attach...d=355696&stc=1

    The motor I am using is from an old Hitachi printer which I took apart a while back. Printed on it is 0.9A/ph. It has six wires however I am using it as a bipolar stepper by just leaving the center tap of each winding unconnected.

    I have adjusted the VREF on the A4988 board to insure that the current is limited bellow the 0.9A. To do this I used the data sheet of the A4988. As I wanted to run the motor at full step mode, the A4988 data sheet specifies that the winding current could only reach 70 percent of the current limit.

    consequently:
    Current limit = 0.9 * 0.7 = 0.63A

    Current limit = Vref * 2, Therefor Vref = 0.63/2 = 0.315V or 315mV

    I have therefor set the current limit using the potentiometer on the A4988 to aprox 315mV

    Once the wiring was set up, I applied power and measured the Vref to confirm it is still the same and it was.

    Next I disconnected the Power to both the Arduino and the driver and connected in the stepper motor. I then connected the power and uploaded the following code:

    // defines pins numbers
    const int stepPin = 3;
    const int dirPin = 4;

    void setup() {
    // Sets the two pins as Outputs
    pinMode(stepPin,OUTPUT);
    pinMode(dirPin,OUTPUT);
    }
    void loop() {
    digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
    // Makes 200 pulses for making one full cycle rotation
    for(int x = 0; x < 200; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);
    }
    delay(5000); // five second delay

    digitalWrite(dirPin,LOW); //Changes the rotations direction
    // Makes 400 pulses for making two full cycle rotation
    for(int x = 0; x < 400; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);
    }
    delay(5000);
    }


    Nothing happened... started off with 5 volts on the power supply and ramped it up to aprox 12vs however still nothing happened. I can feel the heat sink heating up on the A4988 which means power was reaching it. I measured the voltages from the Arduino to the A4988 and the power supply to the driver and the voltages matched the input. I started shaking about the power connections to and suddenly the motor made one step, but that was it. So i thought it was a problem with the breadboard. I checked the connections on the breadboard and all where connected. To be safe i decided to use another breadbord. Again nothing happened. I checked the Aarduino using the 28byj48 and UNL203 driver and stepper that came with it and they worked fine. I confirmed the wiring sequences and layout multiple times and they all matched the tutorial I followed.

    My inital thinking was that the stepper motor was broken, so i disconnected it and tried running it using the power supple (5V) by connecting and disconnecting each coil in manually one by one, and it turned one step at a time, which meant that the stepper was working. Finally i decided to see if current was reaching the stepper, I therefore connected the Altimeter in series with one of the coils and it did not read any current, which meant that current was not reaching the coils.

    Now I am unsure what to do, or what has gone wrong. The vref still reads aprox 310 - 320 mV, this makes me assume that driver is not fried. I do have another A4988 driver however I started working on that one and now the Vref does not go above 62mV so I'm guessing that it is burnt, however the second one reads fine.

    I have tried using the enable button with the following code (Attached; A4988 wiring 2) however it still didnt' make in difference. The following code is what i used for when I set the enabled to low (Note that the pin numbers have been changed)

    http://www.cnczone.com/forums/attach...d=355698&stc=1

    int Index;

    void setup()
    {
    pinMode(4, OUTPUT); //Enable
    pinMode(2, OUTPUT); //Step
    pinMode(3, OUTPUT); //Direction

    digitalWrite(4,LOW);
    }

    void loop()
    {
    digitalWrite(3,HIGH);

    for(Index = 0; Index < 2000; Index++)
    {
    digitalWrite(2,HIGH);
    delayMicroseconds(500);
    digitalWrite(2,LOW);
    delayMicroseconds(500);
    }
    delay(1000);

    digitalWrite(3,LOW);

    for(Index = 0; Index < 2000; Index++)
    {
    digitalWrite(2,HIGH);
    delayMicroseconds(500);
    digitalWrite(2,LOW);
    delayMicroseconds(500);
    }
    delay(1000);
    }

    Why did the motors initially step (only one step upon each shake) when I shook the power supply leads? I am afraid to try that again as I think this is what damaged the first driver I was using. And why is there no current reaching the coils?

    I would really appreciate an opinion on this issue as I have no idea what to do

    Many thanks for you time.

    Adnan

    Similar Threads:
    Attached Thumbnails Attached Thumbnails Problem driving a stepper motor using the A4988 reprap driver board and an Arduino-a4988-wiring-png   Problem driving a stepper motor using the A4988 reprap driver board and an Arduino-a4988-wiring-2-png  


  2. #2
    Registered James Newton's Avatar
    Join Date
    May 2005
    Location
    USA
    Posts
    1397
    Downloads
    0
    Uploads
    0

    Default Re: Problem driving a stepper motor using the A4988 reprap driver board and an Arduin

    First, those drivers are not... robust... you can fry them. One of the quickest ways to fry any driver is to disconnect a motor wire while the unit is powered on. The current built up in the coil collapses and causes a massive voltage spike through the other leads on the motor and takes out the driver. So I would really recommend against using a breadboard since the connections are less than totally reliable. Instead, connect the motor and other wires /directly/ to the driver pins. This assumes you have female housings on the end of the wires (it looks like you do) but if not, I would strongly recommend investing in a crimper, pins and individual housings. And then tape around the individual housings so they become mechanically all one unit.

    You did a valid test with the motor, great job troubleshooting! I would do the same sort of test with the output of the Arduino sketch after changing it so it only produces a step about once a second. Make sure that output is going up and down. And then I would make sure the driver had everything it needs. Are you pulling the Enable pin to the correct level? Go around the pin description on the datasheet and make sure each pin is where it needs to be. Once you know you are feeding it everything it should want, put a meter on each pin from the driver to the motor and feed in pulses slowly, like 2 a second. The meter should show a ramping up, then back down. Do that for each of the 4 motor wire pins. If you are sure you are feeding it everything it needs, and it isn't putting out a correct signal, then replace it. Your taped together pins will come off in one part, and stay together so they go on the right way on the new driver. Be sure to apply logic power FIRST, and THEN motor power. Read the datasheet to see why.

    Hope that helps, and contact my site when you are ready for a real stepper driver!

    James hosts the single best wiki page about motors for CNC hobbyists on the net:
    http://techref.massmind.org/techref/io/motors.htm Disagree? Tell him what's missing! ,o)


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Problem driving a stepper motor using the A4988 reprap driver board and an Arduino

Problem driving a stepper motor using the A4988 reprap driver board and an Arduino