Findings from a couple hours at the lab bench with a CIM and a Jaguar


#1

I’ve spent the evening fussing with a CIM and a black Jaguar (firmware version 107) on my bench.

Findings on the CIM:

  • It’s not actually very well balanced (magnetically or mechanically). This manifests as significant torque ripple even with constant terminal voltage. Trace - yellow is terminal voltage, red is current. Commutation is not beautiful.
  • It has a lot of drag compared to motors I’m used to. Brushes? Bearings? I’m not sure; I haven’t taken one apart.

Findings on the Jaguar:

  • Its current sensing circuit is on the high side DC bus, using a 1mR shunt with an INA193 (20V/V gain). Max range according to the datasheet is 150A.
  • There is correlation between the motor current and the high-side shunt current, but it isn’t great. Check out the trace. Red is actual motor current (as measured with a Tektronix A622). Blue is motor-applied voltage. Yellow is INA193 output. At no-load it looks like this. Notice the odd shape of the INA193 output. I’m not an expert on brushed motors, maybe someone else can explain how the near-square bus current waveform results in a triangular motor current waveform.
  • There’s no diode and no filter between the buck that powers the 5v rail and the input rail. Even short transients on the input rail will cause the controller to reboot itself (there’s very little bulk storage on the low voltage internal supply rails). This was most noticeable when I stopped driving the motor while the controller was configured to “brake”. It would cause my power supply to crowbar its output and crash the input rail momentarily.

Findings on current-mode control:

  • It’s merely OK. It can partially compensate for the ripple inherent in the CIM design, but the poor current-sensing architecture hamstrings its performance.
  • The current-control PID loop runs at the full PWM rate, about 15 KHz. It’s been reported elsewhere that it runs at 1 KHz. High level modes (position control, speed control) may run at this rate, but current-control doesn’t. Or at least it doesn’t look like it does based on what I see on my oscilloscope. I’ll check the source code on Tuesday.
  • You want a PID controller, not a P, PI, or PD controller. Use a small number (0 to 0.5) for the I term. Use a moderate number for the P term (1 to 5). Use a slightly smaller moderate number for the D term (1 to 5). Less-than-one values for P and D appear to go to zero and thus have no effect. I didn’t look into whether non-integer values function as expected.
  • Under no circumstances is the current control actually stable. The badness built-in to the motor coupled with the bad current-sensing circuit means that getting really pretty current control is a doomed effort. You can do well enough to avoid bus sag and to get a rough torque control. It’s probably good enough for FRC.
  • Integral wind-up means that going from an unloaded motor (saturated integral) to a loaded motor (reasonable integral) has significant overshoot. The other direction works fine.

If I were the (electrical) designer of the Jaguar I would…

  • …use a 3mR shunt to get a better signal-to-noise ratio.
  • …use a high-CMRR diffamp current sensor arrangement to actually measure motor current rather than bus current.
  • …put an anti-aliasing filter on the output of the diffamp.
  • …use a diode and a dedicated logic supply input cap to make the controller more tolerant to input power line misbehavior.

#2

Z,
Some of the items you mention are due to the power supply you are using. The motor testing needs a very high current, low impedance supply to obtain accurate data. It is not possible to measure motor current directly as the polarity at the output of the device changes. While possible with multiple INA193, it raises the parts count per device. Measuring input current is affected by device current demands but these are low compared to the motor current. Jaguars rarely reboot in the field although they do fault on low input voltage.
You do not mention what throttle value you are running the motor at but it appears to be something much less than 50% duty cycle. So what comes into play is the brush spacing and the motor rpm. So current draw is reflected by the number of commutator segments that are in contact with brush at any one time. This is common for brushed motors.
If your power supply is really sagging during high current pulses, then I would expect the output of the INA193 to also reflect that. It is internally referenced to the power supply input pin. It might be interesting to add a trace of the power input voltage with the other waveforms. The triangle waveform is a result of the inductance of the motor windings interacting with the current input. At 15kHz this has a smoothing affect that many believe gives the Jaguar it’s more linear response. It is the Victor that is switching at 150 Hz.


#3

I should have posted a waveform of the input voltage to the Jaguar, but it was rock steady. My power supply is a QPX600DP and I was using remote sensing to regulate the voltage at the device under test. If anything, I’ll wager my input supply was lower impedance than most teams’ batteries. What it doesn’t do, however, is deal nicely with sinking current. It’s a source, after all, not a battery. That only manifested when braking.

There are plenty of parts that can do bidirectional current and have a sufficient negative common mode range; they’re just not the INA193. I agree, logic draw is insignificant compared to the motor draw. Despite that, TI put the shunt between the H-bridge and the bulk bus capacitor. If you’re going to do a bus high-side measurement, that’s the right place to do it both because it isn’t affected by logic consumption and because it isn’t smoothed by the bulk capacitor.

Good question; I was running 10-50% of Vin while in voltage control mode and 1-20A in current control mode. I was, however, loading the output of the motor with a brake. The torque ripple was evident at all throttles and loads, and its frequency proportional to the rotational rate of the motor. I fully believe that it was due to the brushes making and breaking contact, its magnitude is really what surprised me. As an aside, it surprises me that FRC is using brushed motors given the incredible availability of brushless ones.

I don’t know enough about brushed motors to have good intuition for their 2-port network properties as a function of rotor position. Of course the motor current is a triangle wave, I’m just trying to reconcile the output of the two current sensors - one a magnetic scope probe, the other a shunt with an amplifier. They’re not measuring between the same two circuit nodes, so it’s not mind-blowing that their output isn’t the same. My best guess right now is that the output of the INA193 is mostly just wrong because the amplifier is picking up a lot of interference.


#4

Z,
The specification on your power supply states a 35 amp max output at 12 volts. The CIM motor has a 130 amp stall current. It will draw 130 amps when starting limited only by the wiring and the series resistance of the controller. At lower throttle values I would expect that the power supply is likely going into current foldback during the “On” period of the output waveform. The current waveform is exactly what I would expect under those conditions. Perhaps Rich Wallace will weigh in. He has done some measurements using a industrial motor test facility. I seem to remember a 1200 amp power supply with impedance control but I don’t know if that is his setup.
When the Jaguar or other controller is in the brake mode, two legs of the bridge are turned on to simulate a short across the motor, that does not prevent some energy making it’s way to the outside world through the power input terminals via the diodes in the FET devices.
Additionally the jaguar uses a particular gate driver chip that has a charge pump to keep drive high at low input voltage and also requires a bootstrap cap for the gate drivers. In order to keep these 3 caps charged up, the output switches independently of the commanded output. This is visible during “0” throttle (as a very narrow pulse) but may be harder to see at other times. If the driver chip sees less than ideal gate drive voltage, it reduces the output as well.


#5

I am quite certain that the power supply did not fold back during any of the above testing. Data is always better than speculation.

These traces were taken using a single channel of the QPX600DP at its maximum current and set to 13.8V (limit is thus 43.4A). I command a 0-50% voltage-controlled step and watch the results. Output shaft is unloaded (at startup rotor inertia is a perfectly suitable load, plus I never had load on the shaft at startup in my earlier testing). Red is DC bus current, blue is bus voltage at the Jaguar terminals. Trigger is on bus current rising over 10A.

Startup, long view
Startup, medium view
Startup, close up of voltage rail
Startup, gate drive

Gate drive is measured with an Agilent N2790A differential probe.


#6

Would you please clarify what you mean by “Command is a response”?

Did you mean you are plotting the response that results from stepping the Jag from 0% to 50% PWM output duty cycle?

… and thank you for running these tests and posting the scope traces.
*
*


#7

Would you please confirm that I am interpreting your test conditions and scope traces correctly? Thank you:

It’s not actually very well balanced (magnetically or mechanically). This manifests as significant torque ripple even with constant terminal voltage. Trace - yellow is terminal voltage, red is current.

The above is with power supply connected directly to CIM (no Jag in circuit), supplying approx 2.7 volts (yellow trace) directly to the CIM leads, resulting in approx 2.4 +/- 0.6 amps at 150Hz (red). No load on the motor shaft (nothing connected, not even a dyno set to zero).

Check out the trace. Red is actual motor current (as measured with a Tektronix A622). Blue is motor-applied voltage. Yellow is INA193 output.

The above is with power supply approx 13.7 volts to Jag. Jag is connected to CIM. Jag is set for approx 17.5% output duty cycle (blue trace) at approx 15KHz.

Red trace is actual motor current measured in the motor lead (not in the power supply line). Approx 5.4 +/- 1.1 amps.

What is the load on the CIM output shaft?

At no-load it looks like this.

No load on the motor shaft (nothing connected, not even a dyno set to zero).

I’m not an expert on brushed motors, maybe someone else can explain how the near-square bus current waveform results in a triangular motor current waveform.

During the “off” portion of the duty cycle, the motor leads are shorted, and the current continues to flow through the motor due to the motor inductance.


#8

Oh sorry, that phrase was horribly unclear. I’ll edit in the original post as well. I meant that I had commanded a 0-50% step in voltage-control mode to the Jaguar, and this was the response with an unloaded CIM (no dyno, free shaft) on its output.

Glad to try and post useful things! I’m trying to help team 1700 think about how to set up their drive system, and part of that exercise is (at least for me) understanding the tools at hand. I’m both a professional and a hobbyist electrical engineer, so this kind of work is habit.

Completely correct. You see that the supply voltage is decently stable, yet the current drawn has significant ripple. There is nothing attached to the CIM; it’s a free shaft in open space. Any time I say no load, I mean actually just a motor on a mount with nothing attached to the shaft.

It’s actually 20% duty cycle, but the Jaguar enforces significant dead time (probably to account for its lethargic gate drive).

Ehh, this is not very scientific. I used a bicycle caliper and rotor and squeezed. How much torque was that? I have no idea - I’m not currently equipped for a proper dyno setup. I can tell you that I was generally applying enough pressure to slow the motor down to something close to 120 RPM. In general I was curious about behavior under heavy load.

And yes, red lines go to my current probe which is in series with the motor and therefore actually measuring motor coil current.

Well, I expect the current in the motor to rise while its leads are connected to the rail, to fall when it’s freewheeling, and to fall precipitously when its leads are both shorted to ground. That the DC bus current is a square was surprising. This is what my brain thinks the circuit looks like (50% duty cycle, unloaded). And this is the current I’d expect through the shunt. The voltage source is the back-EMF of the motor.


#9

A wise person once told me “Data is always better than speculation” :slight_smile:

Your data is showing you what the motor current is doing.

During the off portion of the PWM period, the CIM leads are shorted. See attached sketch, taken from the Black Jag User’s Manual. When the leads are shorted, the current continues to flow through the CIM coil due to the coil inductance.

The Jag switches at 15KHz; that’s a 67 μs period. At 20% duty cycle, that’s 13 μs “on” and 53 μs “off”. During the “on” portion, the voltage is applied and the current builds up. During the “off” portion, the CIM leads are shorted and the current continues to flow but decays. That’s what your data is showing.

Do you have access to equipment to test the CIM’s coil inductance? If so, would you be willing to do that? Then we could crunch the numbers and show that the inductance is high enough to store sufficient energy to maintain current flow during the off portion.

*

Jag Fig4.4 SyncRec.png


Jag Fig4.4 SyncRec.png


#10

Tomorrow I’ll try replacing the shunt with a loop that I can use with my current probe. I understand the current paths that a motor controller enables at different parts of a switching cycle (I used to design really big motor controller for a living). But no matter what, deltaI=V*t/L, and that should be a triangle.

And yes, I have the equipment to directly measure inductance of the windings. I have no doubt that current will continue to flow during the off time, my problem is what I see at the output of the shunt amplifier during the on time. It shouldn’t be square.


#11

Brushes and bushings. Unpowered it seems like a lot; they don’t freewheel much. However that friction is trivial when under typical FRC loads.

FIRST uses brushed motors (as opposed to brushless) because they are inexpensive, durable and plentiful. I vaguely remember an official discussion on this topic from 4 or 5 years ago.

Great post, I’d love to see this as a whitepaper.


#12

I was responding to the “fall precipitously” portion of your comment**:**

The differential equation for the current through the motor during the off portion (when the motor leads are both shorted to ground) is

Ri + L(di/dt) + V[sub]emf[/sub] = 0

That would be of interest. To my knowledge, no one has ever posted the results of such a test here, nor has anyone ever posted a link to an authoritative CIM motor spec which includes inductance.
*
*

CIM model L R emf DiffEq.jpg


CIM model L R emf DiffEq.jpg


#13

Answer is 59uH, much less than I expected. There’s a little inductance ripple with rotor position, maybe about five percent.


#14

What equipment did you use to measure it?


#15

Agilent DSO7104 and Agilent 33522A, by finding the frequency where it matches my source’s 50 ohm output. It was marginally complicated by resonance with the motor’s case capacitance at much higher frequencies, but I wasn’t fooled.

The measurement was corroborated by direct measurement with an old (early 90s) Fluke LCR meter whose model number I haven’t memorized.


#16

Would you mind posting a quick hand-sketch schematic of the above? I’m trying to figure out what you mean by “matches my source’s 50 ohm output”.

I’m familiar with placing a reference resistance of known value in series with an inductor under test and finding the sinusoidal frequency at which the true RMS voltage drop across the coil equals the drop across the reference resistor, but that doesn’t seem to be what you are describing.


#17

That’s precisely what I’m doing, but I’m using the resistance of my source instead of a discrete resistor. Here’s a link detailing the procedure.

Incidentally, we already had all the information necessary to compute inductance. Look at the current waveforms in the original post. During the on-time we apply ~13.8 volts for ~12.2 us and got a delta-current of ~2A comes out to about 84 uH. Of course, I’m not using cursors but rather eyeballing the PNGs I posted earlier, so it’s completely expected that the number not come out the same. But it’s right ballpark.

-Sasha


#18

In order not to confuse any students who may be following this discussion, it’s not precisely what you’re doing. In the method you used, the voltage across the coil is not equal to the voltage across the 50 ohm resistor.


#19

Well, not at the same time, but it’s the same method. Basically I find a high-enough frequency where the voltage across at the output of the meter (post-50R source resistor) doesn’t change when I attach the motor.

Then I lower the frequency until the voltage is exactly half that. At that point the voltage across the resistor and the voltage across the motor are the same, but I can’t measure the voltage across the resistor directly. I have to trust that my instrument is consistent between the two measurements. It’s probably a good assumption.


#20

They’re not the same.

Consider:

When the voltage across the motor is half the voltage across the resistor+motor series circuit,
the frequency will be f = R/(2piL*sqrt(3)).

At that frequency, the magnitude of the motor impedance will be R/sqrt(3), so the voltage across the resistor will be sqrt(3) times the voltage across the motor.
*
*

For the voltages across the resistor and motor to be equal, the frequency would have to be f = R/(2piL). At that frequency, the magnitude of the motor’s impedance would be R, and the voltage across the motor (and the resistor) would each be 0.707 times the voltage across the motor+resistor series circuit.