# Stepper motor and current sense

**URL:** https://community.simplefoc.com/t/stepper-motor-and-current-sense/3166
**Category:** Uncategorized
**Tags:** stepper, current\_sensing
**Created:** [March 28, 2023, 11:24am UTC](https://community.simplefoc.com/t/stepper-motor-and-current-sense/3166 "2023-03-28T11:24:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![trojanerr](https://community.simplefoc.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@trojanerr](https://community.simplefoc.com/u/trojanerr)
#### Post date: [March 28, 2023, 11:24am UTC](https://community.simplefoc.com/t/stepper-motor-and-current-sense/3166/1 "2023-03-28T11:24:11Z")

</div>

Hi  
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()  
with:  
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?

---

<div class="post-metadata">

### Author: ![Shoarmabro](https://community.simplefoc.com/letter_avatar_proxy/v4/letter/s/df788c/32.png) [@Shoarmabro](https://community.simplefoc.com/u/Shoarmabro)
#### Post date: [March 28, 2023, 1:21pm UTC](https://community.simplefoc.com/t/stepper-motor-and-current-sense/3166/2 "2023-03-28T13:21:10Z")

</div>

Hey,

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](https://docs.simplefoc.com/current_sense)

---

<div class="post-metadata">

### Author: ![ssuresh](https://community.simplefoc.com/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@ssuresh](https://community.simplefoc.com/u/ssuresh)
#### Post date: [April 6, 2023, 4:51pm UTC](https://community.simplefoc.com/t/stepper-motor-and-current-sense/3166/3 "2023-04-06T16:51:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dfrenkel](https://community.simplefoc.com/user_avatar/community.simplefoc.com/dfrenkel/32/5299_2.png) [@dfrenkel](https://community.simplefoc.com/u/dfrenkel)
#### Post date: [April 6, 2023, 9:15pm UTC](https://community.simplefoc.com/t/stepper-motor-and-current-sense/3166/4 "2023-04-06T21:15:29Z")

</div>

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?
