BLDC GM3506 motor twitching while running open loop

Hello! I have an issue while trying to run a GM3506 motor with a as5048A hall sensor.

While running open loop velocity control the motor just twitches back and forth (see video: Google Drive: Sign-in)

Here in an image of the general setup aswell
(Google Drive: Sign-in)
The power supply is 12V, max 6A

The soldered pins on the back for (pwmA, pwmB, pwmC, enable) is (5, 9, 6, 8)

The hall sensor works and gives valid readings.

Heres the code:

// Open loop motor control example
#include <SimpleFOC.h>

// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(11);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(5, 9, 6, 8);

// Stepper motor & driver instance
//StepperMotor motor = StepperMotor(50);
//StepperDriver4PWM driver = StepperDriver4PWM(9, 5, 10, 6,  8);

//target variable
float target_velocity = 3;

// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }

void setup() {

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 12;
  // link the motor and the driver

  // limiting motor movements
  motor.voltage_limit = 3;   // [V]
  motor.velocity_limit = 5; // [rad/s] cca 50rpm
  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;

  // init motor hardware

  // add target command T
  command.add('T', doTarget, "target velocity");

  Serial.println("Motor ready!");
  Serial.println("Set target velocity [rad/s]");

void loop() {

  // open loop velocity movement
  // using motor.voltage_limit and motor.velocity_limit

  // user communication;

Hello @Broberg

Welcome to the forum.

Your video requires google sign in. Could you please make it publicly viewable?

Which board are you using?

Thank you.

1 Like

Thank you for the reply! I figured out the problem while going over every connection with a multimeter, it was a bad soldering joint… I can now run the motor in open loop and it spins