Arduino control Faulhaber stepper motors

Hello all,

I'm using Arduino to control Faulhaber AM1020 stepper motors. My set up is the following:

  • Arduino UNO board
  • CNC shield
  • DRV8825 drivers
  • Faulhaber AM1020 stepper motors
  • Windows 7 computer

I have a code (attached) that can control motors via serial communication. My issue is that this code works with some standard stepper motors (SM-17HS4023), but when I change them to the Faulhaber ones, they don't move. When I hold them with my hands I can feel and hear the noise of the pulses as if they were moving, but they are not. I don't know what should I change in order to make my code suitable for these motors.

I'm also uploading the manual for these motors, in case it helps.

PS. The code is written to move to motors in the position X and A of the shield, but I'm planning to use all the positions X,Y,Z and A. This is just for trial.

#include <SoftwareSerial.h>
#include <AccelStepper.h>


const byte numChars = 32;  //number of characters per piece of info
char receivedChars[numChars];
char tempChars[numChars];  //temporary array for use when parsing


float xsteps = 0.0;
float asteps = 0.0;

boolean newdata = false;

//
//two stepper motors
#define xenable 8
#define xstep 2  //pin for step of x motor
#define xdir 5   //pin for dir of x motor
AccelStepper xmotor(1, xstep, xdir);


#define aenable 8
#define astep 12  //pin for step of y motor
#define adir 13   //pin for dir of y motor
AccelStepper amotor(1, astep, adir);

//
void setup() {

  Serial.begin(9600);
  Serial.println("input data");

  pinMode(xenable, OUTPUT);
  pinMode(aenable, OUTPUT);


  xmotor.setEnablePin(xenable);
  xmotor.setPinsInverted(false, false, true);
  xmotor.setAcceleration(1);
  xmotor.setMaxSpeed(10);
  //motorX.setSpeed(100);
  xmotor.enableOutputs();

  amotor.setEnablePin(aenable);
  amotor.setPinsInverted(false, false, true);
  amotor.setAcceleration(1);
  amotor.setMaxSpeed(10);
  //motorY.setSpeed(100);
  amotor.enableOutputs();
}

void loop() {

  receive();
  if (newdata == true) {
    strcpy(tempChars, receivedChars);  //this copies the values in recerivedchars into tempchars (string) for a temporary copy
    parsedata();
    showpd();  //show parsed data
    newdata = false;
  }

  xmotor.moveTo(xsteps);
  amotor.moveTo(asteps);
  xmotor.run();
  amotor.run();
}

//======= define the used functions======

//receiving (and stop receiving) the data
void receive() {
  static boolean rip = false;  //receive in process
  static byte ndx = 0;
  char startmarker = '<';  //character that will mark the start of the reading by the serial monitor (i need to send the characters like that from labview)
  char endmarker = '>';    //the same but with the end of the reading
  char rc;

  while (Serial.available() > 0 && newdata == false) {  //check to see if anything is available in the serial receive buffer
    rc = Serial.read();                                 // we add to the array the characters until the endmarker
    if (rip == true) {
      if (rc != endmarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      } else {
        receivedChars[ndx] = '\0';  //terminate the string
        rip = false;
        ndx = 0;
        newdata = true;
      }
    } else if (rc == startmarker) {
      rip = true;
    }
  }
}

//split the data into the different parts -> depending in how many characters and what kind of characters we are sending
//this function will change
//we are getting in principle 4 sets of steps data (although we will try first with two) that are supposed to be float type
//
void parsedata() {
  char* strtokindx;  //use as an index for the strtok funtion

  strtokindx = strtok(tempChars, ",");  //get the first part
  xsteps = atof(strtokindx);            //converts this to a float
  
  
  strtokindx = strtok(NULL, ",");  //continues where the previous call left
  asteps = atof(strtokindx);

}


//show what we have received (that serves as a confirmation that we did receive it or at least i think and hope so)
void showpd() {  //show parsed data
  Serial.print("X motor steps: ");
  Serial.print(xsteps);
  Serial.print("; A motor steps: ");
  Serial.print(asteps);
  Serial.println();
}

basics.pdf (1.0 MB)
EN_AM1020_FPS.pdf (237.2 KB)

Please posr schematics, not Frizings coloured bird nest.

How do you power the motors, and did you adjust the current accordingly at the DRV8825 when changing the motors?

And look at the graph of motor power in the document you posted. The torque is greatest when the powering voltage is 2.5 to 5 times the rated voltage, but current is same setting. So, how much torque do you want to get from the motor?

Which one. You posted a link to four electrically different models.
The model number behind AM1020 is more important.
Which power supply (voltage).
Did you set DRV current.
Leo..

I am using a 12V power supply, and I did adjust the current at the DRV8825 according to the nominal current per phase (0.09A)

I don't really need a specific torque right now, I'm just testing. I guess that I need a torque strong enough so the motors move.

Sorry, I forgot to specify. My motors are the AM1020SB009008.
I'm using a 12V power supply
And I did set the DRV current according to the 0.09A of nominal current

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