Stalling, backdriving, current monitoring, oh my

Hi all, I’ve been lurking around here for a year or so now and I’m pretty excited to kick off my project. In all honesty, I’m pushing it forward under pressure of dwindling component stocks. Wanna get drivers while I still can! I have a stupid amount of questions rattling around in my head, but this is the biggest one for me. Any thoughts appreciated :slight_smile:

The scenario is, driving a high power motor against a wildly varying load which frequently holds the motor stationary or back-drives it. The motor is driving the load directly and will never rotate further than 90 degrees at most.

As I understand it (not much, so please stop me if I’m wrong) holding the motor at stall will lead to the windings overheating and the death of my motor, and the way to deal with this is current monitoring and chopping the signal to maintain a sustainable current through the windings. As far as I can tell, current mode FOC has been added to simplefoc recently, but I read something about it only monitoring total current through the motor, not per-phase, and I’m not sure that information is up to date? I’m also not sure exactly how this all handles the motor randomly trying to be a generator?

My gameplan at the moment was to use simplefoc’s current mode FOC, with a rotary hall encoder, and an inline current sensor on each motor… But I’m not sure it’s quite so simple. I can’t help but wonder if temperature sensors or braking resistors or who-knows-what else are needed for something like this.

Also, I gather that some of these features are not quite fully ready yet, and I am keen to be involved in that process. I’m decent with embedded C code and a soldering iron, but my wallet is a little light to blow anything up… I’m OK with microcontrollers but motors are voodoo to me so not sure what the risks are here.

Thanks for any advice!

Welcome @Nestor-WW !

Sounds like an intriguing project! Tell us more! :slight_smile:

Its a huge problem these days! All my designs are “on hold” for lack of component availability :cry:

There are two problems to consider:

  1. instant death - e.g. when you put 50A through a 5A system PCB traces can evaporate, components release their magic smoke and motor windings boil off their insulation and fuse together
  2. slow death - e.g. when you continuously run a motor at high (but not out of spec) currents, it gets hot, and hotter, and very hot, and then super mega hot and then eventually some of the things described above start to happen.
    Note that as it heats up the motors values (impedance etc) also change so heating tends to accelerate…

Current sensing all three phase currents is supported by simplefoc. Whether it can work with a given hardware depends on the way the driver board is made: sensing the phases seperately requires 3 shunts / current sensors, one for each phase. If the hardware is set up right, simplefoc can support it.

But yes, the current sensing is a newer feature, and depending on your MCU, your milage may vary.

If the currents involved are high, they have to go somewhere. Depending on your application, they could be used to recharge the battery, or dumped into a power resistor. There’s quite a few circuits online showing different systems, look for “regenerative braking”, “brake resistor” and “load dump”.

In higher power systems you’ll also have to consider the voltages induced by the motor’s windings, and include some protection against voltage spikes.

Sounds good to start! For a system only operating within 90deg, magnetic sensors or encoders might be better than Halls…

I put temperature sensors on all my ESC designs these days, to board against the “slow death” scenario, which can occur without ever going outside the current limits… I use I2C temperature sensors with alert-mode so I can just set a temperature limit and get an interrupt when it is crossed…

This really depends on the power levels we’re talking about…

I really recommend starting out with a small, high ohm gimbal motor. With that kind of motor, nothing much happens even if you short circuit it for a while, and the spikes/currents generated by stalling or back driving it will be manageable. Once your software and protection features are tested a bit, you could move on to a more powerful, expensive motor with lower risk of anything breaking…

All the best for your project, and keep us updated if you want! And let us know if you have any more questions!


There isn’t much of a story to tell so far, it’s haptic feedback on a lever (times two, assuming I can get one to work haha). The motors are unusual in that they are 3 phase steppers, but as best I can tell (I don’t have all the specs in hand yet) should drive like a BLDC, for FOC purposes. It’ll run off a DC PSU from mains.

Yeh great minds think alike, my intention is to make it with cheaper bits first. I have a fun toy project that’s a shrunken version of the real thing. Still, it would be a test-bed for the big one, so I want to get it right in the design phase there just as much as I can.

Something I’m trying to understand here is when you do and don’t need that resistor, I mean, what determines its requirement? My dummie logic tells me that if you’re going to push that motor against the current, you just need it (those pixies gotta go somewhere)… but obviously you don’t, because a lot of applications which are stalled and backdriven simply don’t seem to cater for it at all. For example : Backdrivable Stepper Motor using FOC algorithm - SimpleFOClibrary - YouTube Essentially I’m trying to do this, just with a bigger lever on a bigger motor… But I can’t have a bigger resistor to match, because there is no resistor.

Force feedback wheels are probably the closest analog to what I’m doing, and if I look at those examples, the resistor is just assumed, but when talk of force feedback joysticks comes up (which is even closer to my project, but examples are rare), nobody ever talks about this whole stalling thing, which I don’t get because stalling is where joysticks live. I thought perhaps this is simply because the FFB wheels tend to use larger motors than FFB sticks do, but the sticks tend to use the same motors as e-skates and they all use the resistor…

I seem to be surrounded by conflicting examples. I feel like I’m missing a small detail that makes it all add up for me :slight_smile:

1 Like