Building an Inverted Pendulum System The Ups and Downs of Defying Gravity…

January 28, 2010

Current spikes with inductors

Filed under: Software — Bruce Ammons @ 11:58 pm

I ended up ordering a 220 uH inductor and a 470 uH inductor.  They arrived today so I tried them out.  I tried each inductor separately, then combined them to get 690 uH.  I saved graphs at 5, 25, 50, and 75%.  I plotted the original curve (white), a smoothed curve (red) and the mean value (green).  The graph for the 470 uH inductor at 25% duty cycle is shown below.  For those that are interested in seeing all the graphs, here are the Current Waveform Inductor Results (zipped).

Current waveform, 25% duty cycle, 470 uH inductor

Current waveform, 25% duty cycle, 470 uH inductor

The graphs still look nothing like the behavior that was predicted on the NI discussion forums.  The folks at NI predicted a rising current when it was on and a dropping current when it was off, creating a sawtooth waveform.  They figured sampling in the middle of the on portion of the cycle would give you a good estimate of the average current.  Obviously, that wouldn’t work in this case.  From the different graphs, I was able to make a number of useful observations.

  • There is still a spike at the beginning of the on cycle.  It isn’t as large, but it still makes the first 100 counts of data unusable.  This region should always be avoided when measuring current.
  • The high frequency oscillation is due to the rotation of the motor.  I assume the resistance varies as the motor rotates.  As the inductance increases, the amplitude of these oscillations decreases.  At 5% duty cycle, the motor did not rotate and the graphs are very smooth.
  • The inductors introduced a large amplitude oscillation in the current.  As the inductance increases, the amplitude decreases and the frequency decreases.  With a very large inductance, the oscillations would go away.
  • Ignoring the motor oscillations, these graphs are very repeatable.  They shift up and down as the load is changed but do not change shape at all, indicating that selecting a point where the smoothed curve crosses the mean should always give the correct current value.

With the 220 uH inductor, the graphs seem more uneven and erratic.  With the two larger inductances, I get very similar results.  For now, I plan on going with the 470 uH inductor.  I haven’t examined the motor performance yet, but I suspect it will work just fine.  It seems just as zippy as ever, so any effects should be minor.

Since I can’t easily predict when the best time to read the current is, I plan on building a lookup table that tells me when to sample based on the pulse width.  To create the table, I can locate the intersection between the smooth curve and the mean curve for each pulse width.  It shouldn’t be too difficult to automate the process.  For small pulse widths, I plan on preventing rotation to eliminate the small pulses until the current gets too high.  For larger pulse widths, the smoothing works very well.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress