05-07-2013 12:43 PM
I am trying to use LabVIEW to create a VI that controls the speed of a DC motor. The system needs to have an user set rpm and the DC motor needs to adjust the duty cycle to obtain the correct rpm dependant on the load. A disk with holes and an optical switch is being used to measure rpm.
The current problem is that I cannot get the rpm based on the optical switch.
Thanks for your help!
05-07-2013 01:17 PM
@ku2 wrote:
The current problem is that I cannot get the rpm based on the optical switch.
have the switch signal input into your Daq counter, get a frequency (cycles/sec)..do the math depending on how many holes/revolution
05-07-2013 01:22 PM - edited 05-07-2013 01:23 PM
Thanks for your reply.
We were able to get the frequency using the DAQ. We are now trying to implement the frequency as the process variable for the PID controller. We have it setup so we enter a specified frequency in as the setpoint.
When we do this, we get an error saying the number of samples to write are not the same, even though we seem to have both daq assists set the same.
05-07-2013 01:42 PM
what is the exact error# message
05-07-2013 01:46 PM
Error - 200103 occured at Speed reg.vi:Instance:2:1
Possible reason(s):
Number of samples to write must be the same for every channel.
Task Name:_unnamedTask<C5>
05-07-2013 02:13 PM
We are using the frequency output of the Tone Measurements module to detect the signal from the optical switch (essentially a square wave). When the speed of the motor drops below about 250 rpm (there are 4 slots so this corresponds to a signal frequency of about 16-17 Hz), the frequency detected by Tone Measurements begins increasing and diverges from the true value. Could this be related to the problem, and should we be using a different tool to detect the frequency of the square wave signal? (We have also tried the Pulse Measurements module, which results in an error when the speed drops below about 600 rpm.)
Thank you very much for your help.
05-07-2013 02:36 PM
there is a problem with the first Daq Assistant....
05-07-2013 03:08 PM
The error for the samples to write does not appear after redoing the vi. Thanks. The controller seems to be working mostly.
However, the issue with the Tone Measurement reading inaccurately at low frequencies still exist. Any ideas?
I have attached the latest vi.
Thanks again!
05-08-2013 06:55 PM
Hi ku2,
So I took a look through your VI and have a couple of thoughts.
First of all, it would be useful if you could post the data you're seeing both directly from the DAQ assistant and after it has passed through your Tone Measurement Express VI. It is possible that the motor is turning too slowly to detect the full revolution given your sampling parameters.
Also, note that the Express VIs you are using take much longer to process than lower-level functions. Your DAQ Assistant VI for example probably takes several hundred ms to run, which may seriously limit your acquisition rate. Just a few things to think about.
I hope this helps!
Andy C.
Applications Engineer
National Instruments
05-09-2013 05:07 PM
Thanks.
Now, everything works, but we are not able to increase our sample rate. Labview currently takes data at 10 points per second, but soon as we change the rate, the system stops functioning correctly.
All we want to do is for more samples per second to be written so that we can have a better plot when we analyze our data. Any thoughts? Thanks again.