After successfully tested the open loop, I’m back trying to make it work with a sensor.
My setup is
Esp32
Prodrive 35-36 800kv <0.1 Ohm
DRV8302
AS5048B
im using the example I found in the lib, after correctly run the initialization the motor starts wobbling really fast until I type the C in the terminal to display the Velocity control set.
Moving to angle or velocity is not producing any difference, the motor is not moving at all.
the voltage is limited to 0.5 (motor_limit) , input source 12V, 2A.
reading the forum I’ve already tested :
. magnet alignment (is centered and with a gap of less tan 1 mm)
. magnet is diametric polarized
. magnet is producing the correct output using the GetAngle function.
This is the terminal output
MOT: Monitor enabled!
MOT: Initialise variables.
MOT: Enable driver.
MOT: Align sensor.
MOT: natural_direction==CCW
MOT: Absolute zero align.
MOT: Success!
Test sensor alone - and ensure your angle is 2*PI for a 360 rotation (done?)
Test velocity_openloop mode - smooth movement in both directions. Get a feel for sensible voltage_limit (done)
Test voltage mode - this is simpler than velocity mode as it requires no PID tuning. In this mode motor.mode(target) (in this mode target is voltage_q - so start at 0.1 and move slowly to + or - 0.5)
Once voltage mode is working you know you’ve got good sensor alignment. The rest is typically easy
Test velocity mode - set
motor.PID_velocity.P = 0.1; // and increase slowly to 1.0
motor.PID_velocity.I = 0.0; // and increase slowly to 10
motor.LPF_velocity.Tf = 0.01 //and adjust between 0.2 and 0.0001 (higher is required for noisy sensors
Test angle mode - this is usually easier to tune
motor.P_angle.P = 10; // and increase or decrease (also experiment with voltage_limit)
working good , not that super smooth, especially on slow speed. ( I got a value of 25 before it stalls)
this one in not working, I 've tried to ramp up the value (0.1, 0.2 …) but I got only a tiny tiny movement forward, that are going backwards if I decrease the value. I don’t get the continuous speed I would expect.
During the n3 test Im outputting the angle value and looks stable and steady .
The code is a copy and paste from the voltage_control.ino example.
ok sorry for the delay guys,
Yes you both right and im an idiot.
I’ve removed the cage of the motor to find out I have 14 magnets and not 12. and figure it out later that simple for is using Pole PAIRS so I have to divide it by 2.
the motor is running, not that smooth on very slow velocity but I’ve tune it a bit and is better.
sorry again.