Is there any (relatively simple) way to determine whether a stepper is being directed to move by the voltage signal across its winding? This may be a long shot, but I was wondering if the signals seen across a stepper motor's windings could indicate whether the stepper was being told to move over some short time period.  This is in particular for the stepper used on extruders.

I've read that PWM in used in stepper drivers and controls current patterns to move the motor.  And that a current must also be maintained through the windings if the motor is to hold its position.  So it would seem that there is always a pulsing waveform across the windings whenever the stepper is energized, correct?  When the motor is holding its position, is there anything distinctive about the waveform?

This is for a filament sensor I'd like to make.  The sensor would be located at the extruder motor.  It would monitor movement/flow of the solid filament.  A lack of filament flow could be because of filament runout, tangled or caught filament, or non-extruding travel moves. I'd like to be able to tell the first two causes from the last one (when it's not supposed to be extruding for some hundreds of milliseconds or so).  It would also be nice to tell 'no directed movement' from 'very slow movement' which would happen with small nozzles, slow speed or other slow extrusion situations.

I watched the waveforms with an oscilloscope while printing, but travel moves were quick and relatively rare, so I couldn't definitely see if there was something I could use during those times. Could I just filter the pulse waveform (what corner frequency?) to get an approximation of the current waveform going through the coils -- on the idea that the waveform should resemble a DC level during non-extruding but still energized times.  Perhaps another low-pass filtering of that DC level, or a high-pass of the waveform to indicate directed extrusion?  Using DSP on a micro, of course.

Are there any experts here on the subject of low-level stepper motor control?
So it would seem that there is always a pulsing waveform across the windings whenever the stepper is energized, correct?


Correct.


  When the motor is holding its position, is there anything distinctive about the waveform?


Yes there is. This video contains a short example of what the current waveforms would look like.

If I understand you correctly: You want to detect filament events based by doing current sensing on the phases of the stepper motor. The simple of it is that, if the motor is not turning then the Back ElectroMotive Force will be zero. As the speed increases the BEMF goes up, which causes the current levels to go down. Is this how stall detection in some driver systems work.

You may be able to determine if what you want to do is even practical by studying the fundamentals of stepper motor driving; both voltage mode and current mode.

Apart from that it may be just as practical to use a rotary encoder upstream of the extruder motor to detect the filament movement, or lack thereof.

In your case detecting if the filament is present but not moving calls for stall detection. If the PWM pulse occurs but the rate at which the voltage increased (the slope) did not change, then there was no BEMF event. The lack of such an event would indicate that the rotor did not move. If there is no filament to push, then when the rotor moves it will ring (overshoot it's target position and fluctuate back and forth until it settles into the electrical position that the controller intended), because the mechanical load has changed.

For a NEMA17 stepper, these would be very small change in a very brief event. I would start with installing current sensors on both phases, and then doing some signal processing on top of that.