Filtering PWM output to stepper motor coil to read voltage drop of sense resistor

crutschow

Joined Mar 14, 2008
34,468
It was the "1000" in the pulse def and the fact the X axis starts at 0 that seemed odd.
The 1000 is unnecessary in this case.
It was just a carry-over from the op's sim where he included it for some unknown reason.

The X-axis starts at 0 at the "Time to Start Saving Data" time.
 

Thread Starter

Travm

Joined Aug 16, 2016
363
The 1000 is unnecessary in this case.
It was just a carry-over from the op's sim where he included it for some unknown reason.

The X-axis starts at 0 at the "Time to Start Saving Data" time.
I believe the 1000 is a reference to the # of pulses. If it is not set at some "high enough" number, and you have a circuit with some level of reactance it wont pulse long enough for your circuit to stabilize. Correct me if i'm wrong. That is why it is included in my original sim.
 

crutschow

Joined Mar 14, 2008
34,468
I believe the 1000 is a reference to the # of pulses. If it is not set at some "high enough" number, and you have a circuit with some level of reactance it wont pulse long enough for your circuit to stabilize.
If you leave that value unstated, the pulses will continue indefinitely, to the end of the simulation period.
Thus that value is only needed if you want a specific limit to the number of pulses in your simulation.
I sometimes use it with two sources in series when I want to change the pulse characteristics after a certain number of pulses.
In that case I limit the number of pulses from the first source, and delay the second source until the first source has finished its pulses.
 

MisterBill2

Joined Jan 23, 2018
18,590
So drop your desire to smooth the inductor current (which I see little need for) and just use an RC filter for the current signal, as I simulated in post #32.
The diode in the circuit, D1, is what is allowing the inductor current to keep flowing when the drive current switches off. It greatly improves the motor torque and also reduces the inductive voltage spikes, and it also makes the motor physically quieter. Adding any form of capacitor across the winding of a stepper motor slows the performance a great deal and also reduces the efficiency.
 
Top