LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use PID function to control a DC motor?

Hi everyone,

 

I wanna control a 6v DC motor using PID control toolkit 8.2.

- a close loop control system with an encoder sensor

- using a DAQ card model: NI USB-6008

- the DAQ card will be able to output pwm signal to the transistor then to my motor

 

Im stuck at getting pwm signal from the pid.vi and i wanted to know what is the process variable (PV)

pls help me on my problem, if can pls make an example VI for me

 

Thanks !

0 Kudos
Message 1 of 5
(4,810 Views)

 Hi,

 

The process variable is the variable that you want to control. For you application, I guess it should be the duty cycle of the PWM signal.

 

I do not think that the pid.vi function can generate pwm signal. You can use the PID to create the duty cycle output, and use the output from the pid.vi function to created desired PWM.

 

To create PWM signal, please refer to the following link.

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

 

I think you would not have any problem with creating the PWM with your 6008, since it is a multifunction DAQ.

 

Sincerely,

Gunyapart Deephanphongs

Application Engineer

NI ASEAN

 

 

Message 2 of 5
(4,771 Views)

Hi Chongnang,

 

Thanks for replying. The link that you post is a bit hard to understand for me because of all those DAQmx VIs.
1) Do you have an easier way on how to connect output of the PID.VI to the DAQ assist VI ?
2) This is a closed- loop control system, the question is the signal from my encoder sensor it's a digital or analog ?

3) Do you know how to input transfer function without the control design toolkit ?

 

Thanks.

0 Kudos
Message 3 of 5
(4,762 Views)

Hi,

 

1) Do you have an easier way on how to connect output of the PID.VI to the DAQ assist VI ?

Basically, above solution is easy, you just take it step by step then you will catch the fundamental. For your information, NI 6008 is not the best choice for creating PWM but for application when timing is not important. Beside above link, you may refer to below link (PWM by software timed):

 http://digital.ni.com/public.nsf/allkb/1561D31534F07D608625727900391114

 

2) This is a closed- loop control system, the question is the signal from my encoder sensor it's a digital or analog ?

Your encoder output should be the input of 6008 counter. However, 6008 only has 1 counter only supports simple event counting. This would mean that you could count only rotation in one direction - so either channel A or B. If you are interested in using a quadrature encoder, you might want to look at one of our M-Series DAQ cards. It will give you 3 terminal to connect your A, B and Z terminal from your encoder. For info regarding encoder, you may refer to this link:

http://zone.ni.com/devzone/cda/tut/p/id/7109#toc1

 

3) Do you know how to input transfer function without the control design toolkit ?

Basically, it is very possible, but you just need to do more effort. You may be interested to see this thread on how simulate transfer function without control design toolkit.

http://forums.ni.com/ni/board/message?board.id=170&message.id=367012&requireLogin=False

 

Regards

Yasrof

 

 

 

0 Kudos
Message 4 of 5
(4,727 Views)

hello

 

actually i noticed the conversion, actually its important to my project and need some help if someone can help me, my project is an inverted pendulum and i already designed its interfaces by using PWM drive to drive the motor and optical encoder interface as a sensor but my problem now how i can control the the signal that come from the optical encoder to send it to the pwm and as well to the DC motor

 

 

Thanks

 

ahmad

0 Kudos
Message 5 of 5
(3,832 Views)