Stepper motor and current sense

First of all, thanks a lot for this great library and documentation. I have a setup with an esp 32, a TB9051 driver, and a stepper motor with optical encoder, set up and all working, following the “writing the code” example, but…
I am stuck trying to use the current sense feature, as i can’t link the current sense to the driver as shown in the “writing the code” section.
current_sense.linkDriver(&driver); gives a error “no matching function to call” and the code won’t compile.
If i replace the
StepperMotor motor = StepperMotor(); and
StepperDriver4PWM driver = StepperDriver4PWM()
BLDCMotor motor = BLDCMotor();
BLDCDriver6PWM driver = BLDCDriver6PWM();
it works, so is the current sensing not an option for stepper motors currently, or am i missing something?


I’m reading this:

Each of the implemented classes can be used as stand-alone classes and they can be used to read current values on BLDC driver outputs out of scope of the Arduino SimpleFOClibrary, see example codes in utils > current_sense_test. In order for FOC algorithm to work the current sense classes are linked to a BLDCMotor class which uses the driver to read the FOC currents.
Current Sensing | Arduino-FOC

1 Like

Thanks for pointing out that current sensing is not implemented for stepper motor drivers. Are there any plans to add this in the future? Right now, I have my stepper motors working with the voltage torque control but would love to see if current sensing gives better results.

1 Like

I was just researching current sensing for stepper motors just like you, so it’s nice to see someone else doing the same thing. Is there any advantage to using current sensing?