Hey all,
I am currently working on simpleFOC open-loop velocity control with a throttle and Maxon EC-I 52 48V 440watts with my own built motor driver. I am unable to attain a proper RPM and it gets stuck in middle.
It is a 48v motor but i was able to supply 32v as it is my rps limit.
My driver is IR2184 which operates in 15v.
Below i have attached my code, maxon spec sheet and my motor driver schematics.
If you could give me some guidance on this topic I really appreciate
#include <SimpleFOC.h>
// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(8);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);
// Stepper motor & driver instance
//StepperMotor motor = StepperMotor(50);
//StepperDriver4PWM driver = StepperDriver4PWM(9, 5, 10, 6, 8);
int motor_speed;
//target variable
float target_velocity ;
// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
void doLimit(char* cmd) { command.scalar(&motor.voltage_limit, cmd); }
void setup() {
pinMode(A0,INPUT);
// driver config
// power supply voltage [V]
driver.voltage_power_supply = 48;
// limit the maximal dc voltage the driver can set
// as a protection measure for the low-resistance motors
// this value is fixed on startup
driver.voltage_limit = 8;
driver.init();
// link the motor and the driver
// limiting motor movements
// limit the voltage to be set to the motor
// start very low for high resistance motors
// current = voltage / resistance, so try to be well under 1Amp
// motor.voltage_limit = 5; // [V]
// motor.phase_resistance= 25;
// motor.current_limit=2;
// motor.voltage_power_supply = 30;
// open loop control config
// motor.velocity_limit=20;
motor.linkDriver(&driver);
motor.controller = MotionControlType::velocity_openloop;
//motor.voltage_limit=1;
//motor.phase_resistance = 1;
// motor.current_limit=1;
motor.voltage_limit=12;
motor.phase_resistance=1;
// motor.voltage_limit=34;
motor.velocity_limit=100;
// motor.voltage=(1,1);
// init motor hardware
motor.init();
// add target command T
command.add(‘T’, doTarget, “target velocity”);
command.add(‘L’, doLimit, “voltage limit”);
Serial.begin(9600);
Serial.println(“Motor ready!”);
Serial.println(“Set target velocity [rad/s]”);
_delay(1000);
}
void loop() {
//target_velocity=15;
// open loop velocity movement
// using motor.voltage_limit and motor.velocity_limit
// to turn the motor “backwards”, just set a negative target_velocity
motor_speed = map(analogRead(A0)-5, 0, 1023, 0, 100);
Serial.println(motor_speed);
motor.move(motor_speed);
//target_velocity+=2;
// user communication
command.run();
}
Summary
This text will be hidden