I removed the capacitors from the motor and repeated the test. The current waveform looks better, but it still has spikes. They are much smaller, but they still make it impossible to measure the current at low duty cycles.
The oscillations are much more visible, even though they are the same magnitude as before. I noticed that the frequency of the oscillations is proportional to the speed of the motor. They don’t worry me too much at this point.
My big unknown at the moment is how to measure the average current accurately. My whole control strategy is based on adjusting the duty cycle to control the motor current. If I can’t measure the current, I’m not sure how I will control the motor. My only thought at the moment is to perhaps add an inductor to the motor circuit to increase the inductance and smooth out the current waveform. I have no idea if that would actually work, though.
