3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ You know you can get current probes for scopes, right? \$\endgroup\$ – Will Apr 14 '14 at 11:01
  • \$\begingroup\$ No expert here, but have you looked into a RC or even a RLC filter on the input to the op amp? \$\endgroup\$ – russ_hensel Apr 14 '14 at 13:35
  • \$\begingroup\$ Will: Thanks for the comment -- Yes, I am aware of current probes, and also how expensive they are. I was hoping for a method which would be substantially less expensive, and amenable to building in to the fixture. \$\endgroup\$ – gwideman Apr 15 '14 at 1:03
  • \$\begingroup\$ russ_hensel: The amp symbol here is shorthand for differential amp. Yes, I considered filtering on the input. However that would require precisely matched filtering on each of the two inputs to avoid the PWM edges creating a differential signal of substantial size compared to the signal of interest. It also moves away from being able to use a current-sense amplifier, because those generally depend on very low source impedance... which might be OK but introduces other kettles of fish. \$\endgroup\$ – gwideman Apr 15 '14 at 1:09
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Good suggestion! Your answer led to discovery of some related devices, such as this one: [Allegro ACS714] (pololu.com/product/1185). Not sure about the bandwidth/rise-time on devices like this, but definitely candidates to consider. Thanks! \$\endgroup\$ – gwideman Apr 14 '14 at 23:19
  • \$\begingroup\$ And these Sensitec magentoresistive sensors have some pretty nice specs too: sensitec.com/english/products/current/cms3015.html, though the power requirements are not quite as desirable. Also -- not clear how to actually buy them. \$\endgroup\$ – gwideman Apr 15 '14 at 7:53
1
\$\begingroup\$

I think your discounting of putting a current shunt resistor at Y is illogical. That sounds perfect to me. You could also place one at G and you will have pretty damn good knowledge of current going into, and out of, your stepper motor. Surely if you are holding position, the distribution of current is equal to each pole? During movement, the current load will shift as required to move the rotor/shaft etc.

Give it a try! Sum of currents into the motor is better than nothing at all, and like I said with some assumptions it's reasonable enough.

If you have a scope, you measure the current through the resistor manually by looking at the voltage built up over a known precision resistor value.

Otherwise, get a current shunt monitor breakout board, for something similar to a Texas Instruments INA138 etc. and examine this component's output voltage which is a linear voltage with relation to current detected. These shunt monitors are specially designed for very high differential sensing and CMRR.

There is some useful application notes on this exact topic by Linear Technology, Here, pages 25 and 26

Also please read the first two pages of Section 5.5 in this Zetex (Now Diodes Inc.) application note, page 21-22 where it specifically states:

A very common application of bi-directional current monitoring is in a full or H bridge circuit. If there is access to the supply rails to the bridge, the optimum way to measure the load current is to use either low or high side sensing as depicted by RX and RY in Figure 16

Where in this case, RX and RY refer to current shunt resistors at V+ and Ground as I have suggested.

\$\endgroup\$
  • \$\begingroup\$ Thanks for your suggestion. As I mentioned in the question, these stepper controller ICs use PWM, and part of the objective of the test fixture is to be able to observe the relationship between the PWM voltage activity and the current. This would be confounded if current direction can't be seen, and especially confounded if the activity from two windings is mixed together, as would happen with locating the sense resistor at Y. \$\endgroup\$ – gwideman Apr 14 '14 at 13:41
  • \$\begingroup\$ @gwideman Some of those app notes show ways (and suggest components) to do bidirectional current monitoring, which combined with scoping the voltage levels of the PWM outputs from the IC you could get some good data \$\endgroup\$ – KyranF Apr 14 '14 at 13:47
  • \$\begingroup\$ I appreciate your finding the two application notes, but neither relates to the case at hand. The Zetex example concerns monitoring the current in a DC motor (not a stepper). The Linear example recommends two LTC6101's each monitoring half the H-bridge (locations 'x' in my schematic). For contrast, it presents the "flying" sense resistor primarily to argue against it, pointing out specifically the noise due to PWM activity. And again that's for a DC motor, not a stepper, in which the PWM is more interesting and problematic. \$\endgroup\$ – gwideman Apr 14 '14 at 13:47
  • \$\begingroup\$ Are you able to use oscilloscopes much in your test fixture @gwideman? Some well placed shunt resistors and your own eyes looking at the raw data may be all that is needed. Accuracy issues due to PWM noise does indeed affect the current monitoring ICs, and may give strange output due to high gain or delays or small spikes propagating into large outputs - but raw scope data may be easier to analyse \$\endgroup\$ – KyranF Apr 14 '14 at 13:52
  • \$\begingroup\$ "Surely if you are holding position, the distribution of current is equal to each pole?" -- The dynamics of what happens at the occurrence of steps, and during microstep advancement, are not the same at each winding. \$\endgroup\$ – gwideman Apr 14 '14 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.