Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you convert the encoder counts to RMP of the motor using a myRIO in LabVIEW?

My intent is to gain hardware interfacing and general Labview experience. I am using a myRIO to control a Pittman 8222 34V Brushed DC motor (Motor Specs).

 

I recently created a code to control the angle of this motor using PID, which was visually implemented using the black disc with a white tick mark on it (see attached picture: "IMG_2523"). 

I now want to control the speed of this motor againg using PID, but I am not sure how to properly convert the encoder counts to RPM of this motor. I have attached 2 screen shots of my block diagram and my front panel for reference ("Capture" and "Capture2"). In the front panel picture, you can see my "actual" speed of the motor is a very choppy signal when it should theoretically be a flat line. To get the RPM, I currently use a shift register to store the current count value (which I converted to deg, then to radians), and then subtract the previous run's value, then divide by the while loop sampling time (10 ms). This would give me rad/s, which I then wrote a subVI to convert it to rpm. 

Any help would be greatly appreciated, thanks. 

Download All
0 Kudos
Message 1 of 4
(6,899 Views)

Hello aaarmst2,

 

Are you using the NI LabVIEW PID and Fuzzy Logic Toolkit for windows?

 

If so, the issue you are experiencing is related on why your PID is not controlling in a good way the motor's speed??  

 

Regards,


Regards,
Daniel M.
Applications Engineering
National Instruments
www.ni.com/support
0 Kudos
Message 2 of 4
(6,801 Views)

Hello, yes. I am using the NI Labview PID block. I am not using Fuzzy Logic Toolkit (to my knowledge). 

 

My issue is that I am not calculating the motor speed properly. When I manually rotate the disc, my code is outputting insanely high rpm values that are not accurate. 

0 Kudos
Message 3 of 4
(6,790 Views)

Hi,

 

One thing you could try doing is verifying that the conversion from rad/s to rpm is working correctly. 

 

This tutorial might also be helpful. It's not using the same hardware that you are, but goes through the general steps using PID control. 

CompactRIO Motor Control Basics Tutorial: http://www.ni.com/pdf/labview/us/compactrio_motor_control_basics.pdf

 

 

Daniel Parrott
Software Product Marketing - Data Management & LabVIEW
National Instruments
0 Kudos
Message 4 of 4
(6,768 Views)