Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

How is the NI-9505 'current sense' measured?

Solved!
Go to solution

Hi Bruce

 

Sorry you have not received an NI response on this thread, Lorne no longer works in our Motion Control Department and now is on our RIO team. We require a 500 mH inductance on the system (Motor and the circuit it is in), this forces the current to remain more stable as shown in the attached picture by Lorne under sufficient amount of inductance. I can take a look at the motor, can you link a PDF with its specs? Capacitors are going to provide a resistance of voltage over time dv/dt where as an inductor will provide a resistance to sudden change in current di/dt. As you are seeing this behavior on the 25% duty cycle this makes sense that our capacitors would lead to more instability on a system with a shorter active high duration.

 

For your test did you write an FPGA VI that would record the data from the first 2000 duty cycles? How did you set this to change on each of the 2000 iterations (clock count)?

 

My suggestion would be to add inductors in series with the motor, the inductors should force our current to remain stable without effecting our rapidly changing PWM voltage signal. My only concern is if the motor is very small the increase in inductance may result in seemingly sluggish reaction times from the motor.

 

 


Thank You
Eric Reid
National Instruments
Motion R&D
0 Kudos
Message 31 of 54
(2,495 Views)

Eric,

 

Thanks for your response.  I figured the inductors would work and ordered 470 mH and 220 mH inductors from Digikey today.

 

My motor is the IG32P 265 RPM from superdroidrobots (http://www.superdroidrobots.com/shop/item.asp?itemid=534&catid=76).  The data sheet is here (http://www.superdroidrobots.com/product_info/IG32P.gif).  I don't have a clue what the inductance is.  I assume it is fairly low since there is no decay curve in the current waveform.  I figure the 470 mH will get it up to 500 mH or close enough.  If it is too sluggish I will try out the 220 mH to see if it does enough smoothing to work.  Do you know an easy way to measure the inductance of a motor?

 

Yes, I modified an example FPGA vi to collect the waveform data.  I think I started from the example in this thread and incremented the trigger value by one each cycle of the PWM.  I attached a cleaned up version - it should work if you put it in an FPGA/RT project.

 

Thanks,

 

Bruce

Bruce Ammons
Ammons Engineering
Download All
0 Kudos
Message 32 of 54
(2,491 Views)

Eric,

 

I think units got me again.  The inductors I ordered are uH, not mH.  It makes sense that a motor would be mH, though.  On digikey, the highest current rating in the 500 mH range is 1A, and most of them are about 50 mA.  The resistance is in the neighborhood of 750 ohms, also.  The ones that can handle 1A are about $30 to $80, which is more than I paid for my motor.  Ideally I would like to be able to handle several amps of current occasionally.

 

Any suggestions how to increase the inductance without breaking the bank?

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 33 of 54
(2,490 Views)

Bruce,

 

I assume "500 mH" is just a typo.  The 9505 manual I've seen says 500 uH, so the inductors you've ordered should be fine.

 

Ian

0 Kudos
Message 34 of 54
(2,484 Views)

The 9505 manual I have also says 500 uH.  Somewhere along the line I must have changed it to mH without noticing.

 

I will try them out and report back my results.

 

Thanks,

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 35 of 54
(2,475 Views)

Hi Bruce and Ian

 

Thanks, you are right, I actually made a typo as well in my post I believe starting this. The inductors you purchased should add the inductance you need to get a more stable current measurement. The currnt measurement will naturally vary a little bit, but once inductance and the PID control are factored in it should be negligible for controlling your motor. When the inductors come in just place them in series with the motor. Maybe the motor manufacturer suggested adding capacitors from the controller to the drive, this would make sense as it would resist a voltage spike or sudden change in commanded current. Please let me know on how things go with the new inductors and the current spikes you were seeing earlier. I think this should fix the problem but if it doesn't please post back.


Thank You
Eric Reid
National Instruments
Motion R&D
0 Kudos
Message 36 of 54
(2,471 Views)

Eric and Ian,

 

I tried out the inductors in series with the motors.  I tried each one separately and both together (inductances 220, 470, 690) to see how things change.  I captured graphs at 5, 25, 50, 75% PWM.  I plotted the original curve (white), a smoothed curve (red), and a line at the mean value (green).  I have attached the results.

 

Observations:

 

The graphs look nothing like what was predicted.  There is no easy way to predict or locate an optimum timing for measuring current.

 

There is still a spike at the start of the ON cycle.  The first 100 counts of data are useless due to the spike.  This area 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 will 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 changes will 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.

 

I strongly recommend to anybody using current measurement with the 9505 to check out the current waveform using the program I attached a few posts ago.  You can run your motor at a few different speeds to see how the waveforms look and see if your current measurement is accurate.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 37 of 54
(2,436 Views)

Thanks, Bruce.  That's not at all what I expected!  I'll try to get time to repeat your experiments (not that I doubt them) and post back.

 

For position control, I'm starting to wonder whether closed-loop current control is useful at all.  I'm tempted to try controlling the PWM duty cycle directly from a position PID loop.

 

Ian

0 Kudos
Message 38 of 54
(2,434 Views)

Are you sure you have correctly implemented the fix to the current sense issue suggested by Lorne?  I have been using the attached current sense loop (based on Lorne's suggestions) to drive motors and solenoids of varying inductance with extremely stable current readings even at the lowest commandable duty cycles.  Nailing the triggering delays/coercions was a knock-out fix to previously wacky and confusing current sense readings that tended to show up usually at couple of discrete points (oddly like the data you have presented).

Ethan

0 Kudos
Message 39 of 54
(2,424 Views)

It looks like I jumped the gun a little bit.  I thought the waveform stayed the same shape when the load was increased, but I was wrong.  For large changes, it is a very different waveform.

 

I stopped the motor from rotating and set the PWM at 25% to get a nice clean curve (attached 470), and was surprised.  The current during the ON cycle is about half the current during the OFF cycle, which seems backwards to me.  The shape of the curve is also different, which means I can't assume the mean is at the same point all the time.  It pretty much blows my last plan out of the water.

 

Out of curiosity, I removed the inductor and tried the same setup.  Now the curve decays to a nice, flat value.  Still, the ON value is about half the OFF value (still backwards from what I expect).  I would feel more comfortable reading a steady value from this graph, but where do I read it?  This is the best results I have seen so far, but it still will require more investigation.  I am really doubting the possibility of using current measurements to control a system.

 

I am starting to think it would be easier to read the speed from the encoder and use the speed to calculate the back emf of the motor.  The difference between the back emf and the duty cycle would be proportional to the current (according to theory).  I would have to figure out a few calibration coefficients, but it would probably be easier than this mess.  It would all depend if the motor dynamics are linear or not.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 40 of 54
(2,423 Views)