Hello Community,
I am attempting to control a Gimbal Motor (T-Motor GB54-1) using a cheap 600PPR Encoder in torque control mode (voltage control) with a SimpleFOC Shield 2.0.4 and an Arduino UNO. The motor voltage limit, driver voltage limit, and driver voltage power supply are set to 12V. The number of pole pairs is set to 7.
Here is my code:
#include <SimpleFOC.h>
BLDCMotor motor = BLDCMotor(7);
BLDCDriver3PWM driver = BLDCDriver3PWM(5, 9, 6, 8);
Encoder encoder = Encoder(2, 3, 600);
void doA() { encoder.handleA(); }
void doB() { encoder.handleB(); }
float target_voltage = 2;
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_voltage, cmd); }
void setup() {
encoder.init();
encoder.enableInterrupts(doA, doB);
motor.linkSensor(&encoder);
driver.voltage_limit = 12;
driver.voltage_power_supply = 12;
driver.init();
motor.linkDriver(&driver);
motor.voltage_sensor_align = 5;
motor.torque_controller = TorqueControlType::voltage;
motor.controller = MotionControlType::torque;
Serial.begin(115200);
motor.useMonitoring(Serial);
motor.voltage_limit = 12;
motor.init();
motor.initFOC();
command.add(‘T’, doTarget, “target voltage”);
Serial.println(F(“Motor ready.”));
Serial.println(F(“Set the target voltage using serial terminal:”));
_delay(1000);
}
void loop() {
motor.loopFOC();
motor.move(target_voltage);
encoder.update();
Serial.print(“Enc1 Angle: “);
Serial.print(encoder.getAngle());
Serial.print(”\t”);
Serial.print(“Enc1 Velocity: “);
Serial.print(encoder.getVelocity());
Serial.print(”\t”);
Serial.print("Target Voltage: ");
Serial.println(target_voltage);
command.run();
}
The power supply has an output of 12V and 5A = 60W. Unfortunately, the motor doesn’t reach the expected velocity of about 41 Rad/s but stops at 25 Rad/s because the output voltage stagnates at 9V. I have already tried to use the internal resistance of the motor of 15.6 Ohms, which leads to a constant speed of 25 Rad/s regardless of the input.
Do you see the issue?
Thanks in advance.