Help needed regarding custom DRV8302 based driver

Hi community,

I recently started to experiment with driving BLDC motors. My main intention is to put together a motorized leg for robot dog.

So I designed my custom driver board supporting SimpleFOC. I based it around DRV8302 from TI and Infenion’s IRF1404Z mosfets (schematic and PCB layout attached).

It works when i test it using driver.setPwm(A, B, C). Meaning voltage on all phases is correctly set. It also makes a small BLDC motor move, but eventually ends up burning it in like 3 or 4 seconds. The motor used for testing was A2212/13T (specsheet).

Could anyone please take a quick look if there are any obvious mistakes in my code / driver design?

Schematic:

Code:

#include <SimpleFOC.h>

// MANUALLY GROUNDED -> M_OC, GAIN, DC_CAL
// MANUALLY PULLED HIGH -> OC_ADJ (needes to be remade in final design)

// --- ENCODER ---
MagneticSensorI2C sensor(AS5600_I2C);

// --- DRIVER ---
#define INH_A 6
#define INH_B 5
#define INH_C 3
#define ENABLE A3

#define M_PWM 4

BLDCDriver3PWM driver(INH_A, INH_B, INH_C, ENABLE);

// --- CURRENT SENSING ---
// skip for now

// --- BLDC MOTOR ---
#define POLE_PARIS 7
#define KV 1000
BLDCMotor motor(POLE_PARIS, NOT_SET, KV);

void setup()
{
  Serial.begin(115200);

  sensor.init();
  motor.linkSensor(&sensor);

  // external driver setup
  pinMode(M_PWM, OUTPUT);
  digitalWrite(M_PWM, HIGH); // set 3-pwm mode
  
  // set driver voltage to 12V
  driver.voltage_power_supply = 20;
  driver.voltage_limit = 12;
  driver.init();
  motor.linkDriver(&driver);

  motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
  motor.controller = MotionControlType::velocity;

  motor.useMonitoring(Serial);

  motor.init();
  motor.initFOC();

  // set desired speed
  motor.target = 1;
}

void loop()
{
  motor.loopFOC();

  // move at the desired speed
  motor.move();
}

Thanks!!

It will probably be fine if you give BLDCMotor the resistance (0.09 from that pdf)

1 Like

Then lower the voltage limit to 2 and slowly increase until you get to the motor physical current thermal limit else you will melt anyway.

driver.voltage_limit = 2;

Lastly, this PDF is bullshit because neither the current nor the voltage are correct (60S, seriously, that’s 240 volts), and at 13A this is a 3000 Watt motor with a diameter of 20mm, ridiculous.

Last but not least those motors are designed to work under heavy airflow forced cooling mounted with a propeller. Running it stationary on your desk is not optimal.

You will be lucky if you can push 12V at 5A before it gives up the ghost.

Cheers,
Valentine

Lyrics
Don’t hurt me
Don’t hurt me
Don’t hurt me
Don’t hurt me
Gather up the lost and sold (don’t hurt me, don’t hurt me)
In your arms, in your arms (don’t hurt me, don’t hurt me)
Gather up the pitiful (don’t hurt me, don’t hurt me)
In your arms, in your arms (don’t hurt me, don’t hurt me)
In your arms, in your arms (don’t hurt me, don’t hurt me)
What seems impossible (don’t hurt me, don’t hurt me)
In your arms, in your arms (don’t hurt me, don’t hurt me)
I think I have had my fill (don’t hurt me, don’t hurt me)
In your arms, in your arms (don’t hurt me, don’t hurt me)
In your arms, in your arms (don’t hurt me, don’t hurt me)
I think I should give up the ghost (don’t hurt me, don’t hurt me)
In your arms (don’t hurt me, don’t hurt me)
In your arms (don’t hurt me, don’t hurt me)
In your arms (don’t hurt me, don’t hurt me)
In your arms (don’t hurt me, don’t hurt me)
In your arms (don’t hurt me, don’t hurt me)
In your arms (don’t hurt me, don’t hurt me)
In your arms (don’t hurt me, don’t hurt me)
In your arms

1 Like

Hi, thanks for the advice! I’ll try to limit the voltage and add some fan to simulate the airflow from the propeller (at least somewhat better than none cooling at all). Looking at the specsheet carefully, you are right… Lot of nonsense there. My bad, will read more carefully next time:D!

You did nothing wrong, it’s the manufacturer who published bad data. They would say and do anything to sell you a motor.

Cheers,
Valentine

Is it not possible for you to just use the QVADRANS? Then you could know the board was relatively good/in the bag and focus on the code. And the next person can build upon what you have done more easily.

Hi, I am not completely sure what QVADRANS is, but by doing a quick googling and research here on forum it seems to be a driver board made by community members. I do agree, that using a premade/predesigned board would be much simpler.

Unfortunately, I need the driver to have a very specific PCB shape and integrated CAN related ICs. I could definitely alter QVADRANS design to comply with those things, but that seems like a comparable amount of work to designing my own driver.

Plus I wanna learn how to do this kind of stuff :D. Thanks for suggestion!

Adam

Finally made it work :D!! It was caused by the 12V voltage limit. The new motor spins just fine. The only “problem” is that the motor is quite jittery / coggy at low RPM, but I assume that such behavior is expected from 1000KV drone motor that is being run at low RPM.

Thanks for the advice!

1 Like

Low stable RPM you need high impedance high pole pairs motor (low KV). Something at least 12pp and 100kv at about 10 ohm would do the trick.

Valentine