But the result is the motor moves just a litle bit when i set the target angle (e.g. 10) using serial terminal and when i set again 10 and gets stuck (and hot).
Any idea what it might be?
MOT: Monitor enabled!
MOT: Initialise variables.
MOT: Enable driver.
MOT: Align sensor.
MOT: Sensor failed to notice movement
MOT: Absolute zero align.
MOT: Success!
MOT: Motor ready.
Motor ready.
Set the target angle using serial terminal:
Target angle: 10.00
Target angle: 10.00
In openloop is ok, velocity and position. But when I try to run it with encoder code (index search loop) the result is
MOT: Initialise variables.
MOT: Enable driver.
MOT: Align sensor.
MOT: natural_direction==CW
MOT: Absolute zero align.
MOT: Searching…
If your sensor has a PWM output and you have an oscilloscope or some logic analyzer at hand, you can see if it is working correctly or if, despite being properly powered, there is a mechanical problem.
Sometimes the magnet is not close enough to the sensor or the attached magnet does not have the proper diametrical polarization.
@JorgeMaker - he is using an encoder. No magnets involved! Just interrupts. Although logic analyser on the interrupts would be a good idea!
Alternatively can you put some Serial.prints in doA() doB() and doIndex() to see what’s happening? It’s not normally advisable to put ‘expensive’ Serial prints in interrupts but should be ok for a bit of debugging.
The simplefoc example uses pin A0 for index. I wonder if PciManager likes analog pins?