Hi, we are currently testing our climber, and noticed that it was unexpectedly stalling. So, we decided to check the current being supplied to the motor (the current limit is 60 A and effort is 100%). After connecting to the PDH, we graphed both the SparkMax Output Current and the PDH current for the correspnding PDH port. To our surprise, the values were very different. As shown below, the SparkMax reports a current of 60 A, while the PDH appears to be supplying a current that oscillates between only 10 and 20 A. We’ve noticed similar discrepancies in other SparkMax’s as well on our robot. Based on our calculations, the Spark Max is supposed to handle the load it is given, so we believe the error is in what current the SparkMax thinks it is receiving. Does anyone know how to resolve this issue?
The current limiting (and presumably reporting) on the Spark Max is output (motor stator) current, not input current. The PDH is measuring input current. A lower input current means that it’s not driving at 100% duty cycle (e.g. it’s outputting a lower average voltage).
SparkMax both measures and controls current. The PDH can only measure it on the regular channels. The switched channels are on/off: no modulation at all. So, my bet is on either you are looking at the wrong channel or there is an issue with the current sense amplifier in the PDH. Looking at your traces, they line up REALLY well, so you should have the right channel.
I’d swap to a different channel and re-test to confirm!
Well we plotted both current, voltage, and applied output.
Wouldn’t we expect the voltage to drop much more to cause this kind of increase in output current? The voltage dropped by 12.5% but the change in output current was over 200%.
Note the applied output (duty cycle) is only 20%. So we’d expect output current to be 5x larger than input current, which it is. The average voltage applied at the motor stator is input voltage * duty cycle, so in this case 10.2V * 20% = 2V.
The way to think about this is the following equations:
- Input Power = Output Power + Loss (heat)
- Input Power = Input Voltage * Input Current
- Average Output Voltage = Input Voltage * Duty Cycle
- Output Power = Average Output Voltage * Output Current
So in this case:
- Input Power = 10.2V * 13A = 133 W
- Output Power = 10.2V * 20% * 60A = 122 W
With about 10W lost to heat (might be less due to rounding).
One interesting effect of these equations is that you want to put the motor controllers close to the motor if you want to maximize performance at low duty cycles with long wire runs, because the resistive losses are going to be worse on the motor side (as the currents are higher).
Does this mean we arereally getting 60amps at a 20% duty cycle and the log is not fast enough to show that?
You need to look at the current based on POWER. Re-read peter’s post. Both sensors are reading correctly.
You can think of the SparMax as a step down dc/dc power supply…
Sorry, I didn’t realize you were looking at phase current!
Is the SparkMax only measuring the instantaneous output phase current when that phase is in the on-state?
The motor acts like a large inductor. So current keeps going even when the SparkMax switches it off. There’s more discussion in this thread.
Here’s another thread with the same question, but with pictures and a simulation link Neo motors pulling only 5 Amps when stalled? - #25 by Will_Toth
Some whiteboard doodling (below–check my math!) derived this from the equations Peter posted:
Meaning that (ignoring energy losses) the input current is the product of the output current and duty cycle.
It gets even better!
Add in this:
and we get this:
Meaning that the ratio of current is the inverse of the voltage ratio (which is the duty cycle).
Using this, it’s relatively easy to calculate SparkMax current limits. Let’s say that we’re activating our intake with 50% duty cycle, and the motor is on a 30A breaker (and let’s use that as our wanted input current limit):
And here we have an output current limit of 60A to set on the SparkMax.
This gets a bit more complicated with dynamic duty cycles, but the idea should generally be the same.
Thanks. I’ll read it after FiT District Championship is over.
I guess the current is flowing through the body diodes of the MOSFETs.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.