Hello everyone,
I am trying to build a very basic setup with an ESP32 + AS5600 + GBM2804H-100T + SimpleFOC board, working in any closed loop mode (torque, velocity, angle). However I am facing an issue that got me completely lost.
I am able to run the project in open loop modes (angle and velocity) without any problem (small video x.com).
But, when I try to set any closed loop modes it will fail with either vibrating or idling. I can rotate the motor with my hands, and while doing so, from time to time it jumps to another angle.
I have checked:
- The magnet of the AS5600: I can read the position perfectly, and for the whole rotation.
- I have tried changing the poles / coil resistance parameters.
- Played with PID tunning for angle and velocity
- Downsampling the movements/measurements
One thing to note is that the PP almost always fails, and the example to get the polepairs almost always return negative values, and when it returns a positive value dont event turn after gettting it.
I can add a connection diagram but, since the movement and sensor is working I understand the AS5600 and the motor are working nice.
Anyone has any idea what can I test next? What can I change?
#define ESP_H
#include <Arduino.h>
#include "SimpleFOC.h"
MagneticSensorI2C sensor = MagneticSensorI2C(0x36, 12, 0x0E, 4);
BLDCMotor motor = BLDCMotor(7);
BLDCDriver3PWM driver = BLDCDriver3PWM(18, 4, 5,19);
Commander command = Commander(Serial);
void doMotor(char* cmd) { command.motor(&motor, cmd); }
void setup() {
Serial.begin(115200);
sensor.init();
Serial.println("AS5600 ready");
driver.pwm_frequency = 20000;
// power supply voltage [V]
driver.voltage_power_supply = 12;
// Max DC voltage allowed - default voltage_power_supply
driver.voltage_limit = 4;
// driver init
driver.init();
Serial.println("Driver ready");
motor.linkSensor(&sensor);
motor.linkDriver(&driver);
motor.useMonitoring(Serial);
motor.controller = MotionControlType::torque;
motor.init();
motor.initFOC();
command.add('M', doMotor, "motor");
}
void loop() {
motor.loopFOC();
motor.move();
motor.monitor();
command.run();
}