Tips for a filter circuit, only seeing spikes but ignoring PWM waves - Page 1
Forum section: electronics / beginners

author: Infraviolet
author_rank: Super Contributor
timestamp: January 12, 2022, 09:22:55 pm
content: I've been having some thoughts about DC motor encoding, presently for the purposes of making a generally useful small high torque unit I can use in various robotics projects later on. I'm looking to measure speed by observing some sort of fast event in the motor, and deal with position measures separately on the output side of the gear systems. To measure speed I know I can observe spikes and ripples on the motor's power wires which map to comutator brushes, one can't so reliably get full directional feedback with this as one could from a quadrature encodr, but for speed measures that isn't so important.To do this I need to make a filter circuit to let through and amplify the commutation spikes so I can read them. The trouble is that sometimes I'll be PWMing* the motor, and whilst I've yet to check this for the specific motor type I had in mind, I suspect the PWM waveforms in the motor's supply could look pretty similar to the brush related spikes. I could set up highpass or band pass amplifiers to only let the sharp rise and fall of spieks get through, but think the PWM edges would get through too.Any tips on what differences I could exploit between PWM waves and commutator spikes so as to allow through only the latter? Part of me suspects the PWM waves will drop the voltage on the motor all the way to zero when low, while the spikes and ripples vary by just tens of millivolts from the power voltage, can that diffeence help me n any way?Thanks*probably at a relatively low frequency, 500Hz to 5KHz sort of range, the PWM will definitely be using square waves though so the edges will have very high frequency components to them

author: Benta
author_rank: Super Contributor
timestamp: January 12, 2022, 10:02:30 pm
content: I see very little hope for this approach.Filtering noise vs. noise, noise vs. interference and interference vs. interference is not really an option.You'll be operating with garbage, no matter how you filter it.A more promising approach could be measuring the ripple current to the motor.The commutation will result in current pulses when the motor rotates.In a normal 3-pole motor armature, the brushes will short two segments for a short period of time, which will result in supply ripple current.But why you want to do this, when you have an encoder on the output of the gearbox is a mystery to me.

author: KT88
author_rank: Frequent Contributor
timestamp: January 13, 2022, 10:38:25 am
content: The spikes are mostly related to dV/dt and not the motor current. For current measurement usually the center of the PWM itervalls (on or off) is chosen as it is the farthest away from those spikes and it also is a very good representation of the average current which is proportional to the torque.

author: Infraviolet
author_rank: Super Contributor
timestamp: January 13, 2022, 09:34:50 pm
content: Thanks for the tip on ripple current, still a bit unsure how I'd tell apart ripples from the PWM waveforms though.

author: KT88
author_rank: Frequent Contributor
timestamp: January 13, 2022, 09:49:52 pm
content: The key spec for that is common mode rejection.You could use current sense amplifiers (together with shunt resistors) which come in different architectures that are not galvanically isolated and mostly limited to 80V max. common-mode voltage.Another approach is to use current sensors like the swiss company Lem is offering - and yes 'swiss' hints it - they are pretty costly...A common approach is the use of shunts together with either isolation amplifiers or isolated ADCs. They come from different vendors like TI, Analog Devices or Avago (Broadcom).However All of these current measurement techniques suffer from more or less polluted edges. A common approach is to sample the current during the quiet phases of the PWM.

author: Benta
author_rank: Super Contributor
timestamp: January 13, 2022, 11:33:11 pm
content: First, we're talking brushed DC motor here.The best way of being friendly to neighbours is killing the brush noise. This is done by a 47...100 nF cap across the motor poles, and a 22 nF cap from each motor pole to the body of the motor.That takes care of one issue.Now we come to measuring current ripple. The simplest way is just a resistor in one of the motor leads, say, 0.1...0.5 ohms (I've no idea of the size of your motor.). Measuring the voltage across that will give you the ripple current. Artefacts from brush noise and PWM can then be low-pass filtered in your analog processing afterwards. This whole thing needs to be AC coupled, as there's a much larger DC current in play from the load on the motor.The nice thing is, that the series resistor will additionally give you the option of current limiting etc.