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?

  • $\begingroup$ Yes, there is an input called DIR, so 1 is one direction 0 is the other direction; There is another called STEPS, this receives pulses, if not so the motor is stopped. $\endgroup$ May 15, 2019 at 23:28

2 Answers 2


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?

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.

  • $\begingroup$ Thanks user77232 for the detailed reply. So when the extruder is in a hold (energized but not extruding), the filtered waveform won't have the sinusoid overall shape or the steps or microsteps, just a flat line at some level? The rotary encoder would only show if the filament is moving, not when it is supposed to move. I'm trying to determine both, and look for a discrepancy to decide the print needs to be paused. For actual movement, probably something like the Prusa scheme that uses an optical mouse camera to sense movement $\endgroup$
    – Bill Waslo
    Apr 7, 2019 at 18:37
  • $\begingroup$ Though I'd use a rotary pinch wheel and sense movement of that with the mouse chip, to avoid issues with how various filaments reflect light. $\endgroup$
    – Bill Waslo
    Apr 7, 2019 at 18:38
  • $\begingroup$ The rotary encoder seems like it might give false reports on some cases, such as printing slowly - with flexible filament for instance- with a very small nozzle, in which case the filament linear travel would be very, very slow. And then with a Volcano or Supervolcano at maximum melt rate, a geared-up rotary would spin like mad! $\endgroup$
    – Bill Waslo
    Apr 7, 2019 at 18:38
  • $\begingroup$ You're in for some signal processing here. This becomes more of an electronics.stackexchange.com type question. $\endgroup$
    – user77232
    May 6, 2019 at 17:21
  • $\begingroup$ +1 for the idea of just putting a rotary encoder on -- much easier than processing the signals. $\endgroup$
    – TextGeek
    May 15, 2019 at 15:19

There is nothing you can do to monitor the extruder stepper motor to assure that filament is being fed when it should be fed. A common condition is where the filament binds but the extruder stepper continues to move as commanded. The drive pully strips the dents it presses in the filament, and grinds down the filament. The extruder still steps, and the filament does not.

You can reduce this for particular filaments by increasing the pressure on the filament by the drive pully, but the optimum pressure varies with the filament. For instance, I've found that PET needs a lesser pressure than PLA.

@User77232 suggests using a separate rotary encoder to detect the motion of the filament through a different sensor. This may be better, since you can detect a filament jam with extruder motion. If you are using a PTFE tube to deliver filament to the extruder, the encoder can be mounted at the other end of the tube. You may need to make allowance for some compression and stretch of the filament in the tube, which could delay detecting "lack of movement".

I had hoped that the Triaminic TMC2100 chips (spec here) would provide detection of drive torque by watching the back EMF, but reading the spec didn't look helpful. There was an old patent (that should be long expired) that detected the current needed to move a stepper motor to achieve faster acceleration and quieter operation, but I didn't find on the Triaminic driver a useful torque limit signal. If one could detect the torque required, one could set a peek torque value that is lower than the initial filament strip torque.

Perhaps one could mount the extruder stepper motor with a compliant mount, perhaps something like a TPU or rubber material, and use a strain gauge to measure the stretch of the mount.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .