Closed loop Torque Control with ESP32 Encoder


Some of you you may have read my other post, trying to run a motor in closed-loop velocity control with hall sensors.

I have now tried using the incremental encoder and going through the steps again. I am getting some strange behavior at this stage I would like to share and see what people think is causing it.

My Setup is:
DRV8302 driver board
Maxon EC 1 30 motor
Maxon encoder 16 easy 1024 counts per turn

When I run the motor at 2 Volts. I get an initial speed of around 200 rad/s (1900 rpm) but it quickly starts slowing down although the voltage stays at 2 volts.

if I restart the ESP and it goes through the initialisation process and will start at 200 rad/s but slows down in a similar way.

If I run it at 1 volt I get 110 rad/s it slows down at a slower rate but it slows.

What might be causing this?

Plot of motor velocity at 2 volts

Plot for 1 volt

Hey, did you discover any more on this?

I wonder if its the interrupt load? The ESP32 MCU is very fast though, so theoretically it should be able to handle it, but maybe the implementation could be more efficient at some level?
Not sure, this is just a theory that would explain the graphs in my point of view…