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.