Electronic – Stepper current measurement puzzle

current measurementstepper motor

The basic puzzle: how to conveniently view stepper motor current on a scope?

Edit 2014-04-14: More-sophisticated schematic and description.

I am building a test fixture to examine the behavior and parameters of small stepper motors and various inexpensive stepper driver ICs. The motors would be size NEMA 8 to 23, < 3A windings, bipolar. The drivers are Allegro A4988, commonly available mounted on a carrier with a standard pinout, such as Pololu A4988 Carrier, with related models of chip and carrier having different voltage and current specs.

I want to be able to display various voltages and currents conveniently; this question focuses on the winding current.

The schematic shows the basic idea: A stepper driver IC implements an H-bridge which can switch current to flow in either direction through a motor winding. There are two such bridges in a typical driver IC, to drive the two windings in a typical motor.

Schematic of typical stepper-driver IC on carrier board, showing sense resistor

So, the "obvious" approach is to interpose a a sense resistor (here Rsense, say 0.1 ohm), across which to measure a voltage with a differential amp, providing a voltage to the scope. Example current-sense amps: Linear LT1999; Analog AD8216.

Problem:

Although the DC Common-Mode Rejection Ratio of such amps is adequate (100dB = 100,000) to avoid the 30V difference between low and high states from impinging much on the 0.1V/Amp sense voltage, there is almost definitely a problem with the AC CMRR.

The stepper ICs control the current using PWM, presenting pulses with durations as short as the low microseconds, and rise-times in the tenths of microseconds. To be clear: These pulses are distinct from the change of state when going from one step to the next, and are ongoing even when the stepper is held in a specific position (or micro-position).

So Vsense is in the range of 0 to 0.3V, on top of frequent common 0-30V pulses which we wish the differential amp to reject. Yet for current-sense amps that I've examined, CMRR drops off to about 60dB (=1000) at 1MHz, and 40dB (=100) at 10MHz. It seems that an amp with specs in this range is likely to produce quite a large unwanted output from the PWM pulses.

I've considered various ways to reduce the bandwidth of the two signals seen by the differential amp, but any imbalance in their frequency response, I suspect, for the PWM pulse edges, will precipitate a differential which will get amplified.

Question:

Is there some cleverer way out of this puzzle that manages to evade the problems noted above?

Answers that are less than ideal:

  • Some literature on stepper drivers advocates putting the current-sense resistor in the V+ leads of the upper FETS of the bridge (for example locations 'X' in the figure). This certainly avoids the AC CMRR issue. However, that location is not exposed in stepper drive ICs.

  • One could put a sense resistor at 'y' or 'G' in the figure, but this could not distinguish the two directions of current, and also sums together current for the two windings that an IC controls.

  • Though not brought out to the carrier board's pins, the A4988 Sense1 pin would afford connection to the voltage across sense resistor Rs1 (location z). There is a separate Sense pin for each of the two windings, and the location avoids the CMRR problem. However, it still doesn't distinguish the winding current direction. Also, I had hoped to use the fixture with unmodified driver carrier boards, for easy interchange.

  • A proper scope current probe: Expensive, and hoping to build the current-viewing capability into the fixture.

Best Answer

I like using the closed-loop Hall effect LEM current transducers for this sort of application. They're a lot cheaper than a genuine current probe for a scope (only about $20 or $25), have excellent accuracy and bandwidth from DC up to a couple hundred kHz.

enter image description here

The particular one I've linked has a +/-6A range, but you can put a couple loops through to get +/-3A full scale. Just feed it a reasonably clean +5V and Robert's your uncle.

If you want to make more of a project of it, you can offset the output with differential output between the LEM and a 2.5V reference, or actually subtract it with an op-amp and bipolar supplies, but for most purposes, just adjusting the scope zero will do the trick.