How to use an Arduino to control a Faulhaber motor and motor controller.

I am working on a project where I need a motor to be controlled by a motion controller, and this motion controller is connected to an Arduino UNO R3. Right now I am unable to get the motor running, any help is appreciated.
Here is my current code
const int TX = 3;
const int RX = 4;
const int FAULT = 2;
const int THREEIN = 12;
const int AN_IN = A5;

void setup() {
pinMode(TX, OUTPUT);
pinMode(RX, INPUT);
pinMode(FAULT, INPUT);
pinMode(AN_IN, OUTPUT); //should be what drives the motor
pinMode(7, INPUT); //limit switch
pinMode(10, OUTPUT); //green led
pinMode(THREEIN, OUTPUT);
analogReference(DEFAULT);
Serial.begin(9600);
}

void loop(){
// put your main code here, to run repeatedly:
if(digitalRead(7)==LOW) { //if limit switch is pressed down the led and motor turn on
digitalWrite(10,HIGH);
analogWrite(AN_IN,255);
digitalWrite(THREEIN,HIGH);
digitalWrite(TX,HIGH);
Serial.println(AN_IN);
}
else{
digitalWrite(10,LOW);
digitalWrite(THREEIN,LOW);
analogWrite(AN_IN,0);
//digitalWrite(TX,LOW);
}
}

Here are the spec sheets for the motor and controller
Controller: https://www.faulhaber.com/fileadmin/Import/Media/EN_MCBL3002S_AES_V2-5_DFF.pdf
Motor (024 BX4): https://www.faulhaber.com/fileadmin/Import/Media/EN_2250_BX4S_DFF.pdf
Once again any help is greatly appreciated!

const int AN_IN = A5;
pinMode(AN_IN, OUTPUT); //should be what drives the motor
analogWrite(AN_IN,255);

analogWrite() to pin A5 will not work, because it's not a PWM pin! The Uno has 6 PWM pins: 3, 5, 6, 9, 10 and 11.

PS.: Pins 3, 9, 10 and 11 are 490.196 Hz, and pins 5 and 6 are 976.5625 Hz.

Digital pins.....

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

Hi,

Serial.println(AN_IN);

What do you expect from this line?

Do you have a DMM?

Can you please tell us your electronics, programming, arduino, hardware experience?

Thanks.. Tom.. :slight_smile:

Sorry for the delay and sorry if my first post wasn't very clear,
This is the first time I have undertaken wiring and coding a motor and motor controller. I have the Faulhaber MCBL3002S AES RS motor controller and the Faulhaber Series 2250 ... BX4S servomotor. I'm attempting to run this using an Arduino UNO. I'm simply attempting to get the motor to run when a switch is turned on and to measure some data. The data part I'm not too concerned with but I simply don't know how to/can't get the motor to run. I have the switch also attached to an LED to signal when it should be running and that is working fine. The Arduino side of the motor controller has:

TxD, RxD, AGND, Fault, AnIn, Us, GND, 3.In which are attached to Pin 3, Pin 4, Ground, Pin 2, Pin 5, 5V, Ground, and 3.3V respectively as you can probably tell from the code.
The motor side has Motor C, B, & A, SGND, Ucc, and Sensor C, B, & A, which all connect to the motor's 8 connecting wires.

I have tested to see if any current is flowing through the motor but don't get any readings. I have tried multiple configurations and this seemed to be the most promising to me but I don't know if I am making an obvious mistake or perhaps I need some more parts or that a higher voltage is necessary.
I think that is the best I can do to explain it, I will also post some pictures from Faulhaber's website on how the motor and controller look. I'll also put the updated code where I changed it from pin A5 to digital 5.

const int TX = 3;
const int RX = 4;
const int FAULT = 2; 
const int THREEIN = 12;
const int AN_IN = 5;

void setup() {
  pinMode(TX, OUTPUT);
  pinMode(RX, INPUT);
  pinMode(FAULT, INPUT);
  pinMode(AN_IN, OUTPUT); //should be what drives the motor
  pinMode(7, INPUT); //limit switch
  pinMode(10, OUTPUT); //green led
  pinMode(THREEIN, OUTPUT);
  analogReference(DEFAULT);
  Serial.begin(9600);
}

void loop(){
  // put your main code here, to run repeatedly:  
  if(digitalRead(7)==LOW) { //if limit switch is pressed down the led and motor turn on
    digitalWrite(10,HIGH);
    analogWrite(AN_IN,255);
    digitalWrite(THREEIN,HIGH);
    digitalWrite(TX,HIGH);
    Serial.println(AN_IN);
  }
  else{
    digitalWrite(10,LOW);
    digitalWrite(THREEIN,LOW);
    analogWrite(AN_IN,0);
    //digitalWrite(TX,LOW);
  }                        
}

Faulhaber MotorController.jpg

Faulhaber Motor.jpg

Faulhaber MotorController.jpg

Faulhaber Motor.jpg