# FRC Blog - 2019 Motor Controllers and MXP

This may have been asked before, but will the API for the Spark MAX be open source? We’re looking pretty seriously into doing simulation next year, and having the control library be open source (at least the header files) is important for us to be able to write a mock HAL for the device.

2 Likes

Not Greg, don’t work for REV but this is what they have said they are planning to do.

also not Greg or from Rev, but he’s on vacation so a response may take awhile.

Any update on this, given that it’s now Thursday?

3620 is one of the outside sources that Greg asked to conduct Neo tests. I had not planned to post results before REV does; however, since they are apparently still waiting for results from other sources I will post a some of ours.

We conducted open-circuit and short-circuit tests while back driving Neo motors at constant speed on the test rig pictured in the thumbnail. Based on open-circuit voltage, short-circuit current, and back driving torques measured under both conditions, we calculated equivalent circuit parameters and the torque constant (Newton-meter per RMS Ampere). Using the data, we can calibrate an equivalent circuit model to predict torque and power vs. RPM, assuming the Neo’s terminal voltage and current are limited by an ‘ideal’ BLDC controller that regulates AC motor current in-phase with back-EMF.

The data we measured:

Back-EMF: 3.04 Volt (rms) line-to-line at 2000 RPM
Short-circuit current: 39.2 Ampere (rms) per-phase at 2000 RPM
Back driving power on open-circuit: 5.5 Watt (measured mechanically)
Back driving power on short-circuit: 175 Watt (measured mechanically)

From the above we calculate:

Per-phase back-EMF 1.76 Volt (rms) at 2000 RPM (scales linearly with speed)
Per-phase resistance 36.5 milliOhm (at lab ambient temperature)
Per-phase synchronous reactance 26 milliOhm at 2000 RPM (scales linearly with speed)
Torque constant Kt = 0.0251 Newton-meter per RMS Ampere

Plots of calculated Neo torque and power vs. speed are shown in the thumbnail, along with CIM motor manufacturer’s data.

Please take this as PRELIMINARY. It needs to be checked against directly measured torque vs. speed data, which we are still working on, as are other sources outside of REV.

Thanks for doing this! As someone who is not as familiar with brushless motor performance characteristics, would someone mind explaining some of the nonlinearity in the torque curve? I understand the peak current cap, but what’s behind the slower drop-off in torque for a few hundred RPM (around 1800RPM), or the slight decrease in slope near in the higher RPMs?

Your question about non-linearity in the torque curve reminds me of an old joke from engineering school: non-linear system theory is like non-elephant zoology. Most systems are non-linear, just as most animals are non-elephant. Not a great joke, but it works with nerds.

Permanent magnet DC motors often exhibit roughly linear torque-speed envelope curves because (1) their torque is directly proportional to current, and (2) their maximum current draw decreases linearly with increasing speed. The first property is due to their mechanical commutators and is also only true if the magnetic circuit does not saturate with flux; the second is due to the “Ohm’s Law” nature of their equivalent circuits:

I = (V - E) / R

where V is the terminal voltage,
E is the back EMF, which increases linearly with speed, and
R is internal resistance, which increases with copper temperature.

A brushless motor is really an AC permanent magnet motor. The AC voltage that supplies it is converted from DC by an inverter circuit such as the Spark MAX or other brushless motor speed controllers. Controllers of the “BLDC” type work by synchronizing their AC output to the motor’s back EMF, by directly or indirectly sensing angular orientation of the rotor magnets. Controllers of the “FOC” type are more complex; they also synchronize AC output to rotor magnet orientation, but can adjust the offset angle between the AC current and the magnet’s field so that the motor’s operating speed range is extended. Some motors (like the ones I design for hybrid electric cars) take advantage of FOC control by developing extra torque that depends on that offset angle; however, the Neo is not designed for that. It might benefit from FOC control in other ways; e.g., lower ripple torque. The initial Spark MAX firmware, like that of most readily available brushless controllers today, implements BLDC control.

Because a permanent magnet brushless motor is an AC device, its steady-state equivalent circuit equation uses complex arithmetic [note: its transient equivalent circuit is modeled by a differential equation that I won’t go into here]:

I = (V - E) / Z

where all the terms above are complex numbers, V, I, and E representing AC voltages and currents, and Z = R + jX representing a complex impedance. E and X are directly proportional to speed.

The maximum current draw is therefore limited by (V - E) / R at low speeds, and by (V - E) / X at high speeds. That is the reason that the torque speed curve has two assymptotes. As you pointed out, it is also limited by maximum available current at very low speeds.

1 Like

How would voltage compensation work on a motor like this? If the battery voltage drops 6v from the nominal 12v can I simply double the output value I send to the Spark MAX in order to compensate for the lower voltage? (Like how voltage compensation works now on the CIM)

Yes.

You can also directly send the voltage you want the controller to drive and it will do that for you. It will also be able to react much faster and accurately that way.

Very helpful information. Though I have to admit I’m not familiar with the test terminology or methods, it’s still a really interesting comparison to see.

Any chance you have exact numbers you could post regarding the max free speed, free running current, and typical output power at 40A? I’m curious as to how well REVs theoretical specs compare to actual tests. I’d also be interested to know what kind of current and torque these pull at stall.

So far we have not completed measurements of the full torque-speed performance envelope. This might be due to limitations of my test rig, which is designed for the parametric model (equivalent circuit) measurements that I described in the earlier post.

We did run with Spark MAXs at free speed, which measured 5300 RPM as expected. I did not measure free current on the dc side of the Spark MAX, but I expect it to be about one Ampere, based on the OC shaft power measurement (5.5 W) when back driving.

No test data yet on actual load points. Based on my model, peak power with 40 Ampere current draw should be 330 Watts (mechanical) at 3250 RPM.

We will try some stall-against-the-wall tests to get measured current draw at the PDB. I am very interested in that data, too. I know the students did a lot of driving earlier this week but don’t know if they got any electrical measurements.

Just an FYI.
I received shipping notification for my pre-order today. FedEx says delivery by EOD on the 27th. A little late for Christmas, but before Kickoff. I’ll take it!

We are starting to ship out pre-orders. It is going to take us some time to work through all of them however we are on track to have all pre-orders shipped before Jan 5th, assuming no acts of god.

Greg mentioned earlier we are filling based on when the order was placed, so first come first shipped.

So is the software for the Spark Max going to drop soon too?

This morning we ballasted the Neo Raptor 8.45 chassis to 151 lb, and used three students to oppose it by the feet-and-seat method. Here is a camera shot of the data. We also used a digital scale turned sideways to measure pushing force; it hit momentary peaks of 185 lb. while breaking traction (i.e., burning holes in our test carpet). Using an in-line analog ammeter we saw dc current surges (into the Spark MAX) of about 24 Ampere, with momentary peaks to 35-40 Ampere. That correlates with the PDP total current draw that peaks at 160 Ampere.

So doing a sanity check, each motor saw 185lbf * 1.5in / 8.45 ratio / 4 motors = 8.2 lbfin = ~ 1 Nm. Based on your curve upthread, that’s pretty close to the peak of the power curve, occurring at ~3200 rpm. The CIM curve gives, ~50A at 3200 rpm and 1N*m, so we’re in the right ballpark (comparable, but more efficient than a CIM)

Tldr, you’ve got a good peak power measured point. Thanks for sharing!

I don’t suppose you could repeat your test with more weight, or fewer motors to get a point closer to the stall conditions (on the “bad” side of the efficiency curve)?