Hi community
I’m facing a “failed to notice movement” issue reflected in Serial terminal. I’ve tried to measure the sensor and use a Testpin (D13) to see if there is any movement from hall inputs during motor init. Yes there were hall signals coming in and have witness the motor shaft rotate couple of “steps” FWD followed by REV. I’m using BLDC. But no subsequent motoring movement due to motor init filed. I’ve also tested successfully on the standalone hall sensors and got a complete 6.28 rad after 1 mechanical revolution turn of shaft . please help me if there are other things to explore. How many pulses of hall to be expected during sensor alignment with motor , my scope capture below, is this sufficient? or what is the expected during alignment? thank you.
So what may be the issue of no movement? Can anybody help. Thank you.
digitalWrite(Testpin,!digitalRead(Testpin));
// initialize motor
motor.init();
// align sensor and start FOC
motor.initFOC();
digitalWrite(Testpin,!digitalRead(Testpin));
delay(1000);
IN USE: Arduino 1.8.18/ SimpleFOC V2.3.5/ STM32 MCU based Boards V2.3.0/MCU board specific: STM nucleo F401RE/ Driver Board: 250W B6 driver with 6 pwm inputs (all active high).
#include <SimpleFOC.h>
#include <f401reMap.h>
int Testpin = 13;
// BLDC motor instance
BLDCMotor motor = BLDCMotor(7); //7pp
// BLDC driver instance
BLDCDriver6PWM driver = BLDCDriver6PWM(7, 2, 6, 3, 5, 4); //(7,2, 6,3, 5,4);
// Hall sensor instance
// HallSensor(int hallA, int hallB , int cpr, int index)
// - hallA, hallB, hallC - HallSensor A, B and C pins
// - pp - pole pairs
HallSensor sensor = HallSensor(10, 9, 8, 7);
// Interrupt routine initialization
// channel A and B callbacks
void doA(){sensor.handleA();}
void doB(){sensor.handleB();}
void doC(){sensor.handleC();}
// target voltage to be set to the motor
float target_voltage = 0.8;
void setup() {
//General
pinMode(Testpin,OUTPUT);
// monitoring port
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);
//Sensor
// check if you need internal pullups
sensor.pullup = Pullup::USE_EXTERN;
// initialise encoder hardware
sensor.init();
// hardware interrupt enable
sensor.enableInterrupts(doA, doB, doC);
// link the motor to the sensor
motor.linkSensor(&sensor);
Serial.println(“Sensor ready”);
_delay(1000);
//Driver
// pwm frequency to be used [Hz]
// for atmega328 fixed to 32kHz
// esp32/stm32/teensy configurable
driver.pwm_frequency = 20000;
// power supply voltage [V]
driver.voltage_power_supply = 15;
// daad_zone [0,1] - default 0.02f - 2%
driver.dead_zone = 0.05f;
// driver init
driver.init();
// link driver
motor.linkDriver(&driver);
//FOC
// aligning voltage
motor.voltage_sensor_align = 1;
// choose FOC modulation
motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
// set motion control loop to be used
motor.controller = MotionControlType::torque;
// set torque mode
motor.torque_controller = TorqueControlType::voltage; //voltage Torque control mode
//Motor
// set rotation first direction
//motor.sensor_direction = Direction::CCW;
digitalWrite(Testpin,!digitalRead(Testpin));
// initialize motor
motor.init();
// align sensor and start FOC
motor.initFOC();
digitalWrite(Testpin,!digitalRead(Testpin));
delay(1000);
}
void loop() {
// main FOC algorithm function
motor.loopFOC();
// Motion control function
motor.move(target_voltage); //see above
}

