Hi!
I am trying to run a big 12Nm NEMA 34 stepper motor using SimpleFOC with Arduino Pro Micro (Atmega34u4). Because of the high loads that this motor is going to withstand, I have chosen to use two high current half bridge DC drivers (IBT-2 or BTS7960), to drive each phase of the motor (these exact drivers were listed as options in the supported hardware section in the docs). My power supply is set to 25V.
I have an encoder attached to the motor, but for now, I just want to run it in open-loop mode to be sure that the motor and drivers work together, however, I am having trouble doing that. I have tried setting every possible pin order in the driver constructor but I get similar results for all of them. The motor starts humming/buzzing and does not turn at all, however when I try to turn it by hand it resists. Here’s the code I used:
#include <SimpleFOC.h>
// BLDC motor & driver instance
StepperMotor motor = StepperMotor(50, 1);
// Stepper driver instance
StepperDriver4PWM driver = StepperDriver4PWM(6, 5, 9, 10, 4, 16);
// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&motor.target, cmd); }
void doLimitVolt(char* cmd) { command.scalar(&motor.voltage_limit, cmd); }
void doLimitVelocity(char* cmd) { command.scalar(&motor.velocity_limit, cmd); }
void setup() {
// pinMode(4, OUTPUT);
// pinMode(16, OUTPUT);
// digitalWrite(4, HIGH);
// digitalWrite(16, HIGH);
// driver config
// power supply voltage [V]
driver.voltage_power_supply = 25;
driver.init();
// link the motor and the driver
motor.linkDriver(&driver);
// limiting motor movements
motor.voltage_limit = 25; // [V]
motor.velocity_limit = 1; // [rad/s] cca 50rpm
// open loop control config
motor.controller = MotionControlType::angle_openloop;
// init motor hardware
motor.init();
motor.initFOC();
// add target command T
command.add('T', doTarget, "target angle");
command.add('L', doLimitVolt, "voltage limit");
command.add('V', doLimitVelocity, "velocity limit");
Serial.begin(115200);
Serial.println("Motor ready!");
Serial.println("Set target position [rad]");
_delay(1000);
}
void loop() {
motor.loopFOC();
// open loop angle movements
// using motor.voltage_limit and motor.velocity_limit
motor.move();
// user communication
command.run();
}
The drivers are connected like this:
Driver 1 (Phase A, Black (M+) and Green(M-) wires from the motor)
- R_EN and L_EN to D16
- RPWM to D9
- LPWM to D10
Driver 2 (Phase B, Red (M+) and Blue (M-) wires from the motor) - R_EN and L_EN to D4
- RPWM to D6
- LPWM to D5
Here is a picture of the reference sheet for the motor (I think it’s a standard pinout).
Here is a link to a brief datasheet for the IBT-2 module.
Thanks in advance!