LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I implement a feedback loop to control a DC motor?

I have a couple of 1 hp PMDC motors that I need to control.  I have a VI set up that can take an RPM input, convert it to a 0-5V signal that is sent through my USB-2008 DAQ to an amplifier then to the motor.  It also displays the actual RPM of the motor by converting the frequency of a signal sent by a rotary encoder attached to the motor.  I need it to be able to adjust the applied voltage when a load is applied and keep within a 1 RPM window.  What would be the best way to accomplish this.

 

Dewayne

0 Kudos
Message 1 of 4
(3,106 Views)

Hi Dewayne,

 

Are you using a USB-6008?  I am not familiar with a USB-2008.  Is your 0-5V signal an analog signal, or are you talking about pulse width modulation using TTL?  Do you want adjust the voltage manually or are you going to measure torque/load?

 

 

Nick Keel 

Applications Engineering 

National Instruments

Nick Keel
Product Manager - NI VeriStand and Model Interface Toolkit
National Instruments
0 Kudos
Message 2 of 4
(3,079 Views)

It was a typo, it is a 6008.  The 0-5V signal is analog, it is sent to a board that converts the analog to a PWM signal. I will not be measuring torque as of right now but I do need to have a consistent RPM that is accurate to about .5.  The way I have it set up now there is a large fluctuation from the PID.VI.  I spin the motor up to say 500 RPM then I close the loop.  When I close the loop the PID.VI outputs very low voltages at first and then tries to correct and just bounces back and forth from 0-5V.  I have adjusted the gains to no end.  Is this simply a problem with the output speed of the DAQ or something else.  I have attached my code, it is simple and should be easy to understand. 

 

Dewayne

0 Kudos
Message 3 of 4
(3,075 Views)

Hi Dewayne,

 

I cut out the PID part of your code and used simulated signals.  When I did that the PID loop operated as expected.  What does your actual RPM profile look like?  Have you tried using the PID autotuning VI instead of the PID VI?  I looked at your DAQ assistants and they are set up for different connection types (some are RSE and others are differential).  I would also double check to make sure that you have all of the connections set up correctly.  If you can post another copy of your VI with simulated signals that look like what you are actually getting I can take a look at the code again to see where you are running into problems.  Below is a link that will help you verify that your connections are correct.

 

Field Wiring and Noise Considerations for Analog Signals

http://zone.ni.com/devzone/cda/tut/p/id/3344

 

 

 

Nick Keel 

Applications Engineering 

National Instruments

Nick Keel
Product Manager - NI VeriStand and Model Interface Toolkit
National Instruments
0 Kudos
Message 4 of 4
(3,044 Views)