Hi everyone, I am having a lot of trouble with getting these ODrive Botwheels running. The main problem is when I try to run the wheel in torque or open loop velocity mode the wheel shakes very erratically. In all other modes the wheel does not move no matter what the target is set at. The motor also gets very hot when idling even though my current limit is set at 5A and the ODrive website says the wheels are rated for 5A continuous. The psu I am using is 24v.
Here is a picture of my setup:
I am running simpleFOC on a Raspi Pico connected to the DRV8302 aliexpress board (DRV8302 Motor Drive Module High Power BLDC Brushless PMSM Drive ST FOC Vector Control Amplifier Board DC 5.5-45V 15A - AliExpress 502) controlling a singular ODrive Botwheel (ODrive BotWheels – ODrive Robotics).
Here is my code in Arduino IDE:
#include <SimpleFOC.h>
// DRV8302 pins connections
// don't forget to connect the common ground pin
#define INH_A 0
#define INH_B 1
#define INH_C 2
#define EN_GATE 16
#define M_PWM 17
#define M_OC 18
#define OC_ADJ 19
#define H_A 3
#define H_B 4
#define H_C 5
// motor instance
BLDCMotor motor = BLDCMotor(15);
// driver instance
BLDCDriver3PWM driver = BLDCDriver3PWM(INH_A, INH_B, INH_C, EN_GATE);
// hall sensor instance
HallSensor sensor = HallSensor(H_A, H_B, H_C, 15);
// channel A and B callbacks
void doA(){sensor.handleA();}
void doB(){sensor.handleB();}
void doC(){sensor.handleC();}
// commander interface
Commander command = Commander(Serial);
void onMotor(char* cmd){ command.motor(&motor, cmd); }
void setup() {
// initialize sensor sensor hardware
sensor.init();
sensor.enableInterrupts(doA, doB, doC);
// link the motor to the sensor
motor.linkSensor(&sensor);
// DRV8302 specific code
// M_OC - enable over-current protection
pinMode(M_OC,OUTPUT);
digitalWrite(M_OC,LOW);
// M_PWM - enable 3pwm mode
pinMode(M_PWM,OUTPUT);
digitalWrite(M_PWM,HIGH);
// OD_ADJ - set the maximum over-current limit possible
// Better option would be to use voltage divisor to set exact value
pinMode(OC_ADJ,OUTPUT);
digitalWrite(OC_ADJ,HIGH);
// configure driver
driver.voltage_power_supply = 24;
driver.init();
motor.linkDriver(&driver);
// choose FOC modulation
motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
// set control loop type to be used
motor.controller = MotionControlType::torque;
// controller configuration based on the control type
motor.PID_velocity.P = 0.2;
motor.PID_velocity.I = 20;
// velocity low pass filtering time constant
motor.LPF_velocity.Tf = 0.01;
// angle loop controller
motor.P_angle.P = 20;
// angle loop velocity limit
motor.velocity_limit = 50;
// default voltage_power_supply
motor.voltage_limit = 24;
motor.current_limit = 5;
motor.voltage_sensor_align = 1;
// use monitoring with serial for motor init
// monitoring port
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
// initialize motor
motor.init();
// align sensor and start FOC
motor.initFOC();
// set the initial target value
motor.target = 2;
// define the motor id
command.add('M', onMotor, "motor");
_delay(1000);
}
void loop() {
// iterative setting FOC phase voltage
motor.loopFOC();
// iterative function setting the outer loop target
// velocity, position or voltage
// if target not set in parameter uses motor.target variable
motor.move();
// user communication
command.run();
}
I am pretty much at a loss at this point so any help would be appreciated.