Hello community,
I am trying to create a haptic force feedback device with a bldc motor. On the motor is a thread which winds up a string by the rotary motion of the motor (see Image_1). By pulling the string I want to simulate constant forces. Unfortunately, i’m not getting a perfect constant force while pulling the string because I feel one jerk/cogging (caused by the poles?) every full revolution. Do you guys have any idea how I could manage to drive the motor with a constant force against its direction of rotation? Is this possible with a BLDC motor?
Motor: iPower Motor GM3506 (AS5048A Encoder)
Board: Arduino Pro based BLDC Controller (Arduino Pro - based Brushless motor controller driver board (FOC BLDC servo). | eBay )
Image_1:
Code:
#include <SimpleFOC.h>
MagneticSensorPWM sensor = MagneticSensorPWM(A0, 4, 928);
// BLDC motor & driver instance
BLDCMotor motor = BLDCMotor(11);
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 11);
// voltage set point variable
float target_voltage = 2;
// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_voltage, cmd);}
void setup() {
// initialise magnetic sensor hardware
sensor.init();
// link the motor to the sensor
motor.linkSensor(&sensor);
// power supply voltage
driver.voltage_power_supply = 8;
driver.init();
motor.linkDriver(&driver);
// aligning voltage
motor.voltage_sensor_align = 5;
// choose FOC modulation (optional)
motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
// set motion control loop to be used
motor.controller = MotionControlType::torque;
// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
// initialize motor
motor.init();
// align sensor and start FOC
motor.initFOC();
// add target command T
command.add('T', doTarget, "target voltage");
Serial.println(F("Motor ready."));
Serial.println(F("Set the target voltage using serial terminal:"));
_delay(1000);
}
void loop() {
motor.loopFOC();
motor.move(target_voltage);
command.run();
}
With this code I feel a jerk/cogging every full rotation…
Thank you for your help!
Best, Fausto