LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a period time from a square signal?

Hi, I want to count RPM from a motor by using hall sensor and the output from the hall sensor is digital ( High = 10 V, Low = -10V ), I am using analog input signal and the signal look like nearly a square signal. Basically, I want to count the RPM by counting the period and the RPM equation is 1000/ t(ms) x 60 and then I got the RPM. Now, my question is Is it possible to count the period of the square signal using only software? ( Because my hardware not support CIN freq ) Suggestion and Comments are welcome, Best regards, Citras
0 Kudos
Message 1 of 7
(3,302 Views)

Hello,

 

What hardware do you have? If you have something that has counter inputs maybe it will be easier to get the periods.

Otherwise we'll do with the analog signal.

 

Trying to help


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 7
(3,300 Views)

Hi,

 

If you can measure the pulses and get it into LabVIEW, there are no problem counting the RPM.

 

1.PNG

 

 

This example needs tweeking to work correct. If your array starts in the middle of a positive period it will fail. The example was just ment as a quick way to get you started. 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 3 of 7
(3,297 Views)

Hi Even Deejay,

 

Could you please attach the files in labview 2010 version? Because there are still some components that new for me.

I dont´t really get the logic of your calculation, why u got the samples lower than -5 and bigger than 5 and then subtract it?

And one more question is Can we do this in continuous data acquisition ? Because my task is to record the RPM of a motor that can slower or faster at any time.

 

Best regards,

Citras

0 Kudos
Message 4 of 7
(3,288 Views)

Hi TiTou,

 

I am using dt9804 and it not support counter frequency / period inputs.

And we need to find a way to measure it with analog signal.

 

Best regards,

Citra

0 Kudos
Message 5 of 7
(3,287 Views)

The logic behind the calculation:

 

Find the first sample that is higher than 5 in amplitude (signal is high). Then find the first next sample that goes below -5 (signal is low). If I substract the two values I get the number of samples bewteen when the signal went high and when it went low, in other words; the number of samples where the signal was positive. Since it's a square signal, I simply multiply it by two to get the full period (signal is high and low). By knowing my sample rate and total number of samples I can easily calculate the time.

 

You can do this in continuous mode, but you would have to change the code a bit. Maybe looking at 500 ms of samples at a time and then calculate it. I would suggest the Producer/Consumer architecture. You will then have one while loop that get the measured data and one while loop that does the calculation.

 

 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 6 of 7
(3,282 Views)

Use Pulse Measurements.vi.  It is in the waveform measurements palette.

0 Kudos
Message 7 of 7
(3,264 Views)