So i’ve been working on a new setup using the following:
- MCU: Arduino Nano
- Motor: Flycat 5010 (I believe has 6 pole pairs, but seems to work best in open loop if I enter 22?)
- Driver: L298N
- Magnetic Sensor: AS5600
I can run this thing in open loop no problem, accelerating and decelerating. I can also get a reading from the AS5600 using the tutorial here: Magnetic sensor I2C | Arduino-FOC so I know the driver, motor and sensor can all handle it.
I was getting some really jittery results with the magnetic sensor mounted directly on the motor shaft when I tried closed loop control though - like the motor kept overshooting and trying to correct, and it would just shake itself to death. I am planning a cycloidal gear reduction and was thinking the solution might be to have the sensor read the output after the reduction to avoid jitteriness.
runs fine in open loop: video here
But, when I go to use closed loop, I get some strange results. After calibration, the motor just stays-put.: video here - sorry for the poor quality video. The readout is motor.monitor() and you can see it has a target angle of 20 in the first column, and the read-out of the current angle in the last column - but it won’t budge.
2 things worth mentioning.
I don’t get a confirmation from my serial monitor that my desired angle is sent after I type in something like “12.5” and click send, but also, even if I set a desired angle in the code as I did in the video (e.g. 20 rads), it still stays put.
I’m thinking due to having the encoder after the reduction, when it runs through the setup, it gives an error when trying to determine the pole pairs - it ranges from 70 - 4000, so that’s obviously not correct information - (i’m thinking this is due to the play between the gears) - but how is that affecting things / how do I correct it?
If I separate the sensor from the motor, something seems to happen - if I move the sensor, the motor moves. video here - I think this is more or less what it’s supposed to do? but when i try to command it (either through serial or through the code) to move to an angle - it won’t.