LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Servo Motor Control

I am trying to control a servo motor with angular positions. 

 

I have determined the angular positions of the servo motor that correlate with the duty cycle, and used the linear interpolation function to determine duty cycle values between the standard angles (90, 45, 0, etc.). The function is working fine, however, I want the output duty cycle to be dependent on the angular position on the front panel. For instance, when I change the position, the duty cycle does not change with it. How do I make one indicator dependent on the other? (Attached front panel screenshot for visual)

 

ALSO, I want the determined duty cycle from the interpolation to be the input duty cycle to the PWM function to control the servo motor. How do I do this? When I index the array, how do I get it to index the current indicator value rather than just the first value in the array? 

 

Thank a ton!

Download All
Message 1 of 2
(2,978 Views)

You have a simple linear function f(x)=y=m*x+n

y --> duty cycle

x --> angular position

 

You have to figure out the "m" and "n" values... you can just do that very simple with "Linear Fit.VI" or simply in excel.

Once you have that, it is very easy to do that in LabVIEW. Simply set "duty cycle" as a control and "angular position" will be the output of the function i.e. "m" multiplyed by "angular position" plus "n".

 

0 Kudos
Message 2 of 2
(2,851 Views)