<p>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.</p>

<p>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?</p>

<p>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.</p>

<p>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.</p>

<p>Are there any experts here on the subject of low-level stepper motor control?</p>

[{'answer_id': 8633, 'author': 'user77232', 'author_id': 12857, 'author_profile': 'https://3dprinting.stackexchange.com/users/12857', 'pm_score': 2, 'selected': False, 'text': '<blockquote>\n  <p>So it would seem that there is always a pulsing waveform across the windings whenever the stepper is energized, correct?</p>\n</blockquote>\n\n<p>Correct.</p>\n\n<blockquote>\n  <p>When the motor is holding its position, is there anything distinctive about the waveform?</p>\n</blockquote>\n\n<p><a href="https://www.youtube.com/watch?v=Phds2oFOIYg" rel="nofollow noreferrer">Yes there is</a>. This video contains a short example of what the current waveforms would look like.</p>\n\n<p>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 <a href="https://en.wikipedia.org/wiki/Counter-electromotive_force" rel="nofollow noreferrer">Back ElectroMotive Force</a> 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.</p>\n\n<p>You may be able to determine if what you want to do is even practical by studying the fundamentals of stepper motor driving; both <a href="https://www.arrow.com/en/research-and-events/articles/voltage-versus-current-mode-control-in-stepper-motors" rel="nofollow noreferrer">voltage mode and current mode</a>.</p>\n\n<p>Apart from that it may be just as practical to use a <a href="https://en.wikipedia.org/wiki/Rotary_encoder" rel="nofollow noreferrer">rotary encoder</a> upstream of the extruder motor to detect the filament movement, or lack thereof.</p>\n\n<p>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 <em>ring</em> (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.</p>\n\n<p>For a NEMA17 stepper, these would be very small change in a very brief event. I would start with installing <a href="https://www.sparkfun.com/products/14544" rel="nofollow noreferrer">current sensors</a> on both phases, and then doing some signal processing on top of that. </p>\n'}, {'answer_id': 9964, 'author': 'cmm', 'author_id': 2082, 'author_profile': 'https://3dprinting.stackexchange.com/users/2082', 'pm_score': 0, 'selected': False, 'text': '<p>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.</p>\n\n<p>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.</p>\n\n<p>@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".</p>\n\n<p>I had hoped that the Triaminic TMC2100 chips (spec <a href="https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2100_datasheet_Rev1.09.pdf" rel="nofollow noreferrer">here</a>) 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.</p>\n\n<p>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.</p>\n'}]
['https://3dprinting.stackexchange.com/questions/8627', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/15064/']