BTN8962 for FOC Control - Arduino UNO

Hello everyone,

I recently started getting into SimpleFOC and i tried to replicate the PowerShield V2 on a breadboard with some BTN8962.
I have used this to wire the BTNs to the Arduino.

Here is the output of the BTNs that use that PWM:

The problem is that when I try to connect the motor to the setup it makes a buzzing sound and it moves a bit and stops.

The code that I used is for the open loop velocity control:
// Open loop motor control example
#include <SimpleFOC.h>

// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(6);
// 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);

//target variable
float target_velocity = 0;

// 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() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// driver config
// power supply voltage [V]
driver.voltage_power_supply = 12;
// 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 = 6;
if(!driver.init()){
Serial.println(“Driver init failed!”);
return;
}
// link the motor and the driver
motor.linkDriver(&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 = 2; // [V]

// open loop control config
motor.controller = MotionControlType::velocity_openloop;

// init motor hardware
if(!motor.init()){
Serial.println(“Motor init failed!”);
return;
}

// add target command T
command.add(‘T’, doTarget, “target velocity”);
command.add(‘L’, doLimit, “voltage limit”);

Serial.println(“Motor ready!”);
Serial.println(“Set target velocity [rad/s]”);
_delay(1000);
}

void loop() {

// open loop velocity movement
// using motor.voltage_limit and motor.velocity_limit
// to turn the motor “backwards”, just set a negative target_velocity
motor.move(target_velocity);

// user communication
command.run();
}

Do you have any idea why this might be happening?

And this is the PWM generated by the Arduino

I’ve sucessfully used BTN7960 (ancestor of the BTN8962 available at Amazon) with simpleFOC and it worked decently. IIRC it was quite nonlinear WRT voltage at low speeds so make sure you’re trying a range of voltages but be really careful it’s easy to burn up a motor in openlooop mode. Some other questions:

-What model is your motor? Are you sure the poles are right?
-Have you checked all 3 motor phases? (you’re scope trace only shows 2 signals)

https://www.amazon.com/HUAREW-BTS7960-semiconductor-Refrigeration-Arduino/dp/B0CSFNNCQS/ref=sr_1_1_sspa?crid=30YPENCFGW6VS&dib=eyJ2IjoiMSJ9.mipk9AMYLEZI7DXMcE-gvGFZlnUxvrV6kQ2uqiwQjemzpGvbKWIyOWCnWxYP_b-umuxl7bn8hFzavjFLe8PUmKvXwNcaMXKOG721SU-JV-KaMbQkPClKciysenJbhQiw6I-RRjHOPfUBMYC1IaiCM-y7KrUbRG44mJbDfwE3Eho.PeZGyEUnrZlOp5kxP3yfQkKpk3hWugjbmehesnVmpd4&dib_tag=se&keywords=BTN7960&qid=1737784276&sprefix=btn7960%2Caps%2C97&sr=8-1-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1